@zukhruf/python 0.0.0-stage → 0.8.3
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/LICENSE +21 -0
- package/NOTICE +9 -0
- package/README.md +44 -2
- package/dist/float-repr.d.ts +2 -0
- package/dist/float-repr.d.ts.map +1 -0
- package/dist/float-repr.js +24 -0
- package/dist/float-repr.js.map +1 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +7 -0
- package/dist/index.js.map +1 -0
- package/dist/json-data.d.ts +2 -0
- package/dist/json-data.d.ts.map +1 -0
- package/dist/json-data.js +2 -0
- package/dist/json-data.js.map +1 -0
- package/dist/loads-json.d.ts +3 -0
- package/dist/loads-json.d.ts.map +1 -0
- package/dist/loads-json.js +131 -0
- package/dist/loads-json.js.map +1 -0
- package/dist/neumaier-sum.d.ts +8 -0
- package/dist/neumaier-sum.d.ts.map +1 -0
- package/dist/neumaier-sum.js +42 -0
- package/dist/neumaier-sum.js.map +1 -0
- package/dist/python-space.d.ts +2 -0
- package/dist/python-space.d.ts.map +1 -0
- package/dist/python-space.js +6 -0
- package/dist/python-space.js.map +1 -0
- package/dist/python-word.d.ts +2 -0
- package/dist/python-word.d.ts.map +1 -0
- package/dist/python-word.js +7 -0
- package/dist/python-word.js.map +1 -0
- package/dist/to-json-parse-value.d.ts +6 -0
- package/dist/to-json-parse-value.d.ts.map +1 -0
- package/dist/to-json-parse-value.js +17 -0
- package/dist/to-json-parse-value.js.map +1 -0
- package/package.json +43 -4
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 ezzabuzaid
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/NOTICE
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
@zukhruf/python
|
|
2
|
+
Copyright 2026 ezzabuzaid
|
|
3
|
+
|
|
4
|
+
This package ports the semantics of parts of CPython 3.12 (the sum() of
|
|
5
|
+
floats in Python/bltinmodule.c, float.__repr__ in Python/pystrtod.c, the
|
|
6
|
+
json module's scanner and decoder in Lib/json, and str.isspace), Copyright
|
|
7
|
+
(c) Python Software Foundation, PSF License Version 2,
|
|
8
|
+
https://github.com/python/cpython. The package does not include CPython's
|
|
9
|
+
code.
|
package/README.md
CHANGED
|
@@ -1,3 +1,45 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @zukhruf/python
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
The results of CPython 3.12 in JavaScript, to the last bit: the `sum()` of floats, the `repr()` of a float, `json.loads`, the white space of `str.isspace()`, and the word characters of `\w`. Use it when a TypeScript port must give the same numbers and text as a Python program, such as a benchmark's scorer.
|
|
4
|
+
|
|
5
|
+
The package is public on npm. Until 2026-11-07 it was private and reached through a workspace path (ADR 0001); it became public with `@zukhruf/evals`, which depends on it (backlog #3888).
|
|
6
|
+
|
|
7
|
+
## Use it
|
|
8
|
+
|
|
9
|
+
```ts
|
|
10
|
+
import {
|
|
11
|
+
type JsonData,
|
|
12
|
+
NeumaierSum,
|
|
13
|
+
PYTHON_SPACE,
|
|
14
|
+
PYTHON_WORD,
|
|
15
|
+
floatRepr,
|
|
16
|
+
loadsJson,
|
|
17
|
+
toJsonParseValue,
|
|
18
|
+
} from '@zukhruf/python';
|
|
19
|
+
|
|
20
|
+
NeumaierSum.of([0.1, 0.2, 0.3]); // 0.6, as sum([0.1, 0.2, 0.3]) in Python
|
|
21
|
+
NeumaierSum.mean([0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1]); // 0.1, as sum(values) / len(values) in Python
|
|
22
|
+
floatRepr(1e16); // '1e+16', as repr(1e16)
|
|
23
|
+
const value: JsonData = loadsJson('{"b": 1, "10": 2.0, "a": NaN}');
|
|
24
|
+
// Map { 'b' => 1n, '10' => 2, 'a' => NaN }
|
|
25
|
+
toJsonParseValue(value); // { '10': 2, b: 1, a: NaN }, for a validator
|
|
26
|
+
new RegExp(`[${PYTHON_SPACE}]+`, 'u'); // Python's \s
|
|
27
|
+
new RegExp(`[${PYTHON_WORD}]+`, 'u'); // Python's \w
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
| Export | CPython | What it keeps |
|
|
31
|
+
| ------------------ | ---------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
32
|
+
| `NeumaierSum` | `sum()` of floats (Python/bltinmodule.c) | Neumaier's compensated sum. It starts at 0 and adds the compensation only when that is not 0 and is finite, so `[1e308, 1e308, -1e308]` gives `Infinity` and `[-0.0]` gives `0`. `add` and `value` give a running sum; `NeumaierSum.of(values)` sums an iterable. `NeumaierSum.mean(values)` is `sum(values) / len(values)`, and no value throws a `RangeError` (Python's `ZeroDivisionError`, ADR 0003). |
|
|
33
|
+
| `floatRepr` | `repr()` of a float | The shortest digits, fixed notation for exponents from -4 to 15, and always a fraction: `1.0`, `1e+16`, `1e-05`, `-0.0`, `nan`, `inf`. |
|
|
34
|
+
| `loadsJson` | `json.loads` | A dict is a `Map` in the order of its keys, and a repeated key keeps its first place and its last value. An int is a `bigint` and a float a `number`, so `1` and `1.0` stay apart. `NaN`, `Infinity` and `-Infinity` are numbers. Text that is not JSON throws a `SyntaxError` (Python's `JSONDecodeError`). An int of more than 4300 digits throws a `RangeError` (Python's `ValueError`). |
|
|
35
|
+
| `JsonData` | the values of `json.loads` | `null`, `boolean`, `bigint`, `number`, `string`, arrays and `Map`s of them. They are mutable, as in Python, so `Array.isArray` and `instanceof Map` narrow a value. |
|
|
36
|
+
| `PYTHON_SPACE` | `str.isspace()`, `\s`, `str.split()` | The body of a RegExp class. It has U+001C to U+001F, which JavaScript's `\s` lacks, and lacks U+FEFF, which JavaScript's `\s` has. |
|
|
37
|
+
| `PYTHON_WORD` | `\w` of a `str` pattern | The body of a RegExp class: letters, numbers and `_`. It equals CPython 3.12's `\w` for each character of Unicode 15.0. Node knows characters of later Unicode versions, which it reads as `\w` and Python 3.12 does not. |
|
|
38
|
+
| `toJsonParseValue` | none: the way out of `JsonData` | The value that `JSON.parse` gives for the same text, for code that reads only plain JavaScript, such as a JSON Schema validator. A dict becomes an object, so its integer-like keys move first. An int becomes the nearest `number`, so an int beyond 2^53 loses digits. The int `-0` gives `0`. Keep the `JsonData`, and convert only where such code reads it (ADR 0002). |
|
|
39
|
+
| `JsonParseValue` | none | The type of a value of `toJsonParseValue`: `null`, `boolean`, `number`, `string`, arrays and plain objects of them. |
|
|
40
|
+
|
|
41
|
+
## Documentation
|
|
42
|
+
|
|
43
|
+
- [ADR 0001: one home for the CPython rules that three places copied, reached through a workspace path](docs/adr/0001-one-home-for-the-cpython-rules-that-three-places-copied.md)
|
|
44
|
+
- [ADR 0002: JsonData has one way out, and code takes it only at an edge](docs/adr/0002-json-data-has-one-way-out-at-an-edge.md)
|
|
45
|
+
- [ADR 0003: the mean that a Python program writes as sum(values) / len(values) is NeumaierSum.mean](docs/adr/0003-the-mean-of-a-python-program-is-neumaier-sum-mean.md)
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"float-repr.d.ts","sourceRoot":"","sources":["../src/float-repr.ts"],"names":[],"mappings":"AAGA,wBAAgB,SAAS,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAgB/C"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
// repr() of a float in CPython: the shortest digits that read back as the
|
|
2
|
+
// same float, in fixed notation when the exponent is from -4 to 15, and
|
|
3
|
+
// always with a fraction (Python/pystrtod.c, format_float_short, mode 'r').
|
|
4
|
+
export function floatRepr(value) {
|
|
5
|
+
if (Number.isNaN(value))
|
|
6
|
+
return 'nan';
|
|
7
|
+
if (!Number.isFinite(value))
|
|
8
|
+
return value > 0 ? 'inf' : '-inf';
|
|
9
|
+
const [mantissa = '', exponentText = '0'] = value.toExponential().split('e');
|
|
10
|
+
const sign = mantissa.startsWith('-') || Object.is(value, -0) ? '-' : '';
|
|
11
|
+
const digits = mantissa.replace('-', '').replace('.', '');
|
|
12
|
+
const exponent = Number(exponentText);
|
|
13
|
+
if (exponent < -4 || exponent >= 16) {
|
|
14
|
+
const fraction = digits.slice(1);
|
|
15
|
+
const magnitude = String(Math.abs(exponent)).padStart(2, '0');
|
|
16
|
+
return `${sign}${digits[0]}${fraction ? `.${fraction}` : ''}e${exponent < 0 ? '-' : '+'}${magnitude}`;
|
|
17
|
+
}
|
|
18
|
+
if (exponent < 0)
|
|
19
|
+
return `${sign}0.${'0'.repeat(-exponent - 1)}${digits}`;
|
|
20
|
+
const whole = digits.slice(0, exponent + 1).padEnd(exponent + 1, '0');
|
|
21
|
+
const fraction = digits.slice(exponent + 1);
|
|
22
|
+
return `${sign}${whole}.${fraction || '0'}`;
|
|
23
|
+
}
|
|
24
|
+
//# sourceMappingURL=float-repr.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"float-repr.js","sourceRoot":"","sources":["../src/float-repr.ts"],"names":[],"mappings":"AAAA,0EAA0E;AAC1E,wEAAwE;AACxE,4EAA4E;AAC5E,MAAM,UAAU,SAAS,CAAC,KAAa;IACrC,IAAI,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC;QAAE,OAAO,KAAK,CAAC;IACtC,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC;QAAE,OAAO,KAAK,GAAG,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC;IAC/D,MAAM,CAAC,QAAQ,GAAG,EAAE,EAAE,YAAY,GAAG,GAAG,CAAC,GAAG,KAAK,CAAC,aAAa,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IAC7E,MAAM,IAAI,GAAG,QAAQ,CAAC,UAAU,CAAC,GAAG,CAAC,IAAI,MAAM,CAAC,EAAE,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC;IACzE,MAAM,MAAM,GAAG,QAAQ,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC;IAC1D,MAAM,QAAQ,GAAG,MAAM,CAAC,YAAY,CAAC,CAAC;IACtC,IAAI,QAAQ,GAAG,CAAC,CAAC,IAAI,QAAQ,IAAI,EAAE,EAAE,CAAC;QACpC,MAAM,QAAQ,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;QACjC,MAAM,SAAS,GAAG,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC;QAC9D,OAAO,GAAG,IAAI,GAAG,MAAM,CAAC,CAAC,CAAC,GAAG,QAAQ,CAAC,CAAC,CAAC,IAAI,QAAQ,EAAE,CAAC,CAAC,CAAC,EAAE,IAAI,QAAQ,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,GAAG,SAAS,EAAE,CAAC;IACxG,CAAC;IACD,IAAI,QAAQ,GAAG,CAAC;QAAE,OAAO,GAAG,IAAI,KAAK,GAAG,CAAC,MAAM,CAAC,CAAC,QAAQ,GAAG,CAAC,CAAC,GAAG,MAAM,EAAE,CAAC;IAC1E,MAAM,KAAK,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC,EAAE,QAAQ,GAAG,CAAC,CAAC,CAAC,MAAM,CAAC,QAAQ,GAAG,CAAC,EAAE,GAAG,CAAC,CAAC;IACtE,MAAM,QAAQ,GAAG,MAAM,CAAC,KAAK,CAAC,QAAQ,GAAG,CAAC,CAAC,CAAC;IAC5C,OAAO,GAAG,IAAI,GAAG,KAAK,IAAI,QAAQ,IAAI,GAAG,EAAE,CAAC;AAC9C,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export { floatRepr } from './float-repr.ts';
|
|
2
|
+
export type { JsonData } from './json-data.ts';
|
|
3
|
+
export { loadsJson } from './loads-json.ts';
|
|
4
|
+
export { NeumaierSum } from './neumaier-sum.ts';
|
|
5
|
+
export { PYTHON_SPACE } from './python-space.ts';
|
|
6
|
+
export { PYTHON_WORD } from './python-word.ts';
|
|
7
|
+
export { type JsonParseValue, toJsonParseValue, } from './to-json-parse-value.ts';
|
|
8
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,YAAY,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC/C,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,EACL,KAAK,cAAc,EACnB,gBAAgB,GACjB,MAAM,0BAA0B,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export { floatRepr } from "./float-repr.js";
|
|
2
|
+
export { loadsJson } from "./loads-json.js";
|
|
3
|
+
export { NeumaierSum } from "./neumaier-sum.js";
|
|
4
|
+
export { PYTHON_SPACE } from "./python-space.js";
|
|
5
|
+
export { PYTHON_WORD } from "./python-word.js";
|
|
6
|
+
export { toJsonParseValue, } from "./to-json-parse-value.js";
|
|
7
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAE5C,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,EAEL,gBAAgB,GACjB,MAAM,0BAA0B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"json-data.d.ts","sourceRoot":"","sources":["../src/json-data.ts"],"names":[],"mappings":"AAKA,MAAM,MAAM,QAAQ,GAChB,IAAI,GACJ,OAAO,GACP,MAAM,GACN,MAAM,GACN,MAAM,GACN,QAAQ,EAAE,GACV,GAAG,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"json-data.js","sourceRoot":"","sources":["../src/json-data.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"loads-json.d.ts","sourceRoot":"","sources":["../src/loads-json.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAa/C,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG,QAAQ,CAuDhD"}
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
import { printParseErrorCode, visit } from 'jsonc-parser';
|
|
2
|
+
// Python refuses to read an int of more than this many digits
|
|
3
|
+
// (sys.int_info.default_max_str_digits, Python 3.11 and later).
|
|
4
|
+
const maxIntDigits = 4300;
|
|
5
|
+
// json.loads of CPython: each dict a Map in the order of its keys (a repeated
|
|
6
|
+
// key keeps its first place and its last value), each number with a `.`, `e`
|
|
7
|
+
// or `E` a float and any other an int (a bigint, exact), and the NaN,
|
|
8
|
+
// Infinity and -Infinity tokens of Python's json module. A text that is not
|
|
9
|
+
// JSON throws a SyntaxError, as Python raises a JSONDecodeError: comments and
|
|
10
|
+
// trailing commas too. An int of more than 4300 digits throws a RangeError, as
|
|
11
|
+
// Python raises a ValueError.
|
|
12
|
+
export function loadsJson(text) {
|
|
13
|
+
const tokens = pythonTokens(text);
|
|
14
|
+
const containers = [];
|
|
15
|
+
let root;
|
|
16
|
+
let key = '';
|
|
17
|
+
const add = (value) => {
|
|
18
|
+
const parent = containers.at(-1);
|
|
19
|
+
if (parent === undefined)
|
|
20
|
+
root = value;
|
|
21
|
+
else if (Array.isArray(parent))
|
|
22
|
+
parent.push(value);
|
|
23
|
+
else
|
|
24
|
+
parent.set(key, value);
|
|
25
|
+
};
|
|
26
|
+
visit(tokens.json, {
|
|
27
|
+
onObjectBegin: () => {
|
|
28
|
+
const object = new Map();
|
|
29
|
+
add(object);
|
|
30
|
+
containers.push(object);
|
|
31
|
+
},
|
|
32
|
+
onObjectProperty: (property) => {
|
|
33
|
+
tokens.key(property);
|
|
34
|
+
key = property;
|
|
35
|
+
},
|
|
36
|
+
onObjectEnd: () => {
|
|
37
|
+
containers.pop();
|
|
38
|
+
},
|
|
39
|
+
onArrayBegin: () => {
|
|
40
|
+
const array = [];
|
|
41
|
+
add(array);
|
|
42
|
+
containers.push(array);
|
|
43
|
+
},
|
|
44
|
+
onArrayEnd: () => {
|
|
45
|
+
containers.pop();
|
|
46
|
+
},
|
|
47
|
+
onLiteralValue: (value, offset, length) => {
|
|
48
|
+
if (typeof value !== 'number') {
|
|
49
|
+
add(tokens.number(value));
|
|
50
|
+
return;
|
|
51
|
+
}
|
|
52
|
+
add(numberOf(tokens.json.slice(offset, offset + length), value));
|
|
53
|
+
},
|
|
54
|
+
onError: (error, offset) => {
|
|
55
|
+
throw new SyntaxError(`${printParseErrorCode(error)} at position ${offset} of the JSON text.`);
|
|
56
|
+
},
|
|
57
|
+
}, { disallowComments: true });
|
|
58
|
+
if (root === undefined)
|
|
59
|
+
throw new SyntaxError('The JSON text has no value.');
|
|
60
|
+
return root;
|
|
61
|
+
}
|
|
62
|
+
// A number literal as Python reads it: with ".", "e" or "E" it is a float,
|
|
63
|
+
// else an int, exact at any size up to Python's limit (Lib/json/scanner.py,
|
|
64
|
+
// NUMBER_RE).
|
|
65
|
+
function numberOf(literal, value) {
|
|
66
|
+
if (/[.eE]/.test(literal))
|
|
67
|
+
return value;
|
|
68
|
+
if (literal.replace('-', '').length > maxIntDigits)
|
|
69
|
+
throw new RangeError(`An int of more than ${maxIntDigits} digits, which Python does not read.`);
|
|
70
|
+
return BigInt(literal);
|
|
71
|
+
}
|
|
72
|
+
// Python's json module writes NaN, Infinity and -Infinity as bare tokens,
|
|
73
|
+
// which JSON does not have. json is the text with each token outside a string
|
|
74
|
+
// as a string that starts with a random marker; number gives the number of
|
|
75
|
+
// such a string, and any other value as it is. The json module reads the
|
|
76
|
+
// tokens only as values (_scan_once, Lib/json/scanner.py); a key must start
|
|
77
|
+
// with '"' (JSONObject, Lib/json/decoder.py), so key throws for a token.
|
|
78
|
+
function pythonTokens(text) {
|
|
79
|
+
const marker = `${crypto.randomUUID()}:`;
|
|
80
|
+
let out = '';
|
|
81
|
+
let index = 0;
|
|
82
|
+
while (index < text.length) {
|
|
83
|
+
const char = text[index];
|
|
84
|
+
if (char === '"') {
|
|
85
|
+
const end = stringEnd(text, index);
|
|
86
|
+
out += text.slice(index, end);
|
|
87
|
+
index = end;
|
|
88
|
+
continue;
|
|
89
|
+
}
|
|
90
|
+
const token = ['-Infinity', 'Infinity', 'NaN'].find((candidate) => text.startsWith(candidate, index));
|
|
91
|
+
if (token !== undefined) {
|
|
92
|
+
out += JSON.stringify(marker + token);
|
|
93
|
+
index += token.length;
|
|
94
|
+
continue;
|
|
95
|
+
}
|
|
96
|
+
out += char;
|
|
97
|
+
index++;
|
|
98
|
+
}
|
|
99
|
+
const numbers = [
|
|
100
|
+
[`${marker}NaN`, NaN],
|
|
101
|
+
[`${marker}Infinity`, Infinity],
|
|
102
|
+
[`${marker}-Infinity`, -Infinity],
|
|
103
|
+
];
|
|
104
|
+
return {
|
|
105
|
+
json: out,
|
|
106
|
+
number: (value) => {
|
|
107
|
+
for (const [token, number] of numbers)
|
|
108
|
+
if (value === token)
|
|
109
|
+
return number;
|
|
110
|
+
return value;
|
|
111
|
+
},
|
|
112
|
+
key: (name) => {
|
|
113
|
+
if (numbers.some(([token]) => token === name))
|
|
114
|
+
throw new SyntaxError('Expecting property name enclosed in double quotes');
|
|
115
|
+
},
|
|
116
|
+
};
|
|
117
|
+
}
|
|
118
|
+
// The index after the closing quote of the string that starts at start.
|
|
119
|
+
function stringEnd(text, start) {
|
|
120
|
+
let index = start + 1;
|
|
121
|
+
while (index < text.length) {
|
|
122
|
+
if (text[index] === '\\')
|
|
123
|
+
index += 2;
|
|
124
|
+
else if (text[index] === '"')
|
|
125
|
+
return index + 1;
|
|
126
|
+
else
|
|
127
|
+
index++;
|
|
128
|
+
}
|
|
129
|
+
return text.length;
|
|
130
|
+
}
|
|
131
|
+
//# sourceMappingURL=loads-json.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"loads-json.js","sourceRoot":"","sources":["../src/loads-json.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;AAI1D,8DAA8D;AAC9D,gEAAgE;AAChE,MAAM,YAAY,GAAG,IAAI,CAAC;AAE1B,8EAA8E;AAC9E,6EAA6E;AAC7E,sEAAsE;AACtE,4EAA4E;AAC5E,8EAA8E;AAC9E,+EAA+E;AAC/E,8BAA8B;AAC9B,MAAM,UAAU,SAAS,CAAC,IAAY;IACpC,MAAM,MAAM,GAAG,YAAY,CAAC,IAAI,CAAC,CAAC;IAClC,MAAM,UAAU,GAA2C,EAAE,CAAC;IAC9D,IAAI,IAA0B,CAAC;IAC/B,IAAI,GAAG,GAAG,EAAE,CAAC;IACb,MAAM,GAAG,GAAG,CAAC,KAAe,EAAE,EAAE;QAC9B,MAAM,MAAM,GAAG,UAAU,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;QACjC,IAAI,MAAM,KAAK,SAAS;YAAE,IAAI,GAAG,KAAK,CAAC;aAClC,IAAI,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC;YAAE,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;;YAC9C,MAAM,CAAC,GAAG,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;IAC9B,CAAC,CAAC;IACF,KAAK,CACH,MAAM,CAAC,IAAI,EACX;QACE,aAAa,EAAE,GAAG,EAAE;YAClB,MAAM,MAAM,GAAG,IAAI,GAAG,EAAoB,CAAC;YAC3C,GAAG,CAAC,MAAM,CAAC,CAAC;YACZ,UAAU,CAAC,I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-sum.ts"],"names":[],"mappings":"AAIA,qBAAa,WAAW;;IAKtB,MAAM,CAAC,EAAE,CAAC,MAAM,EAAE,QAAQ,CAAC,MAAM,CAAC,GAAG,MAAM;IAQ3C,MAAM,CAAC,IAAI,CAAC,MAAM,EAAE,QAAQ,CAAC,MAAM,CAAC,GAAG,MAAM;IAc7C,GAAG,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI;IASxB,IAAI,KAAK,IAAI,MAAM,CAIlB;CACF"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
// A running sum with Neumaier's compensated summation (Neumaier 1974), the
|
|
2
|
+
// algorithm of the sum() of CPython 3.12 for floats (Python/bltinmodule.c,
|
|
3
|
+
// builtin_sum_impl), so a sum here equals Python's to the last bit: it starts
|
|
4
|
+
// at 0, and it adds the compensation only when that is not 0 and is finite.
|
|
5
|
+
export class NeumaierSum {
|
|
6
|
+
#sum = 0;
|
|
7
|
+
#compensation = 0;
|
|
8
|
+
// The sum() of the values, in their order.
|
|
9
|
+
static of(values) {
|
|
10
|
+
const sum = new NeumaierSum();
|
|
11
|
+
for (const value of values)
|
|
12
|
+
sum.add(value);
|
|
13
|
+
return sum.value;
|
|
14
|
+
}
|
|
15
|
+
// sum(values) / len(values) (ADR 0003). The values are read once, so a
|
|
16
|
+
// one-pass iterator gives its own count.
|
|
17
|
+
static mean(values) {
|
|
18
|
+
const sum = new NeumaierSum();
|
|
19
|
+
let count = 0;
|
|
20
|
+
for (const value of values) {
|
|
21
|
+
sum.add(value);
|
|
22
|
+
count++;
|
|
23
|
+
}
|
|
24
|
+
if (count === 0)
|
|
25
|
+
throw new RangeError('The mean of no value, for which Python raises ZeroDivisionError.');
|
|
26
|
+
return sum.value / count;
|
|
27
|
+
}
|
|
28
|
+
add(value) {
|
|
29
|
+
const total = this.#sum + value;
|
|
30
|
+
this.#compensation +=
|
|
31
|
+
Math.abs(this.#sum) >= Math.abs(value)
|
|
32
|
+
? this.#sum - total + value
|
|
33
|
+
: value - total + this.#sum;
|
|
34
|
+
this.#sum = total;
|
|
35
|
+
}
|
|
36
|
+
get value() {
|
|
37
|
+
return this.#compensation !== 0 && Number.isFinite(this.#compensation)
|
|
38
|
+
? this.#sum + this.#compensation
|
|
39
|
+
: this.#sum;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
//# sourceMappingURL=neumaier-sum.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"neumaier-sum.js","sourceRoot":"","sources":["../src/neumaier-sum.ts"],"names":[],"mappings":"AAAA,2EAA2E;AAC3E,2EAA2E;AAC3E,8EAA8E;AAC9E,4EAA4E;AAC5E,MAAM,OAAO,WAAW;IACtB,IAAI,GAAG,CAAC,CAAC;IACT,aAAa,GAAG,CAAC,CAAC;IAElB,2CAA2C;IAC3C,MAAM,CAAC,EAAE,CAAC,MAAwB;QAChC,MAAM,GAAG,GAAG,IAAI,WAAW,EAAE,CAAC;QAC9B,KAAK,MAAM,KAAK,IAAI,MAAM;YAAE,GAAG,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;QAC3C,OAAO,GAAG,CAAC,KAAK,CAAC;IACnB,CAAC;IAED,uEAAuE;IACvE,yCAAyC;IACzC,MAAM,CAAC,IAAI,CAAC,MAAwB;QAClC,MAAM,GAAG,GAAG,IAAI,WAAW,EAAE,CAAC;QAC9B,IAAI,KAAK,GAAG,CAAC,CAAC;QACd,KAAK,MAAM,KAAK,IAAI,MAAM,EAAE,CAAC;YAC3B,GAAG,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;YACf,KAAK,EAAE,CAAC;QACV,CAAC;QACD,IAAI,KAAK,KAAK,CAAC;YACb,MAAM,IAAI,UAAU,CAClB,kEAAkE,CACnE,CAAC;QACJ,OAAO,GAAG,CAAC,KAAK,GAAG,KAAK,CAAC;IAC3B,CAAC;IAED,GAAG,CAAC,KAAa;QACf,MAAM,KAAK,GAAG,IAAI,CAAC,IAAI,GAAG,KAAK,CAAC;QAChC,IAAI,CAAC,aAAa;YAChB,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC;gBACpC,CAAC,CAAC,IAAI,CAAC,IAAI,GAAG,KAAK,GAAG,KAAK;gBAC3B,CAAC,CAAC,KAAK,GAAG,KAAK,GAAG,IAAI,CAAC,IAAI,CAAC;QAChC,IAAI,CAAC,IAAI,GAAG,KAAK,CAAC;IACpB,CAAC;IAED,IAAI,KAAK;QACP,OAAO,IAAI,CAAC,aAAa,KAAK,CAAC,IAAI,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,aAAa,CAAC;YACpE,CAAC,CAAC,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,aAAa;YAChC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC;IAChB,CAAC;CACF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"python-space.d.ts","sourceRoot":"","sources":["../src/python-space.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,YAAY,QAA4G,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
// The characters of Python's str.isspace(), which are also its \s and the
|
|
2
|
+
// separators of str.split(), as the body of a RegExp class (u flag): a probe
|
|
3
|
+
// over every code point proved it equal to CPython 3.12's. It differs from
|
|
4
|
+
// JavaScript's \s: it has U+001C to U+001F and lacks U+FEFF.
|
|
5
|
+
export const PYTHON_SPACE = String.raw `\t\n\v\f\r\x1c-\x1f \x85\xa0\u{1680}\u{2000}-\u{200a}\u{2028}\u{2029}\u{202f}\u{205f}\u{3000}`;
|
|
6
|
+
//# sourceMappingURL=python-space.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"python-space.js","sourceRoot":"","sources":["../src/python-space.ts"],"names":[],"mappings":"AAAA,0EAA0E;AAC1E,6EAA6E;AAC7E,2EAA2E;AAC3E,6DAA6D;AAC7D,MAAM,CAAC,MAAM,YAAY,GAAG,MAAM,CAAC,GAAG,CAAA,+FAA+F,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"python-word.d.ts","sourceRoot":"","sources":["../src/python-word.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,WAAW,QAA0B,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
// The characters of Python's \w in a str pattern, as the body of a RegExp
|
|
2
|
+
// class (u flag): letters, numbers and the underscore. The golden test proves
|
|
3
|
+
// it equal to CPython 3.12's for each code point that Python's Unicode
|
|
4
|
+
// database (15.0) assigns; Node knows characters of later Unicode versions,
|
|
5
|
+
// which it reads as \w and Python 3.12 does not.
|
|
6
|
+
export const PYTHON_WORD = String.raw `\p{L}\p{N}_`;
|
|
7
|
+
//# sourceMappingURL=python-word.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"python-word.js","sourceRoot":"","sources":["../src/python-word.ts"],"names":[],"mappings":"AAAA,0EAA0E;AAC1E,8EAA8E;AAC9E,uEAAuE;AACvE,4EAA4E;AAC5E,iDAAiD;AACjD,MAAM,CAAC,MAAM,WAAW,GAAG,MAAM,CAAC,GAAG,CAAA,aAAa,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { JsonData } from './json-data.ts';
|
|
2
|
+
export type JsonParseValue = null | boolean | number | string | JsonParseValue[] | {
|
|
3
|
+
[key: string]: JsonParseValue;
|
|
4
|
+
};
|
|
5
|
+
export declare function toJsonParseValue(value: JsonData): JsonParseValue;
|
|
6
|
+
//# sourceMappingURL=to-json-parse-value.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"to-json-parse-value.d.ts","sourceRoot":"","sources":["../src/to-json-parse-value.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAG/C,MAAM,MAAM,cAAc,GACtB,IAAI,GACJ,OAAO,GACP,MAAM,GACN,MAAM,GACN,cAAc,EAAE,GAChB;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,cAAc,CAAA;CAAE,CAAC;AAStC,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,QAAQ,GAAG,cAAc,CAQhE"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
// The value that JSON.parse gives for the JSON text of a value, for code that
|
|
2
|
+
// reads only plain JavaScript, such as a JSON Schema validator. It loses what
|
|
3
|
+
// JsonData keeps: a dict becomes an object, so its integer-like keys move
|
|
4
|
+
// first, and an int becomes the nearest number, so an int beyond 2^53 loses
|
|
5
|
+
// digits. The int -0 gives 0, where JSON.parse gives -0: an int of Python has
|
|
6
|
+
// no negative zero. Keep the JsonData, and convert it only where such code
|
|
7
|
+
// reads it (ADR 0002).
|
|
8
|
+
export function toJsonParseValue(value) {
|
|
9
|
+
if (typeof value === 'bigint')
|
|
10
|
+
return Number(value);
|
|
11
|
+
if (Array.isArray(value))
|
|
12
|
+
return value.map(toJsonParseValue);
|
|
13
|
+
if (value instanceof Map)
|
|
14
|
+
return Object.fromEntries([...value].map(([key, item]) => [key, toJsonParseValue(item)]));
|
|
15
|
+
return value;
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=to-json-parse-value.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"to-json-parse-value.js","sourceRoot":"","sources":["../src/to-json-parse-value.ts"],"names":[],"mappings":"AAWA,8EAA8E;AAC9E,8EAA8E;AAC9E,0EAA0E;AAC1E,4EAA4E;AAC5E,8EAA8E;AAC9E,2EAA2E;AAC3E,uBAAuB;AACvB,MAAM,UAAU,gBAAgB,CAAC,KAAe;IAC9C,IAAI,OAAO,KAAK,KAAK,QAAQ;QAAE,OAAO,MAAM,CAAC,KAAK,CAAC,CAAC;IACpD,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC;QAAE,OAAO,KAAK,CAAC,GAAG,CAAC,gBAAgB,CAAC,CAAC;IAC7D,IAAI,KAAK,YAAY,GAAG;QACtB,OAAO,MAAM,CAAC,WAAW,CACvB,CAAC,GAAG,KAAK,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,EAAE,IAAI,CAAC,EAAE,EAAE,CAAC,CAAC,GAAG,EAAE,gBAAgB,CAAC,IAAI,CAAC,CAAC,CAAC,CAC/D,CAAC;IACJ,OAAO,KAAK,CAAC;AACf,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,45 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zukhruf/python",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "0.8.3",
|
|
4
|
+
"description": "CPython 3.12 results in JavaScript: the compensated sum() of floats, repr() of a float, json.loads with the order of keys and ints apart from floats, and the white space of str.isspace().",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "https://github.com/JanuaryLabs/zukhruf",
|
|
9
|
+
"directory": "packages/python"
|
|
10
|
+
},
|
|
11
|
+
"bugs": {
|
|
12
|
+
"url": "https://github.com/JanuaryLabs/zukhruf/issues"
|
|
13
|
+
},
|
|
14
|
+
"homepage": "https://github.com/JanuaryLabs/zukhruf/tree/main/packages/python#readme",
|
|
15
|
+
"keywords": [
|
|
16
|
+
"python",
|
|
17
|
+
"cpython",
|
|
18
|
+
"json",
|
|
19
|
+
"repr",
|
|
20
|
+
"sum"
|
|
21
|
+
],
|
|
22
|
+
"type": "module",
|
|
23
|
+
"exports": {
|
|
24
|
+
"./package.json": "./package.json",
|
|
25
|
+
".": {
|
|
26
|
+
"@zukhruf/source": "./src/index.ts",
|
|
27
|
+
"types": "./dist/index.d.ts",
|
|
28
|
+
"import": "./dist/index.js",
|
|
29
|
+
"default": "./dist/index.js"
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
"files": [
|
|
33
|
+
"dist",
|
|
34
|
+
"NOTICE",
|
|
35
|
+
"!dist/spec/**",
|
|
36
|
+
"!**/*.tsbuildinfo",
|
|
37
|
+
"!**/*.test.*"
|
|
38
|
+
],
|
|
39
|
+
"dependencies": {
|
|
40
|
+
"jsonc-parser": "^3.3.1"
|
|
41
|
+
},
|
|
42
|
+
"publishConfig": {
|
|
43
|
+
"access": "public"
|
|
44
|
+
}
|
|
45
|
+
}
|