pythonlib 0.1.0 → 0.2.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 +41 -138
- package/dist/{chunk-3CSEXTA7.js → chunk-4QG3772L.js} +53 -53
- package/dist/chunk-4QG3772L.js.map +1 -0
- package/dist/{chunk-OMQNGE6T.js → chunk-4SZT4HJI.js} +32 -27
- package/dist/chunk-4SZT4HJI.js.map +1 -0
- package/dist/{chunk-IVYYI2VR.js → chunk-6POEDI34.js} +1 -1
- package/dist/chunk-6POEDI34.js.map +1 -0
- package/dist/{chunk-P3SGIF72.js → chunk-6VQ7ITWO.js} +6 -6
- package/dist/chunk-6VQ7ITWO.js.map +1 -0
- package/dist/{chunk-V63LKSA3.js → chunk-7TH4FCVQ.js} +24 -24
- package/dist/chunk-7TH4FCVQ.js.map +1 -0
- package/dist/{chunk-TJFGYXBJ.js → chunk-BDBX5BG4.js} +63 -61
- package/dist/chunk-BDBX5BG4.js.map +1 -0
- package/dist/{chunk-WAONBJE5.js → chunk-H76SKASU.js} +36 -36
- package/dist/chunk-H76SKASU.js.map +1 -0
- package/dist/{chunk-TOI6IG3T.js → chunk-HQ42WNKZ.js} +43 -16
- package/dist/chunk-HQ42WNKZ.js.map +1 -0
- package/dist/{chunk-HA5Y7PKO.js → chunk-KRRY534Q.js} +36 -35
- package/dist/chunk-KRRY534Q.js.map +1 -0
- package/dist/{chunk-UFMTN4T4.js → chunk-XGT3VOIZ.js} +5 -5
- package/dist/chunk-XGT3VOIZ.js.map +1 -0
- package/dist/{collections-xN9Gi0TA.d.ts → collections-CJur5Wg-.d.ts} +5 -3
- package/dist/collections.d.ts +1 -1
- package/dist/collections.js +1 -1
- package/dist/{datetime-DRwFAiGV.d.ts → datetime-Bpce8gG2.d.ts} +17 -15
- package/dist/datetime.d.ts +1 -1
- package/dist/datetime.js +1 -1
- package/dist/{functools-St5GqpKG.d.ts → functools-NrsZAqJk.d.ts} +42 -26
- package/dist/functools.d.ts +1 -1
- package/dist/functools.js +19 -17
- package/dist/index.d.ts +56 -158
- package/dist/index.js +45 -137
- package/dist/index.js.map +1 -1
- package/dist/{itertools-Bj8XivI6.d.ts → itertools-Sjl1LB_0.d.ts} +35 -17
- package/dist/itertools.d.ts +1 -1
- package/dist/itertools.js +15 -11
- package/dist/{json-Xpk0kwSd.d.ts → json-DAlvCadU.d.ts} +7 -5
- package/dist/json.d.ts +1 -1
- package/dist/json.js +1 -1
- package/dist/{math-BrT4Aw3E.d.ts → math-DwEGjjQ-.d.ts} +2 -0
- package/dist/math.d.ts +1 -1
- package/dist/math.js +1 -1
- package/dist/{os-FRSJbEUH.d.ts → os-C6Nt7Ijx.d.ts} +45 -42
- package/dist/os.d.ts +1 -1
- package/dist/os.js +23 -23
- package/dist/{random-D5S5iSV3.d.ts → random-BJv_rSpL.d.ts} +24 -22
- package/dist/random.d.ts +1 -1
- package/dist/random.js +21 -21
- package/dist/{re-DSxiURqN.d.ts → re-B1CHCgyr.d.ts} +17 -15
- package/dist/re.d.ts +1 -1
- package/dist/re.js +7 -7
- package/dist/string.d.ts +51 -48
- package/dist/string.js +13 -13
- package/package.json +20 -3
- package/dist/chunk-3CSEXTA7.js.map +0 -1
- package/dist/chunk-HA5Y7PKO.js.map +0 -1
- package/dist/chunk-IVYYI2VR.js.map +0 -1
- package/dist/chunk-OMQNGE6T.js.map +0 -1
- package/dist/chunk-P3SGIF72.js.map +0 -1
- package/dist/chunk-TJFGYXBJ.js.map +0 -1
- package/dist/chunk-TOI6IG3T.js.map +0 -1
- package/dist/chunk-UFMTN4T4.js.map +0 -1
- package/dist/chunk-V63LKSA3.js.map +0 -1
- package/dist/chunk-WAONBJE5.js.map +0 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { i as itertoolsModule } from './itertools-
|
|
2
|
-
import { f as functoolsModule } from './functools-
|
|
3
|
-
import {
|
|
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-
|
|
10
|
-
import {
|
|
1
|
+
import { i as itertoolsModule } from './itertools-Sjl1LB_0.js';
|
|
2
|
+
import { f as functoolsModule } from './functools-NrsZAqJk.js';
|
|
3
|
+
import { c as collectionsModule } from './collections-CJur5Wg-.js';
|
|
4
|
+
import { m as mathModule } from './math-DwEGjjQ-.js';
|
|
5
|
+
import { r as randomModule } from './random-BJv_rSpL.js';
|
|
6
|
+
import { j as jsonModule } from './json-DAlvCadU.js';
|
|
7
|
+
import { o as osModule } from './os-C6Nt7Ijx.js';
|
|
8
|
+
import { d as datetimeModule } from './datetime-Bpce8gG2.js';
|
|
9
|
+
import { r as reModule } from './re-B1CHCgyr.js';
|
|
10
|
+
import { capWords, Template } from './string.js';
|
|
11
11
|
|
|
12
12
|
/**
|
|
13
13
|
* Core Python operations for TypeScript
|
|
@@ -17,7 +17,7 @@ import { Template, capwords } from './string.js';
|
|
|
17
17
|
* Floor division (Python //)
|
|
18
18
|
* Always rounds towards negative infinity, unlike Math.floor for negatives
|
|
19
19
|
*/
|
|
20
|
-
declare function
|
|
20
|
+
declare function floorDiv$1(a: number, b: number): number;
|
|
21
21
|
/**
|
|
22
22
|
* Power operator (Python **)
|
|
23
23
|
*/
|
|
@@ -28,9 +28,9 @@ declare function pow(base: number, exp: number): number;
|
|
|
28
28
|
*/
|
|
29
29
|
declare function mod$1(a: number, b: number): number;
|
|
30
30
|
/**
|
|
31
|
-
* Python
|
|
31
|
+
* Python divMod()
|
|
32
32
|
*/
|
|
33
|
-
declare function
|
|
33
|
+
declare function divMod$1(a: number, b: number): [number, number];
|
|
34
34
|
/**
|
|
35
35
|
* Python %-style string formatting
|
|
36
36
|
* Handles %s, %d, %i, %f, %r, %x, %o, etc.
|
|
@@ -65,9 +65,11 @@ declare function is$1(a: unknown, b: unknown): boolean;
|
|
|
65
65
|
|
|
66
66
|
/**
|
|
67
67
|
* Python built-in functions for TypeScript
|
|
68
|
-
*
|
|
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}
|
|
69
72
|
*/
|
|
70
|
-
|
|
71
73
|
/**
|
|
72
74
|
* Python range() function
|
|
73
75
|
*/
|
|
@@ -273,17 +275,17 @@ declare const dict$1: {
|
|
|
273
275
|
*/
|
|
274
276
|
get<K extends string | number | symbol, V>(obj: Record<K, V>, key: K, defaultValue?: V): V | undefined;
|
|
275
277
|
/**
|
|
276
|
-
* Python dict.
|
|
278
|
+
* Python dict.setDefault() - get value or set default
|
|
277
279
|
*/
|
|
278
|
-
|
|
280
|
+
setDefault<K extends string | number | symbol, V>(obj: Record<K, V>, key: K, defaultValue: V): V;
|
|
279
281
|
/**
|
|
280
282
|
* Python dict.pop() - remove and return value
|
|
281
283
|
*/
|
|
282
284
|
pop<K extends string | number | symbol, V>(obj: Record<K, V>, key: K, defaultValue?: V): V | undefined;
|
|
283
285
|
/**
|
|
284
|
-
* Python dict.
|
|
286
|
+
* Python dict.popItem() - remove and return last item
|
|
285
287
|
*/
|
|
286
|
-
|
|
288
|
+
popItem<K extends string | number | symbol, V>(obj: Record<K, V>): [K, V];
|
|
287
289
|
/**
|
|
288
290
|
* Python dict.update() - update with another dict
|
|
289
291
|
*/
|
|
@@ -309,9 +311,9 @@ declare const dict$1: {
|
|
|
309
311
|
*/
|
|
310
312
|
items<K extends string | number | symbol, V>(obj: Record<K, V>): [K, V][];
|
|
311
313
|
/**
|
|
312
|
-
* Python dict.
|
|
314
|
+
* Python dict.fromKeys() - create dict from keys
|
|
313
315
|
*/
|
|
314
|
-
|
|
316
|
+
fromKeys<K extends string | number | symbol, V>(keys: K[], value?: V): Record<K, V | undefined>;
|
|
315
317
|
};
|
|
316
318
|
|
|
317
319
|
/**
|
|
@@ -376,17 +378,17 @@ declare const set$1: {
|
|
|
376
378
|
*/
|
|
377
379
|
symmetricDifferenceUpdate<T>(a: Set<T>, b: Set<T>): void;
|
|
378
380
|
/**
|
|
379
|
-
* Python set.
|
|
381
|
+
* Python set.isSubset() - test if all elements are in other
|
|
380
382
|
*/
|
|
381
|
-
|
|
383
|
+
isSubset<T>(a: Set<T>, b: Set<T>): boolean;
|
|
382
384
|
/**
|
|
383
|
-
* Python set.
|
|
385
|
+
* Python set.isSuperset() - test if all other elements are in this set
|
|
384
386
|
*/
|
|
385
|
-
|
|
387
|
+
isSuperset<T>(a: Set<T>, b: Set<T>): boolean;
|
|
386
388
|
/**
|
|
387
|
-
* Python set.
|
|
389
|
+
* Python set.isDisjoint() - test if no common elements
|
|
388
390
|
*/
|
|
389
|
-
|
|
391
|
+
isDisjoint<T>(a: Set<T>, b: Set<T>): boolean;
|
|
390
392
|
};
|
|
391
393
|
|
|
392
394
|
/**
|
|
@@ -418,48 +420,48 @@ declare const os: typeof osModule;
|
|
|
418
420
|
declare const datetime: typeof datetimeModule;
|
|
419
421
|
declare const re: typeof reModule;
|
|
420
422
|
declare const string: {
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
423
|
+
asciiLowercase: string;
|
|
424
|
+
asciiUppercase: string;
|
|
425
|
+
asciiLetters: string;
|
|
424
426
|
digits: string;
|
|
425
|
-
|
|
426
|
-
|
|
427
|
+
hexDigits: string;
|
|
428
|
+
octDigits: string;
|
|
427
429
|
punctuation: string;
|
|
428
430
|
whitespace: string;
|
|
429
431
|
printable: string;
|
|
430
|
-
|
|
432
|
+
capWords: typeof capWords;
|
|
431
433
|
Template: typeof Template;
|
|
432
434
|
join(sep: string, iterable: Iterable<string>): string;
|
|
433
435
|
split(s: string, sep?: string, maxsplit?: number): string[];
|
|
434
|
-
|
|
436
|
+
rSplit(s: string, sep?: string, maxsplit?: number): string[];
|
|
435
437
|
strip(s: string, chars?: string): string;
|
|
436
|
-
|
|
437
|
-
|
|
438
|
+
lStrip(s: string, chars?: string): string;
|
|
439
|
+
rStrip(s: string, chars?: string): string;
|
|
438
440
|
upper(s: string): string;
|
|
439
441
|
lower(s: string): string;
|
|
440
442
|
capitalize(s: string): string;
|
|
441
443
|
title(s: string): string;
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
444
|
+
swapCase(s: string): string;
|
|
445
|
+
startsWith(s: string, prefix: string, start?: number, end?: number): boolean;
|
|
446
|
+
endsWith(s: string, suffix: string, start?: number, end?: number): boolean;
|
|
445
447
|
find(s: string, sub: string, start?: number, end?: number): number;
|
|
446
|
-
|
|
448
|
+
rFind(s: string, sub: string, start?: number, end?: number): number;
|
|
447
449
|
index(s: string, sub: string, start?: number, end?: number): number;
|
|
448
|
-
|
|
450
|
+
rIndex(s: string, sub: string, start?: number, end?: number): number;
|
|
449
451
|
count(s: string, sub: string, start?: number, end?: number): number;
|
|
450
452
|
replace(s: string, old: string, newStr: string, count?: number): string;
|
|
451
|
-
|
|
453
|
+
zFill(s: string, width: number): string;
|
|
452
454
|
center(s: string, width: number, fillchar?: string): string;
|
|
453
|
-
|
|
454
|
-
|
|
455
|
+
lJust(s: string, width: number, fillchar?: string): string;
|
|
456
|
+
rJust(s: string, width: number, fillchar?: string): string;
|
|
455
457
|
partition(s: string, sep: string): [string, string, string];
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
458
|
+
rPartition(s: string, sep: string): [string, string, string];
|
|
459
|
+
isAlpha(s: string): boolean;
|
|
460
|
+
isDigit(s: string): boolean;
|
|
461
|
+
isAlnum(s: string): boolean;
|
|
462
|
+
isSpace(s: string): boolean;
|
|
463
|
+
isUpper(s: string): boolean;
|
|
464
|
+
isLower(s: string): boolean;
|
|
463
465
|
format(s: string, ...args: unknown[]): string;
|
|
464
466
|
};
|
|
465
467
|
type ListConstructor = {
|
|
@@ -474,9 +476,9 @@ type SetConstructor = {
|
|
|
474
476
|
declare const list: ListConstructor;
|
|
475
477
|
declare const dict: DictConstructor;
|
|
476
478
|
declare const set: SetConstructor;
|
|
477
|
-
declare const
|
|
479
|
+
declare const floorDiv: typeof floorDiv$1;
|
|
478
480
|
declare const mod: typeof mod$1;
|
|
479
|
-
declare const
|
|
481
|
+
declare const divMod: typeof divMod$1;
|
|
480
482
|
declare const sprintf: typeof sprintf$1;
|
|
481
483
|
declare const strFormat: typeof strFormat$1;
|
|
482
484
|
declare const slice: typeof slice$1;
|
|
@@ -516,109 +518,5 @@ declare const isinstance: typeof isinstance$1;
|
|
|
516
518
|
declare const type: typeof type$1;
|
|
517
519
|
declare const input: typeof input$1;
|
|
518
520
|
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
521
|
|
|
624
|
-
export { abs, all, any, ascii, at, bin, bool, chr, collections, contains, datetime,
|
|
522
|
+
export { abs, all, any, ascii, at, bin, bool, chr, collections, contains, datetime, 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, random, range, re, repeat as repeatValue, repr, reversed, round, set, slice, sorted, sprintf, str, strFormat, string, sum, tuple, type, zip };
|
package/dist/index.js
CHANGED
|
@@ -1,51 +1,48 @@
|
|
|
1
1
|
import {
|
|
2
2
|
random_exports
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-H76SKASU.js";
|
|
4
4
|
import {
|
|
5
5
|
re_exports
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-7TH4FCVQ.js";
|
|
7
7
|
import {
|
|
8
8
|
Template,
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
9
|
+
asciiLetters,
|
|
10
|
+
asciiLowercase,
|
|
11
|
+
asciiUppercase,
|
|
12
|
+
capWords,
|
|
13
13
|
digits,
|
|
14
|
-
|
|
15
|
-
|
|
14
|
+
hexDigits,
|
|
15
|
+
octDigits,
|
|
16
16
|
printable,
|
|
17
17
|
punctuation,
|
|
18
18
|
string,
|
|
19
19
|
whitespace
|
|
20
|
-
} from "./chunk-
|
|
20
|
+
} from "./chunk-4QG3772L.js";
|
|
21
21
|
import {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
defaultdict,
|
|
25
|
-
deque
|
|
26
|
-
} from "./chunk-UFMTN4T4.js";
|
|
22
|
+
collections_exports
|
|
23
|
+
} from "./chunk-XGT3VOIZ.js";
|
|
27
24
|
import {
|
|
28
25
|
datetime_exports
|
|
29
|
-
} from "./chunk-
|
|
26
|
+
} from "./chunk-KRRY534Q.js";
|
|
30
27
|
import {
|
|
31
28
|
functools_exports
|
|
32
|
-
} from "./chunk-
|
|
29
|
+
} from "./chunk-4SZT4HJI.js";
|
|
33
30
|
import {
|
|
34
31
|
itertools_exports
|
|
35
|
-
} from "./chunk-
|
|
32
|
+
} from "./chunk-HQ42WNKZ.js";
|
|
36
33
|
import {
|
|
37
34
|
json_exports
|
|
38
|
-
} from "./chunk-
|
|
35
|
+
} from "./chunk-6VQ7ITWO.js";
|
|
39
36
|
import {
|
|
40
37
|
math_exports
|
|
41
|
-
} from "./chunk-
|
|
38
|
+
} from "./chunk-6POEDI34.js";
|
|
42
39
|
import {
|
|
43
40
|
os_exports
|
|
44
|
-
} from "./chunk-
|
|
41
|
+
} from "./chunk-BDBX5BG4.js";
|
|
45
42
|
import "./chunk-PZ5AY32C.js";
|
|
46
43
|
|
|
47
44
|
// src/core.ts
|
|
48
|
-
function
|
|
45
|
+
function floorDiv(a, b) {
|
|
49
46
|
return Math.floor(a / b);
|
|
50
47
|
}
|
|
51
48
|
function pow(base, exp) {
|
|
@@ -54,8 +51,8 @@ function pow(base, exp) {
|
|
|
54
51
|
function mod(a, b) {
|
|
55
52
|
return (a % b + b) % b;
|
|
56
53
|
}
|
|
57
|
-
function
|
|
58
|
-
return [
|
|
54
|
+
function divMod(a, b) {
|
|
55
|
+
return [floorDiv(a, b), mod(a, b)];
|
|
59
56
|
}
|
|
60
57
|
function sprintf(template, args) {
|
|
61
58
|
const values = Array.isArray(args) ? args : [args];
|
|
@@ -206,10 +203,6 @@ function is(a, b) {
|
|
|
206
203
|
}
|
|
207
204
|
|
|
208
205
|
// src/builtins.ts
|
|
209
|
-
var py;
|
|
210
|
-
function _setPyRef(pyRef) {
|
|
211
|
-
py = pyRef;
|
|
212
|
-
}
|
|
213
206
|
function range(startOrStop, stop, step) {
|
|
214
207
|
let start;
|
|
215
208
|
let end;
|
|
@@ -466,17 +459,17 @@ function str(x) {
|
|
|
466
459
|
return x ? "True" : "False";
|
|
467
460
|
}
|
|
468
461
|
if (Array.isArray(x)) {
|
|
469
|
-
return "[" + x.map((item) =>
|
|
462
|
+
return "[" + x.map((item) => repr(item)).join(", ") + "]";
|
|
470
463
|
}
|
|
471
464
|
if (x instanceof Map) {
|
|
472
|
-
const entries = Array.from(x.entries()).map(([k, v]) => `${
|
|
465
|
+
const entries = Array.from(x.entries()).map(([k, v]) => `${repr(k)}: ${repr(v)}`).join(", ");
|
|
473
466
|
return "{" + entries + "}";
|
|
474
467
|
}
|
|
475
468
|
if (x instanceof Set) {
|
|
476
469
|
if (x.size === 0) {
|
|
477
470
|
return "set()";
|
|
478
471
|
}
|
|
479
|
-
return "{" + Array.from(x).map((item) =>
|
|
472
|
+
return "{" + Array.from(x).map((item) => repr(item)).join(", ") + "}";
|
|
480
473
|
}
|
|
481
474
|
return String(x);
|
|
482
475
|
}
|
|
@@ -857,9 +850,9 @@ var dict2 = {
|
|
|
857
850
|
return key in obj ? obj[key] : defaultValue;
|
|
858
851
|
},
|
|
859
852
|
/**
|
|
860
|
-
* Python dict.
|
|
853
|
+
* Python dict.setDefault() - get value or set default
|
|
861
854
|
*/
|
|
862
|
-
|
|
855
|
+
setDefault(obj, key, defaultValue) {
|
|
863
856
|
if (!(key in obj)) {
|
|
864
857
|
obj[key] = defaultValue;
|
|
865
858
|
}
|
|
@@ -880,9 +873,9 @@ var dict2 = {
|
|
|
880
873
|
throw new Error("KeyError");
|
|
881
874
|
},
|
|
882
875
|
/**
|
|
883
|
-
* Python dict.
|
|
876
|
+
* Python dict.popItem() - remove and return last item
|
|
884
877
|
*/
|
|
885
|
-
|
|
878
|
+
popItem(obj) {
|
|
886
879
|
const keys = Object.keys(obj);
|
|
887
880
|
if (keys.length === 0) {
|
|
888
881
|
throw new Error("dictionary is empty");
|
|
@@ -937,9 +930,9 @@ var dict2 = {
|
|
|
937
930
|
return Object.entries(obj);
|
|
938
931
|
},
|
|
939
932
|
/**
|
|
940
|
-
* Python dict.
|
|
933
|
+
* Python dict.fromKeys() - create dict from keys
|
|
941
934
|
*/
|
|
942
|
-
|
|
935
|
+
fromKeys(keys, value) {
|
|
943
936
|
const result = {};
|
|
944
937
|
for (const key of keys) {
|
|
945
938
|
result[key] = value;
|
|
@@ -1081,27 +1074,27 @@ var set2 = {
|
|
|
1081
1074
|
for (const item of toAdd) a.add(item);
|
|
1082
1075
|
},
|
|
1083
1076
|
/**
|
|
1084
|
-
* Python set.
|
|
1077
|
+
* Python set.isSubset() - test if all elements are in other
|
|
1085
1078
|
*/
|
|
1086
|
-
|
|
1079
|
+
isSubset(a, b) {
|
|
1087
1080
|
for (const item of a) {
|
|
1088
1081
|
if (!b.has(item)) return false;
|
|
1089
1082
|
}
|
|
1090
1083
|
return true;
|
|
1091
1084
|
},
|
|
1092
1085
|
/**
|
|
1093
|
-
* Python set.
|
|
1086
|
+
* Python set.isSuperset() - test if all other elements are in this set
|
|
1094
1087
|
*/
|
|
1095
|
-
|
|
1088
|
+
isSuperset(a, b) {
|
|
1096
1089
|
for (const item of b) {
|
|
1097
1090
|
if (!a.has(item)) return false;
|
|
1098
1091
|
}
|
|
1099
1092
|
return true;
|
|
1100
1093
|
},
|
|
1101
1094
|
/**
|
|
1102
|
-
* Python set.
|
|
1095
|
+
* Python set.isDisjoint() - test if no common elements
|
|
1103
1096
|
*/
|
|
1104
|
-
|
|
1097
|
+
isDisjoint(a, b) {
|
|
1105
1098
|
for (const item of a) {
|
|
1106
1099
|
if (b.has(item)) return false;
|
|
1107
1100
|
}
|
|
@@ -1121,16 +1114,16 @@ var datetime = datetime_exports;
|
|
|
1121
1114
|
var re = re_exports;
|
|
1122
1115
|
var string2 = {
|
|
1123
1116
|
...string,
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1117
|
+
asciiLowercase,
|
|
1118
|
+
asciiUppercase,
|
|
1119
|
+
asciiLetters,
|
|
1127
1120
|
digits,
|
|
1128
|
-
|
|
1129
|
-
|
|
1121
|
+
hexDigits,
|
|
1122
|
+
octDigits,
|
|
1130
1123
|
punctuation,
|
|
1131
1124
|
whitespace,
|
|
1132
1125
|
printable,
|
|
1133
|
-
|
|
1126
|
+
capWords,
|
|
1134
1127
|
Template
|
|
1135
1128
|
};
|
|
1136
1129
|
var list3 = Object.assign(
|
|
@@ -1145,9 +1138,9 @@ var set3 = Object.assign(
|
|
|
1145
1138
|
(iterable) => set(iterable),
|
|
1146
1139
|
set2
|
|
1147
1140
|
);
|
|
1148
|
-
var
|
|
1141
|
+
var floorDiv2 = floorDiv;
|
|
1149
1142
|
var mod2 = mod;
|
|
1150
|
-
var
|
|
1143
|
+
var divMod2 = divMod;
|
|
1151
1144
|
var sprintf2 = sprintf;
|
|
1152
1145
|
var strFormat2 = strFormat;
|
|
1153
1146
|
var slice2 = slice;
|
|
@@ -1186,89 +1179,6 @@ var isinstance2 = isinstance;
|
|
|
1186
1179
|
var type2 = type;
|
|
1187
1180
|
var input2 = input;
|
|
1188
1181
|
var format2 = format;
|
|
1189
|
-
var py2 = {
|
|
1190
|
-
// Namespaced methods
|
|
1191
|
-
string,
|
|
1192
|
-
list: list3,
|
|
1193
|
-
dict: dict3,
|
|
1194
|
-
set: set3,
|
|
1195
|
-
// Core operations
|
|
1196
|
-
floordiv,
|
|
1197
|
-
pow,
|
|
1198
|
-
mod,
|
|
1199
|
-
divmod,
|
|
1200
|
-
sprintf,
|
|
1201
|
-
strFormat,
|
|
1202
|
-
slice,
|
|
1203
|
-
at,
|
|
1204
|
-
repeat,
|
|
1205
|
-
in: contains,
|
|
1206
|
-
is,
|
|
1207
|
-
// Iterables
|
|
1208
|
-
range,
|
|
1209
|
-
enumerate,
|
|
1210
|
-
zip,
|
|
1211
|
-
iter,
|
|
1212
|
-
reversed,
|
|
1213
|
-
sorted,
|
|
1214
|
-
map,
|
|
1215
|
-
filter,
|
|
1216
|
-
// Collection constructors
|
|
1217
|
-
tuple,
|
|
1218
|
-
// Built-in functions
|
|
1219
|
-
len,
|
|
1220
|
-
abs,
|
|
1221
|
-
min,
|
|
1222
|
-
max,
|
|
1223
|
-
sum,
|
|
1224
|
-
all,
|
|
1225
|
-
any,
|
|
1226
|
-
round,
|
|
1227
|
-
ord,
|
|
1228
|
-
chr,
|
|
1229
|
-
hex,
|
|
1230
|
-
oct,
|
|
1231
|
-
bin,
|
|
1232
|
-
// Type conversions
|
|
1233
|
-
int,
|
|
1234
|
-
float,
|
|
1235
|
-
str,
|
|
1236
|
-
repr,
|
|
1237
|
-
bool,
|
|
1238
|
-
ascii,
|
|
1239
|
-
// Type checking
|
|
1240
|
-
isinstance,
|
|
1241
|
-
type,
|
|
1242
|
-
input,
|
|
1243
|
-
format,
|
|
1244
|
-
// Modules
|
|
1245
|
-
itertools: itertools_exports,
|
|
1246
|
-
functools: functools_exports,
|
|
1247
|
-
math: math_exports,
|
|
1248
|
-
random: random_exports,
|
|
1249
|
-
json: json_exports,
|
|
1250
|
-
os: os_exports,
|
|
1251
|
-
datetime: datetime_exports,
|
|
1252
|
-
re: re_exports,
|
|
1253
|
-
// collections
|
|
1254
|
-
Counter,
|
|
1255
|
-
defaultdict,
|
|
1256
|
-
deque,
|
|
1257
|
-
// string module
|
|
1258
|
-
Template,
|
|
1259
|
-
ascii_lowercase,
|
|
1260
|
-
ascii_uppercase,
|
|
1261
|
-
ascii_letters,
|
|
1262
|
-
digits,
|
|
1263
|
-
hexdigits,
|
|
1264
|
-
octdigits,
|
|
1265
|
-
punctuation,
|
|
1266
|
-
whitespace,
|
|
1267
|
-
printable,
|
|
1268
|
-
capwords
|
|
1269
|
-
};
|
|
1270
|
-
_setPyRef(py2);
|
|
1271
|
-
var index_default = py2;
|
|
1272
1182
|
export {
|
|
1273
1183
|
abs2 as abs,
|
|
1274
1184
|
all2 as all,
|
|
@@ -1281,13 +1191,12 @@ export {
|
|
|
1281
1191
|
collections,
|
|
1282
1192
|
contains2 as contains,
|
|
1283
1193
|
datetime,
|
|
1284
|
-
index_default as default,
|
|
1285
1194
|
dict3 as dict,
|
|
1286
|
-
|
|
1195
|
+
divMod2 as divMod,
|
|
1287
1196
|
enumerate2 as enumerate,
|
|
1288
1197
|
filter2 as filter,
|
|
1289
1198
|
float2 as float,
|
|
1290
|
-
|
|
1199
|
+
floorDiv2 as floorDiv,
|
|
1291
1200
|
format2 as format,
|
|
1292
1201
|
functools,
|
|
1293
1202
|
hex2 as hex,
|
|
@@ -1309,7 +1218,6 @@ export {
|
|
|
1309
1218
|
ord2 as ord,
|
|
1310
1219
|
os,
|
|
1311
1220
|
pow,
|
|
1312
|
-
py2 as py,
|
|
1313
1221
|
random,
|
|
1314
1222
|
range2 as range,
|
|
1315
1223
|
re,
|