rapydscript-ns 0.9.3 → 0.9.5
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/.agignore +1 -1
- package/.github/workflows/ci.yml +38 -38
- package/=template.pyj +5 -5
- package/CHANGELOG.md +18 -0
- package/HACKING.md +103 -103
- package/LICENSE +24 -24
- package/PYTHON_GAPS.md +52 -142
- package/README.md +51 -21
- package/TODO.md +1 -26
- package/add-toc-to-readme +2 -2
- package/bin/export +75 -75
- package/bin/rapydscript +0 -0
- package/bin/web-repl-export +102 -102
- package/build +2 -2
- package/language-service/index.js +88 -36
- package/package.json +1 -1
- package/publish.py +37 -37
- package/release/baselib-plain-pretty.js +157 -31
- package/release/baselib-plain-ugly.js +5 -5
- package/release/compiler.js +724 -426
- package/release/signatures.json +29 -29
- package/session.vim +4 -4
- package/setup.cfg +2 -2
- package/src/ast.pyj +7 -0
- package/src/baselib-containers.pyj +41 -4
- package/src/baselib-errors.pyj +4 -3
- package/src/baselib-internal.pyj +47 -18
- package/src/baselib-str.pyj +16 -3
- package/src/compiler.pyj +36 -36
- package/src/errors.pyj +30 -30
- package/src/lib/aes.pyj +646 -646
- package/src/lib/collections.pyj +227 -3
- package/src/lib/copy.pyj +120 -120
- package/src/lib/elementmaker.pyj +83 -83
- package/src/lib/encodings.pyj +126 -126
- package/src/lib/gettext.pyj +569 -569
- package/src/lib/itertools.pyj +580 -580
- package/src/lib/math.pyj +193 -193
- package/src/lib/operator.pyj +11 -11
- package/src/lib/pprint.pyj +455 -0
- package/src/lib/random.pyj +118 -118
- package/src/lib/react.pyj +74 -74
- package/src/lib/statistics.pyj +0 -0
- package/src/lib/traceback.pyj +63 -63
- package/src/lib/uuid.pyj +77 -77
- package/src/monaco-language-service/completions.js +21 -14
- package/src/monaco-language-service/diagnostics.js +2 -2
- package/src/monaco-language-service/dts.js +58 -15
- package/src/monaco-language-service/package.json +3 -0
- package/src/output/classes.pyj +25 -2
- package/src/output/codegen.pyj +4 -1
- package/src/output/comments.pyj +45 -45
- package/src/output/exceptions.pyj +201 -201
- package/src/output/jsx.pyj +164 -164
- package/src/output/treeshake.pyj +182 -182
- package/src/output/utils.pyj +72 -72
- package/src/parse.pyj +42 -7
- package/src/string_interpolation.pyj +72 -72
- package/src/tokenizer.pyj +18 -2
- package/src/unicode_aliases.pyj +576 -576
- package/src/utils.pyj +192 -192
- package/test/_import_one.pyj +37 -37
- package/test/_import_two/__init__.pyj +11 -11
- package/test/_import_two/level2/deep.pyj +4 -4
- package/test/_import_two/other.pyj +6 -6
- package/test/_import_two/sub.pyj +13 -13
- package/test/aes_vectors.pyj +421 -421
- package/test/annotations.pyj +80 -80
- package/test/baselib.pyj +23 -0
- package/test/chainmap.pyj +185 -0
- package/test/dataclasses.pyj +3 -4
- package/test/decorators.pyj +77 -77
- package/test/docstrings.pyj +39 -39
- package/test/elementmaker_test.pyj +45 -45
- package/test/enum.pyj +1 -1
- package/test/functions.pyj +151 -151
- package/test/generators.pyj +41 -41
- package/test/generic.pyj +370 -370
- package/test/internationalization.pyj +73 -73
- package/test/lint.pyj +164 -164
- package/test/loops.pyj +85 -85
- package/test/numpy.pyj +734 -734
- package/test/pprint.pyj +232 -0
- package/test/python_features.pyj +1 -1
- package/test/repl.pyj +121 -121
- package/test/scoped_flags.pyj +76 -76
- package/test/statistics.pyj +224 -0
- package/test/str.pyj +4 -4
- package/test/unit/index.js +455 -0
- package/test/unit/language-service-completions.js +2 -0
- package/test/unit/language-service-dts.js +113 -0
- package/test/unit/language-service-hover.js +455 -455
- package/test/unit/language-service.js +135 -2
- package/test/unit/web-repl.js +349 -1
- package/tools/compiler.d.ts +367 -367
- package/tools/completer.js +131 -131
- package/tools/export.js +4 -2
- package/tools/gettext.js +185 -185
- package/tools/ini.js +65 -65
- package/tools/msgfmt.js +187 -187
- package/tools/repl.js +223 -223
- package/tools/test.js +118 -118
- package/tools/utils.js +141 -128
- package/tools/web_repl.js +95 -95
- package/try +41 -41
- package/web-repl/env.js +196 -196
- package/web-repl/index.html +163 -163
- package/web-repl/prism.css +139 -139
- package/web-repl/prism.js +113 -113
- package/web-repl/rapydscript.js +228 -226
- package/web-repl/sha1.js +25 -25
package/package.json
CHANGED
package/publish.py
CHANGED
|
@@ -1,37 +1,37 @@
|
|
|
1
|
-
#!/usr/bin/env python
|
|
2
|
-
# vim:fileencoding=utf-8
|
|
3
|
-
# License: BSD Copyright: 2016, Kovid Goyal <kovid at kovidgoyal.net>
|
|
4
|
-
|
|
5
|
-
import subprocess
|
|
6
|
-
import os
|
|
7
|
-
import shutil
|
|
8
|
-
import json
|
|
9
|
-
|
|
10
|
-
# Load metadata
|
|
11
|
-
base = os.path.dirname(os.path.abspath(__file__))
|
|
12
|
-
subprocess.check_call([os.path.join(base, 'build')])
|
|
13
|
-
with open('package.json', 'rb') as f:
|
|
14
|
-
m = json.load(f)
|
|
15
|
-
version = m['version']
|
|
16
|
-
|
|
17
|
-
# Update the files in release/ from dev/
|
|
18
|
-
shutil.rmtree(os.path.join(base, 'release'))
|
|
19
|
-
shutil.copytree(os.path.join(base, 'dev'), os.path.join(base, 'release'))
|
|
20
|
-
subprocess.check_call(['git', 'add', os.path.join(base, 'release')])
|
|
21
|
-
if subprocess.check_output(
|
|
22
|
-
'git status --porcelain --untracked-files release'.split()).strip():
|
|
23
|
-
subprocess.check_call([
|
|
24
|
-
'git', 'commit', '-m', 'Updating release build of compiler'])
|
|
25
|
-
subprocess.check_call('git push'.split())
|
|
26
|
-
|
|
27
|
-
# Tag the release
|
|
28
|
-
subprocess.check_call('git tag -s v{0} -m version-{0}'.format(version).split())
|
|
29
|
-
subprocess.check_call(['git', 'push', 'origin', 'v'+version])
|
|
30
|
-
|
|
31
|
-
# Update the web REPL
|
|
32
|
-
gh_pages = os.path.join(os.path.dirname(base), 'kovidgoyal.github.io')
|
|
33
|
-
subprocess.check_call([os.path.join(gh_pages, 'update-rapyd-repl.py')])
|
|
34
|
-
|
|
35
|
-
# Publish to NPM
|
|
36
|
-
subprocess.check_call(['npm', 'login'])
|
|
37
|
-
subprocess.check_call(['npm', 'publish', base])
|
|
1
|
+
#!/usr/bin/env python
|
|
2
|
+
# vim:fileencoding=utf-8
|
|
3
|
+
# License: BSD Copyright: 2016, Kovid Goyal <kovid at kovidgoyal.net>
|
|
4
|
+
|
|
5
|
+
import subprocess
|
|
6
|
+
import os
|
|
7
|
+
import shutil
|
|
8
|
+
import json
|
|
9
|
+
|
|
10
|
+
# Load metadata
|
|
11
|
+
base = os.path.dirname(os.path.abspath(__file__))
|
|
12
|
+
subprocess.check_call([os.path.join(base, 'build')])
|
|
13
|
+
with open('package.json', 'rb') as f:
|
|
14
|
+
m = json.load(f)
|
|
15
|
+
version = m['version']
|
|
16
|
+
|
|
17
|
+
# Update the files in release/ from dev/
|
|
18
|
+
shutil.rmtree(os.path.join(base, 'release'))
|
|
19
|
+
shutil.copytree(os.path.join(base, 'dev'), os.path.join(base, 'release'))
|
|
20
|
+
subprocess.check_call(['git', 'add', os.path.join(base, 'release')])
|
|
21
|
+
if subprocess.check_output(
|
|
22
|
+
'git status --porcelain --untracked-files release'.split()).strip():
|
|
23
|
+
subprocess.check_call([
|
|
24
|
+
'git', 'commit', '-m', 'Updating release build of compiler'])
|
|
25
|
+
subprocess.check_call('git push'.split())
|
|
26
|
+
|
|
27
|
+
# Tag the release
|
|
28
|
+
subprocess.check_call('git tag -s v{0} -m version-{0}'.format(version).split())
|
|
29
|
+
subprocess.check_call(['git', 'push', 'origin', 'v'+version])
|
|
30
|
+
|
|
31
|
+
# Update the web REPL
|
|
32
|
+
gh_pages = os.path.join(os.path.dirname(base), 'kovidgoyal.github.io')
|
|
33
|
+
subprocess.check_call([os.path.join(gh_pages, 'update-rapyd-repl.py')])
|
|
34
|
+
|
|
35
|
+
# Publish to NPM
|
|
36
|
+
subprocess.check_call(['npm', 'login'])
|
|
37
|
+
subprocess.check_call(['npm', 'publish', base])
|
|
@@ -2837,7 +2837,12 @@ if (!ρσ_list_remove.__argnames__) Object.defineProperties(ρσ_list_remove, {
|
|
|
2837
2837
|
});
|
|
2838
2838
|
|
|
2839
2839
|
function ρσ_list_to_string() {
|
|
2840
|
-
|
|
2840
|
+
var ans;
|
|
2841
|
+
ans = [];
|
|
2842
|
+
for (var i = 0; i < this.length; i++) {
|
|
2843
|
+
ans.push(ρσ_repr((ρσ_expr_temp = this)[(typeof i === "number" && i < 0) ? ρσ_expr_temp.length + i : i]));
|
|
2844
|
+
}
|
|
2845
|
+
return ρσ_list_add(ρσ_list_add("[", ans.join(", ")), "]");
|
|
2841
2846
|
};
|
|
2842
2847
|
if (!ρσ_list_to_string.__module__) Object.defineProperties(ρσ_list_to_string, {
|
|
2843
2848
|
__module__ : {value: "__main__"}
|
|
@@ -2906,6 +2911,9 @@ function ρσ_list_sort_key(value) {
|
|
|
2906
2911
|
if (t === "string" || t === "number") {
|
|
2907
2912
|
return value;
|
|
2908
2913
|
}
|
|
2914
|
+
if (value !== null && value !== undefined && typeof value.__lt__ === "function") {
|
|
2915
|
+
return value;
|
|
2916
|
+
}
|
|
2909
2917
|
return value.toString();
|
|
2910
2918
|
};
|
|
2911
2919
|
if (!ρσ_list_sort_key.__argnames__) Object.defineProperties(ρσ_list_sort_key, {
|
|
@@ -2914,6 +2922,15 @@ if (!ρσ_list_sort_key.__argnames__) Object.defineProperties(ρσ_list_sort_key
|
|
|
2914
2922
|
});
|
|
2915
2923
|
|
|
2916
2924
|
function ρσ_list_sort_cmp(a, b, ap, bp) {
|
|
2925
|
+
if (a !== null && a !== undefined && typeof a.__lt__ === "function") {
|
|
2926
|
+
if (ρσ_op_lt(a, b)) {
|
|
2927
|
+
return -1;
|
|
2928
|
+
}
|
|
2929
|
+
if (ρσ_op_lt(b, a)) {
|
|
2930
|
+
return 1;
|
|
2931
|
+
}
|
|
2932
|
+
return ap - bp;
|
|
2933
|
+
}
|
|
2917
2934
|
if (a < b) {
|
|
2918
2935
|
return -1;
|
|
2919
2936
|
}
|
|
@@ -2938,9 +2955,26 @@ function ρσ_list_sort() {
|
|
|
2938
2955
|
if (Object.prototype.hasOwnProperty.call(ρσ_kwargs_obj, "reverse")){
|
|
2939
2956
|
reverse = ρσ_kwargs_obj.reverse;
|
|
2940
2957
|
}
|
|
2941
|
-
var mult, keymap, posmap, k;
|
|
2942
|
-
key = key || ρσ_list_sort_key;
|
|
2958
|
+
var mult, cmpposmap, keymap, posmap, k;
|
|
2943
2959
|
mult = (reverse) ? -1 : 1;
|
|
2960
|
+
if (key !== null && key !== undefined && typeof key === "function" && key.length === 2) {
|
|
2961
|
+
cmpposmap = dict();
|
|
2962
|
+
for (var i=0; i < this.length; i++) {
|
|
2963
|
+
cmpposmap.set((ρσ_expr_temp = this)[(typeof i === "number" && i < 0) ? ρσ_expr_temp.length + i : i], i);
|
|
2964
|
+
}
|
|
2965
|
+
Array.prototype.sort.call(this, (function() {
|
|
2966
|
+
var ρσ_anonfunc = function (a, b) {
|
|
2967
|
+
return mult * key(a, b) || cmpposmap.get(a) - cmpposmap.get(b);
|
|
2968
|
+
};
|
|
2969
|
+
if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, {
|
|
2970
|
+
__argnames__ : {value: ["a", "b"]},
|
|
2971
|
+
__module__ : {value: "__main__"}
|
|
2972
|
+
});
|
|
2973
|
+
return ρσ_anonfunc;
|
|
2974
|
+
})());
|
|
2975
|
+
return;
|
|
2976
|
+
}
|
|
2977
|
+
key = key || ρσ_list_sort_key;
|
|
2944
2978
|
keymap = dict();
|
|
2945
2979
|
posmap = dict();
|
|
2946
2980
|
for (var i=0; i < this.length; i++) {
|
|
@@ -3690,7 +3724,15 @@ Object.defineProperties(ρσ_set.prototype, (function(){
|
|
|
3690
3724
|
})();
|
|
3691
3725
|
ρσ_set.prototype.toString = ρσ_set.prototype.__repr__ = ρσ_set.prototype.__str__ = ρσ_set.prototype.inspect = (function() {
|
|
3692
3726
|
var ρσ_anonfunc = function () {
|
|
3693
|
-
|
|
3727
|
+
var ans, iterator, r;
|
|
3728
|
+
ans = [];
|
|
3729
|
+
iterator = this.jsset.values();
|
|
3730
|
+
r = iterator.next();
|
|
3731
|
+
while (!r.done) {
|
|
3732
|
+
ans.push(ρσ_repr(r.value));
|
|
3733
|
+
r = iterator.next();
|
|
3734
|
+
}
|
|
3735
|
+
return ρσ_list_add(ρσ_list_add("{", ans.join(", ")), "}");
|
|
3694
3736
|
};
|
|
3695
3737
|
if (!ρσ_anonfunc.__module__) Object.defineProperties(ρσ_anonfunc, {
|
|
3696
3738
|
__module__ : {value: "__main__"}
|
|
@@ -3991,7 +4033,15 @@ Object.defineProperties(ρσ_frozenset.prototype, (function(){
|
|
|
3991
4033
|
})();
|
|
3992
4034
|
ρσ_frozenset.prototype.toString = ρσ_frozenset.prototype.__repr__ = ρσ_frozenset.prototype.__str__ = ρσ_frozenset.prototype.inspect = (function() {
|
|
3993
4035
|
var ρσ_anonfunc = function () {
|
|
3994
|
-
|
|
4036
|
+
var ans, iterator, r;
|
|
4037
|
+
ans = [];
|
|
4038
|
+
iterator = this.jsset.values();
|
|
4039
|
+
r = iterator.next();
|
|
4040
|
+
while (!r.done) {
|
|
4041
|
+
ans.push(ρσ_repr(r.value));
|
|
4042
|
+
r = iterator.next();
|
|
4043
|
+
}
|
|
4044
|
+
return ρσ_list_add(ρσ_list_add("frozenset({", ans.join(", ")), "})");
|
|
3995
4045
|
};
|
|
3996
4046
|
if (!ρσ_anonfunc.__module__) Object.defineProperties(ρσ_anonfunc, {
|
|
3997
4047
|
__module__ : {value: "__main__"}
|
|
@@ -4734,14 +4784,14 @@ function Exception() {
|
|
|
4734
4784
|
Exception.prototype.__init__.apply(this, arguments);
|
|
4735
4785
|
}
|
|
4736
4786
|
ρσ_extends(Exception, Error);
|
|
4737
|
-
Exception.prototype.__init__ = function __init__(
|
|
4787
|
+
Exception.prototype.__init__ = function __init__() {
|
|
4738
4788
|
var self = this;
|
|
4739
|
-
self.
|
|
4789
|
+
self.args = Array.prototype.slice.call(arguments);
|
|
4790
|
+
self.message = (self.args.length > 0) ? self.args[0] : "";
|
|
4740
4791
|
self.stack = _ρσ_NativeError().stack;
|
|
4741
4792
|
self.name = self.constructor.name;
|
|
4742
4793
|
};
|
|
4743
|
-
if (!Exception.prototype.__init__.
|
|
4744
|
-
__argnames__ : {value: ["message"]},
|
|
4794
|
+
if (!Exception.prototype.__init__.__module__) Object.defineProperties(Exception.prototype.__init__, {
|
|
4745
4795
|
__module__ : {value: "__main__"}
|
|
4746
4796
|
});
|
|
4747
4797
|
Exception.__argnames__ = Exception.prototype.__init__.__argnames__;
|
|
@@ -5115,7 +5165,7 @@ function ExceptionGroup() {
|
|
|
5115
5165
|
ρσ_extends(ExceptionGroup, Exception);
|
|
5116
5166
|
ExceptionGroup.prototype.__init__ = function __init__(message, exceptions) {
|
|
5117
5167
|
var self = this;
|
|
5118
|
-
Exception.prototype.__init__.call(self, message);
|
|
5168
|
+
Exception.prototype.__init__.call(self, message, exceptions);
|
|
5119
5169
|
self.exceptions = (exceptions) ? exceptions : ρσ_list_decorate([]);
|
|
5120
5170
|
};
|
|
5121
5171
|
if (!ExceptionGroup.prototype.__init__.__argnames__) Object.defineProperties(ExceptionGroup.prototype.__init__, {
|
|
@@ -5994,16 +6044,22 @@ if (!ρσ_op_pow.__argnames__) Object.defineProperties(ρσ_op_pow, {
|
|
|
5994
6044
|
});
|
|
5995
6045
|
|
|
5996
6046
|
function ρσ_op_and(a, b) {
|
|
6047
|
+
var ta, tb;
|
|
5997
6048
|
if (a !== null && typeof a.__and__ === "function") {
|
|
5998
6049
|
return a.__and__(b);
|
|
5999
6050
|
}
|
|
6000
6051
|
if (b !== null && typeof b.__rand__ === "function") {
|
|
6001
6052
|
return b.__rand__(a);
|
|
6002
6053
|
}
|
|
6003
|
-
|
|
6004
|
-
|
|
6054
|
+
ta = typeof a;
|
|
6055
|
+
tb = typeof b;
|
|
6056
|
+
if ((ta === "number" || ta === "boolean") && (tb === "number" || tb === "boolean")) {
|
|
6057
|
+
return a & b;
|
|
6058
|
+
}
|
|
6059
|
+
if (ta === "bigint" && tb === "bigint") {
|
|
6060
|
+
return a & b;
|
|
6005
6061
|
}
|
|
6006
|
-
|
|
6062
|
+
throw new TypeError(ρσ_list_add(ρσ_list_add(ρσ_list_add(ρσ_list_add("unsupported operand type(s) for &: '", ρσ_arith_type_name(a)), "' and '"), ρσ_arith_type_name(b)), "'"));
|
|
6007
6063
|
};
|
|
6008
6064
|
if (!ρσ_op_and.__argnames__) Object.defineProperties(ρσ_op_and, {
|
|
6009
6065
|
__argnames__ : {value: ["a", "b"]},
|
|
@@ -6011,16 +6067,25 @@ if (!ρσ_op_and.__argnames__) Object.defineProperties(ρσ_op_and, {
|
|
|
6011
6067
|
});
|
|
6012
6068
|
|
|
6013
6069
|
function ρσ_op_or(a, b) {
|
|
6070
|
+
var ta, tb;
|
|
6014
6071
|
if (a !== null && typeof a.__or__ === "function") {
|
|
6015
6072
|
return a.__or__(b);
|
|
6016
6073
|
}
|
|
6017
6074
|
if (b !== null && typeof b.__ror__ === "function") {
|
|
6018
6075
|
return b.__ror__(a);
|
|
6019
6076
|
}
|
|
6020
|
-
|
|
6021
|
-
|
|
6077
|
+
ta = typeof a;
|
|
6078
|
+
tb = typeof b;
|
|
6079
|
+
if (ta === "object" && tb === "object" && a !== null && b !== null && !Array.isArray(a) && !Array.isArray(b) && a.constructor === Object && b.constructor === Object) {
|
|
6080
|
+
return Object.assign({}, a, b);
|
|
6022
6081
|
}
|
|
6023
|
-
|
|
6082
|
+
if ((ta === "number" || ta === "boolean") && (tb === "number" || tb === "boolean")) {
|
|
6083
|
+
return a | b;
|
|
6084
|
+
}
|
|
6085
|
+
if (ta === "bigint" && tb === "bigint") {
|
|
6086
|
+
return a | b;
|
|
6087
|
+
}
|
|
6088
|
+
throw new TypeError(ρσ_list_add(ρσ_list_add(ρσ_list_add(ρσ_list_add("unsupported operand type(s) for |: '", ρσ_arith_type_name(a)), "' and '"), ρσ_arith_type_name(b)), "'"));
|
|
6024
6089
|
};
|
|
6025
6090
|
if (!ρσ_op_or.__argnames__) Object.defineProperties(ρσ_op_or, {
|
|
6026
6091
|
__argnames__ : {value: ["a", "b"]},
|
|
@@ -6028,16 +6093,22 @@ if (!ρσ_op_or.__argnames__) Object.defineProperties(ρσ_op_or, {
|
|
|
6028
6093
|
});
|
|
6029
6094
|
|
|
6030
6095
|
function ρσ_op_xor(a, b) {
|
|
6096
|
+
var ta, tb;
|
|
6031
6097
|
if (a !== null && typeof a.__xor__ === "function") {
|
|
6032
6098
|
return a.__xor__(b);
|
|
6033
6099
|
}
|
|
6034
6100
|
if (b !== null && typeof b.__rxor__ === "function") {
|
|
6035
6101
|
return b.__rxor__(a);
|
|
6036
6102
|
}
|
|
6037
|
-
|
|
6038
|
-
|
|
6103
|
+
ta = typeof a;
|
|
6104
|
+
tb = typeof b;
|
|
6105
|
+
if ((ta === "number" || ta === "boolean") && (tb === "number" || tb === "boolean")) {
|
|
6106
|
+
return a ^ b;
|
|
6107
|
+
}
|
|
6108
|
+
if (ta === "bigint" && tb === "bigint") {
|
|
6109
|
+
return a ^ b;
|
|
6039
6110
|
}
|
|
6040
|
-
|
|
6111
|
+
throw new TypeError(ρσ_list_add(ρσ_list_add(ρσ_list_add(ρσ_list_add("unsupported operand type(s) for ^: '", ρσ_arith_type_name(a)), "' and '"), ρσ_arith_type_name(b)), "'"));
|
|
6041
6112
|
};
|
|
6042
6113
|
if (!ρσ_op_xor.__argnames__) Object.defineProperties(ρσ_op_xor, {
|
|
6043
6114
|
__argnames__ : {value: ["a", "b"]},
|
|
@@ -6045,16 +6116,22 @@ if (!ρσ_op_xor.__argnames__) Object.defineProperties(ρσ_op_xor, {
|
|
|
6045
6116
|
});
|
|
6046
6117
|
|
|
6047
6118
|
function ρσ_op_lshift(a, b) {
|
|
6119
|
+
var ta, tb;
|
|
6048
6120
|
if (a !== null && typeof a.__lshift__ === "function") {
|
|
6049
6121
|
return a.__lshift__(b);
|
|
6050
6122
|
}
|
|
6051
6123
|
if (b !== null && typeof b.__rlshift__ === "function") {
|
|
6052
6124
|
return b.__rlshift__(a);
|
|
6053
6125
|
}
|
|
6054
|
-
|
|
6055
|
-
|
|
6126
|
+
ta = typeof a;
|
|
6127
|
+
tb = typeof b;
|
|
6128
|
+
if ((ta === "number" || ta === "boolean") && (tb === "number" || tb === "boolean")) {
|
|
6129
|
+
return a << b;
|
|
6130
|
+
}
|
|
6131
|
+
if (ta === "bigint" && tb === "bigint") {
|
|
6132
|
+
return a << b;
|
|
6056
6133
|
}
|
|
6057
|
-
|
|
6134
|
+
throw new TypeError(ρσ_list_add(ρσ_list_add(ρσ_list_add(ρσ_list_add("unsupported operand type(s) for <<: '", ρσ_arith_type_name(a)), "' and '"), ρσ_arith_type_name(b)), "'"));
|
|
6058
6135
|
};
|
|
6059
6136
|
if (!ρσ_op_lshift.__argnames__) Object.defineProperties(ρσ_op_lshift, {
|
|
6060
6137
|
__argnames__ : {value: ["a", "b"]},
|
|
@@ -6062,16 +6139,22 @@ if (!ρσ_op_lshift.__argnames__) Object.defineProperties(ρσ_op_lshift, {
|
|
|
6062
6139
|
});
|
|
6063
6140
|
|
|
6064
6141
|
function ρσ_op_rshift(a, b) {
|
|
6142
|
+
var ta, tb;
|
|
6065
6143
|
if (a !== null && typeof a.__rshift__ === "function") {
|
|
6066
6144
|
return a.__rshift__(b);
|
|
6067
6145
|
}
|
|
6068
6146
|
if (b !== null && typeof b.__rrshift__ === "function") {
|
|
6069
6147
|
return b.__rrshift__(a);
|
|
6070
6148
|
}
|
|
6071
|
-
|
|
6072
|
-
|
|
6149
|
+
ta = typeof a;
|
|
6150
|
+
tb = typeof b;
|
|
6151
|
+
if ((ta === "number" || ta === "boolean") && (tb === "number" || tb === "boolean")) {
|
|
6152
|
+
return a >> b;
|
|
6153
|
+
}
|
|
6154
|
+
if (ta === "bigint" && tb === "bigint") {
|
|
6155
|
+
return a >> b;
|
|
6073
6156
|
}
|
|
6074
|
-
|
|
6157
|
+
throw new TypeError(ρσ_list_add(ρσ_list_add(ρσ_list_add(ρσ_list_add("unsupported operand type(s) for >>: '", ρσ_arith_type_name(a)), "' and '"), ρσ_arith_type_name(b)), "'"));
|
|
6075
6158
|
};
|
|
6076
6159
|
if (!ρσ_op_rshift.__argnames__) Object.defineProperties(ρσ_op_rshift, {
|
|
6077
6160
|
__argnames__ : {value: ["a", "b"]},
|
|
@@ -6252,10 +6335,15 @@ if (!ρσ_list_iadd.__argnames__) Object.defineProperties(ρσ_list_iadd, {
|
|
|
6252
6335
|
});
|
|
6253
6336
|
|
|
6254
6337
|
function ρσ_op_neg(a) {
|
|
6338
|
+
var ta;
|
|
6255
6339
|
if (a !== null && typeof a.__neg__ === "function") {
|
|
6256
6340
|
return a.__neg__();
|
|
6257
6341
|
}
|
|
6258
|
-
|
|
6342
|
+
ta = typeof a;
|
|
6343
|
+
if (ta === "number" || ta === "boolean" || ta === "bigint") {
|
|
6344
|
+
return -a;
|
|
6345
|
+
}
|
|
6346
|
+
throw new TypeError(ρσ_list_add(ρσ_list_add("bad operand type for unary -: '", ρσ_arith_type_name(a)), "'"));
|
|
6259
6347
|
};
|
|
6260
6348
|
if (!ρσ_op_neg.__argnames__) Object.defineProperties(ρσ_op_neg, {
|
|
6261
6349
|
__argnames__ : {value: ["a"]},
|
|
@@ -6263,10 +6351,18 @@ if (!ρσ_op_neg.__argnames__) Object.defineProperties(ρσ_op_neg, {
|
|
|
6263
6351
|
});
|
|
6264
6352
|
|
|
6265
6353
|
function ρσ_op_pos(a) {
|
|
6354
|
+
var ta;
|
|
6266
6355
|
if (a !== null && typeof a.__pos__ === "function") {
|
|
6267
6356
|
return a.__pos__();
|
|
6268
6357
|
}
|
|
6269
|
-
|
|
6358
|
+
ta = typeof a;
|
|
6359
|
+
if (ta === "number" || ta === "boolean") {
|
|
6360
|
+
return +a;
|
|
6361
|
+
}
|
|
6362
|
+
if (ta === "bigint") {
|
|
6363
|
+
return a;
|
|
6364
|
+
}
|
|
6365
|
+
throw new TypeError(ρσ_list_add(ρσ_list_add("bad operand type for unary +: '", ρσ_arith_type_name(a)), "'"));
|
|
6270
6366
|
};
|
|
6271
6367
|
if (!ρσ_op_pos.__argnames__) Object.defineProperties(ρσ_op_pos, {
|
|
6272
6368
|
__argnames__ : {value: ["a"]},
|
|
@@ -6274,10 +6370,15 @@ if (!ρσ_op_pos.__argnames__) Object.defineProperties(ρσ_op_pos, {
|
|
|
6274
6370
|
});
|
|
6275
6371
|
|
|
6276
6372
|
function ρσ_op_invert(a) {
|
|
6373
|
+
var ta;
|
|
6277
6374
|
if (a !== null && typeof a.__invert__ === "function") {
|
|
6278
6375
|
return a.__invert__();
|
|
6279
6376
|
}
|
|
6280
|
-
|
|
6377
|
+
ta = typeof a;
|
|
6378
|
+
if (ta === "number" || ta === "boolean" || ta === "bigint") {
|
|
6379
|
+
return ~a;
|
|
6380
|
+
}
|
|
6381
|
+
throw new TypeError(ρσ_list_add(ρσ_list_add("bad operand type for unary ~: '", ρσ_arith_type_name(a)), "'"));
|
|
6281
6382
|
};
|
|
6282
6383
|
if (!ρσ_op_invert.__argnames__) Object.defineProperties(ρσ_op_invert, {
|
|
6283
6384
|
__argnames__ : {value: ["a"]},
|
|
@@ -6373,9 +6474,16 @@ if (!ρσ_op_iand.__argnames__) Object.defineProperties(ρσ_op_iand, {
|
|
|
6373
6474
|
});
|
|
6374
6475
|
|
|
6375
6476
|
function ρσ_op_ior(a, b) {
|
|
6477
|
+
var ta, tb;
|
|
6376
6478
|
if (a !== null && typeof a.__ior__ === "function") {
|
|
6377
6479
|
return a.__ior__(b);
|
|
6378
6480
|
}
|
|
6481
|
+
ta = typeof a;
|
|
6482
|
+
tb = typeof b;
|
|
6483
|
+
if (ta === "object" && tb === "object" && a !== null && b !== null && !Array.isArray(a) && !Array.isArray(b) && a.constructor === Object && b.constructor === Object) {
|
|
6484
|
+
Object.assign(a, b);
|
|
6485
|
+
return a;
|
|
6486
|
+
}
|
|
6379
6487
|
return ρσ_op_or(a, b);
|
|
6380
6488
|
};
|
|
6381
6489
|
if (!ρσ_op_ior.__argnames__) Object.defineProperties(ρσ_op_ior, {
|
|
@@ -6821,10 +6929,17 @@ var ρσ_proxy_target_symbol = typeof Symbol === "function" ? Symbol("ρσ_proxy
|
|
|
6821
6929
|
})();
|
|
6822
6930
|
ρσ_d["set"] = (function() {
|
|
6823
6931
|
var ρσ_anonfunc = function (target, prop, value, receiver) {
|
|
6932
|
+
var slots;
|
|
6824
6933
|
if (typeof target.__setattr__ === "function") {
|
|
6825
6934
|
target.__setattr__.call(receiver, prop, value);
|
|
6826
6935
|
return true;
|
|
6827
6936
|
}
|
|
6937
|
+
if (typeof prop === "string" && prop[0] !== "ρ") {
|
|
6938
|
+
slots = target.constructor && target.constructor.prototype.__ρσ_slots__;
|
|
6939
|
+
if (slots && !slots.hasOwnProperty(prop)) {
|
|
6940
|
+
throw new AttributeError(ρσ_list_add(ρσ_list_add(ρσ_list_add(ρσ_list_add("'", (target.constructor.__name__ || "object")), "' object has no attribute '"), prop), "'"));
|
|
6941
|
+
}
|
|
6942
|
+
}
|
|
6828
6943
|
return Reflect.set(target, prop, value, target);
|
|
6829
6944
|
};
|
|
6830
6945
|
if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, {
|
|
@@ -7117,7 +7232,7 @@ function ρσ_repr_js_builtin(x, as_array) {
|
|
|
7117
7232
|
keys = Object.keys(x);
|
|
7118
7233
|
for (var k = 0; k < keys.length; k++) {
|
|
7119
7234
|
key = keys[(typeof k === "number" && k < 0) ? keys.length + k : k];
|
|
7120
|
-
ans.push(ρσ_list_add(ρσ_list_add(
|
|
7235
|
+
ans.push(ρσ_list_add(ρσ_list_add(ρσ_repr(key), ": "), ρσ_repr(x[(typeof key === "number" && key < 0) ? x.length + key : key])));
|
|
7121
7236
|
}
|
|
7122
7237
|
}
|
|
7123
7238
|
return ρσ_list_add(ρσ_list_add(b[0], ans.join(", ")), b[1]);
|
|
@@ -7164,6 +7279,8 @@ function ρσ_repr(x) {
|
|
|
7164
7279
|
ans = x.__repr__();
|
|
7165
7280
|
} else if (x === true || x === false) {
|
|
7166
7281
|
ans = (x) ? "True" : "False";
|
|
7282
|
+
} else if (typeof x === "string") {
|
|
7283
|
+
ans = ρσ_list_add(ρσ_list_add("'", x.replace("\\", "\\\\").replace("'", "\\'").replace("\n", "\\n").replace("\r", "\\r").replace("\t", "\\t")), "'");
|
|
7167
7284
|
} else if (Array.isArray(x)) {
|
|
7168
7285
|
ans = ρσ_repr_js_builtin(x, true);
|
|
7169
7286
|
} else if (typeof x === "function") {
|
|
@@ -7278,8 +7395,17 @@ define_str_func = (function() {
|
|
|
7278
7395
|
});
|
|
7279
7396
|
return ρσ_anonfunc;
|
|
7280
7397
|
})();
|
|
7281
|
-
|
|
7282
|
-
ρσ
|
|
7398
|
+
if (typeof globalThis !== "undefined" && globalThis._ρσ_orig_split) {
|
|
7399
|
+
ρσ_orig_split = globalThis._ρσ_orig_split;
|
|
7400
|
+
ρσ_orig_replace = globalThis._ρσ_orig_replace;
|
|
7401
|
+
} else {
|
|
7402
|
+
ρσ_orig_split = String.prototype.split.call.bind(String.prototype.split);
|
|
7403
|
+
ρσ_orig_replace = String.prototype.replace.call.bind(String.prototype.replace);
|
|
7404
|
+
if (typeof globalThis !== "undefined") {
|
|
7405
|
+
globalThis._ρσ_orig_split = ρσ_orig_split;
|
|
7406
|
+
globalThis._ρσ_orig_replace = ρσ_orig_replace;
|
|
7407
|
+
}
|
|
7408
|
+
}
|
|
7283
7409
|
define_str_func("format", (function() {
|
|
7284
7410
|
var ρσ_anonfunc = function () {
|
|
7285
7411
|
var template, args, kwargs, explicit, implicit, idx, split, ans, pos, in_brace, markup, ch;
|