pythonlib 1.0.1 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -1
- package/dist/base64-C_am75Sv.d.ts +165 -0
- package/dist/base64.d.ts +1 -0
- package/dist/base64.js +37 -0
- package/dist/chunk-2YTO24B5.js +78 -0
- package/dist/chunk-3CLXPGAB.js +237 -0
- package/dist/{chunk-H76SKASU.js → chunk-3M3PB4RO.js} +4 -6
- package/dist/chunk-5OKGPZBQ.js +1106 -0
- package/dist/chunk-5VAHUJNC.js +348 -0
- package/dist/chunk-B5AUEOAH.js +193 -0
- package/dist/chunk-B5LQJODJ.js +37 -0
- package/dist/{chunk-HQ42WNKZ.js → chunk-BCMGGBWG.js} +2 -5
- package/dist/chunk-BCVIH2BN.js +175 -0
- package/dist/{chunk-EE7SK2GV.js → chunk-D35YI363.js} +15 -12
- package/dist/{chunk-7TH4FCVQ.js → chunk-ETBW6XNR.js} +3 -4
- package/dist/chunk-FCJ7E4OE.js +250 -0
- package/dist/chunk-HSTC277I.js +255 -0
- package/dist/chunk-IANXD4D4.js +250 -0
- package/dist/{chunk-4KYJT3DR.js → chunk-JAUU3HMH.js} +1 -2
- package/dist/chunk-JJKTRIVO.js +262 -0
- package/dist/chunk-KKHKTQNN.js +361 -0
- package/dist/chunk-KKJHGY4C.js +551 -0
- package/dist/chunk-LHPQS75Z.js +192 -0
- package/dist/{chunk-LWO6BIAD.js → chunk-LK2L2TFG.js} +5 -6
- package/dist/chunk-LLZFLQS6.js +280 -0
- package/dist/chunk-LTXTS7RP.js +154 -0
- package/dist/{chunk-4QG3772L.js → chunk-LWYBTWBZ.js} +2 -3
- package/dist/{chunk-6ZAJ37MR.js → chunk-MFKIEN7N.js} +3 -3
- package/dist/{chunk-PZ5AY32C.js → chunk-MLKGABMK.js} +0 -1
- package/dist/chunk-OZRS5PC4.js +312 -0
- package/dist/chunk-PWA3YQZU.js +346 -0
- package/dist/{chunk-6POEDI34.js → chunk-QKJBQKPY.js} +1 -2
- package/dist/chunk-RB6BYCIQ.js +141 -0
- package/dist/chunk-U4X5DEIP.js +188 -0
- package/dist/chunk-UGZ5OY5Z.js +165 -0
- package/dist/chunk-WTZSAITC.js +82 -0
- package/dist/{collections-CJur5Wg-.d.ts → collections-BthXtkEp.d.ts} +5 -1
- package/dist/collections.d.ts +1 -1
- package/dist/collections.js +2 -3
- package/dist/copy-6ZaZ__ge.d.ts +59 -0
- package/dist/copy.d.ts +1 -0
- package/dist/copy.js +9 -0
- package/dist/{datetime-Bpce8gG2.d.ts → datetime-BM_IjhTq.d.ts} +3 -1
- package/dist/datetime.d.ts +1 -1
- package/dist/datetime.js +2 -3
- package/dist/{functools-NrsZAqJk.d.ts → functools-uIa5g75p.d.ts} +3 -1
- package/dist/functools.d.ts +1 -1
- package/dist/functools.js +2 -3
- package/dist/glob.browser-B6d_YdV5.d.ts +50 -0
- package/dist/glob.browser.d.ts +1 -0
- package/dist/glob.browser.js +15 -0
- package/dist/glob.node-wn5ehtyM.d.ts +80 -0
- package/dist/glob.node.d.ts +1 -0
- package/dist/glob.node.js +15 -0
- package/dist/hashlib-vKP511NY.d.ts +205 -0
- package/dist/hashlib.d.ts +1 -0
- package/dist/hashlib.js +39 -0
- package/dist/index.browser.d.ts +172 -0
- package/dist/index.browser.js +304 -0
- package/dist/index.d.ts +61 -437
- package/dist/index.js +138 -1115
- package/dist/{itertools-Sjl1LB_0.d.ts → itertools-T0rwOk2j.d.ts} +2 -4
- package/dist/itertools.d.ts +1 -1
- package/dist/itertools.js +2 -3
- package/dist/{json-DAlvCadU.d.ts → json-DoWhX04T.d.ts} +1 -0
- package/dist/json.d.ts +1 -1
- package/dist/json.js +2 -3
- package/dist/logging.browser-Dux4L5kz.d.ts +185 -0
- package/dist/logging.browser.d.ts +1 -0
- package/dist/logging.browser.js +63 -0
- package/dist/logging.node-CH75bVdE.d.ts +185 -0
- package/dist/logging.node.d.ts +1 -0
- package/dist/logging.node.js +61 -0
- package/dist/{math-DwEGjjQ-.d.ts → math-D2NPMc-x.d.ts} +2 -1
- package/dist/math.d.ts +1 -1
- package/dist/math.js +2 -3
- package/dist/{os-C6Nt7Ijx.d.ts → os.browser-krjSx5kF.d.ts} +32 -54
- package/dist/os.browser.d.ts +2 -0
- package/dist/{os.js → os.browser.js} +41 -16
- package/dist/os.node-CQjch8Ht.d.ts +124 -0
- package/dist/os.node.d.ts +2 -0
- package/dist/os.node.js +83 -0
- package/dist/os.shared-C3x70nhO.d.ts +59 -0
- package/dist/pathlib.browser-NC7kKQYe.d.ts +91 -0
- package/dist/pathlib.browser.d.ts +1 -0
- package/dist/pathlib.browser.js +17 -0
- package/dist/pathlib.node-CY3yUFdT.d.ts +331 -0
- package/dist/pathlib.node.d.ts +2 -0
- package/dist/pathlib.node.js +17 -0
- package/dist/{random-BJv_rSpL.d.ts → random-DcS5jtEs.d.ts} +3 -5
- package/dist/random.d.ts +1 -1
- package/dist/random.js +2 -3
- package/dist/{re-B1CHCgyr.d.ts → re-Bo-IOqov.d.ts} +3 -7
- package/dist/re.d.ts +1 -1
- package/dist/re.js +2 -3
- package/dist/set-JQbLAq8B.d.ts +592 -0
- package/dist/shutil.browser-Ck5oWhnP.d.ts +113 -0
- package/dist/shutil.browser.d.ts +1 -0
- package/dist/shutil.browser.js +33 -0
- package/dist/shutil.node-C9kwvhAf.d.ts +160 -0
- package/dist/shutil.node.d.ts +2 -0
- package/dist/shutil.node.js +33 -0
- package/dist/string.d.ts +3 -1
- package/dist/string.js +2 -3
- package/dist/subprocess-CZVYzQ3V.d.ts +214 -0
- package/dist/subprocess.d.ts +1 -0
- package/dist/subprocess.js +29 -0
- package/dist/sys-IL8LgI_W.d.ts +212 -0
- package/dist/sys.d.ts +1 -0
- package/dist/sys.js +51 -0
- package/dist/tempfile.browser-DciOKfNm.d.ts +78 -0
- package/dist/tempfile.browser.d.ts +1 -0
- package/dist/tempfile.browser.js +19 -0
- package/dist/tempfile.node-bVMY60Cu.d.ts +195 -0
- package/dist/tempfile.node.d.ts +2 -0
- package/dist/tempfile.node.js +23 -0
- package/dist/time-CcYhdiSu.d.ts +245 -0
- package/dist/time.d.ts +1 -0
- package/dist/time.js +49 -0
- package/dist/urllib-DJtkj-0f.d.ts +198 -0
- package/dist/urllib.d.ts +1 -0
- package/dist/urllib.js +37 -0
- package/dist/uuid-C0ypmn56.d.ts +160 -0
- package/dist/uuid.d.ts +1 -0
- package/dist/uuid.js +23 -0
- package/package.json +127 -5
- package/dist/chunk-4KYJT3DR.js.map +0 -1
- package/dist/chunk-4QG3772L.js.map +0 -1
- package/dist/chunk-6POEDI34.js.map +0 -1
- package/dist/chunk-6ZAJ37MR.js.map +0 -1
- package/dist/chunk-7TH4FCVQ.js.map +0 -1
- package/dist/chunk-CXKGPD5D.js +0 -313
- package/dist/chunk-CXKGPD5D.js.map +0 -1
- package/dist/chunk-EE7SK2GV.js.map +0 -1
- package/dist/chunk-H76SKASU.js.map +0 -1
- package/dist/chunk-HQ42WNKZ.js.map +0 -1
- package/dist/chunk-LWO6BIAD.js.map +0 -1
- package/dist/chunk-PZ5AY32C.js.map +0 -1
- package/dist/collections.js.map +0 -1
- package/dist/datetime.js.map +0 -1
- package/dist/functools.js.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/itertools.js.map +0 -1
- package/dist/json.js.map +0 -1
- package/dist/math.js.map +0 -1
- package/dist/os.d.ts +0 -1
- package/dist/os.js.map +0 -1
- package/dist/random.js.map +0 -1
- package/dist/re.js.map +0 -1
- package/dist/string.js.map +0 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,438 +1,55 @@
|
|
|
1
|
-
import { i as itertoolsModule } from './itertools-
|
|
2
|
-
import { f as functoolsModule } from './functools-
|
|
3
|
-
import { c as collectionsModule } from './collections-
|
|
4
|
-
import { m as mathModule } from './math-
|
|
5
|
-
import { r as randomModule } from './random-
|
|
6
|
-
import { j as jsonModule } from './json-
|
|
7
|
-
import { o as osModule } from './os-
|
|
8
|
-
import { d as datetimeModule } from './datetime-
|
|
9
|
-
import { r as reModule } from './re-
|
|
1
|
+
import { i as itertoolsModule } from './itertools-T0rwOk2j.js';
|
|
2
|
+
import { f as functoolsModule } from './functools-uIa5g75p.js';
|
|
3
|
+
import { c as collectionsModule } from './collections-BthXtkEp.js';
|
|
4
|
+
import { m as mathModule } from './math-D2NPMc-x.js';
|
|
5
|
+
import { r as randomModule } from './random-DcS5jtEs.js';
|
|
6
|
+
import { j as jsonModule } from './json-DoWhX04T.js';
|
|
7
|
+
import { o as osModule } from './os.node-CQjch8Ht.js';
|
|
8
|
+
import { d as datetimeModule } from './datetime-BM_IjhTq.js';
|
|
9
|
+
import { r as reModule } from './re-Bo-IOqov.js';
|
|
10
10
|
import { capWords, Template } from './string.js';
|
|
11
|
+
import { s as sysModule } from './sys-IL8LgI_W.js';
|
|
12
|
+
import { t as timeModule } from './time-CcYhdiSu.js';
|
|
13
|
+
import { c as copyModule } from './copy-6ZaZ__ge.js';
|
|
14
|
+
import { b as base64Module } from './base64-C_am75Sv.js';
|
|
15
|
+
import { u as uuidModule } from './uuid-C0ypmn56.js';
|
|
16
|
+
import { h as hashlibModule } from './hashlib-vKP511NY.js';
|
|
17
|
+
import { p as pathlibModule } from './pathlib.node-CY3yUFdT.js';
|
|
18
|
+
import { g as globModule } from './glob.node-wn5ehtyM.js';
|
|
19
|
+
import { s as shutilModule } from './shutil.node-C9kwvhAf.js';
|
|
20
|
+
import { t as tempfileModule } from './tempfile.node-bVMY60Cu.js';
|
|
21
|
+
import { s as subprocessModule } from './subprocess-CZVYzQ3V.js';
|
|
22
|
+
import { u as urllibModule } from './urllib-DJtkj-0f.js';
|
|
23
|
+
import { l as loggingModule } from './logging.node-CH75bVdE.js';
|
|
24
|
+
import { l as list$1, d as dict$1, s as set$1, f as floorDiv$1, m as mod$1, a as divMod$1, b as sprintf$1, c as strFormat$1, e as slice$1, g as at$1, h as contains$1, i as is$1, r as range$1, j as enumerate$1, z as zip$1, k as iter$1, n as reversed$1, o as sorted$1, p as map$1, q as filter$1, t as tuple$1, u as len$1, v as abs$1, w as min$1, x as max$1, y as sum$1, A as all$1, B as any$1, C as round$1, D as ord$1, E as chr$1, F as hex$1, G as oct$1, H as bin$1, I as int$1, J as float$1, K as str$1, L as repr$1, M as bool$1, N as ascii$1, O as isinstance$1, P as type$1, Q as input$1, R as format$1, S as getattr$1, T as hasattr$1, U as setattr$1 } from './set-JQbLAq8B.js';
|
|
25
|
+
export { W as pow, V as repeatValue } from './set-JQbLAq8B.js';
|
|
26
|
+
import './os.shared-C3x70nhO.js';
|
|
27
|
+
import 'node:fs';
|
|
28
|
+
import 'node:fs/promises';
|
|
11
29
|
|
|
12
30
|
/**
|
|
13
|
-
*
|
|
14
|
-
* Arithmetic operations with Python semantics, slicing, etc.
|
|
15
|
-
*/
|
|
16
|
-
/**
|
|
17
|
-
* Floor division (Python //)
|
|
18
|
-
* Always rounds towards negative infinity, unlike Math.floor for negatives
|
|
19
|
-
*/
|
|
20
|
-
declare function floorDiv$1(a: number, b: number): number;
|
|
21
|
-
/**
|
|
22
|
-
* Power operator (Python **)
|
|
23
|
-
*/
|
|
24
|
-
declare function pow(base: number, exp: number): number;
|
|
25
|
-
/**
|
|
26
|
-
* Modulo (Python %)
|
|
27
|
-
* Python's % always returns a result with the same sign as the divisor
|
|
28
|
-
*/
|
|
29
|
-
declare function mod$1(a: number, b: number): number;
|
|
30
|
-
/**
|
|
31
|
-
* Python divMod()
|
|
32
|
-
*/
|
|
33
|
-
declare function divMod$1(a: number, b: number): [number, number];
|
|
34
|
-
/**
|
|
35
|
-
* Python %-style string formatting
|
|
36
|
-
* Handles %s, %d, %i, %f, %r, %x, %o, etc.
|
|
37
|
-
*/
|
|
38
|
-
declare function sprintf$1(template: string, args: unknown): string;
|
|
39
|
-
/**
|
|
40
|
-
* Python str.format() style string formatting
|
|
41
|
-
* Handles {} positional and {name} named placeholders
|
|
42
|
-
*/
|
|
43
|
-
declare function strFormat$1(template: string, ...args: unknown[]): string;
|
|
44
|
-
/**
|
|
45
|
-
* Python-style slice operation
|
|
46
|
-
* Supports negative indices and step
|
|
47
|
-
*/
|
|
48
|
-
declare function slice$1<T>(obj: string | T[], start?: number, stop?: number, step?: number): string | T[];
|
|
49
|
-
/**
|
|
50
|
-
* Python-style index access with support for negative indices
|
|
51
|
-
*/
|
|
52
|
-
declare function at$1<T>(obj: string | T[], index: number): T | string;
|
|
53
|
-
/**
|
|
54
|
-
* Python-style string/array repetition
|
|
55
|
-
*/
|
|
56
|
-
declare function repeat<T>(obj: string | T[], count: number): string | T[];
|
|
57
|
-
/**
|
|
58
|
-
* Python 'in' operator
|
|
59
|
-
*/
|
|
60
|
-
declare function contains$1<T>(item: T, container: Iterable<T> | string | Map<T, unknown> | Set<T>): boolean;
|
|
61
|
-
/**
|
|
62
|
-
* Python 'is' operator (identity comparison)
|
|
63
|
-
*/
|
|
64
|
-
declare function is$1(a: unknown, b: unknown): boolean;
|
|
65
|
-
|
|
66
|
-
/**
|
|
67
|
-
* Python built-in functions for TypeScript
|
|
68
|
-
*
|
|
69
|
-
* Provides core Python built-in functions like len, range, enumerate, sorted, min, max, etc.
|
|
70
|
-
*
|
|
71
|
-
* @see {@link https://docs.python.org/3/library/functions.html | Python built-in functions documentation}
|
|
72
|
-
*/
|
|
73
|
-
/**
|
|
74
|
-
* Python range() function
|
|
75
|
-
*/
|
|
76
|
-
declare function range$1(startOrStop: number, stop?: number, step?: number): Iterable<number>;
|
|
77
|
-
/**
|
|
78
|
-
* Python enumerate() function
|
|
79
|
-
*/
|
|
80
|
-
declare function enumerate$1<T>(iterable: Iterable<T>, start?: number): Iterable<[number, T]>;
|
|
81
|
-
/**
|
|
82
|
-
* Python zip() function
|
|
83
|
-
*/
|
|
84
|
-
declare function zip$1<T extends unknown[][]>(...iterables: {
|
|
85
|
-
[K in keyof T]: Iterable<T[K]>;
|
|
86
|
-
}): Iterable<T>;
|
|
87
|
-
/**
|
|
88
|
-
* Safe iteration helper for for-in loops
|
|
89
|
-
*/
|
|
90
|
-
declare function iter$1<T>(obj: Iterable<T> | Record<string, unknown> | null | undefined): Iterable<T> | string[];
|
|
91
|
-
/**
|
|
92
|
-
* Python reversed() function
|
|
93
|
-
*/
|
|
94
|
-
declare function reversed$1<T>(iterable: Iterable<T>): Iterable<T>;
|
|
95
|
-
/**
|
|
96
|
-
* Python sorted() function
|
|
97
|
-
*/
|
|
98
|
-
declare function sorted$1<T>(iterable: Iterable<T>, options?: {
|
|
99
|
-
key?: (x: T) => unknown;
|
|
100
|
-
reverse?: boolean;
|
|
101
|
-
}): T[];
|
|
102
|
-
/**
|
|
103
|
-
* Python map() function
|
|
104
|
-
*/
|
|
105
|
-
declare function map$1<T, U>(fn: (x: T) => U, iterable: Iterable<T>): Iterable<U>;
|
|
106
|
-
/**
|
|
107
|
-
* Python filter() function
|
|
108
|
-
*/
|
|
109
|
-
declare function filter$1<T>(fn: ((x: T) => boolean) | null, iterable: Iterable<T>): Iterable<T>;
|
|
110
|
-
/**
|
|
111
|
-
* Create a tuple (readonly array)
|
|
112
|
-
*/
|
|
113
|
-
declare function tuple$1<T extends unknown[]>(...items: T): Readonly<T>;
|
|
114
|
-
/**
|
|
115
|
-
* Python len() function
|
|
116
|
-
*/
|
|
117
|
-
declare function len$1(obj: string | unknown[] | Map<unknown, unknown> | Set<unknown> | {
|
|
118
|
-
length: number;
|
|
119
|
-
}): number;
|
|
120
|
-
/**
|
|
121
|
-
* Python abs() function
|
|
122
|
-
*/
|
|
123
|
-
declare function abs$1(x: number): number;
|
|
124
|
-
/**
|
|
125
|
-
* Python min() function
|
|
126
|
-
*/
|
|
127
|
-
declare function min$1<T>(...args: T[] | [Iterable<T>]): T;
|
|
128
|
-
/**
|
|
129
|
-
* Python max() function
|
|
130
|
-
*/
|
|
131
|
-
declare function max$1<T>(...args: T[] | [Iterable<T>]): T;
|
|
132
|
-
/**
|
|
133
|
-
* Python sum() function
|
|
134
|
-
*/
|
|
135
|
-
declare function sum$1(iterable: Iterable<number>, start?: number): number;
|
|
136
|
-
/**
|
|
137
|
-
* Python all() function
|
|
138
|
-
*/
|
|
139
|
-
declare function all$1(iterable: Iterable<unknown>): boolean;
|
|
140
|
-
/**
|
|
141
|
-
* Python any() function
|
|
142
|
-
*/
|
|
143
|
-
declare function any$1(iterable: Iterable<unknown>): boolean;
|
|
144
|
-
/**
|
|
145
|
-
* Python round() function
|
|
146
|
-
*/
|
|
147
|
-
declare function round$1(number: number, ndigits?: number): number;
|
|
148
|
-
/**
|
|
149
|
-
* Python ord()
|
|
150
|
-
*/
|
|
151
|
-
declare function ord$1(char: string): number;
|
|
152
|
-
/**
|
|
153
|
-
* Python chr()
|
|
154
|
-
*/
|
|
155
|
-
declare function chr$1(code: number): string;
|
|
156
|
-
/**
|
|
157
|
-
* Python hex()
|
|
158
|
-
*/
|
|
159
|
-
declare function hex$1(x: number): string;
|
|
160
|
-
/**
|
|
161
|
-
* Python oct()
|
|
162
|
-
*/
|
|
163
|
-
declare function oct$1(x: number): string;
|
|
164
|
-
/**
|
|
165
|
-
* Python bin()
|
|
166
|
-
*/
|
|
167
|
-
declare function bin$1(x: number): string;
|
|
168
|
-
/**
|
|
169
|
-
* Python int() function
|
|
170
|
-
*/
|
|
171
|
-
declare function int$1(x: string | number | boolean, base?: number): number;
|
|
172
|
-
/**
|
|
173
|
-
* Python float() function
|
|
174
|
-
*/
|
|
175
|
-
declare function float$1(x: string | number): number;
|
|
176
|
-
/**
|
|
177
|
-
* Python str() function
|
|
178
|
-
*/
|
|
179
|
-
declare function str$1(x: unknown): string;
|
|
180
|
-
/**
|
|
181
|
-
* Python repr() function
|
|
182
|
-
*/
|
|
183
|
-
declare function repr$1(x: unknown): string;
|
|
184
|
-
/**
|
|
185
|
-
* Python bool() function
|
|
186
|
-
*/
|
|
187
|
-
declare function bool$1(x: unknown): boolean;
|
|
188
|
-
/**
|
|
189
|
-
* Python ascii() - returns ASCII representation
|
|
190
|
-
*/
|
|
191
|
-
declare function ascii$1(x: unknown): string;
|
|
192
|
-
/**
|
|
193
|
-
* Python isinstance() - simplified version
|
|
194
|
-
*/
|
|
195
|
-
declare function isinstance$1(obj: unknown, classInfo: unknown): boolean;
|
|
196
|
-
/**
|
|
197
|
-
* Python type() - simplified version
|
|
198
|
-
*/
|
|
199
|
-
declare function type$1(obj: unknown): string;
|
|
200
|
-
/**
|
|
201
|
-
* Python input() - for Node.js
|
|
202
|
-
*/
|
|
203
|
-
declare function input$1(prompt?: string): string;
|
|
204
|
-
/**
|
|
205
|
-
* Python format() - formats a value according to format spec
|
|
206
|
-
*/
|
|
207
|
-
declare function format$1(value: unknown, spec: string): string;
|
|
208
|
-
/**
|
|
209
|
-
* Python getattr() function - get an attribute from an object
|
|
31
|
+
* Python Built-in Functions for TypeScript
|
|
210
32
|
*
|
|
211
|
-
*
|
|
212
|
-
*
|
|
213
|
-
*
|
|
214
|
-
*
|
|
215
|
-
*/
|
|
216
|
-
declare function getattr$1<T>(obj: unknown, name: string, defaultValue?: T): T | undefined;
|
|
217
|
-
/**
|
|
218
|
-
* Python hasattr() function - check if an object has an attribute
|
|
219
|
-
*
|
|
220
|
-
* @param obj - The object to check
|
|
221
|
-
* @param name - The name of the attribute
|
|
222
|
-
* @returns True if the attribute exists, false otherwise
|
|
223
|
-
*/
|
|
224
|
-
declare function hasattr$1(obj: unknown, name: string): boolean;
|
|
225
|
-
/**
|
|
226
|
-
* Python setattr() function - set an attribute on an object
|
|
227
|
-
*
|
|
228
|
-
* @param obj - The object to set the attribute on
|
|
229
|
-
* @param name - The name of the attribute
|
|
230
|
-
* @param value - The value to set
|
|
231
|
-
*/
|
|
232
|
-
declare function setattr$1(obj: unknown, name: string, value: unknown): void;
|
|
233
|
-
|
|
234
|
-
/**
|
|
235
|
-
* Python list methods for TypeScript
|
|
236
|
-
* Usage: py.list.remove(), py.list.sort(), etc.
|
|
237
|
-
*/
|
|
238
|
-
declare const list$1: {
|
|
239
|
-
/**
|
|
240
|
-
* Python list.append() - modifies array in place
|
|
241
|
-
*/
|
|
242
|
-
append<T>(arr: T[], item: T): void;
|
|
243
|
-
/**
|
|
244
|
-
* Python list.extend() - modifies array in place
|
|
245
|
-
*/
|
|
246
|
-
extend<T>(arr: T[], items: Iterable<T>): void;
|
|
247
|
-
/**
|
|
248
|
-
* Python list.insert() - modifies array in place
|
|
249
|
-
*/
|
|
250
|
-
insert<T>(arr: T[], index: number, item: T): void;
|
|
251
|
-
/**
|
|
252
|
-
* Python list.remove() - removes first occurrence, modifies in place
|
|
253
|
-
*/
|
|
254
|
-
remove<T>(arr: T[], value: T): void;
|
|
255
|
-
/**
|
|
256
|
-
* Python list.pop() - removes and returns item at index
|
|
257
|
-
*/
|
|
258
|
-
pop<T>(arr: T[], index?: number): T;
|
|
259
|
-
/**
|
|
260
|
-
* Python list.clear() - removes all items
|
|
261
|
-
*/
|
|
262
|
-
clear(arr: unknown[]): void;
|
|
263
|
-
/**
|
|
264
|
-
* Python list.index() - finds first occurrence
|
|
265
|
-
*/
|
|
266
|
-
index<T>(arr: T[], value: T, start?: number, end?: number): number;
|
|
267
|
-
/**
|
|
268
|
-
* Python list.count() - counts occurrences
|
|
269
|
-
*/
|
|
270
|
-
count<T>(arr: T[], value: T): number;
|
|
271
|
-
/**
|
|
272
|
-
* Python list.sort() with key function - modifies in place
|
|
273
|
-
*/
|
|
274
|
-
sort<T>(arr: T[], options?: {
|
|
275
|
-
key?: (x: T) => unknown;
|
|
276
|
-
reverse?: boolean;
|
|
277
|
-
}): void;
|
|
278
|
-
/**
|
|
279
|
-
* Python list.reverse() - reverses in place
|
|
280
|
-
*/
|
|
281
|
-
reverse(arr: unknown[]): void;
|
|
282
|
-
/**
|
|
283
|
-
* Python list.copy() - shallow copy
|
|
284
|
-
*/
|
|
285
|
-
copy<T>(arr: T[]): T[];
|
|
286
|
-
/**
|
|
287
|
-
* Python slice assignment: arr[start:end:step] = values
|
|
288
|
-
* Replaces a slice of the array with new values, modifying in place
|
|
289
|
-
*/
|
|
290
|
-
sliceAssign<T>(arr: T[], start: number | undefined, end: number | undefined, step: number | undefined, values: T[]): void;
|
|
291
|
-
};
|
|
292
|
-
|
|
293
|
-
/**
|
|
294
|
-
* Python dict methods for TypeScript
|
|
295
|
-
* Usage: py.dict.get(), py.dict.keys(), etc.
|
|
296
|
-
*/
|
|
297
|
-
declare const dict$1: {
|
|
298
|
-
/**
|
|
299
|
-
* Python dict.get() - get value with optional default
|
|
300
|
-
*/
|
|
301
|
-
get<K extends string | number | symbol, V>(obj: Record<K, V>, key: K, defaultValue?: V): V | undefined;
|
|
302
|
-
/**
|
|
303
|
-
* Python dict.setDefault() - get value or set default
|
|
304
|
-
*/
|
|
305
|
-
setDefault<K extends string | number | symbol, V>(obj: Record<K, V>, key: K, defaultValue: V): V;
|
|
306
|
-
/**
|
|
307
|
-
* Python dict.pop() - remove and return value
|
|
308
|
-
*/
|
|
309
|
-
pop<K extends string | number | symbol, V>(obj: Record<K, V>, key: K, defaultValue?: V): V | undefined;
|
|
310
|
-
/**
|
|
311
|
-
* Python dict.popItem() - remove and return last item
|
|
312
|
-
*/
|
|
313
|
-
popItem<K extends string | number | symbol, V>(obj: Record<K, V>): [K, V];
|
|
314
|
-
/**
|
|
315
|
-
* Python dict.update() - update with another dict
|
|
316
|
-
*/
|
|
317
|
-
update<K extends string | number | symbol, V>(obj: Record<K, V>, other: Record<K, V> | Iterable<[K, V]>): void;
|
|
318
|
-
/**
|
|
319
|
-
* Python dict.clear() - remove all items
|
|
320
|
-
*/
|
|
321
|
-
clear<K extends string | number | symbol, V>(obj: Record<K, V>): void;
|
|
322
|
-
/**
|
|
323
|
-
* Python dict.copy() - shallow copy
|
|
324
|
-
*/
|
|
325
|
-
copy<K extends string | number | symbol, V>(obj: Record<K, V>): Record<K, V>;
|
|
326
|
-
/**
|
|
327
|
-
* Python dict.keys() - returns iterable of keys
|
|
328
|
-
*/
|
|
329
|
-
keys<K extends string | number | symbol, V>(obj: Record<K, V>): K[];
|
|
330
|
-
/**
|
|
331
|
-
* Python dict.values() - returns iterable of values
|
|
332
|
-
*/
|
|
333
|
-
values<K extends string | number | symbol, V>(obj: Record<K, V>): V[];
|
|
334
|
-
/**
|
|
335
|
-
* Python dict.items() - returns iterable of [key, value] pairs
|
|
336
|
-
*/
|
|
337
|
-
items<K extends string | number | symbol, V>(obj: Record<K, V>): [K, V][];
|
|
338
|
-
/**
|
|
339
|
-
* Python dict.fromKeys() - create dict from keys
|
|
340
|
-
*/
|
|
341
|
-
fromKeys<K extends string | number | symbol, V>(keys: K[], value?: V): Record<K, V | undefined>;
|
|
342
|
-
};
|
|
343
|
-
|
|
344
|
-
/**
|
|
345
|
-
* Python set methods for TypeScript
|
|
346
|
-
* Usage: py.set.intersection(), py.set.union(), etc.
|
|
347
|
-
*/
|
|
348
|
-
declare const set$1: {
|
|
349
|
-
/**
|
|
350
|
-
* Python set.add() - add element
|
|
351
|
-
*/
|
|
352
|
-
add<T>(s: Set<T>, item: T): void;
|
|
353
|
-
/**
|
|
354
|
-
* Python set.remove() - remove element, raises error if not found
|
|
355
|
-
*/
|
|
356
|
-
remove<T>(s: Set<T>, item: T): void;
|
|
357
|
-
/**
|
|
358
|
-
* Python set.discard() - remove element if present
|
|
359
|
-
*/
|
|
360
|
-
discard<T>(s: Set<T>, item: T): void;
|
|
361
|
-
/**
|
|
362
|
-
* Python set.pop() - remove and return arbitrary element
|
|
363
|
-
*/
|
|
364
|
-
pop<T>(s: Set<T>): T;
|
|
365
|
-
/**
|
|
366
|
-
* Python set.clear() - remove all elements
|
|
367
|
-
*/
|
|
368
|
-
clear<T>(s: Set<T>): void;
|
|
369
|
-
/**
|
|
370
|
-
* Python set.copy() - shallow copy
|
|
371
|
-
*/
|
|
372
|
-
copy<T>(s: Set<T>): Set<T>;
|
|
373
|
-
/**
|
|
374
|
-
* Python set.update() - add elements from iterable
|
|
375
|
-
*/
|
|
376
|
-
update<T>(s: Set<T>, ...iterables: Iterable<T>[]): void;
|
|
377
|
-
/**
|
|
378
|
-
* Python set.union() - returns new set with all elements
|
|
379
|
-
*/
|
|
380
|
-
union<T>(a: Set<T>, ...others: Iterable<T>[]): Set<T>;
|
|
381
|
-
/**
|
|
382
|
-
* Python set.intersection() - returns new set with common elements
|
|
383
|
-
*/
|
|
384
|
-
intersection<T>(a: Set<T>, b: Set<T>): Set<T>;
|
|
385
|
-
/**
|
|
386
|
-
* Python set.intersection_update() - keep only common elements
|
|
387
|
-
*/
|
|
388
|
-
intersectionUpdate<T>(a: Set<T>, b: Set<T>): void;
|
|
389
|
-
/**
|
|
390
|
-
* Python set.difference() - returns new set with elements in a but not in b
|
|
391
|
-
*/
|
|
392
|
-
difference<T>(a: Set<T>, b: Set<T>): Set<T>;
|
|
393
|
-
/**
|
|
394
|
-
* Python set.difference_update() - remove elements found in b
|
|
395
|
-
*/
|
|
396
|
-
differenceUpdate<T>(a: Set<T>, b: Set<T>): void;
|
|
397
|
-
/**
|
|
398
|
-
* Python set.symmetric_difference() - returns new set with elements in either but not both
|
|
399
|
-
*/
|
|
400
|
-
symmetricDifference<T>(a: Set<T>, b: Set<T>): Set<T>;
|
|
401
|
-
/**
|
|
402
|
-
* Python set.symmetric_difference_update() - update with symmetric difference
|
|
403
|
-
*/
|
|
404
|
-
symmetricDifferenceUpdate<T>(a: Set<T>, b: Set<T>): void;
|
|
405
|
-
/**
|
|
406
|
-
* Python set.isSubset() - test if all elements are in other
|
|
407
|
-
*/
|
|
408
|
-
isSubset<T>(a: Set<T>, b: Set<T>): boolean;
|
|
409
|
-
/**
|
|
410
|
-
* Python set.isSuperset() - test if all other elements are in this set
|
|
411
|
-
*/
|
|
412
|
-
isSuperset<T>(a: Set<T>, b: Set<T>): boolean;
|
|
413
|
-
/**
|
|
414
|
-
* Python set.isDisjoint() - test if no common elements
|
|
415
|
-
*/
|
|
416
|
-
isDisjoint<T>(a: Set<T>, b: Set<T>): boolean;
|
|
417
|
-
};
|
|
418
|
-
|
|
419
|
-
/**
|
|
420
|
-
* Python Runtime Library for TypeScript
|
|
33
|
+
* This module provides Python's built-in functions that are always available
|
|
34
|
+
* without imports. These are the fundamental operations for working with data
|
|
35
|
+
* in Python, including iteration (range, enumerate, zip), aggregation (len,
|
|
36
|
+
* sum, min, max), type conversion (int, str, bool), and more.
|
|
421
37
|
*
|
|
422
|
-
*
|
|
38
|
+
* @example
|
|
39
|
+
* ```typescript
|
|
40
|
+
* // Direct imports
|
|
41
|
+
* import { len, range, sorted, min, max } from "pythonlib"
|
|
423
42
|
*
|
|
424
|
-
*
|
|
425
|
-
*
|
|
43
|
+
* // Module imports (like Python)
|
|
44
|
+
* import { chain, combinations } from "pythonlib/itertools"
|
|
45
|
+
* import { Counter, defaultdict } from "pythonlib/collections"
|
|
426
46
|
*
|
|
427
|
-
*
|
|
428
|
-
*
|
|
429
|
-
*
|
|
430
|
-
* import { chain, combinations } from "pythonlib/itertools"
|
|
431
|
-
* import { Counter, defaultdict } from "pythonlib/collections"
|
|
47
|
+
* // Module namespaces
|
|
48
|
+
* import { json, re, itertools } from "pythonlib"
|
|
49
|
+
* ```
|
|
432
50
|
*
|
|
433
|
-
* 3.
|
|
434
|
-
*
|
|
435
|
-
* json.dump(...), re.match(...), itertools.chain(...)
|
|
51
|
+
* @see {@link https://docs.python.org/3/library/functions.html | Python Built-in Functions}
|
|
52
|
+
* @module
|
|
436
53
|
*/
|
|
437
54
|
|
|
438
55
|
declare const itertools: typeof itertoolsModule;
|
|
@@ -489,15 +106,22 @@ declare const string: {
|
|
|
489
106
|
isLower(s: string): boolean;
|
|
490
107
|
format(s: string, ...args: unknown[]): string;
|
|
491
108
|
};
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
109
|
+
declare const sys: typeof sysModule;
|
|
110
|
+
declare const time: typeof timeModule;
|
|
111
|
+
declare const copy: typeof copyModule;
|
|
112
|
+
declare const base64: typeof base64Module;
|
|
113
|
+
declare const uuid: typeof uuidModule;
|
|
114
|
+
declare const hashlib: typeof hashlibModule;
|
|
115
|
+
declare const pathlib: typeof pathlibModule;
|
|
116
|
+
declare const glob: typeof globModule;
|
|
117
|
+
declare const shutil: typeof shutilModule;
|
|
118
|
+
declare const tempfile: typeof tempfileModule;
|
|
119
|
+
declare const subprocess: typeof subprocessModule;
|
|
120
|
+
declare const urllib: typeof urllibModule;
|
|
121
|
+
declare const logging: typeof loggingModule;
|
|
122
|
+
type ListConstructor = (<T>(iterable?: Iterable<T>) => T[]) & typeof list$1;
|
|
123
|
+
type DictConstructor = (<K, V>(entries?: Iterable<[K, V]>) => Map<K, V>) & typeof dict$1;
|
|
124
|
+
type SetConstructor = (<T>(iterable?: Iterable<T>) => Set<T>) & typeof set$1;
|
|
501
125
|
declare const list: ListConstructor;
|
|
502
126
|
declare const dict: DictConstructor;
|
|
503
127
|
declare const set: SetConstructor;
|
|
@@ -547,4 +171,4 @@ declare const getattr: typeof getattr$1;
|
|
|
547
171
|
declare const hasattr: typeof hasattr$1;
|
|
548
172
|
declare const setattr: typeof setattr$1;
|
|
549
173
|
|
|
550
|
-
export { abs, all, any, ascii, at, bin, bool, chr, collections, contains, datetime, dict, divMod, enumerate, filter, float, floorDiv, format, functools, getattr, hasattr, hex, input, int, is, isinstance, iter, itertools, json, len, list, map, math, max, min, mod, oct, ord, os,
|
|
174
|
+
export { abs, all, any, ascii, at, base64, bin, bool, chr, collections, contains, copy, datetime, dict, divMod, enumerate, filter, float, floorDiv, format, functools, getattr, glob, hasattr, hashlib, hex, input, int, is, isinstance, iter, itertools, json, len, list, logging, map, math, max, min, mod, oct, ord, os, pathlib, random, range, re, repr, reversed, round, set, setattr, shutil, slice, sorted, sprintf, str, strFormat, string, subprocess, sum, sys, tempfile, time, tuple, type, urllib, uuid, zip };
|