pythonlib 0.1.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 +183 -0
- package/dist/chunk-3CSEXTA7.js +376 -0
- package/dist/chunk-3CSEXTA7.js.map +1 -0
- package/dist/chunk-HA5Y7PKO.js +680 -0
- package/dist/chunk-HA5Y7PKO.js.map +1 -0
- package/dist/chunk-IVYYI2VR.js +261 -0
- package/dist/chunk-IVYYI2VR.js.map +1 -0
- package/dist/chunk-OMQNGE6T.js +245 -0
- package/dist/chunk-OMQNGE6T.js.map +1 -0
- package/dist/chunk-P3SGIF72.js +107 -0
- package/dist/chunk-P3SGIF72.js.map +1 -0
- package/dist/chunk-PZ5AY32C.js +10 -0
- package/dist/chunk-PZ5AY32C.js.map +1 -0
- package/dist/chunk-TJFGYXBJ.js +310 -0
- package/dist/chunk-TJFGYXBJ.js.map +1 -0
- package/dist/chunk-TOI6IG3T.js +337 -0
- package/dist/chunk-TOI6IG3T.js.map +1 -0
- package/dist/chunk-UFMTN4T4.js +215 -0
- package/dist/chunk-UFMTN4T4.js.map +1 -0
- package/dist/chunk-V63LKSA3.js +423 -0
- package/dist/chunk-V63LKSA3.js.map +1 -0
- package/dist/chunk-WAONBJE5.js +236 -0
- package/dist/chunk-WAONBJE5.js.map +1 -0
- package/dist/collections-xN9Gi0TA.d.ts +113 -0
- package/dist/collections.d.ts +1 -0
- package/dist/collections.js +12 -0
- package/dist/collections.js.map +1 -0
- package/dist/datetime-DRwFAiGV.d.ts +139 -0
- package/dist/datetime.d.ts +1 -0
- package/dist/datetime.js +22 -0
- package/dist/datetime.js.map +1 -0
- package/dist/functools-St5GqpKG.d.ts +125 -0
- package/dist/functools.d.ts +1 -0
- package/dist/functools.js +32 -0
- package/dist/functools.js.map +1 -0
- package/dist/index.d.ts +624 -0
- package/dist/index.js +1332 -0
- package/dist/index.js.map +1 -0
- package/dist/itertools-Bj8XivI6.d.ts +138 -0
- package/dist/itertools.d.ts +1 -0
- package/dist/itertools.js +44 -0
- package/dist/itertools.js.map +1 -0
- package/dist/json-Xpk0kwSd.d.ts +77 -0
- package/dist/json.d.ts +1 -0
- package/dist/json.js +14 -0
- package/dist/json.js.map +1 -0
- package/dist/math-BrT4Aw3E.d.ts +147 -0
- package/dist/math.d.ts +1 -0
- package/dist/math.js +96 -0
- package/dist/math.js.map +1 -0
- package/dist/os-FRSJbEUH.d.ts +143 -0
- package/dist/os.d.ts +1 -0
- package/dist/os.js +58 -0
- package/dist/os.js.map +1 -0
- package/dist/random-D5S5iSV3.d.ts +72 -0
- package/dist/random.d.ts +1 -0
- package/dist/random.js +42 -0
- package/dist/random.js.map +1 -0
- package/dist/re-DSxiURqN.d.ts +148 -0
- package/dist/re.d.ts +1 -0
- package/dist/re.js +52 -0
- package/dist/re.js.map +1 -0
- package/dist/string.d.ts +166 -0
- package/dist/string.js +30 -0
- package/dist/string.js.map +1 -0
- package/package.json +85 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { b as attrgetter, c as cache, e as cmp_to_key, d as identity, i as itemgetter, l as lru_cache, m as methodcaller, p as partial, a as partialmethod, r as reduce, s as singledispatch, t as total_ordering, w as wraps } from './functools-St5GqpKG.js';
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import {
|
|
2
|
+
attrgetter,
|
|
3
|
+
cache,
|
|
4
|
+
cmp_to_key,
|
|
5
|
+
identity,
|
|
6
|
+
itemgetter,
|
|
7
|
+
lru_cache,
|
|
8
|
+
methodcaller,
|
|
9
|
+
partial,
|
|
10
|
+
partialmethod,
|
|
11
|
+
reduce,
|
|
12
|
+
singledispatch,
|
|
13
|
+
total_ordering,
|
|
14
|
+
wraps
|
|
15
|
+
} from "./chunk-OMQNGE6T.js";
|
|
16
|
+
import "./chunk-PZ5AY32C.js";
|
|
17
|
+
export {
|
|
18
|
+
attrgetter,
|
|
19
|
+
cache,
|
|
20
|
+
cmp_to_key,
|
|
21
|
+
identity,
|
|
22
|
+
itemgetter,
|
|
23
|
+
lru_cache,
|
|
24
|
+
methodcaller,
|
|
25
|
+
partial,
|
|
26
|
+
partialmethod,
|
|
27
|
+
reduce,
|
|
28
|
+
singledispatch,
|
|
29
|
+
total_ordering,
|
|
30
|
+
wraps
|
|
31
|
+
};
|
|
32
|
+
//# sourceMappingURL=functools.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,624 @@
|
|
|
1
|
+
import { i as itertoolsModule } from './itertools-Bj8XivI6.js';
|
|
2
|
+
import { f as functoolsModule } from './functools-St5GqpKG.js';
|
|
3
|
+
import { C as Counter, d as defaultdict, a as deque, c as collectionsModule } from './collections-xN9Gi0TA.js';
|
|
4
|
+
import { m as mathModule } from './math-BrT4Aw3E.js';
|
|
5
|
+
import { r as randomModule } from './random-D5S5iSV3.js';
|
|
6
|
+
import { j as jsonModule } from './json-Xpk0kwSd.js';
|
|
7
|
+
import { o as osModule } from './os-FRSJbEUH.js';
|
|
8
|
+
import { d as datetimeModule } from './datetime-DRwFAiGV.js';
|
|
9
|
+
import { r as reModule } from './re-DSxiURqN.js';
|
|
10
|
+
import { Template, capwords } from './string.js';
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Core Python operations for TypeScript
|
|
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
|
+
* len, range, enumerate, sorted, min, max, etc.
|
|
69
|
+
*/
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* Python range() function
|
|
73
|
+
*/
|
|
74
|
+
declare function range$1(startOrStop: number, stop?: number, step?: number): Iterable<number>;
|
|
75
|
+
/**
|
|
76
|
+
* Python enumerate() function
|
|
77
|
+
*/
|
|
78
|
+
declare function enumerate$1<T>(iterable: Iterable<T>, start?: number): Iterable<[number, T]>;
|
|
79
|
+
/**
|
|
80
|
+
* Python zip() function
|
|
81
|
+
*/
|
|
82
|
+
declare function zip$1<T extends unknown[][]>(...iterables: {
|
|
83
|
+
[K in keyof T]: Iterable<T[K]>;
|
|
84
|
+
}): Iterable<T>;
|
|
85
|
+
/**
|
|
86
|
+
* Safe iteration helper for for-in loops
|
|
87
|
+
*/
|
|
88
|
+
declare function iter$1<T>(obj: Iterable<T> | Record<string, unknown> | null | undefined): Iterable<T> | string[];
|
|
89
|
+
/**
|
|
90
|
+
* Python reversed() function
|
|
91
|
+
*/
|
|
92
|
+
declare function reversed$1<T>(iterable: Iterable<T>): Iterable<T>;
|
|
93
|
+
/**
|
|
94
|
+
* Python sorted() function
|
|
95
|
+
*/
|
|
96
|
+
declare function sorted$1<T>(iterable: Iterable<T>, options?: {
|
|
97
|
+
key?: (x: T) => unknown;
|
|
98
|
+
reverse?: boolean;
|
|
99
|
+
}): T[];
|
|
100
|
+
/**
|
|
101
|
+
* Python map() function
|
|
102
|
+
*/
|
|
103
|
+
declare function map$1<T, U>(fn: (x: T) => U, iterable: Iterable<T>): Iterable<U>;
|
|
104
|
+
/**
|
|
105
|
+
* Python filter() function
|
|
106
|
+
*/
|
|
107
|
+
declare function filter$1<T>(fn: ((x: T) => boolean) | null, iterable: Iterable<T>): Iterable<T>;
|
|
108
|
+
/**
|
|
109
|
+
* Create a tuple (readonly array)
|
|
110
|
+
*/
|
|
111
|
+
declare function tuple$1<T extends unknown[]>(...items: T): Readonly<T>;
|
|
112
|
+
/**
|
|
113
|
+
* Python len() function
|
|
114
|
+
*/
|
|
115
|
+
declare function len$1(obj: string | unknown[] | Map<unknown, unknown> | Set<unknown> | {
|
|
116
|
+
length: number;
|
|
117
|
+
}): number;
|
|
118
|
+
/**
|
|
119
|
+
* Python abs() function
|
|
120
|
+
*/
|
|
121
|
+
declare function abs$1(x: number): number;
|
|
122
|
+
/**
|
|
123
|
+
* Python min() function
|
|
124
|
+
*/
|
|
125
|
+
declare function min$1<T>(...args: T[] | [Iterable<T>]): T;
|
|
126
|
+
/**
|
|
127
|
+
* Python max() function
|
|
128
|
+
*/
|
|
129
|
+
declare function max$1<T>(...args: T[] | [Iterable<T>]): T;
|
|
130
|
+
/**
|
|
131
|
+
* Python sum() function
|
|
132
|
+
*/
|
|
133
|
+
declare function sum$1(iterable: Iterable<number>, start?: number): number;
|
|
134
|
+
/**
|
|
135
|
+
* Python all() function
|
|
136
|
+
*/
|
|
137
|
+
declare function all$1(iterable: Iterable<unknown>): boolean;
|
|
138
|
+
/**
|
|
139
|
+
* Python any() function
|
|
140
|
+
*/
|
|
141
|
+
declare function any$1(iterable: Iterable<unknown>): boolean;
|
|
142
|
+
/**
|
|
143
|
+
* Python round() function
|
|
144
|
+
*/
|
|
145
|
+
declare function round$1(number: number, ndigits?: number): number;
|
|
146
|
+
/**
|
|
147
|
+
* Python ord()
|
|
148
|
+
*/
|
|
149
|
+
declare function ord$1(char: string): number;
|
|
150
|
+
/**
|
|
151
|
+
* Python chr()
|
|
152
|
+
*/
|
|
153
|
+
declare function chr$1(code: number): string;
|
|
154
|
+
/**
|
|
155
|
+
* Python hex()
|
|
156
|
+
*/
|
|
157
|
+
declare function hex$1(x: number): string;
|
|
158
|
+
/**
|
|
159
|
+
* Python oct()
|
|
160
|
+
*/
|
|
161
|
+
declare function oct$1(x: number): string;
|
|
162
|
+
/**
|
|
163
|
+
* Python bin()
|
|
164
|
+
*/
|
|
165
|
+
declare function bin$1(x: number): string;
|
|
166
|
+
/**
|
|
167
|
+
* Python int() function
|
|
168
|
+
*/
|
|
169
|
+
declare function int$1(x: string | number | boolean, base?: number): number;
|
|
170
|
+
/**
|
|
171
|
+
* Python float() function
|
|
172
|
+
*/
|
|
173
|
+
declare function float$1(x: string | number): number;
|
|
174
|
+
/**
|
|
175
|
+
* Python str() function
|
|
176
|
+
*/
|
|
177
|
+
declare function str$1(x: unknown): string;
|
|
178
|
+
/**
|
|
179
|
+
* Python repr() function
|
|
180
|
+
*/
|
|
181
|
+
declare function repr$1(x: unknown): string;
|
|
182
|
+
/**
|
|
183
|
+
* Python bool() function
|
|
184
|
+
*/
|
|
185
|
+
declare function bool$1(x: unknown): boolean;
|
|
186
|
+
/**
|
|
187
|
+
* Python ascii() - returns ASCII representation
|
|
188
|
+
*/
|
|
189
|
+
declare function ascii$1(x: unknown): string;
|
|
190
|
+
/**
|
|
191
|
+
* Python isinstance() - simplified version
|
|
192
|
+
*/
|
|
193
|
+
declare function isinstance$1(obj: unknown, classInfo: unknown): boolean;
|
|
194
|
+
/**
|
|
195
|
+
* Python type() - simplified version
|
|
196
|
+
*/
|
|
197
|
+
declare function type$1(obj: unknown): string;
|
|
198
|
+
/**
|
|
199
|
+
* Python input() - for Node.js
|
|
200
|
+
*/
|
|
201
|
+
declare function input$1(prompt?: string): string;
|
|
202
|
+
/**
|
|
203
|
+
* Python format() - formats a value according to format spec
|
|
204
|
+
*/
|
|
205
|
+
declare function format$1(value: unknown, spec: string): string;
|
|
206
|
+
|
|
207
|
+
/**
|
|
208
|
+
* Python list methods for TypeScript
|
|
209
|
+
* Usage: py.list.remove(), py.list.sort(), etc.
|
|
210
|
+
*/
|
|
211
|
+
declare const list$1: {
|
|
212
|
+
/**
|
|
213
|
+
* Python list.append() - modifies array in place
|
|
214
|
+
*/
|
|
215
|
+
append<T>(arr: T[], item: T): void;
|
|
216
|
+
/**
|
|
217
|
+
* Python list.extend() - modifies array in place
|
|
218
|
+
*/
|
|
219
|
+
extend<T>(arr: T[], items: Iterable<T>): void;
|
|
220
|
+
/**
|
|
221
|
+
* Python list.insert() - modifies array in place
|
|
222
|
+
*/
|
|
223
|
+
insert<T>(arr: T[], index: number, item: T): void;
|
|
224
|
+
/**
|
|
225
|
+
* Python list.remove() - removes first occurrence, modifies in place
|
|
226
|
+
*/
|
|
227
|
+
remove<T>(arr: T[], value: T): void;
|
|
228
|
+
/**
|
|
229
|
+
* Python list.pop() - removes and returns item at index
|
|
230
|
+
*/
|
|
231
|
+
pop<T>(arr: T[], index?: number): T;
|
|
232
|
+
/**
|
|
233
|
+
* Python list.clear() - removes all items
|
|
234
|
+
*/
|
|
235
|
+
clear(arr: unknown[]): void;
|
|
236
|
+
/**
|
|
237
|
+
* Python list.index() - finds first occurrence
|
|
238
|
+
*/
|
|
239
|
+
index<T>(arr: T[], value: T, start?: number, end?: number): number;
|
|
240
|
+
/**
|
|
241
|
+
* Python list.count() - counts occurrences
|
|
242
|
+
*/
|
|
243
|
+
count<T>(arr: T[], value: T): number;
|
|
244
|
+
/**
|
|
245
|
+
* Python list.sort() with key function - modifies in place
|
|
246
|
+
*/
|
|
247
|
+
sort<T>(arr: T[], options?: {
|
|
248
|
+
key?: (x: T) => unknown;
|
|
249
|
+
reverse?: boolean;
|
|
250
|
+
}): void;
|
|
251
|
+
/**
|
|
252
|
+
* Python list.reverse() - reverses in place
|
|
253
|
+
*/
|
|
254
|
+
reverse(arr: unknown[]): void;
|
|
255
|
+
/**
|
|
256
|
+
* Python list.copy() - shallow copy
|
|
257
|
+
*/
|
|
258
|
+
copy<T>(arr: T[]): T[];
|
|
259
|
+
/**
|
|
260
|
+
* Python slice assignment: arr[start:end:step] = values
|
|
261
|
+
* Replaces a slice of the array with new values, modifying in place
|
|
262
|
+
*/
|
|
263
|
+
sliceAssign<T>(arr: T[], start: number | undefined, end: number | undefined, step: number | undefined, values: T[]): void;
|
|
264
|
+
};
|
|
265
|
+
|
|
266
|
+
/**
|
|
267
|
+
* Python dict methods for TypeScript
|
|
268
|
+
* Usage: py.dict.get(), py.dict.keys(), etc.
|
|
269
|
+
*/
|
|
270
|
+
declare const dict$1: {
|
|
271
|
+
/**
|
|
272
|
+
* Python dict.get() - get value with optional default
|
|
273
|
+
*/
|
|
274
|
+
get<K extends string | number | symbol, V>(obj: Record<K, V>, key: K, defaultValue?: V): V | undefined;
|
|
275
|
+
/**
|
|
276
|
+
* Python dict.setdefault() - get value or set default
|
|
277
|
+
*/
|
|
278
|
+
setdefault<K extends string | number | symbol, V>(obj: Record<K, V>, key: K, defaultValue: V): V;
|
|
279
|
+
/**
|
|
280
|
+
* Python dict.pop() - remove and return value
|
|
281
|
+
*/
|
|
282
|
+
pop<K extends string | number | symbol, V>(obj: Record<K, V>, key: K, defaultValue?: V): V | undefined;
|
|
283
|
+
/**
|
|
284
|
+
* Python dict.popitem() - remove and return last item
|
|
285
|
+
*/
|
|
286
|
+
popitem<K extends string | number | symbol, V>(obj: Record<K, V>): [K, V];
|
|
287
|
+
/**
|
|
288
|
+
* Python dict.update() - update with another dict
|
|
289
|
+
*/
|
|
290
|
+
update<K extends string | number | symbol, V>(obj: Record<K, V>, other: Record<K, V> | Iterable<[K, V]>): void;
|
|
291
|
+
/**
|
|
292
|
+
* Python dict.clear() - remove all items
|
|
293
|
+
*/
|
|
294
|
+
clear<K extends string | number | symbol, V>(obj: Record<K, V>): void;
|
|
295
|
+
/**
|
|
296
|
+
* Python dict.copy() - shallow copy
|
|
297
|
+
*/
|
|
298
|
+
copy<K extends string | number | symbol, V>(obj: Record<K, V>): Record<K, V>;
|
|
299
|
+
/**
|
|
300
|
+
* Python dict.keys() - returns iterable of keys
|
|
301
|
+
*/
|
|
302
|
+
keys<K extends string | number | symbol, V>(obj: Record<K, V>): K[];
|
|
303
|
+
/**
|
|
304
|
+
* Python dict.values() - returns iterable of values
|
|
305
|
+
*/
|
|
306
|
+
values<K extends string | number | symbol, V>(obj: Record<K, V>): V[];
|
|
307
|
+
/**
|
|
308
|
+
* Python dict.items() - returns iterable of [key, value] pairs
|
|
309
|
+
*/
|
|
310
|
+
items<K extends string | number | symbol, V>(obj: Record<K, V>): [K, V][];
|
|
311
|
+
/**
|
|
312
|
+
* Python dict.fromkeys() - create dict from keys
|
|
313
|
+
*/
|
|
314
|
+
fromkeys<K extends string | number | symbol, V>(keys: K[], value?: V): Record<K, V | undefined>;
|
|
315
|
+
};
|
|
316
|
+
|
|
317
|
+
/**
|
|
318
|
+
* Python set methods for TypeScript
|
|
319
|
+
* Usage: py.set.intersection(), py.set.union(), etc.
|
|
320
|
+
*/
|
|
321
|
+
declare const set$1: {
|
|
322
|
+
/**
|
|
323
|
+
* Python set.add() - add element
|
|
324
|
+
*/
|
|
325
|
+
add<T>(s: Set<T>, item: T): void;
|
|
326
|
+
/**
|
|
327
|
+
* Python set.remove() - remove element, raises error if not found
|
|
328
|
+
*/
|
|
329
|
+
remove<T>(s: Set<T>, item: T): void;
|
|
330
|
+
/**
|
|
331
|
+
* Python set.discard() - remove element if present
|
|
332
|
+
*/
|
|
333
|
+
discard<T>(s: Set<T>, item: T): void;
|
|
334
|
+
/**
|
|
335
|
+
* Python set.pop() - remove and return arbitrary element
|
|
336
|
+
*/
|
|
337
|
+
pop<T>(s: Set<T>): T;
|
|
338
|
+
/**
|
|
339
|
+
* Python set.clear() - remove all elements
|
|
340
|
+
*/
|
|
341
|
+
clear<T>(s: Set<T>): void;
|
|
342
|
+
/**
|
|
343
|
+
* Python set.copy() - shallow copy
|
|
344
|
+
*/
|
|
345
|
+
copy<T>(s: Set<T>): Set<T>;
|
|
346
|
+
/**
|
|
347
|
+
* Python set.update() - add elements from iterable
|
|
348
|
+
*/
|
|
349
|
+
update<T>(s: Set<T>, ...iterables: Iterable<T>[]): void;
|
|
350
|
+
/**
|
|
351
|
+
* Python set.union() - returns new set with all elements
|
|
352
|
+
*/
|
|
353
|
+
union<T>(a: Set<T>, ...others: Iterable<T>[]): Set<T>;
|
|
354
|
+
/**
|
|
355
|
+
* Python set.intersection() - returns new set with common elements
|
|
356
|
+
*/
|
|
357
|
+
intersection<T>(a: Set<T>, b: Set<T>): Set<T>;
|
|
358
|
+
/**
|
|
359
|
+
* Python set.intersection_update() - keep only common elements
|
|
360
|
+
*/
|
|
361
|
+
intersectionUpdate<T>(a: Set<T>, b: Set<T>): void;
|
|
362
|
+
/**
|
|
363
|
+
* Python set.difference() - returns new set with elements in a but not in b
|
|
364
|
+
*/
|
|
365
|
+
difference<T>(a: Set<T>, b: Set<T>): Set<T>;
|
|
366
|
+
/**
|
|
367
|
+
* Python set.difference_update() - remove elements found in b
|
|
368
|
+
*/
|
|
369
|
+
differenceUpdate<T>(a: Set<T>, b: Set<T>): void;
|
|
370
|
+
/**
|
|
371
|
+
* Python set.symmetric_difference() - returns new set with elements in either but not both
|
|
372
|
+
*/
|
|
373
|
+
symmetricDifference<T>(a: Set<T>, b: Set<T>): Set<T>;
|
|
374
|
+
/**
|
|
375
|
+
* Python set.symmetric_difference_update() - update with symmetric difference
|
|
376
|
+
*/
|
|
377
|
+
symmetricDifferenceUpdate<T>(a: Set<T>, b: Set<T>): void;
|
|
378
|
+
/**
|
|
379
|
+
* Python set.issubset() - test if all elements are in other
|
|
380
|
+
*/
|
|
381
|
+
issubset<T>(a: Set<T>, b: Set<T>): boolean;
|
|
382
|
+
/**
|
|
383
|
+
* Python set.issuperset() - test if all other elements are in this set
|
|
384
|
+
*/
|
|
385
|
+
issuperset<T>(a: Set<T>, b: Set<T>): boolean;
|
|
386
|
+
/**
|
|
387
|
+
* Python set.isdisjoint() - test if no common elements
|
|
388
|
+
*/
|
|
389
|
+
isdisjoint<T>(a: Set<T>, b: Set<T>): boolean;
|
|
390
|
+
};
|
|
391
|
+
|
|
392
|
+
/**
|
|
393
|
+
* Python Runtime Library for TypeScript
|
|
394
|
+
*
|
|
395
|
+
* Import styles:
|
|
396
|
+
*
|
|
397
|
+
* 1. Builtins (global Python functions):
|
|
398
|
+
* import { len, range, sorted, min, max } from "pythonlib"
|
|
399
|
+
*
|
|
400
|
+
* 2. Module imports (like Python):
|
|
401
|
+
* import { dump, loads } from "pythonlib/json"
|
|
402
|
+
* import { match, search, sub } from "pythonlib/re"
|
|
403
|
+
* import { chain, combinations } from "pythonlib/itertools"
|
|
404
|
+
* import { Counter, defaultdict } from "pythonlib/collections"
|
|
405
|
+
*
|
|
406
|
+
* 3. Module namespaces (alternative):
|
|
407
|
+
* import { json, re, itertools } from "pythonlib"
|
|
408
|
+
* json.dump(...), re.match(...), itertools.chain(...)
|
|
409
|
+
*/
|
|
410
|
+
|
|
411
|
+
declare const itertools: typeof itertoolsModule;
|
|
412
|
+
declare const functools: typeof functoolsModule;
|
|
413
|
+
declare const collections: typeof collectionsModule;
|
|
414
|
+
declare const math: typeof mathModule;
|
|
415
|
+
declare const random: typeof randomModule;
|
|
416
|
+
declare const json: typeof jsonModule;
|
|
417
|
+
declare const os: typeof osModule;
|
|
418
|
+
declare const datetime: typeof datetimeModule;
|
|
419
|
+
declare const re: typeof reModule;
|
|
420
|
+
declare const string: {
|
|
421
|
+
ascii_lowercase: string;
|
|
422
|
+
ascii_uppercase: string;
|
|
423
|
+
ascii_letters: string;
|
|
424
|
+
digits: string;
|
|
425
|
+
hexdigits: string;
|
|
426
|
+
octdigits: string;
|
|
427
|
+
punctuation: string;
|
|
428
|
+
whitespace: string;
|
|
429
|
+
printable: string;
|
|
430
|
+
capwords: typeof capwords;
|
|
431
|
+
Template: typeof Template;
|
|
432
|
+
join(sep: string, iterable: Iterable<string>): string;
|
|
433
|
+
split(s: string, sep?: string, maxsplit?: number): string[];
|
|
434
|
+
rsplit(s: string, sep?: string, maxsplit?: number): string[];
|
|
435
|
+
strip(s: string, chars?: string): string;
|
|
436
|
+
lstrip(s: string, chars?: string): string;
|
|
437
|
+
rstrip(s: string, chars?: string): string;
|
|
438
|
+
upper(s: string): string;
|
|
439
|
+
lower(s: string): string;
|
|
440
|
+
capitalize(s: string): string;
|
|
441
|
+
title(s: string): string;
|
|
442
|
+
swapcase(s: string): string;
|
|
443
|
+
startswith(s: string, prefix: string, start?: number, end?: number): boolean;
|
|
444
|
+
endswith(s: string, suffix: string, start?: number, end?: number): boolean;
|
|
445
|
+
find(s: string, sub: string, start?: number, end?: number): number;
|
|
446
|
+
rfind(s: string, sub: string, start?: number, end?: number): number;
|
|
447
|
+
index(s: string, sub: string, start?: number, end?: number): number;
|
|
448
|
+
rindex(s: string, sub: string, start?: number, end?: number): number;
|
|
449
|
+
count(s: string, sub: string, start?: number, end?: number): number;
|
|
450
|
+
replace(s: string, old: string, newStr: string, count?: number): string;
|
|
451
|
+
zfill(s: string, width: number): string;
|
|
452
|
+
center(s: string, width: number, fillchar?: string): string;
|
|
453
|
+
ljust(s: string, width: number, fillchar?: string): string;
|
|
454
|
+
rjust(s: string, width: number, fillchar?: string): string;
|
|
455
|
+
partition(s: string, sep: string): [string, string, string];
|
|
456
|
+
rpartition(s: string, sep: string): [string, string, string];
|
|
457
|
+
isalpha(s: string): boolean;
|
|
458
|
+
isdigit(s: string): boolean;
|
|
459
|
+
isalnum(s: string): boolean;
|
|
460
|
+
isspace(s: string): boolean;
|
|
461
|
+
isupper(s: string): boolean;
|
|
462
|
+
islower(s: string): boolean;
|
|
463
|
+
format(s: string, ...args: unknown[]): string;
|
|
464
|
+
};
|
|
465
|
+
type ListConstructor = {
|
|
466
|
+
<T>(iterable?: Iterable<T>): T[];
|
|
467
|
+
} & typeof list$1;
|
|
468
|
+
type DictConstructor = {
|
|
469
|
+
<K, V>(entries?: Iterable<[K, V]>): Map<K, V>;
|
|
470
|
+
} & typeof dict$1;
|
|
471
|
+
type SetConstructor = {
|
|
472
|
+
<T>(iterable?: Iterable<T>): Set<T>;
|
|
473
|
+
} & typeof set$1;
|
|
474
|
+
declare const list: ListConstructor;
|
|
475
|
+
declare const dict: DictConstructor;
|
|
476
|
+
declare const set: SetConstructor;
|
|
477
|
+
declare const floordiv: typeof floordiv$1;
|
|
478
|
+
declare const mod: typeof mod$1;
|
|
479
|
+
declare const divmod: typeof divmod$1;
|
|
480
|
+
declare const sprintf: typeof sprintf$1;
|
|
481
|
+
declare const strFormat: typeof strFormat$1;
|
|
482
|
+
declare const slice: typeof slice$1;
|
|
483
|
+
declare const at: typeof at$1;
|
|
484
|
+
declare const contains: typeof contains$1;
|
|
485
|
+
declare const is: typeof is$1;
|
|
486
|
+
|
|
487
|
+
declare const range: typeof range$1;
|
|
488
|
+
declare const enumerate: typeof enumerate$1;
|
|
489
|
+
declare const zip: typeof zip$1;
|
|
490
|
+
declare const iter: typeof iter$1;
|
|
491
|
+
declare const reversed: typeof reversed$1;
|
|
492
|
+
declare const sorted: typeof sorted$1;
|
|
493
|
+
declare const map: typeof map$1;
|
|
494
|
+
declare const filter: typeof filter$1;
|
|
495
|
+
declare const tuple: typeof tuple$1;
|
|
496
|
+
declare const len: typeof len$1;
|
|
497
|
+
declare const abs: typeof abs$1;
|
|
498
|
+
declare const min: typeof min$1;
|
|
499
|
+
declare const max: typeof max$1;
|
|
500
|
+
declare const sum: typeof sum$1;
|
|
501
|
+
declare const all: typeof all$1;
|
|
502
|
+
declare const any: typeof any$1;
|
|
503
|
+
declare const round: typeof round$1;
|
|
504
|
+
declare const ord: typeof ord$1;
|
|
505
|
+
declare const chr: typeof chr$1;
|
|
506
|
+
declare const hex: typeof hex$1;
|
|
507
|
+
declare const oct: typeof oct$1;
|
|
508
|
+
declare const bin: typeof bin$1;
|
|
509
|
+
declare const int: typeof int$1;
|
|
510
|
+
declare const float: typeof float$1;
|
|
511
|
+
declare const str: typeof str$1;
|
|
512
|
+
declare const repr: typeof repr$1;
|
|
513
|
+
declare const bool: typeof bool$1;
|
|
514
|
+
declare const ascii: typeof ascii$1;
|
|
515
|
+
declare const isinstance: typeof isinstance$1;
|
|
516
|
+
declare const type: typeof type$1;
|
|
517
|
+
declare const input: typeof input$1;
|
|
518
|
+
declare const format: typeof format$1;
|
|
519
|
+
declare const py: {
|
|
520
|
+
string: {
|
|
521
|
+
join(sep: string, iterable: Iterable<string>): string;
|
|
522
|
+
split(s: string, sep?: string, maxsplit?: number): string[];
|
|
523
|
+
rsplit(s: string, sep?: string, maxsplit?: number): string[];
|
|
524
|
+
strip(s: string, chars?: string): string;
|
|
525
|
+
lstrip(s: string, chars?: string): string;
|
|
526
|
+
rstrip(s: string, chars?: string): string;
|
|
527
|
+
upper(s: string): string;
|
|
528
|
+
lower(s: string): string;
|
|
529
|
+
capitalize(s: string): string;
|
|
530
|
+
title(s: string): string;
|
|
531
|
+
swapcase(s: string): string;
|
|
532
|
+
startswith(s: string, prefix: string, start?: number, end?: number): boolean;
|
|
533
|
+
endswith(s: string, suffix: string, start?: number, end?: number): boolean;
|
|
534
|
+
find(s: string, sub: string, start?: number, end?: number): number;
|
|
535
|
+
rfind(s: string, sub: string, start?: number, end?: number): number;
|
|
536
|
+
index(s: string, sub: string, start?: number, end?: number): number;
|
|
537
|
+
rindex(s: string, sub: string, start?: number, end?: number): number;
|
|
538
|
+
count(s: string, sub: string, start?: number, end?: number): number;
|
|
539
|
+
replace(s: string, old: string, newStr: string, count?: number): string;
|
|
540
|
+
zfill(s: string, width: number): string;
|
|
541
|
+
center(s: string, width: number, fillchar?: string): string;
|
|
542
|
+
ljust(s: string, width: number, fillchar?: string): string;
|
|
543
|
+
rjust(s: string, width: number, fillchar?: string): string;
|
|
544
|
+
partition(s: string, sep: string): [string, string, string];
|
|
545
|
+
rpartition(s: string, sep: string): [string, string, string];
|
|
546
|
+
isalpha(s: string): boolean;
|
|
547
|
+
isdigit(s: string): boolean;
|
|
548
|
+
isalnum(s: string): boolean;
|
|
549
|
+
isspace(s: string): boolean;
|
|
550
|
+
isupper(s: string): boolean;
|
|
551
|
+
islower(s: string): boolean;
|
|
552
|
+
format(s: string, ...args: unknown[]): string;
|
|
553
|
+
};
|
|
554
|
+
list: ListConstructor;
|
|
555
|
+
dict: DictConstructor;
|
|
556
|
+
set: SetConstructor;
|
|
557
|
+
floordiv: typeof floordiv$1;
|
|
558
|
+
pow: typeof pow;
|
|
559
|
+
mod: typeof mod$1;
|
|
560
|
+
divmod: typeof divmod$1;
|
|
561
|
+
sprintf: typeof sprintf$1;
|
|
562
|
+
strFormat: typeof strFormat$1;
|
|
563
|
+
slice: typeof slice$1;
|
|
564
|
+
at: typeof at$1;
|
|
565
|
+
repeat: typeof repeat;
|
|
566
|
+
in: typeof contains$1;
|
|
567
|
+
is: typeof is$1;
|
|
568
|
+
range: typeof range$1;
|
|
569
|
+
enumerate: typeof enumerate$1;
|
|
570
|
+
zip: typeof zip$1;
|
|
571
|
+
iter: typeof iter$1;
|
|
572
|
+
reversed: typeof reversed$1;
|
|
573
|
+
sorted: typeof sorted$1;
|
|
574
|
+
map: typeof map$1;
|
|
575
|
+
filter: typeof filter$1;
|
|
576
|
+
tuple: typeof tuple$1;
|
|
577
|
+
len: typeof len$1;
|
|
578
|
+
abs: typeof abs$1;
|
|
579
|
+
min: typeof min$1;
|
|
580
|
+
max: typeof max$1;
|
|
581
|
+
sum: typeof sum$1;
|
|
582
|
+
all: typeof all$1;
|
|
583
|
+
any: typeof any$1;
|
|
584
|
+
round: typeof round$1;
|
|
585
|
+
ord: typeof ord$1;
|
|
586
|
+
chr: typeof chr$1;
|
|
587
|
+
hex: typeof hex$1;
|
|
588
|
+
oct: typeof oct$1;
|
|
589
|
+
bin: typeof bin$1;
|
|
590
|
+
int: typeof int$1;
|
|
591
|
+
float: typeof float$1;
|
|
592
|
+
str: typeof str$1;
|
|
593
|
+
repr: typeof repr$1;
|
|
594
|
+
bool: typeof bool$1;
|
|
595
|
+
ascii: typeof ascii$1;
|
|
596
|
+
isinstance: typeof isinstance$1;
|
|
597
|
+
type: typeof type$1;
|
|
598
|
+
input: typeof input$1;
|
|
599
|
+
format: typeof format$1;
|
|
600
|
+
itertools: typeof itertoolsModule;
|
|
601
|
+
functools: typeof functoolsModule;
|
|
602
|
+
math: typeof mathModule;
|
|
603
|
+
random: typeof randomModule;
|
|
604
|
+
json: typeof jsonModule;
|
|
605
|
+
os: typeof osModule;
|
|
606
|
+
datetime: typeof datetimeModule;
|
|
607
|
+
re: typeof reModule;
|
|
608
|
+
Counter: typeof Counter;
|
|
609
|
+
defaultdict: typeof defaultdict;
|
|
610
|
+
deque: typeof deque;
|
|
611
|
+
Template: typeof Template;
|
|
612
|
+
ascii_lowercase: string;
|
|
613
|
+
ascii_uppercase: string;
|
|
614
|
+
ascii_letters: string;
|
|
615
|
+
digits: string;
|
|
616
|
+
hexdigits: string;
|
|
617
|
+
octdigits: string;
|
|
618
|
+
punctuation: string;
|
|
619
|
+
whitespace: string;
|
|
620
|
+
printable: string;
|
|
621
|
+
capwords: typeof capwords;
|
|
622
|
+
};
|
|
623
|
+
|
|
624
|
+
export { abs, all, any, ascii, at, bin, bool, chr, collections, contains, datetime, py as default, dict, divmod, enumerate, filter, float, floordiv, format, functools, hex, input, int, is, isinstance, iter, itertools, json, len, list, map, math, max, min, mod, oct, ord, os, pow, py, random, range, re, repeat as repeatValue, repr, reversed, round, set, slice, sorted, sprintf, str, strFormat, string, sum, tuple, type, zip };
|