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.
Files changed (150) hide show
  1. package/README.md +3 -1
  2. package/dist/base64-C_am75Sv.d.ts +165 -0
  3. package/dist/base64.d.ts +1 -0
  4. package/dist/base64.js +37 -0
  5. package/dist/chunk-2YTO24B5.js +78 -0
  6. package/dist/chunk-3CLXPGAB.js +237 -0
  7. package/dist/{chunk-H76SKASU.js → chunk-3M3PB4RO.js} +4 -6
  8. package/dist/chunk-5OKGPZBQ.js +1106 -0
  9. package/dist/chunk-5VAHUJNC.js +348 -0
  10. package/dist/chunk-B5AUEOAH.js +193 -0
  11. package/dist/chunk-B5LQJODJ.js +37 -0
  12. package/dist/{chunk-HQ42WNKZ.js → chunk-BCMGGBWG.js} +2 -5
  13. package/dist/chunk-BCVIH2BN.js +175 -0
  14. package/dist/{chunk-EE7SK2GV.js → chunk-D35YI363.js} +15 -12
  15. package/dist/{chunk-7TH4FCVQ.js → chunk-ETBW6XNR.js} +3 -4
  16. package/dist/chunk-FCJ7E4OE.js +250 -0
  17. package/dist/chunk-HSTC277I.js +255 -0
  18. package/dist/chunk-IANXD4D4.js +250 -0
  19. package/dist/{chunk-4KYJT3DR.js → chunk-JAUU3HMH.js} +1 -2
  20. package/dist/chunk-JJKTRIVO.js +262 -0
  21. package/dist/chunk-KKHKTQNN.js +361 -0
  22. package/dist/chunk-KKJHGY4C.js +551 -0
  23. package/dist/chunk-LHPQS75Z.js +192 -0
  24. package/dist/{chunk-LWO6BIAD.js → chunk-LK2L2TFG.js} +5 -6
  25. package/dist/chunk-LLZFLQS6.js +280 -0
  26. package/dist/chunk-LTXTS7RP.js +154 -0
  27. package/dist/{chunk-4QG3772L.js → chunk-LWYBTWBZ.js} +2 -3
  28. package/dist/{chunk-6ZAJ37MR.js → chunk-MFKIEN7N.js} +3 -3
  29. package/dist/{chunk-PZ5AY32C.js → chunk-MLKGABMK.js} +0 -1
  30. package/dist/chunk-OZRS5PC4.js +312 -0
  31. package/dist/chunk-PWA3YQZU.js +346 -0
  32. package/dist/{chunk-6POEDI34.js → chunk-QKJBQKPY.js} +1 -2
  33. package/dist/chunk-RB6BYCIQ.js +141 -0
  34. package/dist/chunk-U4X5DEIP.js +188 -0
  35. package/dist/chunk-UGZ5OY5Z.js +165 -0
  36. package/dist/chunk-WTZSAITC.js +82 -0
  37. package/dist/{collections-CJur5Wg-.d.ts → collections-BthXtkEp.d.ts} +5 -1
  38. package/dist/collections.d.ts +1 -1
  39. package/dist/collections.js +2 -3
  40. package/dist/copy-6ZaZ__ge.d.ts +59 -0
  41. package/dist/copy.d.ts +1 -0
  42. package/dist/copy.js +9 -0
  43. package/dist/{datetime-Bpce8gG2.d.ts → datetime-BM_IjhTq.d.ts} +3 -1
  44. package/dist/datetime.d.ts +1 -1
  45. package/dist/datetime.js +2 -3
  46. package/dist/{functools-NrsZAqJk.d.ts → functools-uIa5g75p.d.ts} +3 -1
  47. package/dist/functools.d.ts +1 -1
  48. package/dist/functools.js +2 -3
  49. package/dist/glob.browser-B6d_YdV5.d.ts +50 -0
  50. package/dist/glob.browser.d.ts +1 -0
  51. package/dist/glob.browser.js +15 -0
  52. package/dist/glob.node-wn5ehtyM.d.ts +80 -0
  53. package/dist/glob.node.d.ts +1 -0
  54. package/dist/glob.node.js +15 -0
  55. package/dist/hashlib-vKP511NY.d.ts +205 -0
  56. package/dist/hashlib.d.ts +1 -0
  57. package/dist/hashlib.js +39 -0
  58. package/dist/index.browser.d.ts +172 -0
  59. package/dist/index.browser.js +304 -0
  60. package/dist/index.d.ts +61 -437
  61. package/dist/index.js +138 -1115
  62. package/dist/{itertools-Sjl1LB_0.d.ts → itertools-T0rwOk2j.d.ts} +2 -4
  63. package/dist/itertools.d.ts +1 -1
  64. package/dist/itertools.js +2 -3
  65. package/dist/{json-DAlvCadU.d.ts → json-DoWhX04T.d.ts} +1 -0
  66. package/dist/json.d.ts +1 -1
  67. package/dist/json.js +2 -3
  68. package/dist/logging.browser-Dux4L5kz.d.ts +185 -0
  69. package/dist/logging.browser.d.ts +1 -0
  70. package/dist/logging.browser.js +63 -0
  71. package/dist/logging.node-CH75bVdE.d.ts +185 -0
  72. package/dist/logging.node.d.ts +1 -0
  73. package/dist/logging.node.js +61 -0
  74. package/dist/{math-DwEGjjQ-.d.ts → math-D2NPMc-x.d.ts} +2 -1
  75. package/dist/math.d.ts +1 -1
  76. package/dist/math.js +2 -3
  77. package/dist/{os-C6Nt7Ijx.d.ts → os.browser-krjSx5kF.d.ts} +32 -54
  78. package/dist/os.browser.d.ts +2 -0
  79. package/dist/{os.js → os.browser.js} +41 -16
  80. package/dist/os.node-CQjch8Ht.d.ts +124 -0
  81. package/dist/os.node.d.ts +2 -0
  82. package/dist/os.node.js +83 -0
  83. package/dist/os.shared-C3x70nhO.d.ts +59 -0
  84. package/dist/pathlib.browser-NC7kKQYe.d.ts +91 -0
  85. package/dist/pathlib.browser.d.ts +1 -0
  86. package/dist/pathlib.browser.js +17 -0
  87. package/dist/pathlib.node-CY3yUFdT.d.ts +331 -0
  88. package/dist/pathlib.node.d.ts +2 -0
  89. package/dist/pathlib.node.js +17 -0
  90. package/dist/{random-BJv_rSpL.d.ts → random-DcS5jtEs.d.ts} +3 -5
  91. package/dist/random.d.ts +1 -1
  92. package/dist/random.js +2 -3
  93. package/dist/{re-B1CHCgyr.d.ts → re-Bo-IOqov.d.ts} +3 -7
  94. package/dist/re.d.ts +1 -1
  95. package/dist/re.js +2 -3
  96. package/dist/set-JQbLAq8B.d.ts +592 -0
  97. package/dist/shutil.browser-Ck5oWhnP.d.ts +113 -0
  98. package/dist/shutil.browser.d.ts +1 -0
  99. package/dist/shutil.browser.js +33 -0
  100. package/dist/shutil.node-C9kwvhAf.d.ts +160 -0
  101. package/dist/shutil.node.d.ts +2 -0
  102. package/dist/shutil.node.js +33 -0
  103. package/dist/string.d.ts +3 -1
  104. package/dist/string.js +2 -3
  105. package/dist/subprocess-CZVYzQ3V.d.ts +214 -0
  106. package/dist/subprocess.d.ts +1 -0
  107. package/dist/subprocess.js +29 -0
  108. package/dist/sys-IL8LgI_W.d.ts +212 -0
  109. package/dist/sys.d.ts +1 -0
  110. package/dist/sys.js +51 -0
  111. package/dist/tempfile.browser-DciOKfNm.d.ts +78 -0
  112. package/dist/tempfile.browser.d.ts +1 -0
  113. package/dist/tempfile.browser.js +19 -0
  114. package/dist/tempfile.node-bVMY60Cu.d.ts +195 -0
  115. package/dist/tempfile.node.d.ts +2 -0
  116. package/dist/tempfile.node.js +23 -0
  117. package/dist/time-CcYhdiSu.d.ts +245 -0
  118. package/dist/time.d.ts +1 -0
  119. package/dist/time.js +49 -0
  120. package/dist/urllib-DJtkj-0f.d.ts +198 -0
  121. package/dist/urllib.d.ts +1 -0
  122. package/dist/urllib.js +37 -0
  123. package/dist/uuid-C0ypmn56.d.ts +160 -0
  124. package/dist/uuid.d.ts +1 -0
  125. package/dist/uuid.js +23 -0
  126. package/package.json +127 -5
  127. package/dist/chunk-4KYJT3DR.js.map +0 -1
  128. package/dist/chunk-4QG3772L.js.map +0 -1
  129. package/dist/chunk-6POEDI34.js.map +0 -1
  130. package/dist/chunk-6ZAJ37MR.js.map +0 -1
  131. package/dist/chunk-7TH4FCVQ.js.map +0 -1
  132. package/dist/chunk-CXKGPD5D.js +0 -313
  133. package/dist/chunk-CXKGPD5D.js.map +0 -1
  134. package/dist/chunk-EE7SK2GV.js.map +0 -1
  135. package/dist/chunk-H76SKASU.js.map +0 -1
  136. package/dist/chunk-HQ42WNKZ.js.map +0 -1
  137. package/dist/chunk-LWO6BIAD.js.map +0 -1
  138. package/dist/chunk-PZ5AY32C.js.map +0 -1
  139. package/dist/collections.js.map +0 -1
  140. package/dist/datetime.js.map +0 -1
  141. package/dist/functools.js.map +0 -1
  142. package/dist/index.js.map +0 -1
  143. package/dist/itertools.js.map +0 -1
  144. package/dist/json.js.map +0 -1
  145. package/dist/math.js.map +0 -1
  146. package/dist/os.d.ts +0 -1
  147. package/dist/os.js.map +0 -1
  148. package/dist/random.js.map +0 -1
  149. package/dist/re.js.map +0 -1
  150. package/dist/string.js.map +0 -1
