rapydscript-ng 0.7.24 → 0.8.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/CHANGELOG.md +19 -0
- package/README.md +72 -26
- package/bin/package.json +1 -0
- package/bin/rapydscript +65 -62
- package/editor-plugins/nvim/rapydscript/README.md +184 -0
- package/editor-plugins/nvim/rapydscript/bin/rapydscript.so +0 -0
- package/editor-plugins/nvim/rapydscript/ftdetect/rapydscript.lua +10 -0
- package/editor-plugins/nvim/rapydscript/lua/rapydscript/health.lua +88 -0
- package/editor-plugins/nvim/rapydscript/lua/rapydscript/init.lua +279 -0
- package/local-agent.md +28 -0
- package/package.json +4 -5
- package/release/baselib-plain-pretty.js +448 -326
- package/release/baselib-plain-ugly.js +3 -3
- package/release/compiler.js +2528 -1672
- package/release/signatures.json +17 -17
- package/src/ast.pyj +73 -25
- package/src/baselib-builtins.pyj +2 -2
- package/src/baselib-containers.pyj +153 -151
- package/src/baselib-internal.pyj +3 -3
- package/src/baselib-str.pyj +5 -5
- package/src/lib/aes.pyj +1 -1
- package/src/lib/encodings.pyj +1 -1
- package/src/lib/pythonize.pyj +1 -1
- package/src/lib/re.pyj +2 -2
- package/src/lib/traceback.pyj +165 -28
- package/src/lib/uuid.pyj +1 -1
- package/src/output/codegen.pyj +10 -3
- package/src/output/functions.pyj +31 -40
- package/src/output/literals.pyj +11 -14
- package/src/output/loops.pyj +25 -87
- package/src/output/modules.pyj +5 -47
- package/src/output/statements.pyj +1 -1
- package/src/output/stream.pyj +58 -31
- package/src/parse.pyj +777 -427
- package/src/tokenizer.pyj +16 -4
- package/src/utils.pyj +1 -1
- package/test/_treeshake_mod.pyj +30 -0
- package/test/_treeshake_side_effect.pyj +9 -0
- package/test/ast_serialization.pyj +392 -0
- package/test/async.pyj +95 -0
- package/test/baselib.pyj +1 -2
- package/test/embedded_compiler.pyj +57 -0
- package/test/fmt.pyj +201 -0
- package/test/generic.pyj +7 -3
- package/test/imports.pyj +8 -6
- package/test/internationalization.pyj +38 -37
- package/test/lint.pyj +120 -117
- package/test/lsp.pyj +222 -0
- package/test/repl.pyj +70 -65
- package/test/sourcemaps.pyj +315 -0
- package/test/starargs.pyj +46 -39
- package/test/traceback.pyj +263 -0
- package/test/treeshaking.pyj +181 -0
- package/test/web_repl_export.pyj +88 -0
- package/tools/ast_serialize.mjs +557 -0
- package/tools/cli.mjs +510 -0
- package/tools/compile.mjs +201 -0
- package/tools/compiler.mjs +127 -0
- package/tools/{completer.js → completer.mjs} +6 -6
- package/tools/{embedded_compiler.js → embedded_compiler.mjs} +17 -13
- package/tools/export.js +109 -56
- package/tools/fmt.mjs +735 -0
- package/tools/{gettext.js → gettext.mjs} +46 -53
- package/tools/{ini.js → ini.mjs} +9 -10
- package/tools/{lint.js → lint.mjs} +78 -55
- package/tools/lsp.mjs +914 -0
- package/tools/lsp_protocol.mjs +259 -0
- package/tools/lsp_symbols.mjs +418 -0
- package/tools/{msgfmt.js → msgfmt.mjs} +18 -18
- package/tools/{repl.js → repl.mjs} +52 -41
- package/tools/{self.js → self.mjs} +56 -46
- package/tools/sourcemap.mjs +123 -0
- package/tools/test.mjs +152 -0
- package/tools/treeshake.mjs +400 -0
- package/tools/{utils.js → utils.mjs} +26 -23
- package/tools/{web_repl.js → web_repl.mjs} +15 -13
- package/tools/web_repl_export.mjs +93 -0
- package/tree-sitter/README.md +101 -0
- package/tree-sitter/grammar.js +992 -0
- package/tree-sitter/package.json +43 -0
- package/tree-sitter/queries/rapydscript/highlights.scm +232 -0
- package/tree-sitter/queries/rapydscript/indents.scm +64 -0
- package/tree-sitter/queries/rapydscript/injections.scm +14 -0
- package/tree-sitter/queries/rapydscript/locals.scm +108 -0
- package/tree-sitter/src/grammar.json +4976 -0
- package/tree-sitter/src/node-types.json +2901 -0
- package/tree-sitter/src/parser.c +196465 -0
- package/tree-sitter/src/scanner.c +294 -0
- package/tree-sitter/src/tree_sitter/alloc.h +54 -0
- package/tree-sitter/src/tree_sitter/array.h +330 -0
- package/tree-sitter/src/tree_sitter/parser.h +286 -0
- package/tree-sitter/test/corpus/chaining.txt +99 -0
- package/tree-sitter/test/corpus/classes.txt +147 -0
- package/tree-sitter/test/corpus/comprehensions.txt +155 -0
- package/tree-sitter/test/corpus/containers.txt +242 -0
- package/tree-sitter/test/corpus/control_flow.txt +361 -0
- package/tree-sitter/test/corpus/decorators.txt +64 -0
- package/tree-sitter/test/corpus/existential.txt +102 -0
- package/tree-sitter/test/corpus/functions.txt +293 -0
- package/tree-sitter/test/corpus/imports.txt +117 -0
- package/tree-sitter/test/corpus/literals.txt +135 -0
- package/tree-sitter/test/corpus/operators.txt +296 -0
- package/tree-sitter/test/corpus/statements.txt +189 -0
- package/tree-sitter/test/corpus/strings.txt +90 -0
- package/tree-sitter/test/corpus/subscripts.txt +227 -0
- package/tree-sitter/tree-sitter.json +36 -0
- package/web-repl/env.js +35 -23
- package/web-repl/main.js +8 -8
- package/bin/export +0 -75
- package/bin/web-repl-export +0 -102
- package/tools/cli.js +0 -523
- package/tools/compile.js +0 -184
- package/tools/compiler.js +0 -84
- package/tools/test.js +0 -110
|
@@ -12,7 +12,7 @@ function ρσ_print() {
|
|
|
12
12
|
if (typeof console === "object") {
|
|
13
13
|
parts = [];
|
|
14
14
|
for (var i = 0; i < arguments.length; i++) {
|
|
15
|
-
parts.push(ρσ_str(arguments[
|
|
15
|
+
parts.push(ρσ_str(arguments[i]));
|
|
16
16
|
}
|
|
17
17
|
console.log(parts.join(" "));
|
|
18
18
|
}
|
|
@@ -108,7 +108,7 @@ if (!ρσ_id.__argnames__) Object.defineProperties(ρσ_id, {
|
|
|
108
108
|
|
|
109
109
|
function ρσ_dir(item) {
|
|
110
110
|
var arr;
|
|
111
|
-
arr =
|
|
111
|
+
arr = [];
|
|
112
112
|
for (var i in item) {
|
|
113
113
|
arr.push(i);
|
|
114
114
|
}
|
|
@@ -591,9 +591,10 @@ function ρσ_max() {
|
|
|
591
591
|
}
|
|
592
592
|
if (kwargs.key) {
|
|
593
593
|
args = (function() {
|
|
594
|
-
var ρσ_Iter =
|
|
595
|
-
|
|
596
|
-
|
|
594
|
+
var ρσ_Iter = args, ρσ_Result = [], x;
|
|
595
|
+
ρσ_Iter = ((typeof ρσ_Iter[Symbol.iterator] === "function") ? (ρσ_Iter instanceof Map ? ρσ_Iter.keys() : ρσ_Iter) : Object.keys(ρσ_Iter));
|
|
596
|
+
for (var ρσ_Index of ρσ_Iter) {
|
|
597
|
+
x = ρσ_Index;
|
|
597
598
|
ρσ_Result.push(kwargs.key(x));
|
|
598
599
|
}
|
|
599
600
|
ρσ_Result = ρσ_list_constructor(ρσ_Result);
|
|
@@ -683,237 +684,6 @@ if (!ρσ_not_equals.__argnames__) Object.defineProperties(ρσ_not_equals, {
|
|
|
683
684
|
});
|
|
684
685
|
|
|
685
686
|
var equals = ρσ_equals;
|
|
686
|
-
function ρσ_list_extend(iterable) {
|
|
687
|
-
var start, iterator, result;
|
|
688
|
-
if (Array.isArray(iterable) || typeof iterable === "string") {
|
|
689
|
-
start = this.length;
|
|
690
|
-
this.length += iterable.length;
|
|
691
|
-
for (var i = 0; i < iterable.length; i++) {
|
|
692
|
-
(ρσ_expr_temp = this)[ρσ_bound_index(start + i, ρσ_expr_temp)] = iterable[(typeof i === "number" && i < 0) ? iterable.length + i : i];
|
|
693
|
-
}
|
|
694
|
-
} else {
|
|
695
|
-
iterator = (typeof Map === "function" && iterable instanceof Map) ? iterable.keys() : iterable[ρσ_iterator_symbol]();
|
|
696
|
-
result = iterator.next();
|
|
697
|
-
while (!result.done) {
|
|
698
|
-
this.push(result.value);
|
|
699
|
-
result = iterator.next();
|
|
700
|
-
}
|
|
701
|
-
}
|
|
702
|
-
};
|
|
703
|
-
if (!ρσ_list_extend.__argnames__) Object.defineProperties(ρσ_list_extend, {
|
|
704
|
-
__argnames__ : {value: ["iterable"]},
|
|
705
|
-
__module__ : {value: "__main__"}
|
|
706
|
-
});
|
|
707
|
-
|
|
708
|
-
function ρσ_list_index(val, start, stop) {
|
|
709
|
-
start = start || 0;
|
|
710
|
-
if (start < 0) {
|
|
711
|
-
start = this.length + start;
|
|
712
|
-
}
|
|
713
|
-
if (start < 0) {
|
|
714
|
-
throw new ValueError(val + " is not in list");
|
|
715
|
-
}
|
|
716
|
-
if (stop === undefined) {
|
|
717
|
-
stop = this.length;
|
|
718
|
-
}
|
|
719
|
-
if (stop < 0) {
|
|
720
|
-
stop = this.length + stop;
|
|
721
|
-
}
|
|
722
|
-
for (var i = start; i < stop; i++) {
|
|
723
|
-
if (((ρσ_expr_temp = this)[(typeof i === "number" && i < 0) ? ρσ_expr_temp.length + i : i] === val || typeof (ρσ_expr_temp = this)[(typeof i === "number" && i < 0) ? ρσ_expr_temp.length + i : i] === "object" && ρσ_equals((ρσ_expr_temp = this)[(typeof i === "number" && i < 0) ? ρσ_expr_temp.length + i : i], val))) {
|
|
724
|
-
return i;
|
|
725
|
-
}
|
|
726
|
-
}
|
|
727
|
-
throw new ValueError(val + " is not in list");
|
|
728
|
-
};
|
|
729
|
-
if (!ρσ_list_index.__argnames__) Object.defineProperties(ρσ_list_index, {
|
|
730
|
-
__argnames__ : {value: ["val", "start", "stop"]},
|
|
731
|
-
__module__ : {value: "__main__"}
|
|
732
|
-
});
|
|
733
|
-
|
|
734
|
-
function ρσ_list_pop(index) {
|
|
735
|
-
var ans;
|
|
736
|
-
if (this.length === 0) {
|
|
737
|
-
throw new IndexError("list is empty");
|
|
738
|
-
}
|
|
739
|
-
if (index === undefined) {
|
|
740
|
-
index = -1;
|
|
741
|
-
}
|
|
742
|
-
ans = this.splice(index, 1);
|
|
743
|
-
if (!ans.length) {
|
|
744
|
-
throw new IndexError("pop index out of range");
|
|
745
|
-
}
|
|
746
|
-
return ans[0];
|
|
747
|
-
};
|
|
748
|
-
if (!ρσ_list_pop.__argnames__) Object.defineProperties(ρσ_list_pop, {
|
|
749
|
-
__argnames__ : {value: ["index"]},
|
|
750
|
-
__module__ : {value: "__main__"}
|
|
751
|
-
});
|
|
752
|
-
|
|
753
|
-
function ρσ_list_remove(value) {
|
|
754
|
-
for (var i = 0; i < this.length; i++) {
|
|
755
|
-
if (((ρσ_expr_temp = this)[(typeof i === "number" && i < 0) ? ρσ_expr_temp.length + i : i] === value || typeof (ρσ_expr_temp = this)[(typeof i === "number" && i < 0) ? ρσ_expr_temp.length + i : i] === "object" && ρσ_equals((ρσ_expr_temp = this)[(typeof i === "number" && i < 0) ? ρσ_expr_temp.length + i : i], value))) {
|
|
756
|
-
this.splice(i, 1);
|
|
757
|
-
return;
|
|
758
|
-
}
|
|
759
|
-
}
|
|
760
|
-
throw new ValueError(value + " not in list");
|
|
761
|
-
};
|
|
762
|
-
if (!ρσ_list_remove.__argnames__) Object.defineProperties(ρσ_list_remove, {
|
|
763
|
-
__argnames__ : {value: ["value"]},
|
|
764
|
-
__module__ : {value: "__main__"}
|
|
765
|
-
});
|
|
766
|
-
|
|
767
|
-
function ρσ_list_to_string() {
|
|
768
|
-
return "[" + this.join(", ") + "]";
|
|
769
|
-
};
|
|
770
|
-
if (!ρσ_list_to_string.__module__) Object.defineProperties(ρσ_list_to_string, {
|
|
771
|
-
__module__ : {value: "__main__"}
|
|
772
|
-
});
|
|
773
|
-
|
|
774
|
-
function ρσ_list_insert(index, val) {
|
|
775
|
-
if (index < 0) {
|
|
776
|
-
index += this.length;
|
|
777
|
-
}
|
|
778
|
-
index = min(this.length, max(index, 0));
|
|
779
|
-
if (index === 0) {
|
|
780
|
-
this.unshift(val);
|
|
781
|
-
return;
|
|
782
|
-
}
|
|
783
|
-
for (var i = this.length; i > index; i--) {
|
|
784
|
-
(ρσ_expr_temp = this)[(typeof i === "number" && i < 0) ? ρσ_expr_temp.length + i : i] = (ρσ_expr_temp = this)[ρσ_bound_index(i - 1, ρσ_expr_temp)];
|
|
785
|
-
}
|
|
786
|
-
(ρσ_expr_temp = this)[(typeof index === "number" && index < 0) ? ρσ_expr_temp.length + index : index] = val;
|
|
787
|
-
};
|
|
788
|
-
if (!ρσ_list_insert.__argnames__) Object.defineProperties(ρσ_list_insert, {
|
|
789
|
-
__argnames__ : {value: ["index", "val"]},
|
|
790
|
-
__module__ : {value: "__main__"}
|
|
791
|
-
});
|
|
792
|
-
|
|
793
|
-
function ρσ_list_copy() {
|
|
794
|
-
return ρσ_list_constructor(this);
|
|
795
|
-
};
|
|
796
|
-
if (!ρσ_list_copy.__module__) Object.defineProperties(ρσ_list_copy, {
|
|
797
|
-
__module__ : {value: "__main__"}
|
|
798
|
-
});
|
|
799
|
-
|
|
800
|
-
function ρσ_list_clear() {
|
|
801
|
-
this.length = 0;
|
|
802
|
-
};
|
|
803
|
-
if (!ρσ_list_clear.__module__) Object.defineProperties(ρσ_list_clear, {
|
|
804
|
-
__module__ : {value: "__main__"}
|
|
805
|
-
});
|
|
806
|
-
|
|
807
|
-
function ρσ_list_as_array() {
|
|
808
|
-
return Array.prototype.slice.call(this);
|
|
809
|
-
};
|
|
810
|
-
if (!ρσ_list_as_array.__module__) Object.defineProperties(ρσ_list_as_array, {
|
|
811
|
-
__module__ : {value: "__main__"}
|
|
812
|
-
});
|
|
813
|
-
|
|
814
|
-
function ρσ_list_count(value) {
|
|
815
|
-
return this.reduce((function() {
|
|
816
|
-
var ρσ_anonfunc = function (n, val) {
|
|
817
|
-
return n + (val === value);
|
|
818
|
-
};
|
|
819
|
-
if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, {
|
|
820
|
-
__argnames__ : {value: ["n", "val"]},
|
|
821
|
-
__module__ : {value: "__main__"}
|
|
822
|
-
});
|
|
823
|
-
return ρσ_anonfunc;
|
|
824
|
-
})(), 0);
|
|
825
|
-
};
|
|
826
|
-
if (!ρσ_list_count.__argnames__) Object.defineProperties(ρσ_list_count, {
|
|
827
|
-
__argnames__ : {value: ["value"]},
|
|
828
|
-
__module__ : {value: "__main__"}
|
|
829
|
-
});
|
|
830
|
-
|
|
831
|
-
function ρσ_list_sort_key(value) {
|
|
832
|
-
var t;
|
|
833
|
-
t = typeof value;
|
|
834
|
-
if (t === "string" || t === "number") {
|
|
835
|
-
return value;
|
|
836
|
-
}
|
|
837
|
-
return value.toString();
|
|
838
|
-
};
|
|
839
|
-
if (!ρσ_list_sort_key.__argnames__) Object.defineProperties(ρσ_list_sort_key, {
|
|
840
|
-
__argnames__ : {value: ["value"]},
|
|
841
|
-
__module__ : {value: "__main__"}
|
|
842
|
-
});
|
|
843
|
-
|
|
844
|
-
function ρσ_list_sort_cmp(a, b, ap, bp) {
|
|
845
|
-
if (a < b) {
|
|
846
|
-
return -1;
|
|
847
|
-
}
|
|
848
|
-
if (a > b) {
|
|
849
|
-
return 1;
|
|
850
|
-
}
|
|
851
|
-
return ap - bp;
|
|
852
|
-
};
|
|
853
|
-
if (!ρσ_list_sort_cmp.__argnames__) Object.defineProperties(ρσ_list_sort_cmp, {
|
|
854
|
-
__argnames__ : {value: ["a", "b", "ap", "bp"]},
|
|
855
|
-
__module__ : {value: "__main__"}
|
|
856
|
-
});
|
|
857
|
-
|
|
858
|
-
function ρσ_list_sort() {
|
|
859
|
-
var key = (arguments[0] === undefined || ( 0 === arguments.length-1 && arguments[arguments.length-1] !== null && typeof arguments[arguments.length-1] === "object" && arguments[arguments.length-1] [ρσ_kwargs_symbol] === true)) ? ρσ_list_sort.__defaults__.key : arguments[0];
|
|
860
|
-
var reverse = (arguments[1] === undefined || ( 1 === arguments.length-1 && arguments[arguments.length-1] !== null && typeof arguments[arguments.length-1] === "object" && arguments[arguments.length-1] [ρσ_kwargs_symbol] === true)) ? ρσ_list_sort.__defaults__.reverse : arguments[1];
|
|
861
|
-
var ρσ_kwargs_obj = arguments[arguments.length-1];
|
|
862
|
-
if (ρσ_kwargs_obj === null || typeof ρσ_kwargs_obj !== "object" || ρσ_kwargs_obj [ρσ_kwargs_symbol] !== true) ρσ_kwargs_obj = {};
|
|
863
|
-
if (Object.prototype.hasOwnProperty.call(ρσ_kwargs_obj, "key")){
|
|
864
|
-
key = ρσ_kwargs_obj.key;
|
|
865
|
-
}
|
|
866
|
-
if (Object.prototype.hasOwnProperty.call(ρσ_kwargs_obj, "reverse")){
|
|
867
|
-
reverse = ρσ_kwargs_obj.reverse;
|
|
868
|
-
}
|
|
869
|
-
var mult, keymap, posmap, k;
|
|
870
|
-
key = key || ρσ_list_sort_key;
|
|
871
|
-
mult = (reverse) ? -1 : 1;
|
|
872
|
-
keymap = dict();
|
|
873
|
-
posmap = dict();
|
|
874
|
-
for (var i=0; i < this.length; i++) {
|
|
875
|
-
k = (ρσ_expr_temp = this)[(typeof i === "number" && i < 0) ? ρσ_expr_temp.length + i : i];
|
|
876
|
-
keymap.set(k, key(k));
|
|
877
|
-
posmap.set(k, i);
|
|
878
|
-
}
|
|
879
|
-
this.sort((function() {
|
|
880
|
-
var ρσ_anonfunc = function (a, b) {
|
|
881
|
-
return mult * ρσ_list_sort_cmp(keymap.get(a), keymap.get(b), posmap.get(a), posmap.get(b));
|
|
882
|
-
};
|
|
883
|
-
if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, {
|
|
884
|
-
__argnames__ : {value: ["a", "b"]},
|
|
885
|
-
__module__ : {value: "__main__"}
|
|
886
|
-
});
|
|
887
|
-
return ρσ_anonfunc;
|
|
888
|
-
})());
|
|
889
|
-
};
|
|
890
|
-
if (!ρσ_list_sort.__defaults__) Object.defineProperties(ρσ_list_sort, {
|
|
891
|
-
__defaults__ : {value: {key:null, reverse:false}},
|
|
892
|
-
__handles_kwarg_interpolation__ : {value: true},
|
|
893
|
-
__argnames__ : {value: ["key", "reverse"]},
|
|
894
|
-
__module__ : {value: "__main__"}
|
|
895
|
-
});
|
|
896
|
-
|
|
897
|
-
function ρσ_list_concat() {
|
|
898
|
-
var ans;
|
|
899
|
-
ans = Array.prototype.concat.apply(this, arguments);
|
|
900
|
-
ρσ_list_decorate(ans);
|
|
901
|
-
return ans;
|
|
902
|
-
};
|
|
903
|
-
if (!ρσ_list_concat.__module__) Object.defineProperties(ρσ_list_concat, {
|
|
904
|
-
__module__ : {value: "__main__"}
|
|
905
|
-
});
|
|
906
|
-
|
|
907
|
-
function ρσ_list_slice() {
|
|
908
|
-
var ans;
|
|
909
|
-
ans = Array.prototype.slice.apply(this, arguments);
|
|
910
|
-
ρσ_list_decorate(ans);
|
|
911
|
-
return ans;
|
|
912
|
-
};
|
|
913
|
-
if (!ρσ_list_slice.__module__) Object.defineProperties(ρσ_list_slice, {
|
|
914
|
-
__module__ : {value: "__main__"}
|
|
915
|
-
});
|
|
916
|
-
|
|
917
687
|
function ρσ_list_iterator(value) {
|
|
918
688
|
var self;
|
|
919
689
|
self = this;
|
|
@@ -951,75 +721,6 @@ if (!ρσ_list_iterator.__argnames__) Object.defineProperties(ρσ_list_iterator
|
|
|
951
721
|
__module__ : {value: "__main__"}
|
|
952
722
|
});
|
|
953
723
|
|
|
954
|
-
function ρσ_list_len() {
|
|
955
|
-
return this.length;
|
|
956
|
-
};
|
|
957
|
-
if (!ρσ_list_len.__module__) Object.defineProperties(ρσ_list_len, {
|
|
958
|
-
__module__ : {value: "__main__"}
|
|
959
|
-
});
|
|
960
|
-
|
|
961
|
-
function ρσ_list_contains(val) {
|
|
962
|
-
for (var i = 0; i < this.length; i++) {
|
|
963
|
-
if (((ρσ_expr_temp = this)[(typeof i === "number" && i < 0) ? ρσ_expr_temp.length + i : i] === val || typeof (ρσ_expr_temp = this)[(typeof i === "number" && i < 0) ? ρσ_expr_temp.length + i : i] === "object" && ρσ_equals((ρσ_expr_temp = this)[(typeof i === "number" && i < 0) ? ρσ_expr_temp.length + i : i], val))) {
|
|
964
|
-
return true;
|
|
965
|
-
}
|
|
966
|
-
}
|
|
967
|
-
return false;
|
|
968
|
-
};
|
|
969
|
-
if (!ρσ_list_contains.__argnames__) Object.defineProperties(ρσ_list_contains, {
|
|
970
|
-
__argnames__ : {value: ["val"]},
|
|
971
|
-
__module__ : {value: "__main__"}
|
|
972
|
-
});
|
|
973
|
-
|
|
974
|
-
function ρσ_list_eq(other) {
|
|
975
|
-
if (!ρσ_arraylike(other)) {
|
|
976
|
-
return false;
|
|
977
|
-
}
|
|
978
|
-
if ((this.length !== other.length && (typeof this.length !== "object" || ρσ_not_equals(this.length, other.length)))) {
|
|
979
|
-
return false;
|
|
980
|
-
}
|
|
981
|
-
for (var i = 0; i < this.length; i++) {
|
|
982
|
-
if (!((((ρσ_expr_temp = this)[(typeof i === "number" && i < 0) ? ρσ_expr_temp.length + i : i] === other[(typeof i === "number" && i < 0) ? other.length + i : i] || typeof (ρσ_expr_temp = this)[(typeof i === "number" && i < 0) ? ρσ_expr_temp.length + i : i] === "object" && ρσ_equals((ρσ_expr_temp = this)[(typeof i === "number" && i < 0) ? ρσ_expr_temp.length + i : i], other[(typeof i === "number" && i < 0) ? other.length + i : i]))))) {
|
|
983
|
-
return false;
|
|
984
|
-
}
|
|
985
|
-
}
|
|
986
|
-
return true;
|
|
987
|
-
};
|
|
988
|
-
if (!ρσ_list_eq.__argnames__) Object.defineProperties(ρσ_list_eq, {
|
|
989
|
-
__argnames__ : {value: ["other"]},
|
|
990
|
-
__module__ : {value: "__main__"}
|
|
991
|
-
});
|
|
992
|
-
|
|
993
|
-
function ρσ_list_decorate(ans) {
|
|
994
|
-
ans.append = Array.prototype.push;
|
|
995
|
-
ans.toString = ρσ_list_to_string;
|
|
996
|
-
ans.inspect = ρσ_list_to_string;
|
|
997
|
-
ans.extend = ρσ_list_extend;
|
|
998
|
-
ans.index = ρσ_list_index;
|
|
999
|
-
ans.pypop = ρσ_list_pop;
|
|
1000
|
-
ans.remove = ρσ_list_remove;
|
|
1001
|
-
ans.insert = ρσ_list_insert;
|
|
1002
|
-
ans.copy = ρσ_list_copy;
|
|
1003
|
-
ans.clear = ρσ_list_clear;
|
|
1004
|
-
ans.count = ρσ_list_count;
|
|
1005
|
-
ans.concat = ρσ_list_concat;
|
|
1006
|
-
ans.pysort = ρσ_list_sort;
|
|
1007
|
-
ans.slice = ρσ_list_slice;
|
|
1008
|
-
ans.as_array = ρσ_list_as_array;
|
|
1009
|
-
ans.__len__ = ρσ_list_len;
|
|
1010
|
-
ans.__contains__ = ρσ_list_contains;
|
|
1011
|
-
ans.__eq__ = ρσ_list_eq;
|
|
1012
|
-
ans.constructor = ρσ_list_constructor;
|
|
1013
|
-
if (typeof ans[ρσ_iterator_symbol] !== "function") {
|
|
1014
|
-
ans[ρσ_iterator_symbol] = ρσ_list_iterator;
|
|
1015
|
-
}
|
|
1016
|
-
return ans;
|
|
1017
|
-
};
|
|
1018
|
-
if (!ρσ_list_decorate.__argnames__) Object.defineProperties(ρσ_list_decorate, {
|
|
1019
|
-
__argnames__ : {value: ["ans"]},
|
|
1020
|
-
__module__ : {value: "__main__"}
|
|
1021
|
-
});
|
|
1022
|
-
|
|
1023
724
|
function ρσ_list_constructor(iterable) {
|
|
1024
725
|
var ans, iterator, result;
|
|
1025
726
|
if (iterable === undefined) {
|
|
@@ -1031,7 +732,7 @@ function ρσ_list_constructor(iterable) {
|
|
|
1031
732
|
}
|
|
1032
733
|
} else if (typeof iterable[ρσ_iterator_symbol] === "function") {
|
|
1033
734
|
iterator = (typeof Map === "function" && iterable instanceof Map) ? iterable.keys() : iterable[ρσ_iterator_symbol]();
|
|
1034
|
-
ans =
|
|
735
|
+
ans = [];
|
|
1035
736
|
result = iterator.next();
|
|
1036
737
|
while (!result.done) {
|
|
1037
738
|
ans.push(result.value);
|
|
@@ -1042,7 +743,7 @@ function ρσ_list_constructor(iterable) {
|
|
|
1042
743
|
} else {
|
|
1043
744
|
ans = Object.keys(iterable);
|
|
1044
745
|
}
|
|
1045
|
-
return
|
|
746
|
+
return ans;
|
|
1046
747
|
};
|
|
1047
748
|
if (!ρσ_list_constructor.__argnames__) Object.defineProperties(ρσ_list_constructor, {
|
|
1048
749
|
__argnames__ : {value: ["iterable"]},
|
|
@@ -1050,6 +751,424 @@ if (!ρσ_list_constructor.__argnames__) Object.defineProperties(ρσ_list_const
|
|
|
1050
751
|
});
|
|
1051
752
|
|
|
1052
753
|
ρσ_list_constructor.__name__ = "list";
|
|
754
|
+
if (typeof Array.prototype.append !== "function") {
|
|
755
|
+
Object.defineProperty(Array.prototype, "append", (function(){
|
|
756
|
+
var ρσ_d = {};
|
|
757
|
+
ρσ_d["writable"] = false;
|
|
758
|
+
ρσ_d["configurable"] = false;
|
|
759
|
+
ρσ_d["enumerable"] = false;
|
|
760
|
+
ρσ_d["value"] = Array.prototype.push;
|
|
761
|
+
return ρσ_d;
|
|
762
|
+
}).call(this));
|
|
763
|
+
Object.defineProperty(Array.prototype, "extend", (function(){
|
|
764
|
+
var ρσ_d = {};
|
|
765
|
+
ρσ_d["writable"] = false;
|
|
766
|
+
ρσ_d["configurable"] = false;
|
|
767
|
+
ρσ_d["enumerable"] = false;
|
|
768
|
+
ρσ_d["value"] = (function() {
|
|
769
|
+
var ρσ_anonfunc = function (iterable) {
|
|
770
|
+
var start, iterator, result;
|
|
771
|
+
if (Array.isArray(iterable) || typeof iterable === "string") {
|
|
772
|
+
start = this.length;
|
|
773
|
+
this.length += iterable.length;
|
|
774
|
+
for (var i = 0; i < iterable.length; i++) {
|
|
775
|
+
(ρσ_expr_temp = this)[ρσ_bound_index(start + i, ρσ_expr_temp)] = iterable[(typeof i === "number" && i < 0) ? iterable.length + i : i];
|
|
776
|
+
}
|
|
777
|
+
} else {
|
|
778
|
+
iterator = (typeof Map === "function" && iterable instanceof Map) ? iterable.keys() : iterable[ρσ_iterator_symbol]();
|
|
779
|
+
result = iterator.next();
|
|
780
|
+
while (!result.done) {
|
|
781
|
+
this.push(result.value);
|
|
782
|
+
result = iterator.next();
|
|
783
|
+
}
|
|
784
|
+
}
|
|
785
|
+
};
|
|
786
|
+
if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, {
|
|
787
|
+
__argnames__ : {value: ["iterable"]},
|
|
788
|
+
__module__ : {value: "__main__"}
|
|
789
|
+
});
|
|
790
|
+
return ρσ_anonfunc;
|
|
791
|
+
})();
|
|
792
|
+
return ρσ_d;
|
|
793
|
+
}).call(this));
|
|
794
|
+
Object.defineProperty(Array.prototype, "index", (function(){
|
|
795
|
+
var ρσ_d = {};
|
|
796
|
+
ρσ_d["writable"] = false;
|
|
797
|
+
ρσ_d["configurable"] = false;
|
|
798
|
+
ρσ_d["enumerable"] = false;
|
|
799
|
+
ρσ_d["value"] = (function() {
|
|
800
|
+
var ρσ_anonfunc = function (val, start, stop) {
|
|
801
|
+
start = start || 0;
|
|
802
|
+
if (start < 0) {
|
|
803
|
+
start = this.length + start;
|
|
804
|
+
}
|
|
805
|
+
if (start < 0) {
|
|
806
|
+
throw new ValueError(val + " is not in list");
|
|
807
|
+
}
|
|
808
|
+
if (stop === undefined) {
|
|
809
|
+
stop = this.length;
|
|
810
|
+
}
|
|
811
|
+
if (stop < 0) {
|
|
812
|
+
stop = this.length + stop;
|
|
813
|
+
}
|
|
814
|
+
for (var i = start; i < stop; i++) {
|
|
815
|
+
if (((ρσ_expr_temp = this)[(typeof i === "number" && i < 0) ? ρσ_expr_temp.length + i : i] === val || typeof (ρσ_expr_temp = this)[(typeof i === "number" && i < 0) ? ρσ_expr_temp.length + i : i] === "object" && ρσ_equals((ρσ_expr_temp = this)[(typeof i === "number" && i < 0) ? ρσ_expr_temp.length + i : i], val))) {
|
|
816
|
+
return i;
|
|
817
|
+
}
|
|
818
|
+
}
|
|
819
|
+
throw new ValueError(val + " is not in list");
|
|
820
|
+
};
|
|
821
|
+
if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, {
|
|
822
|
+
__argnames__ : {value: ["val", "start", "stop"]},
|
|
823
|
+
__module__ : {value: "__main__"}
|
|
824
|
+
});
|
|
825
|
+
return ρσ_anonfunc;
|
|
826
|
+
})();
|
|
827
|
+
return ρσ_d;
|
|
828
|
+
}).call(this));
|
|
829
|
+
Object.defineProperty(Array.prototype, "pypop", (function(){
|
|
830
|
+
var ρσ_d = {};
|
|
831
|
+
ρσ_d["writable"] = false;
|
|
832
|
+
ρσ_d["configurable"] = false;
|
|
833
|
+
ρσ_d["enumerable"] = false;
|
|
834
|
+
ρσ_d["value"] = (function() {
|
|
835
|
+
var ρσ_anonfunc = function (index) {
|
|
836
|
+
var ans;
|
|
837
|
+
if (this.length === 0) {
|
|
838
|
+
throw new IndexError("list is empty");
|
|
839
|
+
}
|
|
840
|
+
if (index === undefined) {
|
|
841
|
+
index = -1;
|
|
842
|
+
}
|
|
843
|
+
ans = this.splice(index, 1);
|
|
844
|
+
if (!ans.length) {
|
|
845
|
+
throw new IndexError("pop index out of range");
|
|
846
|
+
}
|
|
847
|
+
return ans[0];
|
|
848
|
+
};
|
|
849
|
+
if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, {
|
|
850
|
+
__argnames__ : {value: ["index"]},
|
|
851
|
+
__module__ : {value: "__main__"}
|
|
852
|
+
});
|
|
853
|
+
return ρσ_anonfunc;
|
|
854
|
+
})();
|
|
855
|
+
return ρσ_d;
|
|
856
|
+
}).call(this));
|
|
857
|
+
Object.defineProperty(Array.prototype, "remove", (function(){
|
|
858
|
+
var ρσ_d = {};
|
|
859
|
+
ρσ_d["writable"] = false;
|
|
860
|
+
ρσ_d["configurable"] = false;
|
|
861
|
+
ρσ_d["enumerable"] = false;
|
|
862
|
+
ρσ_d["value"] = (function() {
|
|
863
|
+
var ρσ_anonfunc = function (value) {
|
|
864
|
+
for (var i = 0; i < this.length; i++) {
|
|
865
|
+
if (((ρσ_expr_temp = this)[(typeof i === "number" && i < 0) ? ρσ_expr_temp.length + i : i] === value || typeof (ρσ_expr_temp = this)[(typeof i === "number" && i < 0) ? ρσ_expr_temp.length + i : i] === "object" && ρσ_equals((ρσ_expr_temp = this)[(typeof i === "number" && i < 0) ? ρσ_expr_temp.length + i : i], value))) {
|
|
866
|
+
this.splice(i, 1);
|
|
867
|
+
return;
|
|
868
|
+
}
|
|
869
|
+
}
|
|
870
|
+
throw new ValueError(value + " not in list");
|
|
871
|
+
};
|
|
872
|
+
if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, {
|
|
873
|
+
__argnames__ : {value: ["value"]},
|
|
874
|
+
__module__ : {value: "__main__"}
|
|
875
|
+
});
|
|
876
|
+
return ρσ_anonfunc;
|
|
877
|
+
})();
|
|
878
|
+
return ρσ_d;
|
|
879
|
+
}).call(this));
|
|
880
|
+
Object.defineProperty(Array.prototype, "toString", (function(){
|
|
881
|
+
var ρσ_d = {};
|
|
882
|
+
ρσ_d["writable"] = false;
|
|
883
|
+
ρσ_d["configurable"] = false;
|
|
884
|
+
ρσ_d["enumerable"] = false;
|
|
885
|
+
ρσ_d["value"] = (function() {
|
|
886
|
+
var ρσ_anonfunc = function () {
|
|
887
|
+
return "[" + this.join(", ") + "]";
|
|
888
|
+
};
|
|
889
|
+
if (!ρσ_anonfunc.__module__) Object.defineProperties(ρσ_anonfunc, {
|
|
890
|
+
__module__ : {value: "__main__"}
|
|
891
|
+
});
|
|
892
|
+
return ρσ_anonfunc;
|
|
893
|
+
})();
|
|
894
|
+
return ρσ_d;
|
|
895
|
+
}).call(this));
|
|
896
|
+
Object.defineProperty(Array.prototype, "inspect", (function(){
|
|
897
|
+
var ρσ_d = {};
|
|
898
|
+
ρσ_d["writable"] = false;
|
|
899
|
+
ρσ_d["configurable"] = false;
|
|
900
|
+
ρσ_d["enumerable"] = false;
|
|
901
|
+
ρσ_d["value"] = (function() {
|
|
902
|
+
var ρσ_anonfunc = function () {
|
|
903
|
+
return "[" + this.join(", ") + "]";
|
|
904
|
+
};
|
|
905
|
+
if (!ρσ_anonfunc.__module__) Object.defineProperties(ρσ_anonfunc, {
|
|
906
|
+
__module__ : {value: "__main__"}
|
|
907
|
+
});
|
|
908
|
+
return ρσ_anonfunc;
|
|
909
|
+
})();
|
|
910
|
+
return ρσ_d;
|
|
911
|
+
}).call(this));
|
|
912
|
+
Object.defineProperty(Array.prototype, "insert", (function(){
|
|
913
|
+
var ρσ_d = {};
|
|
914
|
+
ρσ_d["writable"] = false;
|
|
915
|
+
ρσ_d["configurable"] = false;
|
|
916
|
+
ρσ_d["enumerable"] = false;
|
|
917
|
+
ρσ_d["value"] = (function() {
|
|
918
|
+
var ρσ_anonfunc = function (index, val) {
|
|
919
|
+
if (index < 0) {
|
|
920
|
+
index += this.length;
|
|
921
|
+
}
|
|
922
|
+
index = min(this.length, max(index, 0));
|
|
923
|
+
if (index === 0) {
|
|
924
|
+
this.unshift(val);
|
|
925
|
+
return;
|
|
926
|
+
}
|
|
927
|
+
for (var i = this.length; i > index; i--) {
|
|
928
|
+
(ρσ_expr_temp = this)[(typeof i === "number" && i < 0) ? ρσ_expr_temp.length + i : i] = (ρσ_expr_temp = this)[ρσ_bound_index(i - 1, ρσ_expr_temp)];
|
|
929
|
+
}
|
|
930
|
+
(ρσ_expr_temp = this)[(typeof index === "number" && index < 0) ? ρσ_expr_temp.length + index : index] = val;
|
|
931
|
+
};
|
|
932
|
+
if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, {
|
|
933
|
+
__argnames__ : {value: ["index", "val"]},
|
|
934
|
+
__module__ : {value: "__main__"}
|
|
935
|
+
});
|
|
936
|
+
return ρσ_anonfunc;
|
|
937
|
+
})();
|
|
938
|
+
return ρσ_d;
|
|
939
|
+
}).call(this));
|
|
940
|
+
Object.defineProperty(Array.prototype, "copy", (function(){
|
|
941
|
+
var ρσ_d = {};
|
|
942
|
+
ρσ_d["writable"] = false;
|
|
943
|
+
ρσ_d["configurable"] = false;
|
|
944
|
+
ρσ_d["enumerable"] = false;
|
|
945
|
+
ρσ_d["value"] = (function() {
|
|
946
|
+
var ρσ_anonfunc = function () {
|
|
947
|
+
return ρσ_list_constructor(this);
|
|
948
|
+
};
|
|
949
|
+
if (!ρσ_anonfunc.__module__) Object.defineProperties(ρσ_anonfunc, {
|
|
950
|
+
__module__ : {value: "__main__"}
|
|
951
|
+
});
|
|
952
|
+
return ρσ_anonfunc;
|
|
953
|
+
})();
|
|
954
|
+
return ρσ_d;
|
|
955
|
+
}).call(this));
|
|
956
|
+
Object.defineProperty(Array.prototype, "clear", (function(){
|
|
957
|
+
var ρσ_d = {};
|
|
958
|
+
ρσ_d["writable"] = false;
|
|
959
|
+
ρσ_d["configurable"] = false;
|
|
960
|
+
ρσ_d["enumerable"] = false;
|
|
961
|
+
ρσ_d["value"] = (function() {
|
|
962
|
+
var ρσ_anonfunc = function () {
|
|
963
|
+
this.length = 0;
|
|
964
|
+
};
|
|
965
|
+
if (!ρσ_anonfunc.__module__) Object.defineProperties(ρσ_anonfunc, {
|
|
966
|
+
__module__ : {value: "__main__"}
|
|
967
|
+
});
|
|
968
|
+
return ρσ_anonfunc;
|
|
969
|
+
})();
|
|
970
|
+
return ρσ_d;
|
|
971
|
+
}).call(this));
|
|
972
|
+
Object.defineProperty(Array.prototype, "count", (function(){
|
|
973
|
+
var ρσ_d = {};
|
|
974
|
+
ρσ_d["writable"] = false;
|
|
975
|
+
ρσ_d["configurable"] = false;
|
|
976
|
+
ρσ_d["enumerable"] = false;
|
|
977
|
+
ρσ_d["value"] = (function() {
|
|
978
|
+
var ρσ_anonfunc = function (value) {
|
|
979
|
+
return this.reduce((function() {
|
|
980
|
+
var ρσ_anonfunc = function (n, val) {
|
|
981
|
+
return n + (val === value);
|
|
982
|
+
};
|
|
983
|
+
if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, {
|
|
984
|
+
__argnames__ : {value: ["n", "val"]},
|
|
985
|
+
__module__ : {value: "__main__"}
|
|
986
|
+
});
|
|
987
|
+
return ρσ_anonfunc;
|
|
988
|
+
})(), 0);
|
|
989
|
+
};
|
|
990
|
+
if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, {
|
|
991
|
+
__argnames__ : {value: ["value"]},
|
|
992
|
+
__module__ : {value: "__main__"}
|
|
993
|
+
});
|
|
994
|
+
return ρσ_anonfunc;
|
|
995
|
+
})();
|
|
996
|
+
return ρσ_d;
|
|
997
|
+
}).call(this));
|
|
998
|
+
Object.defineProperty(Array.prototype, "pysort", (function(){
|
|
999
|
+
var ρσ_d = {};
|
|
1000
|
+
ρσ_d["writable"] = false;
|
|
1001
|
+
ρσ_d["configurable"] = false;
|
|
1002
|
+
ρσ_d["enumerable"] = false;
|
|
1003
|
+
ρσ_d["value"] = (function() {
|
|
1004
|
+
var ρσ_anonfunc = function () {
|
|
1005
|
+
var key = (arguments[0] === undefined || ( 0 === arguments.length-1 && arguments[arguments.length-1] !== null && typeof arguments[arguments.length-1] === "object" && arguments[arguments.length-1] [ρσ_kwargs_symbol] === true)) ? ρσ_anonfunc.__defaults__.key : arguments[0];
|
|
1006
|
+
var reverse = (arguments[1] === undefined || ( 1 === arguments.length-1 && arguments[arguments.length-1] !== null && typeof arguments[arguments.length-1] === "object" && arguments[arguments.length-1] [ρσ_kwargs_symbol] === true)) ? ρσ_anonfunc.__defaults__.reverse : arguments[1];
|
|
1007
|
+
var ρσ_kwargs_obj = arguments[arguments.length-1];
|
|
1008
|
+
if (ρσ_kwargs_obj === null || typeof ρσ_kwargs_obj !== "object" || ρσ_kwargs_obj [ρσ_kwargs_symbol] !== true) ρσ_kwargs_obj = {};
|
|
1009
|
+
if (Object.prototype.hasOwnProperty.call(ρσ_kwargs_obj, "key")){
|
|
1010
|
+
key = ρσ_kwargs_obj.key;
|
|
1011
|
+
}
|
|
1012
|
+
if (Object.prototype.hasOwnProperty.call(ρσ_kwargs_obj, "reverse")){
|
|
1013
|
+
reverse = ρσ_kwargs_obj.reverse;
|
|
1014
|
+
}
|
|
1015
|
+
var mult, keymap, posmap, k;
|
|
1016
|
+
function _sort_key(value) {
|
|
1017
|
+
var t;
|
|
1018
|
+
t = typeof value;
|
|
1019
|
+
if (t === "string" || t === "number") {
|
|
1020
|
+
return value;
|
|
1021
|
+
}
|
|
1022
|
+
return value.toString();
|
|
1023
|
+
};
|
|
1024
|
+
if (!_sort_key.__argnames__) Object.defineProperties(_sort_key, {
|
|
1025
|
+
__argnames__ : {value: ["value"]},
|
|
1026
|
+
__module__ : {value: "__main__"}
|
|
1027
|
+
});
|
|
1028
|
+
|
|
1029
|
+
function _sort_cmp(a, b, ap, bp) {
|
|
1030
|
+
if (a < b) {
|
|
1031
|
+
return -1;
|
|
1032
|
+
}
|
|
1033
|
+
if (a > b) {
|
|
1034
|
+
return 1;
|
|
1035
|
+
}
|
|
1036
|
+
return ap - bp;
|
|
1037
|
+
};
|
|
1038
|
+
if (!_sort_cmp.__argnames__) Object.defineProperties(_sort_cmp, {
|
|
1039
|
+
__argnames__ : {value: ["a", "b", "ap", "bp"]},
|
|
1040
|
+
__module__ : {value: "__main__"}
|
|
1041
|
+
});
|
|
1042
|
+
|
|
1043
|
+
key = key || _sort_key;
|
|
1044
|
+
mult = (reverse) ? -1 : 1;
|
|
1045
|
+
keymap = dict();
|
|
1046
|
+
posmap = dict();
|
|
1047
|
+
for (var i=0; i < this.length; i++) {
|
|
1048
|
+
k = (ρσ_expr_temp = this)[(typeof i === "number" && i < 0) ? ρσ_expr_temp.length + i : i];
|
|
1049
|
+
keymap.set(k, key(k));
|
|
1050
|
+
posmap.set(k, i);
|
|
1051
|
+
}
|
|
1052
|
+
this.sort((function() {
|
|
1053
|
+
var ρσ_anonfunc = function (a, b) {
|
|
1054
|
+
return mult * _sort_cmp(keymap.get(a), keymap.get(b), posmap.get(a), posmap.get(b));
|
|
1055
|
+
};
|
|
1056
|
+
if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, {
|
|
1057
|
+
__argnames__ : {value: ["a", "b"]},
|
|
1058
|
+
__module__ : {value: "__main__"}
|
|
1059
|
+
});
|
|
1060
|
+
return ρσ_anonfunc;
|
|
1061
|
+
})());
|
|
1062
|
+
};
|
|
1063
|
+
if (!ρσ_anonfunc.__defaults__) Object.defineProperties(ρσ_anonfunc, {
|
|
1064
|
+
__defaults__ : {value: {key:null, reverse:false}},
|
|
1065
|
+
__handles_kwarg_interpolation__ : {value: true},
|
|
1066
|
+
__argnames__ : {value: ["key", "reverse"]},
|
|
1067
|
+
__module__ : {value: "__main__"}
|
|
1068
|
+
});
|
|
1069
|
+
return ρσ_anonfunc;
|
|
1070
|
+
})();
|
|
1071
|
+
return ρσ_d;
|
|
1072
|
+
}).call(this));
|
|
1073
|
+
Object.defineProperty(Array.prototype, "as_array", (function(){
|
|
1074
|
+
var ρσ_d = {};
|
|
1075
|
+
ρσ_d["writable"] = false;
|
|
1076
|
+
ρσ_d["configurable"] = false;
|
|
1077
|
+
ρσ_d["enumerable"] = false;
|
|
1078
|
+
ρσ_d["value"] = (function() {
|
|
1079
|
+
var ρσ_anonfunc = function () {
|
|
1080
|
+
return Array.from(this);
|
|
1081
|
+
};
|
|
1082
|
+
if (!ρσ_anonfunc.__module__) Object.defineProperties(ρσ_anonfunc, {
|
|
1083
|
+
__module__ : {value: "__main__"}
|
|
1084
|
+
});
|
|
1085
|
+
return ρσ_anonfunc;
|
|
1086
|
+
})();
|
|
1087
|
+
return ρσ_d;
|
|
1088
|
+
}).call(this));
|
|
1089
|
+
Object.defineProperty(Array.prototype, "__len__", (function(){
|
|
1090
|
+
var ρσ_d = {};
|
|
1091
|
+
ρσ_d["writable"] = false;
|
|
1092
|
+
ρσ_d["configurable"] = false;
|
|
1093
|
+
ρσ_d["enumerable"] = false;
|
|
1094
|
+
ρσ_d["value"] = (function() {
|
|
1095
|
+
var ρσ_anonfunc = function () {
|
|
1096
|
+
return this.length;
|
|
1097
|
+
};
|
|
1098
|
+
if (!ρσ_anonfunc.__module__) Object.defineProperties(ρσ_anonfunc, {
|
|
1099
|
+
__module__ : {value: "__main__"}
|
|
1100
|
+
});
|
|
1101
|
+
return ρσ_anonfunc;
|
|
1102
|
+
})();
|
|
1103
|
+
return ρσ_d;
|
|
1104
|
+
}).call(this));
|
|
1105
|
+
Object.defineProperty(Array.prototype, "__contains__", (function(){
|
|
1106
|
+
var ρσ_d = {};
|
|
1107
|
+
ρσ_d["writable"] = false;
|
|
1108
|
+
ρσ_d["configurable"] = false;
|
|
1109
|
+
ρσ_d["enumerable"] = false;
|
|
1110
|
+
ρσ_d["value"] = (function() {
|
|
1111
|
+
var ρσ_anonfunc = function (val) {
|
|
1112
|
+
for (var i = 0; i < this.length; i++) {
|
|
1113
|
+
if (((ρσ_expr_temp = this)[(typeof i === "number" && i < 0) ? ρσ_expr_temp.length + i : i] === val || typeof (ρσ_expr_temp = this)[(typeof i === "number" && i < 0) ? ρσ_expr_temp.length + i : i] === "object" && ρσ_equals((ρσ_expr_temp = this)[(typeof i === "number" && i < 0) ? ρσ_expr_temp.length + i : i], val))) {
|
|
1114
|
+
return true;
|
|
1115
|
+
}
|
|
1116
|
+
}
|
|
1117
|
+
return false;
|
|
1118
|
+
};
|
|
1119
|
+
if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, {
|
|
1120
|
+
__argnames__ : {value: ["val"]},
|
|
1121
|
+
__module__ : {value: "__main__"}
|
|
1122
|
+
});
|
|
1123
|
+
return ρσ_anonfunc;
|
|
1124
|
+
})();
|
|
1125
|
+
return ρσ_d;
|
|
1126
|
+
}).call(this));
|
|
1127
|
+
Object.defineProperty(Array.prototype, "__eq__", (function(){
|
|
1128
|
+
var ρσ_d = {};
|
|
1129
|
+
ρσ_d["writable"] = false;
|
|
1130
|
+
ρσ_d["configurable"] = false;
|
|
1131
|
+
ρσ_d["enumerable"] = false;
|
|
1132
|
+
ρσ_d["value"] = (function() {
|
|
1133
|
+
var ρσ_anonfunc = function (other) {
|
|
1134
|
+
if (!ρσ_arraylike(other)) {
|
|
1135
|
+
return false;
|
|
1136
|
+
}
|
|
1137
|
+
if ((this.length !== other.length && (typeof this.length !== "object" || ρσ_not_equals(this.length, other.length)))) {
|
|
1138
|
+
return false;
|
|
1139
|
+
}
|
|
1140
|
+
for (var i = 0; i < this.length; i++) {
|
|
1141
|
+
if (!((((ρσ_expr_temp = this)[(typeof i === "number" && i < 0) ? ρσ_expr_temp.length + i : i] === other[(typeof i === "number" && i < 0) ? other.length + i : i] || typeof (ρσ_expr_temp = this)[(typeof i === "number" && i < 0) ? ρσ_expr_temp.length + i : i] === "object" && ρσ_equals((ρσ_expr_temp = this)[(typeof i === "number" && i < 0) ? ρσ_expr_temp.length + i : i], other[(typeof i === "number" && i < 0) ? other.length + i : i]))))) {
|
|
1142
|
+
return false;
|
|
1143
|
+
}
|
|
1144
|
+
}
|
|
1145
|
+
return true;
|
|
1146
|
+
};
|
|
1147
|
+
if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, {
|
|
1148
|
+
__argnames__ : {value: ["other"]},
|
|
1149
|
+
__module__ : {value: "__main__"}
|
|
1150
|
+
});
|
|
1151
|
+
return ρσ_anonfunc;
|
|
1152
|
+
})();
|
|
1153
|
+
return ρσ_d;
|
|
1154
|
+
}).call(this));
|
|
1155
|
+
Object.defineProperty(Array.prototype, "constructor", (function(){
|
|
1156
|
+
var ρσ_d = {};
|
|
1157
|
+
ρσ_d["writable"] = false;
|
|
1158
|
+
ρσ_d["configurable"] = false;
|
|
1159
|
+
ρσ_d["enumerable"] = false;
|
|
1160
|
+
ρσ_d["value"] = ρσ_list_constructor;
|
|
1161
|
+
return ρσ_d;
|
|
1162
|
+
}).call(this));
|
|
1163
|
+
}
|
|
1164
|
+
function ρσ_list_decorate(ans) {
|
|
1165
|
+
return ans;
|
|
1166
|
+
};
|
|
1167
|
+
if (!ρσ_list_decorate.__argnames__) Object.defineProperties(ρσ_list_decorate, {
|
|
1168
|
+
__argnames__ : {value: ["ans"]},
|
|
1169
|
+
__module__ : {value: "__main__"}
|
|
1170
|
+
});
|
|
1171
|
+
|
|
1053
1172
|
var list = ρσ_list_constructor, list_wrap = ρσ_list_decorate;
|
|
1054
1173
|
function sorted() {
|
|
1055
1174
|
var iterable = ( 0 === arguments.length-1 && arguments[arguments.length-1] !== null && typeof arguments[arguments.length-1] === "object" && arguments[arguments.length-1] [ρσ_kwargs_symbol] === true) ? undefined : arguments[0];
|
|
@@ -2464,7 +2583,7 @@ if (!ρσ_delslice.__argnames__) Object.defineProperties(ρσ_delslice, {
|
|
|
2464
2583
|
|
|
2465
2584
|
function ρσ_flatten(arr) {
|
|
2466
2585
|
var ans, value;
|
|
2467
|
-
ans =
|
|
2586
|
+
ans = [];
|
|
2468
2587
|
for (var i=0; i < arr.length; i++) {
|
|
2469
2588
|
value = arr[(typeof i === "number" && i < 0) ? arr.length + i : i];
|
|
2470
2589
|
if (Array.isArray(value)) {
|
|
@@ -2525,7 +2644,7 @@ if (!ρσ_extends.__argnames__) Object.defineProperties(ρσ_extends, {
|
|
|
2525
2644
|
return arr.has(val);
|
|
2526
2645
|
}
|
|
2527
2646
|
if (ρσ_arraylike(arr)) {
|
|
2528
|
-
return
|
|
2647
|
+
return Array.prototype.__contains__.call(arr, val);
|
|
2529
2648
|
}
|
|
2530
2649
|
return Object.prototype.hasOwnProperty.call(arr, val);
|
|
2531
2650
|
};
|
|
@@ -2545,7 +2664,7 @@ if (!ρσ_extends.__argnames__) Object.defineProperties(ρσ_extends, {
|
|
|
2545
2664
|
return arr.__contains__(val);
|
|
2546
2665
|
}
|
|
2547
2666
|
if (ρσ_arraylike(arr)) {
|
|
2548
|
-
return
|
|
2667
|
+
return Array.prototype.__contains__.call(arr, val);
|
|
2549
2668
|
}
|
|
2550
2669
|
return Object.prototype.hasOwnProperty.call(arr, val);
|
|
2551
2670
|
};
|
|
@@ -2568,7 +2687,7 @@ function ρσ_Iterable(iterable) {
|
|
|
2568
2687
|
}
|
|
2569
2688
|
if (typeof iterable[ρσ_iterator_symbol] === "function") {
|
|
2570
2689
|
iterator = (typeof Map === "function" && iterable instanceof Map) ? iterable.keys() : iterable[ρσ_iterator_symbol]();
|
|
2571
|
-
ans =
|
|
2690
|
+
ans = [];
|
|
2572
2691
|
result = iterator.next();
|
|
2573
2692
|
while (!result.done) {
|
|
2574
2693
|
ans.push(result.value);
|
|
@@ -3062,9 +3181,10 @@ if (!zip.__module__) Object.defineProperties(zip, {
|
|
|
3062
3181
|
|
|
3063
3182
|
function any(iterable) {
|
|
3064
3183
|
var i;
|
|
3065
|
-
var ρσ_Iter0 =
|
|
3066
|
-
|
|
3067
|
-
|
|
3184
|
+
var ρσ_Iter0 = iterable;
|
|
3185
|
+
ρσ_Iter0 = ((typeof ρσ_Iter0[Symbol.iterator] === "function") ? (ρσ_Iter0 instanceof Map ? ρσ_Iter0.keys() : ρσ_Iter0) : Object.keys(ρσ_Iter0));
|
|
3186
|
+
for (var ρσ_Index0 of ρσ_Iter0) {
|
|
3187
|
+
i = ρσ_Index0;
|
|
3068
3188
|
if (i) {
|
|
3069
3189
|
return true;
|
|
3070
3190
|
}
|
|
@@ -3078,9 +3198,10 @@ if (!any.__argnames__) Object.defineProperties(any, {
|
|
|
3078
3198
|
|
|
3079
3199
|
function all(iterable) {
|
|
3080
3200
|
var i;
|
|
3081
|
-
var ρσ_Iter1 =
|
|
3082
|
-
|
|
3083
|
-
|
|
3201
|
+
var ρσ_Iter1 = iterable;
|
|
3202
|
+
ρσ_Iter1 = ((typeof ρσ_Iter1[Symbol.iterator] === "function") ? (ρσ_Iter1 instanceof Map ? ρσ_Iter1.keys() : ρσ_Iter1) : Object.keys(ρσ_Iter1));
|
|
3203
|
+
for (var ρσ_Index1 of ρσ_Iter1) {
|
|
3204
|
+
i = ρσ_Index1;
|
|
3084
3205
|
if (!i) {
|
|
3085
3206
|
return false;
|
|
3086
3207
|
}
|
|
@@ -3119,9 +3240,10 @@ if (!ρσ_repr_js_builtin.__argnames__) Object.defineProperties(ρσ_repr_js_bui
|
|
|
3119
3240
|
function ρσ_html_element_to_string(elem) {
|
|
3120
3241
|
var attrs, val, attr, ans;
|
|
3121
3242
|
attrs = [];
|
|
3122
|
-
var ρσ_Iter0 =
|
|
3123
|
-
|
|
3124
|
-
|
|
3243
|
+
var ρσ_Iter0 = elem.attributes;
|
|
3244
|
+
ρσ_Iter0 = ((typeof ρσ_Iter0[Symbol.iterator] === "function") ? (ρσ_Iter0 instanceof Map ? ρσ_Iter0.keys() : ρσ_Iter0) : Object.keys(ρσ_Iter0));
|
|
3245
|
+
for (var ρσ_Index0 of ρσ_Iter0) {
|
|
3246
|
+
attr = ρσ_Index0;
|
|
3125
3247
|
if (attr.specified) {
|
|
3126
3248
|
val = attr.value;
|
|
3127
3249
|
if (val.length > 10) {
|
|
@@ -3274,7 +3396,7 @@ define_str_func("format", (function() {
|
|
|
3274
3396
|
if (template === undefined) {
|
|
3275
3397
|
throw new TypeError("Template is required");
|
|
3276
3398
|
}
|
|
3277
|
-
args = Array.
|
|
3399
|
+
args = Array.from(arguments);
|
|
3278
3400
|
kwargs = {};
|
|
3279
3401
|
if (args[args.length-1] && args[args.length-1][ρσ_kwargs_symbol] !== undefined) {
|
|
3280
3402
|
kwargs = args[args.length-1];
|
|
@@ -4090,7 +4212,7 @@ define_str_func("split", (function() {
|
|
|
4090
4212
|
var ρσ_anonfunc = function (sep, maxsplit) {
|
|
4091
4213
|
var split, ans, extra, parts;
|
|
4092
4214
|
if (maxsplit === 0) {
|
|
4093
|
-
return
|
|
4215
|
+
return [ this ];
|
|
4094
4216
|
}
|
|
4095
4217
|
split = ρσ_orig_split;
|
|
4096
4218
|
if (sep === undefined || sep === null) {
|
|
@@ -4121,7 +4243,7 @@ define_str_func("split", (function() {
|
|
|
4121
4243
|
ans.push(extra);
|
|
4122
4244
|
}
|
|
4123
4245
|
}
|
|
4124
|
-
return
|
|
4246
|
+
return ans;
|
|
4125
4247
|
};
|
|
4126
4248
|
if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, {
|
|
4127
4249
|
__argnames__ : {value: ["sep", "maxsplit"]},
|
|
@@ -4184,7 +4306,7 @@ define_str_func("rsplit", (function() {
|
|
|
4184
4306
|
ans.push(this.slice(0, end));
|
|
4185
4307
|
ans.reverse();
|
|
4186
4308
|
}
|
|
4187
|
-
return
|
|
4309
|
+
return ans;
|
|
4188
4310
|
};
|
|
4189
4311
|
if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, {
|
|
4190
4312
|
__argnames__ : {value: ["sep", "maxsplit"]},
|
|
@@ -4209,7 +4331,7 @@ define_str_func("splitlines", (function() {
|
|
|
4209
4331
|
} else {
|
|
4210
4332
|
ans = split(this, /(?:\r?\n)|\r/);
|
|
4211
4333
|
}
|
|
4212
|
-
return
|
|
4334
|
+
return ans;
|
|
4213
4335
|
};
|
|
4214
4336
|
if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, {
|
|
4215
4337
|
__argnames__ : {value: ["keepends"]},
|
|
@@ -4294,7 +4416,7 @@ define_str_func("zfill", (function() {
|
|
|
4294
4416
|
return (function(){
|
|
4295
4417
|
var ρσ_d = {};
|
|
4296
4418
|
ρσ_d["done"] = false;
|
|
4297
|
-
ρσ_d["value"] =
|
|
4419
|
+
ρσ_d["value"] = [ pos, ans ];
|
|
4298
4420
|
return ρσ_d;
|
|
4299
4421
|
}).call(this);
|
|
4300
4422
|
} else {
|