pythonlib 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +183 -0
- package/dist/chunk-3CSEXTA7.js +376 -0
- package/dist/chunk-3CSEXTA7.js.map +1 -0
- package/dist/chunk-HA5Y7PKO.js +680 -0
- package/dist/chunk-HA5Y7PKO.js.map +1 -0
- package/dist/chunk-IVYYI2VR.js +261 -0
- package/dist/chunk-IVYYI2VR.js.map +1 -0
- package/dist/chunk-OMQNGE6T.js +245 -0
- package/dist/chunk-OMQNGE6T.js.map +1 -0
- package/dist/chunk-P3SGIF72.js +107 -0
- package/dist/chunk-P3SGIF72.js.map +1 -0
- package/dist/chunk-PZ5AY32C.js +10 -0
- package/dist/chunk-PZ5AY32C.js.map +1 -0
- package/dist/chunk-TJFGYXBJ.js +310 -0
- package/dist/chunk-TJFGYXBJ.js.map +1 -0
- package/dist/chunk-TOI6IG3T.js +337 -0
- package/dist/chunk-TOI6IG3T.js.map +1 -0
- package/dist/chunk-UFMTN4T4.js +215 -0
- package/dist/chunk-UFMTN4T4.js.map +1 -0
- package/dist/chunk-V63LKSA3.js +423 -0
- package/dist/chunk-V63LKSA3.js.map +1 -0
- package/dist/chunk-WAONBJE5.js +236 -0
- package/dist/chunk-WAONBJE5.js.map +1 -0
- package/dist/collections-xN9Gi0TA.d.ts +113 -0
- package/dist/collections.d.ts +1 -0
- package/dist/collections.js +12 -0
- package/dist/collections.js.map +1 -0
- package/dist/datetime-DRwFAiGV.d.ts +139 -0
- package/dist/datetime.d.ts +1 -0
- package/dist/datetime.js +22 -0
- package/dist/datetime.js.map +1 -0
- package/dist/functools-St5GqpKG.d.ts +125 -0
- package/dist/functools.d.ts +1 -0
- package/dist/functools.js +32 -0
- package/dist/functools.js.map +1 -0
- package/dist/index.d.ts +624 -0
- package/dist/index.js +1332 -0
- package/dist/index.js.map +1 -0
- package/dist/itertools-Bj8XivI6.d.ts +138 -0
- package/dist/itertools.d.ts +1 -0
- package/dist/itertools.js +44 -0
- package/dist/itertools.js.map +1 -0
- package/dist/json-Xpk0kwSd.d.ts +77 -0
- package/dist/json.d.ts +1 -0
- package/dist/json.js +14 -0
- package/dist/json.js.map +1 -0
- package/dist/math-BrT4Aw3E.d.ts +147 -0
- package/dist/math.d.ts +1 -0
- package/dist/math.js +96 -0
- package/dist/math.js.map +1 -0
- package/dist/os-FRSJbEUH.d.ts +143 -0
- package/dist/os.d.ts +1 -0
- package/dist/os.js +58 -0
- package/dist/os.js.map +1 -0
- package/dist/random-D5S5iSV3.d.ts +72 -0
- package/dist/random.d.ts +1 -0
- package/dist/random.js +42 -0
- package/dist/random.js.map +1 -0
- package/dist/re-DSxiURqN.d.ts +148 -0
- package/dist/re.d.ts +1 -0
- package/dist/re.js +52 -0
- package/dist/re.js.map +1 -0
- package/dist/string.d.ts +166 -0
- package/dist/string.js +30 -0
- package/dist/string.js.map +1 -0
- package/package.json +85 -0
package/dist/string.d.ts
ADDED
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Python string methods and constants for TypeScript
|
|
3
|
+
* Usage: py.string.join(), py.string.split(), py.string.ascii_lowercase, etc.
|
|
4
|
+
*/
|
|
5
|
+
/** The lowercase letters 'abcdefghijklmnopqrstuvwxyz' */
|
|
6
|
+
declare const ascii_lowercase = "abcdefghijklmnopqrstuvwxyz";
|
|
7
|
+
/** The uppercase letters 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' */
|
|
8
|
+
declare const ascii_uppercase = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
|
|
9
|
+
/** The concatenation of ascii_lowercase and ascii_uppercase */
|
|
10
|
+
declare const ascii_letters: string;
|
|
11
|
+
/** The string '0123456789' */
|
|
12
|
+
declare const digits = "0123456789";
|
|
13
|
+
/** The string '0123456789abcdefABCDEF' */
|
|
14
|
+
declare const hexdigits = "0123456789abcdefABCDEF";
|
|
15
|
+
/** The string '01234567' */
|
|
16
|
+
declare const octdigits = "01234567";
|
|
17
|
+
/** String of ASCII characters which are considered punctuation */
|
|
18
|
+
declare const punctuation = "!\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~";
|
|
19
|
+
/** String of ASCII characters which are considered whitespace */
|
|
20
|
+
declare const whitespace = " \t\n\r\v\f";
|
|
21
|
+
/** String of ASCII characters which are considered printable */
|
|
22
|
+
declare const printable: string;
|
|
23
|
+
declare class Template {
|
|
24
|
+
readonly template: string;
|
|
25
|
+
constructor(template: string);
|
|
26
|
+
/** Perform substitution, raising KeyError for missing keys */
|
|
27
|
+
substitute(mapping?: Record<string, unknown>): string;
|
|
28
|
+
/** Perform substitution, returning original placeholder for missing keys */
|
|
29
|
+
safe_substitute(mapping?: Record<string, unknown>): string;
|
|
30
|
+
/** Get identifiers in template */
|
|
31
|
+
get_identifiers(): string[];
|
|
32
|
+
}
|
|
33
|
+
/** Capitalize words in string */
|
|
34
|
+
declare function capwords(s: string, sep?: string): string;
|
|
35
|
+
declare const string: {
|
|
36
|
+
/**
|
|
37
|
+
* Python str.join()
|
|
38
|
+
*/
|
|
39
|
+
join(sep: string, iterable: Iterable<string>): string;
|
|
40
|
+
/**
|
|
41
|
+
* Python str.split()
|
|
42
|
+
*/
|
|
43
|
+
split(s: string, sep?: string, maxsplit?: number): string[];
|
|
44
|
+
/**
|
|
45
|
+
* Python str.rsplit()
|
|
46
|
+
*/
|
|
47
|
+
rsplit(s: string, sep?: string, maxsplit?: number): string[];
|
|
48
|
+
/**
|
|
49
|
+
* Python str.strip()
|
|
50
|
+
*/
|
|
51
|
+
strip(s: string, chars?: string): string;
|
|
52
|
+
/**
|
|
53
|
+
* Python str.lstrip()
|
|
54
|
+
*/
|
|
55
|
+
lstrip(s: string, chars?: string): string;
|
|
56
|
+
/**
|
|
57
|
+
* Python str.rstrip()
|
|
58
|
+
*/
|
|
59
|
+
rstrip(s: string, chars?: string): string;
|
|
60
|
+
/**
|
|
61
|
+
* Python str.upper()
|
|
62
|
+
*/
|
|
63
|
+
upper(s: string): string;
|
|
64
|
+
/**
|
|
65
|
+
* Python str.lower()
|
|
66
|
+
*/
|
|
67
|
+
lower(s: string): string;
|
|
68
|
+
/**
|
|
69
|
+
* Python str.capitalize()
|
|
70
|
+
*/
|
|
71
|
+
capitalize(s: string): string;
|
|
72
|
+
/**
|
|
73
|
+
* Python str.title()
|
|
74
|
+
*/
|
|
75
|
+
title(s: string): string;
|
|
76
|
+
/**
|
|
77
|
+
* Python str.swapcase()
|
|
78
|
+
*/
|
|
79
|
+
swapcase(s: string): string;
|
|
80
|
+
/**
|
|
81
|
+
* Python str.startswith()
|
|
82
|
+
*/
|
|
83
|
+
startswith(s: string, prefix: string, start?: number, end?: number): boolean;
|
|
84
|
+
/**
|
|
85
|
+
* Python str.endswith()
|
|
86
|
+
*/
|
|
87
|
+
endswith(s: string, suffix: string, start?: number, end?: number): boolean;
|
|
88
|
+
/**
|
|
89
|
+
* Python str.find()
|
|
90
|
+
*/
|
|
91
|
+
find(s: string, sub: string, start?: number, end?: number): number;
|
|
92
|
+
/**
|
|
93
|
+
* Python str.rfind()
|
|
94
|
+
*/
|
|
95
|
+
rfind(s: string, sub: string, start?: number, end?: number): number;
|
|
96
|
+
/**
|
|
97
|
+
* Python str.index() - raises error if not found
|
|
98
|
+
*/
|
|
99
|
+
index(s: string, sub: string, start?: number, end?: number): number;
|
|
100
|
+
/**
|
|
101
|
+
* Python str.rindex() - raises error if not found
|
|
102
|
+
*/
|
|
103
|
+
rindex(s: string, sub: string, start?: number, end?: number): number;
|
|
104
|
+
/**
|
|
105
|
+
* Python str.count()
|
|
106
|
+
*/
|
|
107
|
+
count(s: string, sub: string, start?: number, end?: number): number;
|
|
108
|
+
/**
|
|
109
|
+
* Python str.replace()
|
|
110
|
+
*/
|
|
111
|
+
replace(s: string, old: string, newStr: string, count?: number): string;
|
|
112
|
+
/**
|
|
113
|
+
* Python str.zfill()
|
|
114
|
+
*/
|
|
115
|
+
zfill(s: string, width: number): string;
|
|
116
|
+
/**
|
|
117
|
+
* Python str.center()
|
|
118
|
+
*/
|
|
119
|
+
center(s: string, width: number, fillchar?: string): string;
|
|
120
|
+
/**
|
|
121
|
+
* Python str.ljust()
|
|
122
|
+
*/
|
|
123
|
+
ljust(s: string, width: number, fillchar?: string): string;
|
|
124
|
+
/**
|
|
125
|
+
* Python str.rjust()
|
|
126
|
+
*/
|
|
127
|
+
rjust(s: string, width: number, fillchar?: string): string;
|
|
128
|
+
/**
|
|
129
|
+
* Python str.partition()
|
|
130
|
+
*/
|
|
131
|
+
partition(s: string, sep: string): [string, string, string];
|
|
132
|
+
/**
|
|
133
|
+
* Python str.rpartition()
|
|
134
|
+
*/
|
|
135
|
+
rpartition(s: string, sep: string): [string, string, string];
|
|
136
|
+
/**
|
|
137
|
+
* Python str.isalpha()
|
|
138
|
+
*/
|
|
139
|
+
isalpha(s: string): boolean;
|
|
140
|
+
/**
|
|
141
|
+
* Python str.isdigit()
|
|
142
|
+
*/
|
|
143
|
+
isdigit(s: string): boolean;
|
|
144
|
+
/**
|
|
145
|
+
* Python str.isalnum()
|
|
146
|
+
*/
|
|
147
|
+
isalnum(s: string): boolean;
|
|
148
|
+
/**
|
|
149
|
+
* Python str.isspace()
|
|
150
|
+
*/
|
|
151
|
+
isspace(s: string): boolean;
|
|
152
|
+
/**
|
|
153
|
+
* Python str.isupper()
|
|
154
|
+
*/
|
|
155
|
+
isupper(s: string): boolean;
|
|
156
|
+
/**
|
|
157
|
+
* Python str.islower()
|
|
158
|
+
*/
|
|
159
|
+
islower(s: string): boolean;
|
|
160
|
+
/**
|
|
161
|
+
* Python str.format() - basic implementation
|
|
162
|
+
*/
|
|
163
|
+
format(s: string, ...args: unknown[]): string;
|
|
164
|
+
};
|
|
165
|
+
|
|
166
|
+
export { Template, ascii_letters, ascii_lowercase, ascii_uppercase, capwords, digits, hexdigits, octdigits, printable, punctuation, string, whitespace };
|
package/dist/string.js
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Template,
|
|
3
|
+
ascii_letters,
|
|
4
|
+
ascii_lowercase,
|
|
5
|
+
ascii_uppercase,
|
|
6
|
+
capwords,
|
|
7
|
+
digits,
|
|
8
|
+
hexdigits,
|
|
9
|
+
octdigits,
|
|
10
|
+
printable,
|
|
11
|
+
punctuation,
|
|
12
|
+
string,
|
|
13
|
+
whitespace
|
|
14
|
+
} from "./chunk-3CSEXTA7.js";
|
|
15
|
+
import "./chunk-PZ5AY32C.js";
|
|
16
|
+
export {
|
|
17
|
+
Template,
|
|
18
|
+
ascii_letters,
|
|
19
|
+
ascii_lowercase,
|
|
20
|
+
ascii_uppercase,
|
|
21
|
+
capwords,
|
|
22
|
+
digits,
|
|
23
|
+
hexdigits,
|
|
24
|
+
octdigits,
|
|
25
|
+
printable,
|
|
26
|
+
punctuation,
|
|
27
|
+
string,
|
|
28
|
+
whitespace
|
|
29
|
+
};
|
|
30
|
+
//# sourceMappingURL=string.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
package/package.json
ADDED
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "pythonlib",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Python standard library for TypeScript - itertools, functools, collections, and more",
|
|
5
|
+
"repository": {
|
|
6
|
+
"type": "git",
|
|
7
|
+
"url": "https://github.com/sebastian-software/python2ts.git",
|
|
8
|
+
"directory": "packages/pythonlib"
|
|
9
|
+
},
|
|
10
|
+
"type": "module",
|
|
11
|
+
"main": "dist/index.js",
|
|
12
|
+
"types": "dist/index.d.ts",
|
|
13
|
+
"exports": {
|
|
14
|
+
".": {
|
|
15
|
+
"import": "./dist/index.js",
|
|
16
|
+
"types": "./dist/index.d.ts"
|
|
17
|
+
},
|
|
18
|
+
"./collections": {
|
|
19
|
+
"import": "./dist/collections.js",
|
|
20
|
+
"types": "./dist/collections.d.ts"
|
|
21
|
+
},
|
|
22
|
+
"./itertools": {
|
|
23
|
+
"import": "./dist/itertools.js",
|
|
24
|
+
"types": "./dist/itertools.d.ts"
|
|
25
|
+
},
|
|
26
|
+
"./functools": {
|
|
27
|
+
"import": "./dist/functools.js",
|
|
28
|
+
"types": "./dist/functools.d.ts"
|
|
29
|
+
},
|
|
30
|
+
"./math": {
|
|
31
|
+
"import": "./dist/math.js",
|
|
32
|
+
"types": "./dist/math.d.ts"
|
|
33
|
+
},
|
|
34
|
+
"./random": {
|
|
35
|
+
"import": "./dist/random.js",
|
|
36
|
+
"types": "./dist/random.d.ts"
|
|
37
|
+
},
|
|
38
|
+
"./datetime": {
|
|
39
|
+
"import": "./dist/datetime.js",
|
|
40
|
+
"types": "./dist/datetime.d.ts"
|
|
41
|
+
},
|
|
42
|
+
"./re": {
|
|
43
|
+
"import": "./dist/re.js",
|
|
44
|
+
"types": "./dist/re.d.ts"
|
|
45
|
+
},
|
|
46
|
+
"./json": {
|
|
47
|
+
"import": "./dist/json.js",
|
|
48
|
+
"types": "./dist/json.d.ts"
|
|
49
|
+
},
|
|
50
|
+
"./os": {
|
|
51
|
+
"import": "./dist/os.js",
|
|
52
|
+
"types": "./dist/os.d.ts"
|
|
53
|
+
},
|
|
54
|
+
"./string": {
|
|
55
|
+
"import": "./dist/string.js",
|
|
56
|
+
"types": "./dist/string.d.ts"
|
|
57
|
+
}
|
|
58
|
+
},
|
|
59
|
+
"files": [
|
|
60
|
+
"dist",
|
|
61
|
+
"README.md"
|
|
62
|
+
],
|
|
63
|
+
"scripts": {
|
|
64
|
+
"build": "tsup",
|
|
65
|
+
"dev": "tsup --watch",
|
|
66
|
+
"typecheck": "tsc --noEmit"
|
|
67
|
+
},
|
|
68
|
+
"keywords": [
|
|
69
|
+
"python",
|
|
70
|
+
"typescript",
|
|
71
|
+
"itertools",
|
|
72
|
+
"functools",
|
|
73
|
+
"collections",
|
|
74
|
+
"stdlib"
|
|
75
|
+
],
|
|
76
|
+
"author": "Sebastian Software GmbH",
|
|
77
|
+
"license": "MIT",
|
|
78
|
+
"devDependencies": {
|
|
79
|
+
"tsup": "^8.3.0",
|
|
80
|
+
"typescript": "^5.6.0"
|
|
81
|
+
},
|
|
82
|
+
"engines": {
|
|
83
|
+
"node": ">=22.0.0"
|
|
84
|
+
}
|
|
85
|
+
}
|