@@ -0,0 +1,141 @@
1
+ import {
2
+ __export
3
+ } from "./chunk-MLKGABMK.js";
4
+
5
+ // src/glob.node.ts
6
+ var glob_node_exports = {};
7
+ __export(glob_node_exports, {
8
+ escape: () => escape,
9
+ glob: () => glob,
10
+ hasMagic: () => hasMagic,
11
+ iglob: () => iglob,
12
+ rglob: () => rglob
13
+ });
14
+ import { readdir, stat } from "fs/promises";
15
+ import { isAbsolute, join, relative } from "path";
16
+ async function glob(pattern, options) {
17
+ const rootDir = options?.rootDir ?? ".";
18
+ const recursive = options?.recursive ?? pattern.includes("**");
19
+ const includeHidden = options?.includeHidden ?? false;
20
+ const results = [];
21
+ const regex = patternToRegex(pattern);
22
+ const isAbsolutePath = isAbsolute(pattern);
23
+ const baseDir = isAbsolutePath ? "/" : rootDir;
24
+ const parts = pattern.split(/[\\/]/);
25
+ let fixedPrefix = "";
26
+ for (let i = 0; i < parts.length; i++) {
27
+ const part = parts[i] ?? "";
28
+ if (part.includes("*") || part.includes("?") || part.includes("[")) {
29
+ break;
30
+ }
31
+ if (fixedPrefix) {
32
+ fixedPrefix = join(fixedPrefix, part);
33
+ } else if (part === "" && i === 0 && isAbsolutePath) {
34
+ fixedPrefix = "/";
35
+ } else {
36
+ fixedPrefix = part;
37
+ }
38
+ }
39
+ const searchDir = fixedPrefix ? isAbsolutePath ? fixedPrefix : join(rootDir, fixedPrefix) : baseDir;
40
+ const walk = async (dir, depth) => {
41
+ let entries;
42
+ try {
43
+ entries = await readdir(dir);
44
+ } catch {
45
+ return;
46
+ }
47
+ for (const entry of entries) {
48
+ if (!includeHidden && entry.startsWith(".")) {
49
+ continue;
50
+ }
51
+ const fullPath = join(dir, entry);
52
+ const relativePath = isAbsolutePath ? fullPath : relative(rootDir, fullPath);
53
+ if (regex.test(relativePath)) {
54
+ results.push(relativePath);
55
+ }
56
+ if (recursive) {
57
+ try {
58
+ if ((await stat(fullPath)).isDirectory()) {
59
+ await walk(fullPath, depth + 1);
60
+ }
61
+ } catch {
62
+ }
63
+ }
64
+ }
65
+ };
66
+ await walk(searchDir, 0);
67
+ return results.sort();
68
+ }
69
+ async function* iglob(pattern, options) {
70
+ const results = await glob(pattern, options);
71
+ for (const result of results) {
72
+ yield result;
73
+ }
74
+ }
75
+ function escape(pathname) {
76
+ return pathname.replace(/([*?[])/g, "[$1]");
77
+ }
78
+ function hasMagic(pattern) {
79
+ return /[*?[\]]/.test(pattern);
80
+ }
81
+ function patternToRegex(pattern) {
82
+ let regex = "";
83
+ let i = 0;
84
+ while (i < pattern.length) {
85
+ const char = pattern[i];
86
+ if (char === "*") {
87
+ if (pattern[i + 1] === "*") {
88
+ if (pattern[i + 2] === "/" || pattern[i + 2] === "\\") {
89
+ regex += "(?:.*/)?";
90
+ i += 3;
91
+ } else {
92
+ regex += ".*";
93
+ i += 2;
94
+ }
95
+ } else {
96
+ regex += "[^/\\\\]*";
97
+ i++;
98
+ }
99
+ } else if (char === "?") {
100
+ regex += "[^/\\\\]";
101
+ i++;
102
+ } else if (char === "[") {
103
+ let j = i + 1;
104
+ let charClass = "[";
105
+ if (pattern[j] === "!" || pattern[j] === "^") {
106
+ charClass += "^";
107
+ j++;
108
+ }
109
+ while (j < pattern.length && pattern[j] !== "]") {
110
+ charClass += pattern[j] ?? "";
111
+ j++;
112
+ }
113
+ charClass += "]";
114
+ regex += charClass;
115
+ i = j + 1;
116
+ } else if (char === "/" || char === "\\") {
117
+ regex += "[/\\\\]";
118
+ i++;
119
+ } else if (".+^${}()|\\".includes(char ?? "")) {
120
+ regex += "\\" + (char ?? "");
121
+ i++;
122
+ } else {
123
+ regex += char ?? "";
124
+ i++;
125
+ }
126
+ }
127
+ return new RegExp("^" + regex + "$");
128
+ }
129
+ async function rglob(pattern, rootDir = ".") {
130
+ const fullPattern = pattern.startsWith("**") ? pattern : "**/" + pattern;
131
+ return glob(fullPattern, { recursive: true, rootDir });
132
+ }
133
+
134
+ export {
135
+ glob,
136
+ iglob,
137
+ escape,
138
+ hasMagic,
139
+ rglob,
140
+ glob_node_exports
141
+ };
@@ -0,0 +1,188 @@
1
+ import {
2
+ __export
3
+ } from "./chunk-MLKGABMK.js";
4
+
5
+ // src/sys.ts
6
+ var sys_exports = {};
7
+ __export(sys_exports, {
8
+ apiVersion: () => apiVersion,
9
+ argv: () => argv,
10
+ byteorder: () => byteorder,
11
+ executable: () => executable,
12
+ exit: () => exit,
13
+ floatInfo: () => floatInfo,
14
+ getDefaultEncoding: () => getDefaultEncoding,
15
+ getFilesystemEncoding: () => getFilesystemEncoding,
16
+ getRecursionLimit: () => getRecursionLimit,
17
+ getRefCount: () => getRefCount,
18
+ getSizeOf: () => getSizeOf,
19
+ hashInfo: () => hashInfo,
20
+ intInfo: () => intInfo,
21
+ maxsize: () => maxsize,
22
+ path: () => path,
23
+ platform: () => platform,
24
+ prefix: () => prefix,
25
+ setRecursionLimit: () => setRecursionLimit,
26
+ stderr: () => stderr,
27
+ stdin: () => stdin,
28
+ stdout: () => stdout,
29
+ version: () => version,
30
+ versionInfo: () => versionInfo
31
+ });
32
+ var argv = typeof process !== "undefined" ? process.argv.slice(2) : [];
33
+ var platform = typeof process !== "undefined" ? process.platform : "unknown";
34
+ var version = "3.11.0 (pythonlib TypeScript implementation)";
35
+ var versionInfo = {
36
+ major: 3,
37
+ minor: 11,
38
+ micro: 0,
39
+ releaselevel: "final",
40
+ serial: 0,
41
+ // Make it tuple-like (indexable)
42
+ 0: 3,
43
+ 1: 11,
44
+ 2: 0,
45
+ 3: "final",
46
+ 4: 0,
47
+ length: 5,
48
+ [Symbol.iterator]: function* () {
49
+ yield this.major;
50
+ yield this.minor;
51
+ yield this.micro;
52
+ yield this.releaselevel;
53
+ yield this.serial;
54
+ }
55
+ };
56
+ var executable = typeof process !== "undefined" ? process.execPath : "";
57
+ var path = (() => {
58
+ if (typeof process === "undefined") return [];
59
+ return [];
60
+ })();
61
+ var maxsize = Number.MAX_SAFE_INTEGER;
62
+ var stdin = typeof process !== "undefined" ? process.stdin : null;
63
+ var stdout = typeof process !== "undefined" ? process.stdout : null;
64
+ var stderr = typeof process !== "undefined" ? process.stderr : null;
65
+ function exit(code) {
66
+ if (typeof process !== "undefined") {
67
+ process.exit(code ?? 0);
68
+ }
69
+ throw new Error(`SystemExit: ${String(code ?? 0)}`);
70
+ }
71
+ function getRecursionLimit() {
72
+ return 1e3;
73
+ }
74
+ function setRecursionLimit(limit) {
75
+ void limit;
76
+ }
77
+ function getSizeOf(obj) {
78
+ const seen = /* @__PURE__ */ new WeakSet();
79
+ function estimate(value) {
80
+ if (value === null || value === void 0) return 0;
81
+ const type = typeof value;
82
+ if (type === "boolean") return 4;
83
+ if (type === "number") return 8;
84
+ if (type === "string") return value.length * 2;
85
+ if (type === "bigint") return value.toString().length * 8 / 10;
86
+ if (type === "object" || type === "function") {
87
+ if (seen.has(value)) return 0;
88
+ seen.add(value);
89
+ if (Array.isArray(value)) {
90
+ return value.reduce((sum, item) => sum + estimate(item), 64);
91
+ }
92
+ if (value instanceof Map) {
93
+ let size2 = 64;
94
+ for (const [k, v] of value) {
95
+ size2 += estimate(k) + estimate(v);
96
+ }
97
+ return size2;
98
+ }
99
+ if (value instanceof Set) {
100
+ let size2 = 64;
101
+ for (const item of value) {
102
+ size2 += estimate(item);
103
+ }
104
+ return size2;
105
+ }
106
+ let size = 64;
107
+ for (const key in value) {
108
+ size += key.length * 2 + estimate(value[key]);
109
+ }
110
+ return size;
111
+ }
112
+ return 0;
113
+ }
114
+ return estimate(obj);
115
+ }
116
+ function getRefCount(obj) {
117
+ void obj;
118
+ return 1;
119
+ }
120
+ function getDefaultEncoding() {
121
+ return "utf-8";
122
+ }
123
+ function getFilesystemEncoding() {
124
+ return "utf-8";
125
+ }
126
+ var apiVersion = 0;
127
+ var prefix = typeof process !== "undefined" ? process.execPath.replace(/\/bin\/node$/, "") : "";
128
+ var byteorder = (() => {
129
+ const buffer = new ArrayBuffer(2);
130
+ new DataView(buffer).setInt16(0, 256, true);
131
+ return new Int16Array(buffer)[0] === 256 ? "little" : "big";
132
+ })();
133
+ var floatInfo = {
134
+ max: Number.MAX_VALUE,
135
+ maxExp: 1024,
136
+ max10Exp: 308,
137
+ min: Number.MIN_VALUE,
138
+ minExp: -1021,
139
+ min10Exp: -307,
140
+ dig: 15,
141
+ mant_dig: 53,
142
+ epsilon: Number.EPSILON,
143
+ radix: 2,
144
+ rounds: 1
145
+ };
146
+ var intInfo = {
147
+ bitsPerDigit: 30,
148
+ sizeofDigit: 4,
149
+ defaultMaxStrDigits: 4300,
150
+ strDigitsCheckThreshold: 640
151
+ };
152
+ var hashInfo = {
153
+ width: 64,
154
+ modulus: 2n ** 61n - 1n,
155
+ inf: 314159,
156
+ nan: 0,
157
+ imag: 1000003,
158
+ algorithm: "siphash24",
159
+ hashBits: 64,
160
+ seedBits: 128
161
+ };
162
+
163
+ export {
164
+ argv,
165
+ platform,
166
+ version,
167
+ versionInfo,
168
+ executable,
169
+ path,
170
+ maxsize,
171
+ stdin,
172
+ stdout,
173
+ stderr,
174
+ exit,
175
+ getRecursionLimit,
176
+ setRecursionLimit,
177
+ getSizeOf,
178
+ getRefCount,
179
+ getDefaultEncoding,
180
+ getFilesystemEncoding,
181
+ apiVersion,
182
+ prefix,
183
+ byteorder,
184
+ floatInfo,
185
+ intInfo,
186
+ hashInfo,
187
+ sys_exports
188
+ };
@@ -0,0 +1,165 @@
1
+ import {
2
+ __export
3
+ } from "./chunk-MLKGABMK.js";
4
+
5
+ // src/tempfile.node.ts
6
+ var tempfile_node_exports = {};
7
+ __export(tempfile_node_exports, {
8
+ NamedTemporaryFile: () => NamedTemporaryFile,
9
+ TemporaryDirectory: () => TemporaryDirectory,
10
+ gettempdir: () => gettempdir,
11
+ gettempprefix: () => gettempprefix,
12
+ mkdtemp: () => mkdtemp,
13
+ mkstemp: () => mkstemp,
14
+ mktemp: () => mktemp,
15
+ namedTemporaryFile: () => namedTemporaryFile,
16
+ temporaryDirectory: () => temporaryDirectory
17
+ });
18
+ import { mkdir, open, rm, unlink } from "fs/promises";
19
+ import { join } from "path";
20
+ import { tmpdir } from "os";
21
+ import { randomBytes } from "crypto";
22
+ function gettempdir() {
23
+ return tmpdir();
24
+ }
25
+ function mktemp(suffix = "", prefix = "tmp", dir) {
26
+ const tempDir = dir ?? gettempdir();
27
+ const randomPart = randomBytes(8).toString("hex");
28
+ return join(tempDir, `${prefix}${randomPart}${suffix}`);
29
+ }
30
+ async function mkstemp(suffix = "", prefix = "tmp", dir, _text = false) {
31
+ const tempDir = dir ?? gettempdir();
32
+ const randomPart = randomBytes(8).toString("hex");
33
+ const path = join(tempDir, `${prefix}${randomPart}${suffix}`);
34
+ const handle = await open(path, "w+", 384);
35
+ return [handle, path];
36
+ }
37
+ async function mkdtemp(suffix = "", prefix = "tmp", dir) {
38
+ const tempDir = dir ?? gettempdir();
39
+ const randomPart = randomBytes(8).toString("hex");
40
+ const path = join(tempDir, `${prefix}${randomPart}${suffix}`);
41
+ await mkdir(path, { mode: 448 });
42
+ return path;
43
+ }
44
+ var NamedTemporaryFile = class _NamedTemporaryFile {
45
+ /** The file handle */
46
+ handle;
47
+ /** The file path */
48
+ name;
49
+ /** Whether to delete the file on close */
50
+ deleteOnClose;
51
+ _closed = false;
52
+ constructor(handle, name, deleteOnClose) {
53
+ this.handle = handle;
54
+ this.name = name;
55
+ this.deleteOnClose = deleteOnClose;
56
+ }
57
+ /**
58
+ * Create a new NamedTemporaryFile.
59
+ */
60
+ static async create(options) {
61
+ const suffix = options?.suffix ?? "";
62
+ const prefix = options?.prefix ?? "tmp";
63
+ const dir = options?.dir;
64
+ const deleteOnClose = options?.delete ?? true;
65
+ const [handle, path] = await mkstemp(suffix, prefix, dir);
66
+ return new _NamedTemporaryFile(handle, path, deleteOnClose);
67
+ }
68
+ /**
69
+ * Write data to the file.
70
+ */
71
+ async write(data) {
72
+ const result = await this.handle.write(typeof data === "string" ? Buffer.from(data) : data);
73
+ return result.bytesWritten;
74
+ }
75
+ /**
76
+ * Read data from the file.
77
+ */
78
+ async read(size) {
79
+ const fileSize = size ?? (await this.handle.stat()).size;
80
+ const buffer = Buffer.alloc(fileSize);
81
+ await this.handle.read(buffer, 0, buffer.length, 0);
82
+ return buffer;
83
+ }
84
+ /**
85
+ * Seek to a position in the file.
86
+ */
87
+ seek(_offset, _whence = 0) {
88
+ }
89
+ /**
90
+ * Flush the file buffer.
91
+ */
92
+ async flush() {
93
+ await this.handle.sync();
94
+ }
95
+ /**
96
+ * Close the file.
97
+ */
98
+ async close() {
99
+ if (!this._closed) {
100
+ await this.handle.close();
101
+ if (this.deleteOnClose) {
102
+ try {
103
+ await unlink(this.name);
104
+ } catch {
105
+ }
106
+ }
107
+ this._closed = true;
108
+ }
109
+ }
110
+ /**
111
+ * Check if the file is closed.
112
+ */
113
+ get closed() {
114
+ return this._closed;
115
+ }
116
+ };
117
+ var TemporaryDirectory = class _TemporaryDirectory {
118
+ /** The directory path */
119
+ name;
120
+ _cleaned = false;
121
+ constructor(name) {
122
+ this.name = name;
123
+ }
124
+ /**
125
+ * Create a new TemporaryDirectory.
126
+ */
127
+ static async create(options) {
128
+ const name = await mkdtemp(options?.suffix, options?.prefix, options?.dir);
129
+ return new _TemporaryDirectory(name);
130
+ }
131
+ /**
132
+ * Remove the temporary directory and its contents.
133
+ */
134
+ async cleanup() {
135
+ if (!this._cleaned) {
136
+ try {
137
+ await rm(this.name, { recursive: true, force: true });
138
+ } catch {
139
+ }
140
+ this._cleaned = true;
141
+ }
142
+ }
143
+ };
144
+ async function namedTemporaryFile(options) {
145
+ return NamedTemporaryFile.create(options);
146
+ }
147
+ async function temporaryDirectory(options) {
148
+ return TemporaryDirectory.create(options);
149
+ }
150
+ function gettempprefix() {
151
+ return "tmp";
152
+ }
153
+
154
+ export {
155
+ gettempdir,
156
+ mktemp,
157
+ mkstemp,
158
+ mkdtemp,
159
+ NamedTemporaryFile,
160
+ TemporaryDirectory,
161
+ namedTemporaryFile,
162
+ temporaryDirectory,
163
+ gettempprefix,
164
+ tempfile_node_exports
165
+ };
@@ -0,0 +1,82 @@
1
+ import {
2
+ __export
3
+ } from "./chunk-MLKGABMK.js";
4
+
5
+ // src/shutil.browser.ts
6
+ var shutil_browser_exports = {};
7
+ __export(shutil_browser_exports, {
8
+ copy: () => copy,
9
+ copy2: () => copy2,
10
+ copyFile: () => copyFile,
11
+ copyFileObj: () => copyFileObj,
12
+ copyMode: () => copyMode,
13
+ copyStat: () => copyStat,
14
+ copytree: () => copytree,
15
+ diskUsage: () => diskUsage,
16
+ getTerminalSize: () => getTerminalSize,
17
+ makeArchive: () => makeArchive,
18
+ move: () => move,
19
+ rmtree: () => rmtree,
20
+ unpackArchive: () => unpackArchive,
21
+ which: () => which
22
+ });
23
+ async function copy(_src, _dst) {
24
+ throw new Error("shutil.copy is not supported in browser environment");
25
+ }
26
+ async function copy2(_src, _dst) {
27
+ throw new Error("shutil.copy2 is not supported in browser environment");
28
+ }
29
+ async function copytree(_src, _dst, _options) {
30
+ throw new Error("shutil.copytree is not supported in browser environment");
31
+ }
32
+ async function move(_src, _dst) {
33
+ throw new Error("shutil.move is not supported in browser environment");
34
+ }
35
+ async function rmtree(_path, _ignoreErrors = false) {
36
+ throw new Error("shutil.rmtree is not supported in browser environment");
37
+ }
38
+ async function which(_cmd, _mode, _path) {
39
+ return null;
40
+ }
41
+ async function diskUsage(_path) {
42
+ throw new Error("shutil.diskUsage is not supported in browser environment");
43
+ }
44
+ async function copyMode(_src, _dst) {
45
+ }
46
+ async function copyStat(_src, _dst) {
47
+ }
48
+ async function copyFile(_src, _dst) {
49
+ throw new Error("shutil.copyFile is not supported in browser environment");
50
+ }
51
+ async function copyFileObj(_fsrc, _fdst, _length) {
52
+ throw new Error("shutil.copyFileObj is not supported in browser environment");
53
+ }
54
+ function getTerminalSize(fallback) {
55
+ const [columns, lines] = fallback ?? [80, 24];
56
+ return { columns, lines };
57
+ }
58
+ function makeArchive(_baseName, _format, _rootDir) {
59
+ throw new Error("makeArchive is not supported in browser environment");
60
+ }
61
+ function unpackArchive(_filename, _extractDir) {
62
+ throw new Error("unpackArchive is not supported in browser environment");
63
+ }
64
+
65
+ export {
66
+ copy,
67
+ copy2,
68
+ copytree,
69
+ move,
70
+ rmtree,
71
+ which,
72
+ diskUsage,
73
+ copyMode,
74
+ copyStat,
75
+ copyFile,
76
+ copyFileObj,
77
+ getTerminalSize,
78
+ makeArchive,
79
+ unpackArchive,
80
+ shutil_browser_exports
81
+ };
82
+ /* v8 ignore start -- browser stubs @preserve */
@@ -1,9 +1,12 @@
1
1
  /**
2
2
  * Python collections module for TypeScript
3
3
  *
4
- * Provides specialized container datatypes.
4
+ * Provides specialized container datatypes including Counter for counting
5
+ * hashable objects, defaultdict for dictionaries with default values, and
6
+ * deque for double-ended queues.
5
7
  *
6
8
  * @see {@link https://docs.python.org/3/library/collections.html | Python collections documentation}
9
+ * @module
7
10
  */
8
11
  /**
9
12
  * Counter: a dict subclass for counting hashable objects
@@ -23,6 +26,7 @@ declare class Counter<T> extends Map<T, number> {
23
26
  /**
24
27
  * List the n most common elements and their counts
25
28
  * If n is undefined, list all elements from most common to least
29
+ * Uses ES2023 Array.prototype.toSorted() for immutable sorting
26
30
  */
27
31
  mostCommon(n?: number): [T, number][];
28
32
  /**
@@ -1 +1 @@
1
- export { C as Counter, d as defaultdict, a as deque } from './collections-CJur5Wg-.js';
1
+ export { C as Counter, d as defaultdict, a as deque } from './collections-BthXtkEp.js';
@@ -2,11 +2,10 @@ import {
2
2
  Counter,
3
3
  defaultdict,
4
4
  deque
5
- } from "./chunk-6ZAJ37MR.js";
6
- import "./chunk-PZ5AY32C.js";
5
+ } from "./chunk-MFKIEN7N.js";
6
+ import "./chunk-MLKGABMK.js";
7
7
  export {
8
8
  Counter,
9
9
  defaultdict,
10
10
  deque
11
11
  };
12
- //# sourceMappingURL=collections.js.map
@@ -0,0 +1,59 @@
1
+ /**
2
+ * Python copy module for TypeScript
3
+ *
4
+ * Provides shallow and deep copy operations.
5
+ *
6
+ * @see {@link https://docs.python.org/3/library/copy.html | Python copy documentation}
7
+ * @module
8
+ */
9
+ /**
10
+ * Create a shallow copy of an object.
11
+ *
12
+ * For primitive types, returns the value as-is.
13
+ * For arrays, returns a new array with the same elements.
14
+ * For objects, returns a new object with the same properties.
15
+ * For Maps and Sets, returns new instances with the same entries.
16
+ *
17
+ * @param x - The object to copy
18
+ * @returns A shallow copy of x
19
+ *
20
+ * @example
21
+ * ```typescript
22
+ * const original = [1, [2, 3], 4]
23
+ * const copied = copy(original)
24
+ * copied[0] = 99
25
+ * console.log(original[0]) // 1 (unchanged)
26
+ * copied[1][0] = 99
27
+ * console.log(original[1][0]) // 99 (nested array is shared)
28
+ * ```
29
+ */
30
+ declare function copy<T>(x: T): T;
31
+ /**
32
+ * Create a deep copy of an object.
33
+ *
34
+ * Creates a complete independent copy of the object and all nested objects.
35
+ * Uses structuredClone when available, with a fallback for older environments.
36
+ *
37
+ * Note: Functions cannot be deep copied and will be shared between copies.
38
+ *
39
+ * @param x - The object to deep copy
40
+ * @param memo - Internal map for circular reference handling (optional)
41
+ * @returns A deep copy of x
42
+ *
43
+ * @example
44
+ * ```typescript
45
+ * const original = { a: 1, b: { c: 2 } }
46
+ * const copied = deepcopy(original)
47
+ * copied.b.c = 99
48
+ * console.log(original.b.c) // 2 (unchanged)
49
+ * ```
50
+ */
51
+ declare function deepcopy<T>(x: T, memo?: Map<unknown, unknown>): T;
52
+
53
+ declare const copyModule_copy: typeof copy;
54
+ declare const copyModule_deepcopy: typeof deepcopy;
55
+ declare namespace copyModule {
56
+ export { copyModule_copy as copy, copyModule_deepcopy as deepcopy };
57
+ }
58
+
59
+ export { copy as a, copyModule as c, deepcopy as d };
package/dist/copy.d.ts ADDED
@@ -0,0 +1 @@
1
+ export { a as copy, d as deepcopy } from './copy-6ZaZ__ge.js';
package/dist/copy.js ADDED
@@ -0,0 +1,9 @@
1
+ import {
2
+ copy,
3
+ deepcopy
4
+ } from "./chunk-LTXTS7RP.js";
5
+ import "./chunk-MLKGABMK.js";
6
+ export {
7
+ copy,
8
+ deepcopy
9
+ };
@@ -1,9 +1,11 @@
1
1
  /**
2
2
  * Python datetime module for TypeScript
3
3
  *
4
- * Provides date and time handling matching Python's datetime module.
4
+ * Provides date and time handling matching Python's datetime module,
5
+ * including date, time, datetime, and timedelta classes.
5
6
  *
6
7
  * @see {@link https://docs.python.org/3/library/datetime.html | Python datetime documentation}
8
+ * @module
7
9
  */
8
10
  declare class timedelta {
9
11
  readonly days: number;
@@ -1 +1 @@
1
- export { f as MAXYEAR, M as MINYEAR, a as date, c as datetime, s as strftime, e as strptime, b as time, t as timedelta } from './datetime-Bpce8gG2.js';
1
+ export { f as MAXYEAR, M as MINYEAR, a as date, c as datetime, s as strftime, e as strptime, b as time, t as timedelta } from './datetime-BM_IjhTq.js';