pythonlib 1.0.1 → 1.0.2
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/dist/{chunk-6POEDI34.js → chunk-56DGFWIJ.js} +1 -1
- package/dist/chunk-56DGFWIJ.js.map +1 -0
- package/dist/{chunk-CXKGPD5D.js → chunk-5AOJFFYN.js} +1 -1
- package/dist/chunk-5AOJFFYN.js.map +1 -0
- package/dist/{chunk-H76SKASU.js → chunk-7BZB2TQF.js} +1 -1
- package/dist/chunk-7BZB2TQF.js.map +1 -0
- package/dist/{chunk-4QG3772L.js → chunk-CEZSBJJV.js} +1 -1
- package/dist/chunk-CEZSBJJV.js.map +1 -0
- package/dist/{chunk-HQ42WNKZ.js → chunk-CUP6EPDB.js} +1 -1
- package/dist/chunk-CUP6EPDB.js.map +1 -0
- package/dist/{chunk-4KYJT3DR.js → chunk-G6PUQTVZ.js} +1 -1
- package/dist/chunk-G6PUQTVZ.js.map +1 -0
- package/dist/{chunk-LWO6BIAD.js → chunk-OSX7QZAW.js} +1 -1
- package/dist/chunk-OSX7QZAW.js.map +1 -0
- package/dist/{chunk-EE7SK2GV.js → chunk-QURVRHY2.js} +1 -1
- package/dist/chunk-QURVRHY2.js.map +1 -0
- package/dist/{chunk-7TH4FCVQ.js → chunk-RSBRI27Z.js} +1 -1
- package/dist/chunk-RSBRI27Z.js.map +1 -0
- package/dist/{chunk-6ZAJ37MR.js → chunk-TAYRRHJ3.js} +3 -2
- package/dist/chunk-TAYRRHJ3.js.map +1 -0
- package/dist/{collections-CJur5Wg-.d.ts → collections-BthXtkEp.d.ts} +5 -1
- package/dist/collections.d.ts +1 -1
- package/dist/collections.js +1 -1
- package/dist/{datetime-Bpce8gG2.d.ts → datetime-BM_IjhTq.d.ts} +3 -1
- package/dist/datetime.d.ts +1 -1
- package/dist/datetime.js +1 -1
- package/dist/{functools-NrsZAqJk.d.ts → functools-uIa5g75p.d.ts} +3 -1
- package/dist/functools.d.ts +1 -1
- package/dist/functools.js +1 -1
- package/dist/index.d.ts +243 -53
- package/dist/index.js +39 -81
- package/dist/index.js.map +1 -1
- package/dist/{itertools-Sjl1LB_0.d.ts → itertools-T0rwOk2j.d.ts} +2 -4
- package/dist/itertools.d.ts +1 -1
- package/dist/itertools.js +1 -1
- package/dist/{json-DAlvCadU.d.ts → json-DoWhX04T.d.ts} +1 -0
- package/dist/json.d.ts +1 -1
- package/dist/json.js +1 -1
- package/dist/{math-DwEGjjQ-.d.ts → math-D2NPMc-x.d.ts} +2 -1
- package/dist/math.d.ts +1 -1
- package/dist/math.js +1 -1
- package/dist/{os-C6Nt7Ijx.d.ts → os-CqGKe872.d.ts} +3 -2
- package/dist/os.d.ts +1 -1
- package/dist/os.js +1 -1
- package/dist/{random-BJv_rSpL.d.ts → random-DcS5jtEs.d.ts} +3 -5
- package/dist/random.d.ts +1 -1
- package/dist/random.js +1 -1
- package/dist/{re-B1CHCgyr.d.ts → re-Bo-IOqov.d.ts} +3 -7
- package/dist/re.d.ts +1 -1
- package/dist/re.js +1 -1
- package/dist/string.d.ts +3 -1
- package/dist/string.js +1 -1
- package/package.json +1 -1
- package/dist/chunk-4KYJT3DR.js.map +0 -1
- package/dist/chunk-4QG3772L.js.map +0 -1
- package/dist/chunk-6POEDI34.js.map +0 -1
- package/dist/chunk-6ZAJ37MR.js.map +0 -1
- package/dist/chunk-7TH4FCVQ.js.map +0 -1
- package/dist/chunk-CXKGPD5D.js.map +0 -1
- package/dist/chunk-EE7SK2GV.js.map +0 -1
- package/dist/chunk-H76SKASU.js.map +0 -1
- package/dist/chunk-HQ42WNKZ.js.map +0 -1
- package/dist/chunk-LWO6BIAD.js.map +0 -1
|
@@ -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;
|
package/dist/datetime.d.ts
CHANGED
|
@@ -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-
|
|
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';
|
package/dist/datetime.js
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Python functools module for TypeScript
|
|
3
3
|
*
|
|
4
|
-
* Provides higher-order functions and operations on callable objects
|
|
4
|
+
* Provides higher-order functions and operations on callable objects,
|
|
5
|
+
* including partial application, function caching (lru_cache), and reduce.
|
|
5
6
|
*
|
|
6
7
|
* @see {@link https://docs.python.org/3/library/functools.html | Python functools documentation}
|
|
8
|
+
* @module
|
|
7
9
|
*/
|
|
8
10
|
/**
|
|
9
11
|
* Create a partial function application
|
package/dist/functools.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { b as attrGetter, c as cache, e as cmpToKey, d as identity, i as itemGetter, l as lruCache, m as methodCaller, p as partial, a as partialMethod, g as pipe, r as reduce, s as singleDispatch, t as totalOrdering, w as wraps } from './functools-
|
|
1
|
+
export { b as attrGetter, c as cache, e as cmpToKey, d as identity, i as itemGetter, l as lruCache, m as methodCaller, p as partial, a as partialMethod, g as pipe, r as reduce, s as singleDispatch, t as totalOrdering, w as wraps } from './functools-uIa5g75p.js';
|
package/dist/functools.js
CHANGED
package/dist/index.d.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { i as itertoolsModule } from './itertools-
|
|
2
|
-
import { f as functoolsModule } from './functools-
|
|
3
|
-
import { c as collectionsModule } from './collections-
|
|
4
|
-
import { m as mathModule } from './math-
|
|
5
|
-
import { r as randomModule } from './random-
|
|
6
|
-
import { j as jsonModule } from './json-
|
|
7
|
-
import { o as osModule } from './os-
|
|
8
|
-
import { d as datetimeModule } from './datetime-
|
|
9
|
-
import { r as reModule } from './re-
|
|
1
|
+
import { i as itertoolsModule } from './itertools-T0rwOk2j.js';
|
|
2
|
+
import { f as functoolsModule } from './functools-uIa5g75p.js';
|
|
3
|
+
import { c as collectionsModule } from './collections-BthXtkEp.js';
|
|
4
|
+
import { m as mathModule } from './math-D2NPMc-x.js';
|
|
5
|
+
import { r as randomModule } from './random-DcS5jtEs.js';
|
|
6
|
+
import { j as jsonModule } from './json-DoWhX04T.js';
|
|
7
|
+
import { o as osModule } from './os-CqGKe872.js';
|
|
8
|
+
import { d as datetimeModule } from './datetime-BM_IjhTq.js';
|
|
9
|
+
import { r as reModule } from './re-Bo-IOqov.js';
|
|
10
10
|
import { capWords, Template } from './string.js';
|
|
11
11
|
|
|
12
12
|
/**
|
|
@@ -71,138 +71,312 @@ declare function is$1(a: unknown, b: unknown): boolean;
|
|
|
71
71
|
* @see {@link https://docs.python.org/3/library/functions.html | Python built-in functions documentation}
|
|
72
72
|
*/
|
|
73
73
|
/**
|
|
74
|
-
*
|
|
74
|
+
* Return a sequence of numbers from start to stop (exclusive) by step.
|
|
75
|
+
*
|
|
76
|
+
* @param startOrStop - If only one argument, this is stop (start defaults to 0). Otherwise, this is start.
|
|
77
|
+
* @param stop - The end value (exclusive)
|
|
78
|
+
* @param step - The increment (default: 1)
|
|
79
|
+
* @returns An iterable of numbers
|
|
80
|
+
* @see {@link https://docs.python.org/3/library/functions.html#func-range | Python range()}
|
|
75
81
|
*/
|
|
76
82
|
declare function range$1(startOrStop: number, stop?: number, step?: number): Iterable<number>;
|
|
77
83
|
/**
|
|
78
|
-
*
|
|
84
|
+
* Return an iterable of tuples containing (index, value) pairs.
|
|
85
|
+
*
|
|
86
|
+
* @param iterable - The sequence to enumerate
|
|
87
|
+
* @param start - The starting index (default: 0)
|
|
88
|
+
* @returns An iterable of [index, value] tuples
|
|
89
|
+
* @see {@link https://docs.python.org/3/library/functions.html#enumerate | Python enumerate()}
|
|
79
90
|
*/
|
|
80
91
|
declare function enumerate$1<T>(iterable: Iterable<T>, start?: number): Iterable<[number, T]>;
|
|
81
92
|
/**
|
|
82
|
-
*
|
|
93
|
+
* Iterate over multiple iterables in parallel, yielding tuples.
|
|
94
|
+
*
|
|
95
|
+
* Stops when the shortest iterable is exhausted.
|
|
96
|
+
*
|
|
97
|
+
* @param iterables - The iterables to zip together
|
|
98
|
+
* @returns An iterable of tuples containing elements from each input
|
|
99
|
+
* @see {@link https://docs.python.org/3/library/functions.html#zip | Python zip()}
|
|
83
100
|
*/
|
|
84
101
|
declare function zip$1<T extends unknown[][]>(...iterables: {
|
|
85
102
|
[K in keyof T]: Iterable<T[K]>;
|
|
86
103
|
}): Iterable<T>;
|
|
87
104
|
/**
|
|
88
|
-
*
|
|
105
|
+
* Return an iterator object for the given iterable.
|
|
106
|
+
*
|
|
107
|
+
* For objects without Symbol.iterator, returns the object's keys.
|
|
108
|
+
*
|
|
109
|
+
* @param obj - The object to iterate over
|
|
110
|
+
* @returns An iterable
|
|
111
|
+
* @see {@link https://docs.python.org/3/library/functions.html#iter | Python iter()}
|
|
89
112
|
*/
|
|
90
113
|
declare function iter$1<T>(obj: Iterable<T> | Record<string, unknown> | null | undefined): Iterable<T> | string[];
|
|
91
114
|
/**
|
|
92
|
-
*
|
|
115
|
+
* Return a reversed iterator over the values of the given sequence.
|
|
116
|
+
*
|
|
117
|
+
* Uses ES2023 Array.prototype.toReversed() for immutable reversal.
|
|
118
|
+
*
|
|
119
|
+
* @param iterable - The sequence to reverse
|
|
120
|
+
* @returns An iterable yielding elements in reverse order
|
|
121
|
+
* @see {@link https://docs.python.org/3/library/functions.html#reversed | Python reversed()}
|
|
93
122
|
*/
|
|
94
123
|
declare function reversed$1<T>(iterable: Iterable<T>): Iterable<T>;
|
|
95
124
|
/**
|
|
96
|
-
*
|
|
125
|
+
* Return a new sorted list from the items in the iterable.
|
|
126
|
+
*
|
|
127
|
+
* Uses ES2023 Array.prototype.toSorted() for immutable sorting.
|
|
128
|
+
*
|
|
129
|
+
* @param iterable - The sequence to sort
|
|
130
|
+
* @param options - Sorting options: key function and/or reverse flag
|
|
131
|
+
* @returns A new sorted array
|
|
132
|
+
* @see {@link https://docs.python.org/3/library/functions.html#sorted | Python sorted()}
|
|
97
133
|
*/
|
|
98
134
|
declare function sorted$1<T>(iterable: Iterable<T>, options?: {
|
|
99
135
|
key?: (x: T) => unknown;
|
|
100
136
|
reverse?: boolean;
|
|
101
137
|
}): T[];
|
|
102
138
|
/**
|
|
103
|
-
*
|
|
139
|
+
* Apply a function to every item of the iterable and yield the results.
|
|
140
|
+
*
|
|
141
|
+
* Uses ES2024 Iterator.prototype.map() for lazy evaluation.
|
|
142
|
+
*
|
|
143
|
+
* @param fn - The function to apply to each element
|
|
144
|
+
* @param iterable - The input iterable
|
|
145
|
+
* @returns An iterable of transformed values
|
|
146
|
+
* @see {@link https://docs.python.org/3/library/functions.html#map | Python map()}
|
|
104
147
|
*/
|
|
105
148
|
declare function map$1<T, U>(fn: (x: T) => U, iterable: Iterable<T>): Iterable<U>;
|
|
106
149
|
/**
|
|
107
|
-
*
|
|
150
|
+
* Return an iterable yielding items where the function returns true.
|
|
151
|
+
*
|
|
152
|
+
* If function is null, return items that are truthy.
|
|
153
|
+
* Uses ES2024 Iterator.prototype.filter() for lazy evaluation.
|
|
154
|
+
*
|
|
155
|
+
* @param fn - The predicate function (or null for truthiness check)
|
|
156
|
+
* @param iterable - The input iterable
|
|
157
|
+
* @returns An iterable of filtered values
|
|
158
|
+
* @see {@link https://docs.python.org/3/library/functions.html#filter | Python filter()}
|
|
108
159
|
*/
|
|
109
160
|
declare function filter$1<T>(fn: ((x: T) => boolean) | null, iterable: Iterable<T>): Iterable<T>;
|
|
110
161
|
/**
|
|
111
|
-
* Create
|
|
162
|
+
* Create an immutable tuple (frozen array).
|
|
163
|
+
*
|
|
164
|
+
* @param items - The elements to include in the tuple
|
|
165
|
+
* @returns A frozen (readonly) array
|
|
166
|
+
* @see {@link https://docs.python.org/3/library/functions.html#func-tuple | Python tuple()}
|
|
112
167
|
*/
|
|
113
168
|
declare function tuple$1<T extends unknown[]>(...items: T): Readonly<T>;
|
|
114
169
|
/**
|
|
115
|
-
*
|
|
170
|
+
* Return the number of items in an object.
|
|
171
|
+
*
|
|
172
|
+
* Works with strings, arrays, Maps, Sets, and objects with a length property.
|
|
173
|
+
*
|
|
174
|
+
* @param obj - The object to measure
|
|
175
|
+
* @returns The number of items
|
|
176
|
+
* @see {@link https://docs.python.org/3/library/functions.html#len | Python len()}
|
|
116
177
|
*/
|
|
117
178
|
declare function len$1(obj: string | unknown[] | Map<unknown, unknown> | Set<unknown> | {
|
|
118
179
|
length: number;
|
|
119
180
|
}): number;
|
|
120
181
|
/**
|
|
121
|
-
*
|
|
182
|
+
* Return the absolute value of a number.
|
|
183
|
+
*
|
|
184
|
+
* @param x - The number
|
|
185
|
+
* @returns The absolute value
|
|
186
|
+
* @see {@link https://docs.python.org/3/library/functions.html#abs | Python abs()}
|
|
122
187
|
*/
|
|
123
188
|
declare function abs$1(x: number): number;
|
|
124
189
|
/**
|
|
125
|
-
*
|
|
190
|
+
* Return the smallest item in an iterable or the smallest of two or more arguments.
|
|
191
|
+
*
|
|
192
|
+
* @param args - An iterable, or multiple values to compare
|
|
193
|
+
* @returns The minimum value
|
|
194
|
+
* @see {@link https://docs.python.org/3/library/functions.html#min | Python min()}
|
|
126
195
|
*/
|
|
127
196
|
declare function min$1<T>(...args: T[] | [Iterable<T>]): T;
|
|
128
197
|
/**
|
|
129
|
-
*
|
|
198
|
+
* Return the largest item in an iterable or the largest of two or more arguments.
|
|
199
|
+
*
|
|
200
|
+
* @param args - An iterable, or multiple values to compare
|
|
201
|
+
* @returns The maximum value
|
|
202
|
+
* @see {@link https://docs.python.org/3/library/functions.html#max | Python max()}
|
|
130
203
|
*/
|
|
131
204
|
declare function max$1<T>(...args: T[] | [Iterable<T>]): T;
|
|
132
205
|
/**
|
|
133
|
-
*
|
|
206
|
+
* Return the sum of all items in the iterable plus an optional start value.
|
|
207
|
+
*
|
|
208
|
+
* @param iterable - The numbers to sum
|
|
209
|
+
* @param start - The initial value (default: 0)
|
|
210
|
+
* @returns The sum
|
|
211
|
+
* @see {@link https://docs.python.org/3/library/functions.html#sum | Python sum()}
|
|
134
212
|
*/
|
|
135
213
|
declare function sum$1(iterable: Iterable<number>, start?: number): number;
|
|
136
214
|
/**
|
|
137
|
-
*
|
|
215
|
+
* Return True if all elements of the iterable are truthy (or if empty).
|
|
216
|
+
*
|
|
217
|
+
* @param iterable - The elements to test
|
|
218
|
+
* @returns True if all elements are truthy
|
|
219
|
+
* @see {@link https://docs.python.org/3/library/functions.html#all | Python all()}
|
|
138
220
|
*/
|
|
139
221
|
declare function all$1(iterable: Iterable<unknown>): boolean;
|
|
140
222
|
/**
|
|
141
|
-
*
|
|
223
|
+
* Return True if any element of the iterable is truthy.
|
|
224
|
+
*
|
|
225
|
+
* @param iterable - The elements to test
|
|
226
|
+
* @returns True if any element is truthy
|
|
227
|
+
* @see {@link https://docs.python.org/3/library/functions.html#any | Python any()}
|
|
142
228
|
*/
|
|
143
229
|
declare function any$1(iterable: Iterable<unknown>): boolean;
|
|
144
230
|
/**
|
|
145
|
-
*
|
|
231
|
+
* Round a number to a given precision in decimal digits.
|
|
232
|
+
*
|
|
233
|
+
* Uses banker's rounding (round half to even) for values exactly halfway.
|
|
234
|
+
*
|
|
235
|
+
* @param number - The number to round
|
|
236
|
+
* @param ndigits - Number of decimal places (default: 0)
|
|
237
|
+
* @returns The rounded number
|
|
238
|
+
* @see {@link https://docs.python.org/3/library/functions.html#round | Python round()}
|
|
146
239
|
*/
|
|
147
240
|
declare function round$1(number: number, ndigits?: number): number;
|
|
148
241
|
/**
|
|
149
|
-
*
|
|
242
|
+
* Return the Unicode code point for a one-character string.
|
|
243
|
+
*
|
|
244
|
+
* @param char - A single character
|
|
245
|
+
* @returns The Unicode code point
|
|
246
|
+
* @see {@link https://docs.python.org/3/library/functions.html#ord | Python ord()}
|
|
150
247
|
*/
|
|
151
248
|
declare function ord$1(char: string): number;
|
|
152
249
|
/**
|
|
153
|
-
*
|
|
250
|
+
* Return the string representing a character at the given Unicode code point.
|
|
251
|
+
*
|
|
252
|
+
* @param code - The Unicode code point
|
|
253
|
+
* @returns A single-character string
|
|
254
|
+
* @see {@link https://docs.python.org/3/library/functions.html#chr | Python chr()}
|
|
154
255
|
*/
|
|
155
256
|
declare function chr$1(code: number): string;
|
|
156
257
|
/**
|
|
157
|
-
*
|
|
258
|
+
* Convert an integer to a lowercase hexadecimal string prefixed with "0x".
|
|
259
|
+
*
|
|
260
|
+
* @param x - The integer to convert
|
|
261
|
+
* @returns Hexadecimal string (e.g., "0xff")
|
|
262
|
+
* @see {@link https://docs.python.org/3/library/functions.html#hex | Python hex()}
|
|
158
263
|
*/
|
|
159
264
|
declare function hex$1(x: number): string;
|
|
160
265
|
/**
|
|
161
|
-
*
|
|
266
|
+
* Convert an integer to an octal string prefixed with "0o".
|
|
267
|
+
*
|
|
268
|
+
* @param x - The integer to convert
|
|
269
|
+
* @returns Octal string (e.g., "0o17")
|
|
270
|
+
* @see {@link https://docs.python.org/3/library/functions.html#oct | Python oct()}
|
|
162
271
|
*/
|
|
163
272
|
declare function oct$1(x: number): string;
|
|
164
273
|
/**
|
|
165
|
-
*
|
|
274
|
+
* Convert an integer to a binary string prefixed with "0b".
|
|
275
|
+
*
|
|
276
|
+
* @param x - The integer to convert
|
|
277
|
+
* @returns Binary string (e.g., "0b1010")
|
|
278
|
+
* @see {@link https://docs.python.org/3/library/functions.html#bin | Python bin()}
|
|
166
279
|
*/
|
|
167
280
|
declare function bin$1(x: number): string;
|
|
168
281
|
/**
|
|
169
|
-
*
|
|
282
|
+
* Convert a value to an integer.
|
|
283
|
+
*
|
|
284
|
+
* Truncates floats toward zero. Parses strings in the given base.
|
|
285
|
+
*
|
|
286
|
+
* @param x - The value to convert
|
|
287
|
+
* @param base - The base for string conversion (default: 10)
|
|
288
|
+
* @returns The integer value
|
|
289
|
+
* @see {@link https://docs.python.org/3/library/functions.html#int | Python int()}
|
|
170
290
|
*/
|
|
171
291
|
declare function int$1(x: string | number | boolean, base?: number): number;
|
|
172
292
|
/**
|
|
173
|
-
*
|
|
293
|
+
* Convert a value to a floating-point number.
|
|
294
|
+
*
|
|
295
|
+
* @param x - The value to convert
|
|
296
|
+
* @returns The float value
|
|
297
|
+
* @see {@link https://docs.python.org/3/library/functions.html#float | Python float()}
|
|
174
298
|
*/
|
|
175
299
|
declare function float$1(x: string | number): number;
|
|
176
300
|
/**
|
|
177
|
-
*
|
|
301
|
+
* Convert a value to its string representation.
|
|
302
|
+
*
|
|
303
|
+
* Uses Python-style formatting for booleans (True/False), None, and collections.
|
|
304
|
+
*
|
|
305
|
+
* @param x - The value to convert
|
|
306
|
+
* @returns The string representation
|
|
307
|
+
* @see {@link https://docs.python.org/3/library/functions.html#func-str | Python str()}
|
|
178
308
|
*/
|
|
179
309
|
declare function str$1(x: unknown): string;
|
|
180
310
|
/**
|
|
181
|
-
*
|
|
311
|
+
* Return a string containing a printable representation of an object.
|
|
312
|
+
*
|
|
313
|
+
* Strings are quoted, other types use str() representation.
|
|
314
|
+
*
|
|
315
|
+
* @param x - The value to represent
|
|
316
|
+
* @returns A printable representation
|
|
317
|
+
* @see {@link https://docs.python.org/3/library/functions.html#repr | Python repr()}
|
|
182
318
|
*/
|
|
183
319
|
declare function repr$1(x: unknown): string;
|
|
184
320
|
/**
|
|
185
|
-
* Python
|
|
321
|
+
* Convert a value to a boolean using Python's truthiness rules.
|
|
322
|
+
*
|
|
323
|
+
* False values: null, undefined, false, 0, empty strings, empty arrays, empty Maps/Sets.
|
|
324
|
+
*
|
|
325
|
+
* @param x - The value to convert
|
|
326
|
+
* @returns The boolean value
|
|
327
|
+
* @see {@link https://docs.python.org/3/library/functions.html#bool | Python bool()}
|
|
186
328
|
*/
|
|
187
329
|
declare function bool$1(x: unknown): boolean;
|
|
188
330
|
/**
|
|
189
|
-
*
|
|
331
|
+
* Return a string containing a printable ASCII representation.
|
|
332
|
+
*
|
|
333
|
+
* Non-ASCII characters are escaped using \\xhh, \\uhhhh, or \\Uhhhhhhhh.
|
|
334
|
+
*
|
|
335
|
+
* @param x - The value to represent
|
|
336
|
+
* @returns ASCII-safe printable representation
|
|
337
|
+
* @see {@link https://docs.python.org/3/library/functions.html#ascii | Python ascii()}
|
|
190
338
|
*/
|
|
191
339
|
declare function ascii$1(x: unknown): string;
|
|
192
340
|
/**
|
|
193
|
-
*
|
|
341
|
+
* Return True if the object is an instance of the specified class.
|
|
342
|
+
*
|
|
343
|
+
* Supports JavaScript constructors (Number, String, etc.) and Python type names.
|
|
344
|
+
*
|
|
345
|
+
* @param obj - The object to check
|
|
346
|
+
* @param classInfo - The class or type name to check against
|
|
347
|
+
* @returns True if obj is an instance of classInfo
|
|
348
|
+
* @see {@link https://docs.python.org/3/library/functions.html#isinstance | Python isinstance()}
|
|
194
349
|
*/
|
|
195
350
|
declare function isinstance$1(obj: unknown, classInfo: unknown): boolean;
|
|
196
351
|
/**
|
|
197
|
-
*
|
|
352
|
+
* Return the type name of an object as a string.
|
|
353
|
+
*
|
|
354
|
+
* Returns Python-style type names: 'int', 'float', 'str', 'bool', 'list', 'dict', 'set'.
|
|
355
|
+
*
|
|
356
|
+
* @param obj - The object to check
|
|
357
|
+
* @returns The type name
|
|
358
|
+
* @see {@link https://docs.python.org/3/library/functions.html#type | Python type()}
|
|
198
359
|
*/
|
|
199
360
|
declare function type$1(obj: unknown): string;
|
|
200
361
|
/**
|
|
201
|
-
*
|
|
362
|
+
* Read a line of input from the user.
|
|
363
|
+
*
|
|
364
|
+
* Note: This function requires async implementation in JavaScript environments.
|
|
365
|
+
*
|
|
366
|
+
* @param prompt - Optional prompt string to display
|
|
367
|
+
* @returns The input string
|
|
368
|
+
* @see {@link https://docs.python.org/3/library/functions.html#input | Python input()}
|
|
202
369
|
*/
|
|
203
370
|
declare function input$1(prompt?: string): string;
|
|
204
371
|
/**
|
|
205
|
-
*
|
|
372
|
+
* Convert a value to a formatted representation using a format specification.
|
|
373
|
+
*
|
|
374
|
+
* Supports Python format spec mini-language for numbers and strings.
|
|
375
|
+
*
|
|
376
|
+
* @param value - The value to format
|
|
377
|
+
* @param spec - The format specification string
|
|
378
|
+
* @returns The formatted string
|
|
379
|
+
* @see {@link https://docs.python.org/3/library/functions.html#format | Python format()}
|
|
206
380
|
*/
|
|
207
381
|
declare function format$1(value: unknown, spec: string): string;
|
|
208
382
|
/**
|
|
@@ -344,6 +518,8 @@ declare const dict$1: {
|
|
|
344
518
|
/**
|
|
345
519
|
* Python set methods for TypeScript
|
|
346
520
|
* Usage: py.set.intersection(), py.set.union(), etc.
|
|
521
|
+
*
|
|
522
|
+
* Uses ES2024 native Set methods where available for optimal performance.
|
|
347
523
|
*/
|
|
348
524
|
declare const set$1: {
|
|
349
525
|
/**
|
|
@@ -376,10 +552,12 @@ declare const set$1: {
|
|
|
376
552
|
update<T>(s: Set<T>, ...iterables: Iterable<T>[]): void;
|
|
377
553
|
/**
|
|
378
554
|
* Python set.union() - returns new set with all elements
|
|
555
|
+
* Uses ES2024 Set.prototype.union()
|
|
379
556
|
*/
|
|
380
557
|
union<T>(a: Set<T>, ...others: Iterable<T>[]): Set<T>;
|
|
381
558
|
/**
|
|
382
559
|
* Python set.intersection() - returns new set with common elements
|
|
560
|
+
* Uses ES2024 Set.prototype.intersection()
|
|
383
561
|
*/
|
|
384
562
|
intersection<T>(a: Set<T>, b: Set<T>): Set<T>;
|
|
385
563
|
/**
|
|
@@ -388,6 +566,7 @@ declare const set$1: {
|
|
|
388
566
|
intersectionUpdate<T>(a: Set<T>, b: Set<T>): void;
|
|
389
567
|
/**
|
|
390
568
|
* Python set.difference() - returns new set with elements in a but not in b
|
|
569
|
+
* Uses ES2024 Set.prototype.difference()
|
|
391
570
|
*/
|
|
392
571
|
difference<T>(a: Set<T>, b: Set<T>): Set<T>;
|
|
393
572
|
/**
|
|
@@ -396,43 +575,54 @@ declare const set$1: {
|
|
|
396
575
|
differenceUpdate<T>(a: Set<T>, b: Set<T>): void;
|
|
397
576
|
/**
|
|
398
577
|
* Python set.symmetric_difference() - returns new set with elements in either but not both
|
|
578
|
+
* Uses ES2024 Set.prototype.symmetricDifference()
|
|
399
579
|
*/
|
|
400
580
|
symmetricDifference<T>(a: Set<T>, b: Set<T>): Set<T>;
|
|
401
581
|
/**
|
|
402
582
|
* Python set.symmetric_difference_update() - update with symmetric difference
|
|
583
|
+
* Uses ES2024 Set.prototype.symmetricDifference()
|
|
403
584
|
*/
|
|
404
585
|
symmetricDifferenceUpdate<T>(a: Set<T>, b: Set<T>): void;
|
|
405
586
|
/**
|
|
406
587
|
* Python set.isSubset() - test if all elements are in other
|
|
588
|
+
* Uses ES2024 Set.prototype.isSubsetOf()
|
|
407
589
|
*/
|
|
408
590
|
isSubset<T>(a: Set<T>, b: Set<T>): boolean;
|
|
409
591
|
/**
|
|
410
592
|
* Python set.isSuperset() - test if all other elements are in this set
|
|
593
|
+
* Uses ES2024 Set.prototype.isSupersetOf()
|
|
411
594
|
*/
|
|
412
595
|
isSuperset<T>(a: Set<T>, b: Set<T>): boolean;
|
|
413
596
|
/**
|
|
414
597
|
* Python set.isDisjoint() - test if no common elements
|
|
598
|
+
* Uses ES2024 Set.prototype.isDisjointFrom()
|
|
415
599
|
*/
|
|
416
600
|
isDisjoint<T>(a: Set<T>, b: Set<T>): boolean;
|
|
417
601
|
};
|
|
418
602
|
|
|
419
603
|
/**
|
|
420
|
-
* Python
|
|
604
|
+
* Python Built-in Functions for TypeScript
|
|
605
|
+
*
|
|
606
|
+
* This module provides Python's built-in functions that are always available
|
|
607
|
+
* without imports. These are the fundamental operations for working with data
|
|
608
|
+
* in Python, including iteration (range, enumerate, zip), aggregation (len,
|
|
609
|
+
* sum, min, max), type conversion (int, str, bool), and more.
|
|
421
610
|
*
|
|
422
|
-
*
|
|
611
|
+
* @example
|
|
612
|
+
* ```typescript
|
|
613
|
+
* // Direct imports
|
|
614
|
+
* import { len, range, sorted, min, max } from "pythonlib"
|
|
423
615
|
*
|
|
424
|
-
*
|
|
425
|
-
*
|
|
616
|
+
* // Module imports (like Python)
|
|
617
|
+
* import { chain, combinations } from "pythonlib/itertools"
|
|
618
|
+
* import { Counter, defaultdict } from "pythonlib/collections"
|
|
426
619
|
*
|
|
427
|
-
*
|
|
428
|
-
*
|
|
429
|
-
*
|
|
430
|
-
* import { chain, combinations } from "pythonlib/itertools"
|
|
431
|
-
* import { Counter, defaultdict } from "pythonlib/collections"
|
|
620
|
+
* // Module namespaces
|
|
621
|
+
* import { json, re, itertools } from "pythonlib"
|
|
622
|
+
* ```
|
|
432
623
|
*
|
|
433
|
-
* 3.
|
|
434
|
-
*
|
|
435
|
-
* json.dump(...), re.match(...), itertools.chain(...)
|
|
624
|
+
* @see {@link https://docs.python.org/3/library/functions.html | Python Built-in Functions}
|
|
625
|
+
* @module
|
|
436
626
|
*/
|
|
437
627
|
|
|
438
628
|
declare const itertools: typeof itertoolsModule;
|