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,245 @@
1
+ /**
2
+ * Python time module for TypeScript
3
+ *
4
+ * Provides time-related functions including time access, conversions,
5
+ * and formatting. Note that `sleep()` uses a synchronous busy-wait
6
+ * which blocks the event loop.
7
+ *
8
+ * @see {@link https://docs.python.org/3/library/time.html | Python time documentation}
9
+ * @module
10
+ */
11
+ /**
12
+ * Structure representing a time tuple, similar to Python's struct_time.
13
+ */
14
+ interface StructTime {
15
+ /** Year (e.g., 2023) */
16
+ tm_year: number;
17
+ /** Month (1-12) */
18
+ tm_mon: number;
19
+ /** Day of month (1-31) */
20
+ tm_mday: number;
21
+ /** Hour (0-23) */
22
+ tm_hour: number;
23
+ /** Minute (0-59) */
24
+ tm_min: number;
25
+ /** Second (0-61, allowing for leap seconds) */
26
+ tm_sec: number;
27
+ /** Day of week (0-6, Monday is 0) */
28
+ tm_wday: number;
29
+ /** Day of year (1-366) */
30
+ tm_yday: number;
31
+ /** DST flag (-1, 0, or 1) */
32
+ tm_isdst: number;
33
+ }
34
+ /**
35
+ * Return the time in seconds since the epoch as a floating point number.
36
+ *
37
+ * @returns Seconds since Unix epoch (January 1, 1970)
38
+ *
39
+ * @example
40
+ * ```typescript
41
+ * console.log(time()) // 1704067200.123
42
+ * ```
43
+ */
44
+ declare function time(): number;
45
+ /**
46
+ * Return the time in nanoseconds since the epoch as a BigInt.
47
+ *
48
+ * @returns Nanoseconds since Unix epoch
49
+ *
50
+ * @example
51
+ * ```typescript
52
+ * console.log(timeNs()) // 1704067200123456789n
53
+ * ```
54
+ */
55
+ declare function timeNs(): bigint;
56
+ /**
57
+ * Suspend execution for the given number of seconds.
58
+ * WARNING: This uses a synchronous busy-wait that blocks the event loop.
59
+ *
60
+ * @param secs - Number of seconds to sleep (can be fractional)
61
+ *
62
+ * @example
63
+ * ```typescript
64
+ * sleep(0.5) // Sleep for 500 milliseconds
65
+ * ```
66
+ */
67
+ declare function sleep(secs: number): void;
68
+ /**
69
+ * Return the value of a performance counter (monotonic clock).
70
+ * Uses performance.now() for high precision.
71
+ *
72
+ * @returns Seconds as a float (relative to an undefined reference point)
73
+ *
74
+ * @example
75
+ * ```typescript
76
+ * const start = perfCounter()
77
+ * // ... do work ...
78
+ * const elapsed = perfCounter() - start
79
+ * ```
80
+ */
81
+ declare function perfCounter(): number;
82
+ /**
83
+ * Return the value of a performance counter in nanoseconds.
84
+ *
85
+ * @returns Nanoseconds as a BigInt (relative to an undefined reference point)
86
+ */
87
+ declare function perfCounterNs(): bigint;
88
+ /**
89
+ * Return the value of a monotonic clock.
90
+ * This clock cannot go backwards and is not affected by system clock updates.
91
+ *
92
+ * @returns Seconds as a float (relative to an undefined reference point)
93
+ */
94
+ declare function monotonic(): number;
95
+ /**
96
+ * Return the value of a monotonic clock in nanoseconds.
97
+ *
98
+ * @returns Nanoseconds as a BigInt
99
+ */
100
+ declare function monotonicNs(): bigint;
101
+ /**
102
+ * Convert seconds since epoch to a StructTime in local time.
103
+ *
104
+ * @param secs - Seconds since epoch (defaults to current time)
105
+ * @returns StructTime object representing local time
106
+ *
107
+ * @example
108
+ * ```typescript
109
+ * const t = localtime()
110
+ * console.log(t.tm_year, t.tm_mon, t.tm_mday)
111
+ * ```
112
+ */
113
+ declare function localtime(secs?: number): StructTime;
114
+ /**
115
+ * Convert seconds since epoch to a StructTime in UTC.
116
+ *
117
+ * @param secs - Seconds since epoch (defaults to current time)
118
+ * @returns StructTime object representing UTC time
119
+ */
120
+ declare function gmtime(secs?: number): StructTime;
121
+ /**
122
+ * Convert a StructTime to seconds since epoch (inverse of localtime).
123
+ *
124
+ * @param t - StructTime object
125
+ * @returns Seconds since epoch as a float
126
+ */
127
+ declare function mktime(t: StructTime): number;
128
+ /**
129
+ * Format a StructTime as a string using strftime-style format codes.
130
+ *
131
+ * Supported format codes:
132
+ * - %Y: Year with century (e.g., 2023)
133
+ * - %y: Year without century (00-99)
134
+ * - %m: Month (01-12)
135
+ * - %d: Day of month (01-31)
136
+ * - %H: Hour 24-hour (00-23)
137
+ * - %I: Hour 12-hour (01-12)
138
+ * - %M: Minute (00-59)
139
+ * - %S: Second (00-61)
140
+ * - %p: AM or PM
141
+ * - %A: Full weekday name
142
+ * - %a: Abbreviated weekday name
143
+ * - %B: Full month name
144
+ * - %b: Abbreviated month name
145
+ * - %w: Weekday as decimal (0-6, Sunday is 0)
146
+ * - %j: Day of year (001-366)
147
+ * - %U: Week number of year (Sunday first day)
148
+ * - %W: Week number of year (Monday first day)
149
+ * - %c: Locale's date and time representation
150
+ * - %x: Locale's date representation
151
+ * - %X: Locale's time representation
152
+ * - %%: Literal %
153
+ *
154
+ * @param format - Format string
155
+ * @param t - StructTime object (defaults to current local time)
156
+ * @returns Formatted time string
157
+ */
158
+ declare function strftime(format: string, t?: StructTime): string;
159
+ /**
160
+ * Parse a string according to a format and return a StructTime.
161
+ *
162
+ * @param timeString - String to parse
163
+ * @param format - Format string (same codes as strftime)
164
+ * @returns StructTime object
165
+ * @throws Error if string doesn't match format
166
+ */
167
+ declare function strptime(timeString: string, format: string): StructTime;
168
+ /**
169
+ * Convert a StructTime to a string in the format: "Dow Mon dd hh:mm:ss yyyy"
170
+ *
171
+ * @param t - StructTime object (defaults to current local time)
172
+ * @returns Formatted time string
173
+ */
174
+ declare function asctime(t?: StructTime): string;
175
+ /**
176
+ * Convert seconds since epoch to a string (equivalent to asctime(localtime(secs)))
177
+ *
178
+ * @param secs - Seconds since epoch (defaults to current time)
179
+ * @returns Formatted time string
180
+ */
181
+ declare function ctime(secs?: number): string;
182
+ /**
183
+ * Return the offset of the local timezone from UTC in seconds.
184
+ * Positive values mean west of UTC, negative mean east.
185
+ */
186
+ declare const timezone: number;
187
+ /**
188
+ * Return the offset of the local timezone from UTC in seconds during DST.
189
+ * This is the same as timezone on systems that don't have DST.
190
+ */
191
+ declare const altzone: number;
192
+ /**
193
+ * Return a tuple of two strings: standard timezone name and DST timezone name.
194
+ */
195
+ declare const tzname: [string, string];
196
+ /**
197
+ * True if DST is defined for the local timezone.
198
+ */
199
+ declare const daylight = 0;
200
+ /**
201
+ * Return the process time as a float (CPU time used by the process).
202
+ * In JavaScript, this approximates using Date.now().
203
+ */
204
+ declare function processTime(): number;
205
+ /**
206
+ * Return the process time in nanoseconds.
207
+ */
208
+ declare function processTimeNs(): bigint;
209
+ /**
210
+ * Return the current thread's CPU time (same as processTime in JavaScript).
211
+ */
212
+ declare function threadTime(): number;
213
+ /**
214
+ * Return the current thread's CPU time in nanoseconds.
215
+ */
216
+ declare function threadTimeNs(): bigint;
217
+
218
+ type timeModule_StructTime = StructTime;
219
+ declare const timeModule_altzone: typeof altzone;
220
+ declare const timeModule_asctime: typeof asctime;
221
+ declare const timeModule_ctime: typeof ctime;
222
+ declare const timeModule_daylight: typeof daylight;
223
+ declare const timeModule_gmtime: typeof gmtime;
224
+ declare const timeModule_localtime: typeof localtime;
225
+ declare const timeModule_mktime: typeof mktime;
226
+ declare const timeModule_monotonic: typeof monotonic;
227
+ declare const timeModule_monotonicNs: typeof monotonicNs;
228
+ declare const timeModule_perfCounter: typeof perfCounter;
229
+ declare const timeModule_perfCounterNs: typeof perfCounterNs;
230
+ declare const timeModule_processTime: typeof processTime;
231
+ declare const timeModule_processTimeNs: typeof processTimeNs;
232
+ declare const timeModule_sleep: typeof sleep;
233
+ declare const timeModule_strftime: typeof strftime;
234
+ declare const timeModule_strptime: typeof strptime;
235
+ declare const timeModule_threadTime: typeof threadTime;
236
+ declare const timeModule_threadTimeNs: typeof threadTimeNs;
237
+ declare const timeModule_time: typeof time;
238
+ declare const timeModule_timeNs: typeof timeNs;
239
+ declare const timeModule_timezone: typeof timezone;
240
+ declare const timeModule_tzname: typeof tzname;
241
+ declare namespace timeModule {
242
+ export { type timeModule_StructTime as StructTime, timeModule_altzone as altzone, timeModule_asctime as asctime, timeModule_ctime as ctime, timeModule_daylight as daylight, timeModule_gmtime as gmtime, timeModule_localtime as localtime, timeModule_mktime as mktime, timeModule_monotonic as monotonic, timeModule_monotonicNs as monotonicNs, timeModule_perfCounter as perfCounter, timeModule_perfCounterNs as perfCounterNs, timeModule_processTime as processTime, timeModule_processTimeNs as processTimeNs, timeModule_sleep as sleep, timeModule_strftime as strftime, timeModule_strptime as strptime, timeModule_threadTime as threadTime, timeModule_threadTimeNs as threadTimeNs, timeModule_time as time, timeModule_timeNs as timeNs, timeModule_timezone as timezone, timeModule_tzname as tzname };
243
+ }
244
+
245
+ export { type StructTime as S, time as a, timeNs as b, perfCounterNs as c, monotonicNs as d, mktime as e, strftime as f, gmtime as g, strptime as h, asctime as i, ctime as j, timezone as k, localtime as l, monotonic as m, altzone as n, tzname as o, perfCounter as p, daylight as q, processTime as r, sleep as s, timeModule as t, processTimeNs as u, threadTime as v, threadTimeNs as w };
package/dist/time.d.ts ADDED
@@ -0,0 +1 @@
1
+ export { S as StructTime, n as altzone, i as asctime, j as ctime, q as daylight, g as gmtime, l as localtime, e as mktime, m as monotonic, d as monotonicNs, p as perfCounter, c as perfCounterNs, r as processTime, u as processTimeNs, s as sleep, f as strftime, h as strptime, v as threadTime, w as threadTimeNs, a as time, b as timeNs, k as timezone, o as tzname } from './time-CcYhdiSu.js';
package/dist/time.js ADDED
@@ -0,0 +1,49 @@
1
+ import {
2
+ altzone,
3
+ asctime,
4
+ ctime,
5
+ daylight,
6
+ gmtime,
7
+ localtime,
8
+ mktime,
9
+ monotonic,
10
+ monotonicNs,
11
+ perfCounter,
12
+ perfCounterNs,
13
+ processTime,
14
+ processTimeNs,
15
+ sleep,
16
+ strftime,
17
+ strptime,
18
+ threadTime,
19
+ threadTimeNs,
20
+ time,
21
+ timeNs,
22
+ timezone,
23
+ tzname
24
+ } from "./chunk-KKHKTQNN.js";
25
+ import "./chunk-MLKGABMK.js";
26
+ export {
27
+ altzone,
28
+ asctime,
29
+ ctime,
30
+ daylight,
31
+ gmtime,
32
+ localtime,
33
+ mktime,
34
+ monotonic,
35
+ monotonicNs,
36
+ perfCounter,
37
+ perfCounterNs,
38
+ processTime,
39
+ processTimeNs,
40
+ sleep,
41
+ strftime,
42
+ strptime,
43
+ threadTime,
44
+ threadTimeNs,
45
+ time,
46
+ timeNs,
47
+ timezone,
48
+ tzname
49
+ };
@@ -0,0 +1,198 @@
1
+ /**
2
+ * Python urllib module for TypeScript
3
+ *
4
+ * Provides URL handling and parsing utilities.
5
+ *
6
+ * @see {@link https://docs.python.org/3/library/urllib.html | Python urllib documentation}
7
+ * @module
8
+ */
9
+ /**
10
+ * Parsed URL result structure.
11
+ */
12
+ interface ParseResult {
13
+ /** URL scheme (e.g., "http", "https") */
14
+ scheme: string;
15
+ /** Network location (e.g., "example.com:8080") */
16
+ netloc: string;
17
+ /** URL path */
18
+ path: string;
19
+ /** Query parameters (without leading ?) */
20
+ params: string;
21
+ /** Query string (without leading ?) */
22
+ query: string;
23
+ /** Fragment (without leading #) */
24
+ fragment: string;
25
+ /** Username if present */
26
+ username: string | null;
27
+ /** Password if present */
28
+ password: string | null;
29
+ /** Hostname */
30
+ hostname: string | null;
31
+ /** Port number */
32
+ port: number | null;
33
+ }
34
+ /**
35
+ * Parse a URL into its components.
36
+ *
37
+ * @param urlstring - The URL to parse
38
+ * @param scheme - Default scheme if not present in URL
39
+ * @param allowFragments - Whether to parse fragments (default: true)
40
+ * @returns Parsed URL components
41
+ *
42
+ * @example
43
+ * ```typescript
44
+ * const result = urlparse("https://user:pass@example.com:8080/path?query=1#frag")
45
+ * console.log(result.scheme) // "https"
46
+ * console.log(result.hostname) // "example.com"
47
+ * console.log(result.port) // 8080
48
+ * ```
49
+ */
50
+ declare function urlparse(urlstring: string, scheme?: string, allowFragments?: boolean): ParseResult;
51
+ /**
52
+ * Combine URL components back into a URL string.
53
+ *
54
+ * @param components - URL components tuple [scheme, netloc, path, params, query, fragment]
55
+ * @returns Combined URL string
56
+ */
57
+ declare function urlunparse(components: [string, string, string, string, string, string] | ParseResult): string;
58
+ /**
59
+ * Join a base URL with another URL.
60
+ *
61
+ * @param base - Base URL
62
+ * @param url - URL to join (can be relative)
63
+ * @param allowFragments - Whether to allow fragments
64
+ * @returns Combined URL
65
+ */
66
+ declare function urljoin(base: string, url: string, allowFragments?: boolean): string;
67
+ /**
68
+ * Encode a dictionary or sequence of tuples as a query string.
69
+ *
70
+ * @param query - Query parameters as object or array of tuples
71
+ * @param doseq - If true, treat sequence values as separate parameters
72
+ * @returns URL-encoded query string
73
+ */
74
+ declare function urlencode(query: Record<string, string | string[]> | [string, string][], doseq?: boolean): string;
75
+ /**
76
+ * Parse a query string into a dictionary.
77
+ *
78
+ * @param qs - Query string to parse
79
+ * @param keepBlankValues - Whether to keep blank values
80
+ * @returns Object mapping keys to arrays of values
81
+ */
82
+ declare function parseQs(qs: string, keepBlankValues?: boolean): Record<string, string[]>;
83
+ /**
84
+ * Parse a query string into a dictionary (single values).
85
+ *
86
+ * @param qs - Query string to parse
87
+ * @param keepBlankValues - Whether to keep blank values
88
+ * @returns Object mapping keys to single values
89
+ */
90
+ declare function parseQsl(qs: string, keepBlankValues?: boolean): [string, string][];
91
+ /**
92
+ * Percent-encode a string for use in a URL.
93
+ *
94
+ * @param s - String to encode
95
+ * @param safe - Characters that should not be encoded (default: empty)
96
+ * @returns Percent-encoded string
97
+ */
98
+ declare function quote(s: string, safe?: string): string;
99
+ /**
100
+ * Like quote() but also encodes forward slashes.
101
+ *
102
+ * @param s - String to encode
103
+ * @param safe - Characters that should not be encoded
104
+ * @returns Percent-encoded string
105
+ */
106
+ declare function quotePlus(s: string, safe?: string): string;
107
+ /**
108
+ * Decode a percent-encoded string.
109
+ *
110
+ * @param s - String to decode
111
+ * @returns Decoded string
112
+ */
113
+ declare function unquote(s: string): string;
114
+ /**
115
+ * Like unquote() but also decodes plus signs as spaces.
116
+ *
117
+ * @param s - String to decode
118
+ * @returns Decoded string
119
+ */
120
+ declare function unquotePlus(s: string): string;
121
+ /**
122
+ * Split a URL after the scheme into [scheme, rest].
123
+ *
124
+ * @param url - URL to split
125
+ * @returns Tuple of [scheme, rest]
126
+ */
127
+ declare function splittype(url: string): [string, string];
128
+ /**
129
+ * Split a URL after the host into [host, rest].
130
+ *
131
+ * @param url - URL to split
132
+ * @returns Tuple of [host, rest]
133
+ */
134
+ declare function splithost(url: string): [string | null, string];
135
+ /**
136
+ * Split a host into [user, host].
137
+ *
138
+ * @param host - Host string (may include user:pass@)
139
+ * @returns Tuple of [user, host]
140
+ */
141
+ declare function splituser(host: string): [string | null, string];
142
+ /**
143
+ * Split a user:pass into [user, password].
144
+ *
145
+ * @param user - User string (may include :pass)
146
+ * @returns Tuple of [user, password]
147
+ */
148
+ declare function splitpasswd(user: string): [string, string | null];
149
+ /**
150
+ * Split a host:port into [host, port].
151
+ *
152
+ * @param host - Host string (may include :port)
153
+ * @returns Tuple of [host, port]
154
+ */
155
+ declare function splitport(host: string): [string, string | null];
156
+ /**
157
+ * Namespace object for parse functions (urllib.parse compatibility).
158
+ */
159
+ declare const parse: {
160
+ urlparse: typeof urlparse;
161
+ urlunparse: typeof urlunparse;
162
+ urljoin: typeof urljoin;
163
+ urlencode: typeof urlencode;
164
+ parseQs: typeof parseQs;
165
+ parseQsl: typeof parseQsl;
166
+ quote: typeof quote;
167
+ quotePlus: typeof quotePlus;
168
+ unquote: typeof unquote;
169
+ unquotePlus: typeof unquotePlus;
170
+ splittype: typeof splittype;
171
+ splithost: typeof splithost;
172
+ splituser: typeof splituser;
173
+ splitpasswd: typeof splitpasswd;
174
+ splitport: typeof splitport;
175
+ };
176
+
177
+ type urllibModule_ParseResult = ParseResult;
178
+ declare const urllibModule_parse: typeof parse;
179
+ declare const urllibModule_parseQs: typeof parseQs;
180
+ declare const urllibModule_parseQsl: typeof parseQsl;
181
+ declare const urllibModule_quote: typeof quote;
182
+ declare const urllibModule_quotePlus: typeof quotePlus;
183
+ declare const urllibModule_splithost: typeof splithost;
184
+ declare const urllibModule_splitpasswd: typeof splitpasswd;
185
+ declare const urllibModule_splitport: typeof splitport;
186
+ declare const urllibModule_splittype: typeof splittype;
187
+ declare const urllibModule_splituser: typeof splituser;
188
+ declare const urllibModule_unquote: typeof unquote;
189
+ declare const urllibModule_unquotePlus: typeof unquotePlus;
190
+ declare const urllibModule_urlencode: typeof urlencode;
191
+ declare const urllibModule_urljoin: typeof urljoin;
192
+ declare const urllibModule_urlparse: typeof urlparse;
193
+ declare const urllibModule_urlunparse: typeof urlunparse;
194
+ declare namespace urllibModule {
195
+ export { type urllibModule_ParseResult as ParseResult, urllibModule_parse as parse, urllibModule_parseQs as parseQs, urllibModule_parseQsl as parseQsl, urllibModule_quote as quote, urllibModule_quotePlus as quotePlus, urllibModule_splithost as splithost, urllibModule_splitpasswd as splitpasswd, urllibModule_splitport as splitport, urllibModule_splittype as splittype, urllibModule_splituser as splituser, urllibModule_unquote as unquote, urllibModule_unquotePlus as unquotePlus, urllibModule_urlencode as urlencode, urllibModule_urljoin as urljoin, urllibModule_urlparse as urlparse, urllibModule_urlunparse as urlunparse };
196
+ }
197
+
198
+ export { type ParseResult as P, urlparse as a, urlunparse as b, urljoin as c, urlencode as d, parseQsl as e, quotePlus as f, unquote as g, unquotePlus as h, splithost as i, splituser as j, splitpasswd as k, splitport as l, parse as m, parseQs as p, quote as q, splittype as s, urllibModule as u };
@@ -0,0 +1 @@
1
+ export { P as ParseResult, m as parse, p as parseQs, e as parseQsl, q as quote, f as quotePlus, i as splithost, k as splitpasswd, l as splitport, s as splittype, j as splituser, g as unquote, h as unquotePlus, d as urlencode, c as urljoin, a as urlparse, b as urlunparse } from './urllib-DJtkj-0f.js';
package/dist/urllib.js ADDED
@@ -0,0 +1,37 @@
1
+ import {
2
+ parse,
3
+ parseQs,
4
+ parseQsl,
5
+ quote,
6
+ quotePlus,
7
+ splithost,
8
+ splitpasswd,
9
+ splitport,
10
+ splittype,
11
+ splituser,
12
+ unquote,
13
+ unquotePlus,
14
+ urlencode,
15
+ urljoin,
16
+ urlparse,
17
+ urlunparse
18
+ } from "./chunk-IANXD4D4.js";
19
+ import "./chunk-MLKGABMK.js";
20
+ export {
21
+ parse,
22
+ parseQs,
23
+ parseQsl,
24
+ quote,
25
+ quotePlus,
26
+ splithost,
27
+ splitpasswd,
28
+ splitport,
29
+ splittype,
30
+ splituser,
31
+ unquote,
32
+ unquotePlus,
33
+ urlencode,
34
+ urljoin,
35
+ urlparse,
36
+ urlunparse
37
+ };
@@ -0,0 +1,160 @@
1
+ /**
2
+ * Python uuid module for TypeScript
3
+ *
4
+ * Provides UUID objects as specified in RFC 4122.
5
+ *
6
+ * @see {@link https://docs.python.org/3/library/uuid.html | Python uuid documentation}
7
+ * @module
8
+ */
9
+ /**
10
+ * UUID class representing a universally unique identifier.
11
+ */
12
+ declare class UUID {
13
+ private readonly _bytes;
14
+ /** Helper to safely get byte at index */
15
+ private getByte;
16
+ /**
17
+ * Create a UUID from various input formats.
18
+ *
19
+ * @param hex - Hexadecimal string (with or without hyphens)
20
+ * @param bytes - 16 bytes as Uint8Array
21
+ * @param int - Integer value
22
+ */
23
+ constructor(options: {
24
+ hex: string;
25
+ } | {
26
+ bytes: Uint8Array;
27
+ } | {
28
+ int: bigint;
29
+ } | string);
30
+ /**
31
+ * The UUID as a 32-character lowercase hexadecimal string.
32
+ */
33
+ get hex(): string;
34
+ /**
35
+ * The UUID as a 16-byte Uint8Array.
36
+ */
37
+ get bytes(): Uint8Array;
38
+ /**
39
+ * The UUID as a 128-bit integer.
40
+ */
41
+ get int(): bigint;
42
+ /**
43
+ * The version number (1 through 5, as an integer).
44
+ */
45
+ get version(): number;
46
+ /**
47
+ * The variant (reserved bits).
48
+ */
49
+ get variant(): string;
50
+ /**
51
+ * The UUID as a hyphenated string (xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx).
52
+ */
53
+ toString(): string;
54
+ /**
55
+ * The UUID as a URN (urn:uuid:xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx).
56
+ */
57
+ get urn(): string;
58
+ /**
59
+ * Compare UUIDs for equality.
60
+ */
61
+ equals(other: UUID): boolean;
62
+ /**
63
+ * Get the time_low field (first 32 bits).
64
+ */
65
+ get timeLow(): number;
66
+ /**
67
+ * Get the time_mid field (next 16 bits).
68
+ */
69
+ get timeMid(): number;
70
+ /**
71
+ * Get the time_hi_version field (next 16 bits).
72
+ */
73
+ get timeHiVersion(): number;
74
+ /**
75
+ * Get the clock_seq_hi_variant field.
76
+ */
77
+ get clockSeqHiVariant(): number;
78
+ /**
79
+ * Get the clock_seq_low field.
80
+ */
81
+ get clockSeqLow(): number;
82
+ /**
83
+ * Get the node field (last 48 bits).
84
+ */
85
+ get node(): bigint;
86
+ }
87
+ /**
88
+ * Generate a random UUID (version 4).
89
+ *
90
+ * Uses crypto.randomUUID() when available, otherwise falls back to
91
+ * crypto.getRandomValues().
92
+ *
93
+ * @returns A new random UUID
94
+ *
95
+ * @example
96
+ * ```typescript
97
+ * const id = uuid4()
98
+ * console.log(id.toString()) // "550e8400-e29b-41d4-a716-446655440000"
99
+ * ```
100
+ */
101
+ declare function uuid4(): UUID;
102
+ /**
103
+ * Generate a UUID based on host ID and current time (version 1).
104
+ *
105
+ * Note: In browser environments, the node ID is randomly generated
106
+ * since MAC addresses are not accessible.
107
+ *
108
+ * @param node - Optional 48-bit node ID (defaults to random)
109
+ * @param clockSeq - Optional 14-bit clock sequence (defaults to random)
110
+ * @returns A new time-based UUID
111
+ */
112
+ declare function uuid1(node?: bigint, clockSeq?: number): UUID;
113
+ /**
114
+ * Generate a UUID based on the MD5 hash of a namespace identifier and a name (version 3).
115
+ *
116
+ * @param namespace - The namespace UUID
117
+ * @param name - The name string
118
+ * @returns A new name-based UUID using MD5
119
+ */
120
+ declare function uuid3(_namespace: UUID, _name: string): UUID;
121
+ /**
122
+ * Generate a UUID based on the SHA-1 hash of a namespace identifier and a name (version 5).
123
+ *
124
+ * @param namespace - The namespace UUID
125
+ * @param name - The name string
126
+ * @returns A new name-based UUID using SHA-1
127
+ */
128
+ declare function uuid5(_namespace: UUID, _name: string): UUID;
129
+ /**
130
+ * The namespace UUID for DNS domain names.
131
+ */
132
+ declare const NAMESPACE_DNS: UUID;
133
+ /**
134
+ * The namespace UUID for URLs.
135
+ */
136
+ declare const NAMESPACE_URL: UUID;
137
+ /**
138
+ * The namespace UUID for ISO OIDs.
139
+ */
140
+ declare const NAMESPACE_OID: UUID;
141
+ /**
142
+ * The namespace UUID for X.500 DNs.
143
+ */
144
+ declare const NAMESPACE_X500: UUID;
145
+
146
+ declare const uuidModule_NAMESPACE_DNS: typeof NAMESPACE_DNS;
147
+ declare const uuidModule_NAMESPACE_OID: typeof NAMESPACE_OID;
148
+ declare const uuidModule_NAMESPACE_URL: typeof NAMESPACE_URL;
149
+ declare const uuidModule_NAMESPACE_X500: typeof NAMESPACE_X500;
150
+ type uuidModule_UUID = UUID;
151
+ declare const uuidModule_UUID: typeof UUID;
152
+ declare const uuidModule_uuid1: typeof uuid1;
153
+ declare const uuidModule_uuid3: typeof uuid3;
154
+ declare const uuidModule_uuid4: typeof uuid4;
155
+ declare const uuidModule_uuid5: typeof uuid5;
156
+ declare namespace uuidModule {
157
+ export { uuidModule_NAMESPACE_DNS as NAMESPACE_DNS, uuidModule_NAMESPACE_OID as NAMESPACE_OID, uuidModule_NAMESPACE_URL as NAMESPACE_URL, uuidModule_NAMESPACE_X500 as NAMESPACE_X500, uuidModule_UUID as UUID, uuidModule_uuid1 as uuid1, uuidModule_uuid3 as uuid3, uuidModule_uuid4 as uuid4, uuidModule_uuid5 as uuid5 };
158
+ }
159
+
160
+ export { NAMESPACE_DNS as N, UUID as U, uuid4 as a, uuid1 as b, uuid3 as c, uuid5 as d, NAMESPACE_URL as e, NAMESPACE_OID as f, NAMESPACE_X500 as g, uuidModule as u };
package/dist/uuid.d.ts ADDED
@@ -0,0 +1 @@
1
+ export { N as NAMESPACE_DNS, f as NAMESPACE_OID, e as NAMESPACE_URL, g as NAMESPACE_X500, U as UUID, b as uuid1, c as uuid3, a as uuid4, d as uuid5 } from './uuid-C0ypmn56.js';