commit python-pscript for openSUSE:Factory
Hello community, here is the log from the commit of package python-pscript for openSUSE:Factory checked in at 2019-06-01 09:45:32 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/python-pscript (Old) and /work/SRC/openSUSE:Factory/.python-pscript.new.5148 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Package is "python-pscript" Sat Jun 1 09:45:32 2019 rev:4 rq:705241 version:0.7.1 Changes: -------- --- /work/SRC/openSUSE:Factory/python-pscript/python-pscript.changes 2019-03-26 22:31:47.917714817 +0100 +++ /work/SRC/openSUSE:Factory/.python-pscript.new.5148/python-pscript.changes 2019-06-01 09:45:38.327403374 +0200 @@ -1,0 +2,7 @@ +Fri May 24 12:20:38 UTC 2019 - pgajdos@suse.com + +- version update to 0.7.1 + * fix style error + * Quicker op_equals + +------------------------------------------------------------------- Old: ---- pscript-0.7.0.tar.gz New: ---- pscript-0.7.1.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python-pscript.spec ++++++ --- /var/tmp/diff_new_pack.7HcxyR/_old 2019-06-01 09:45:40.783402536 +0200 +++ /var/tmp/diff_new_pack.7HcxyR/_new 2019-06-01 09:45:40.815402525 +0200 @@ -18,7 +18,7 @@ %{?!python_module:%define python_module() python-%{**} python3-%{**}} Name: python-pscript -Version: 0.7.0 +Version: 0.7.1 Release: 0 Summary: Python to JavaScript compiler License: BSD-2-Clause ++++++ pscript-0.7.0.tar.gz -> pscript-0.7.1.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pscript-0.7.0/PKG-INFO new/pscript-0.7.1/PKG-INFO --- old/pscript-0.7.0/PKG-INFO 2018-11-08 16:25:25.000000000 +0100 +++ new/pscript-0.7.1/PKG-INFO 2019-03-29 22:17:47.000000000 +0100 @@ -1,6 +1,6 @@ Metadata-Version: 1.1 Name: pscript -Version: 0.7.0 +Version: 0.7.1 Summary: Python to JavaScript compiler. Home-page: http://pscript.readthedocs.io Author: Almar Klein and contributors diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pscript-0.7.0/pscript/__init__.py new/pscript-0.7.1/pscript/__init__.py --- old/pscript-0.7.0/pscript/__init__.py 2018-11-08 16:23:18.000000000 +0100 +++ new/pscript-0.7.1/pscript/__init__.py 2019-03-29 22:14:19.000000000 +0100 @@ -17,7 +17,7 @@ when correct, but error reporting may not be very Pythonic. The most important functions you need to know about are -:func:`py2js <pscript.py2js>` and +:func:`py2js <pscript.py2js>` and :func:`evalpy <pscript.evalpy>`. In principal you do not need knowledge of JavaScript to write PScript code, though it does help in corner cases. @@ -32,7 +32,7 @@ Python, to allow user-defined interaction to be flexible, fast, and stand-alone. -This resulted in the following two main goals: +This resulted in the following two main goals: * To make writing JavaScript easier and less frustrating, by letting people write it with the Python syntax and builtins, and fixing some @@ -74,7 +74,7 @@ The empty list and dict evaluate to false (whereas in JS it's true), and ``isinstance()`` just works (whereas JS' ``typeof`` is -broken). +broken). Deep comparisons are supported (e.g. for ``==`` and ``in``), so you can compare two lists or dicts, or even a structure of nested @@ -135,7 +135,7 @@ have a negative impact on performance in tight loops (in comparison to writing the JS by hand). The recommended approach is to write performance critical code in pure JavaScript -(using :func:`RawJS <pscript.RawJS>`) if necessary. +(using :func:`RawJS <pscript.RawJS>`) if necessary. .. _pscript-overload: @@ -144,7 +144,7 @@ ---------------------------------------------- To improve the performance of critical code, it's possible to disable -some of the overloading that make PScript more Pythonic. This increases +some of the overloading that make PScript more Pythonic. This increases the speed of code, but it also makes it more like JavaScript. To use this feature, write ``PSCRIPT_OVERLOAD = False``. Any code that @@ -169,7 +169,7 @@ ------- This is an overview of the language features that PScript -supports/lacks. +supports/lacks. Not currently supported: @@ -239,7 +239,7 @@ """ -__version__ = '0.7.0' +__version__ = '0.7.1' import sys import logging @@ -268,13 +268,13 @@ # flake8: noqa if ok: - + from .parser0 import Parser0, JSError from .parser1 import Parser1 from .parser2 import Parser2 from .parser3 import Parser3 from .base import * - + from .functions import py2js, evaljs, evalpy, JSString from .functions import script2js, js_rename, create_js_module from .stdlib import get_full_std_lib, get_all_std_names diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pscript-0.7.0/pscript/parser1.py new/pscript-0.7.1/pscript/parser1.py --- old/pscript-0.7.0/pscript/parser1.py 2018-11-08 16:21:21.000000000 +0100 +++ new/pscript-0.7.1/pscript/parser1.py 2019-03-08 14:00:40.000000000 +0100 @@ -848,7 +848,7 @@ return [] if node.root and node.root == '__future__': return [] # stuff to help the parser - if node.root is 'time': + if node.root == 'time': return [] # PScript natively supports time() and perf_counter() raise JSError('PScript does not support imports.') diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pscript-0.7.0/pscript/stdlib.py new/pscript-0.7.1/pscript/stdlib.py --- old/pscript-0.7.0/pscript/stdlib.py 2018-10-25 13:22:51.000000000 +0200 +++ new/pscript-0.7.1/pscript/stdlib.py 2019-03-08 14:00:02.000000000 +0100 @@ -42,7 +42,7 @@ _update_deps(FUNCTIONS[dep], function_deps, method_deps) for dep in list(method_deps): _update_deps(METHODS[dep], function_deps, method_deps) - + return nargs, sorted(function_deps), sorted(method_deps) def _update_deps(code, function_deps, method_deps): @@ -93,7 +93,7 @@ def get_full_std_lib(indent=0): """ Get the code for the full PScript standard library. - + The given indent specifies how many sets of 4 spaces to prepend. If the full stdlib is made available in JavaScript, multiple snippets of code can be transpiled without inlined stdlib parts by @@ -349,7 +349,7 @@ for (i=0; i<iter.length; i++) {res.push([i, iter[i]]);} return res; }""" - + FUNCTIONS['zip'] = """function () { // nargs: 2 3 4 5 6 7 8 9 var i, j, tup, arg, args = [], res = [], len = 1e20; for (i=0; i<arguments.length; i++) { @@ -375,7 +375,7 @@ if ((typeof iter==="object") && (!Array.isArray(iter))) {iter = Object.keys(iter);} var comp = function (a, b) {a = key(a); b = key(b); if (a<b) {return -1;} if (a>b) {return 1;} return 0;}; - comp = Boolean(key) ? comp : undefined; + comp = Boolean(key) ? comp : undefined; iter = iter.slice().sort(comp); if (reverse) iter.reverse(); return iter; @@ -404,6 +404,13 @@ }""" FUNCTIONS['op_equals'] = """function op_equals (a, b) { // nargs: 2 + var a_type = typeof a; + // If a (or b actually) is of type string, number or boolean, we don't need + // to do all the other type checking below. + if (a_type === "string" || a_type === "boolean" || a_type === "number") { + return a == b; + } + if (a == null || b == null) { } else if (Array.isArray(a) && Array.isArray(b)) { var i = 0, iseq = a.length == b.length; @@ -463,7 +470,7 @@ METHODS['extend'] = """function (x) { // nargs: 1 if (!Array.isArray(this)) return this.KEY.apply(this, arguments); - this.push.apply(this, x); + this.push.apply(this, x); }""" METHODS['insert'] = """function (i, x) { // nargs: 2 @@ -488,7 +495,7 @@ if (!Array.isArray(this)) return this.KEY.apply(this, arguments); var comp = function (a, b) {a = key(a); b = key(b); if (a<b) {return -1;} if (a>b) {return 1;} return 0;}; - comp = Boolean(key) ? comp : undefined; + comp = Boolean(key) ? comp : undefined; this.sort(comp); if (reverse) this.reverse(); }""" @@ -539,14 +546,14 @@ stop = Math.min(this.length, ((stop < 0) ? this.length + stop : stop)); if (Array.isArray(this)) { var count = 0; - for (var i=0; i<this.length; i++) { + for (var i=0; i<this.length; i++) { if (FUNCTION_PREFIXop_equals(this[i], x)) {count+=1;} } return count; } else if (this.constructor == String) { var count = 0, i = start; while (i >= 0 && i < stop) { i = this.indexOf(x, i); - if (i < 0) break; + if (i < 0) break; count += 1; i += Math.max(1, x.length); } return count; @@ -764,7 +771,7 @@ METHODS['join'] = """function (x) { // nargs: 1 if (this.constructor !== String) return this.KEY.apply(this, arguments); - return x.join(this); // call join on the list instead of the string. + return x.join(this); // call join on the list instead of the string. }""" METHODS['ljust'] = """function (w, fill) { // nargs: 1 2 @@ -793,7 +800,7 @@ var i1 = this.indexOf(sep); if (i1 < 0) return [this.slice(0), '', ''] var i2 = i1 + sep.length; - return [this.slice(0, i1), this.slice(i1, i2), this.slice(i2)]; + return [this.slice(0, i1), this.slice(i1, i2), this.slice(i2)]; }""" METHODS['replace'] = """function (s1, s2, count) { // nargs: 2 3 @@ -844,7 +851,7 @@ var i1 = this.lastIndexOf(sep); if (i1 < 0) return ['', '', this.slice(0)] var i2 = i1 + sep.length; - return [this.slice(0, i1), this.slice(i1, i2), this.slice(i2)]; + return [this.slice(0, i1), this.slice(i1, i2), this.slice(i2)]; }""" METHODS['rsplit'] = """function (sep, count) { // nargs: 1 2 @@ -965,7 +972,7 @@ 'FUNCTION_PREFIX', FUNCTION_PREFIX).replace( 'METHOD_PREFIX', METHOD_PREFIX).replace( ', )', ')') - + for key in FUNCTIONS: FUNCTIONS[key] = re.subn(r'METHOD_PREFIX(.+?)\(', r'METHOD_PREFIX\1.call(', FUNCTIONS[key])[0] diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pscript-0.7.0/pscript.egg-info/PKG-INFO new/pscript-0.7.1/pscript.egg-info/PKG-INFO --- old/pscript-0.7.0/pscript.egg-info/PKG-INFO 2018-11-08 16:25:24.000000000 +0100 +++ new/pscript-0.7.1/pscript.egg-info/PKG-INFO 2019-03-29 22:17:46.000000000 +0100 @@ -1,6 +1,6 @@ Metadata-Version: 1.1 Name: pscript -Version: 0.7.0 +Version: 0.7.1 Summary: Python to JavaScript compiler. Home-page: http://pscript.readthedocs.io Author: Almar Klein and contributors diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pscript-0.7.0/pscript_legacy/__init__.py new/pscript-0.7.1/pscript_legacy/__init__.py --- old/pscript-0.7.0/pscript_legacy/__init__.py 2018-11-08 16:25:24.000000000 +0100 +++ new/pscript-0.7.1/pscript_legacy/__init__.py 2019-03-29 22:17:45.000000000 +0100 @@ -18,7 +18,7 @@ when correct, but error reporting may not be very Pythonic. The most important functions you need to know about are -:func:`py2js <pscript.py2js>` and +:func:`py2js <pscript.py2js>` and :func:`evalpy <pscript.evalpy>`. In principal you do not need knowledge of JavaScript to write PScript code, though it does help in corner cases. @@ -33,7 +33,7 @@ Python, to allow user-defined interaction to be flexible, fast, and stand-alone. -This resulted in the following two main goals: +This resulted in the following two main goals: * To make writing JavaScript easier and less frustrating, by letting people write it with the Python syntax and builtins, and fixing some @@ -75,7 +75,7 @@ The empty list and dict evaluate to false (whereas in JS it's true), and ``isinstance()`` just works (whereas JS' ``typeof`` is -broken). +broken). Deep comparisons are supported (e.g. for ``==`` and ``in``), so you can compare two lists or dicts, or even a structure of nested @@ -136,7 +136,7 @@ have a negative impact on performance in tight loops (in comparison to writing the JS by hand). The recommended approach is to write performance critical code in pure JavaScript -(using :func:`RawJS <pscript.RawJS>`) if necessary. +(using :func:`RawJS <pscript.RawJS>`) if necessary. .. _pscript-overload: @@ -145,7 +145,7 @@ ---------------------------------------------- To improve the performance of critical code, it's possible to disable -some of the overloading that make PScript more Pythonic. This increases +some of the overloading that make PScript more Pythonic. This increases the speed of code, but it also makes it more like JavaScript. To use this feature, write ``PSCRIPT_OVERLOAD = False``. Any code that @@ -170,7 +170,7 @@ ------- This is an overview of the language features that PScript -supports/lacks. +supports/lacks. Not currently supported: @@ -242,7 +242,7 @@ from __future__ import print_function, absolute_import, with_statement, unicode_literals, division -__version__ = '0.7.0' +__version__ = '0.7.1' import sys import logging @@ -271,13 +271,13 @@ # flake8: noqa if ok: - + from .parser0 import Parser0, JSError from .parser1 import Parser1 from .parser2 import Parser2 from .parser3 import Parser3 from .base import * - + from .functions import py2js, evaljs, evalpy, JSString from .functions import script2js, js_rename, create_js_module from .stdlib import get_full_std_lib, get_all_std_names diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pscript-0.7.0/pscript_legacy/parser1.py new/pscript-0.7.1/pscript_legacy/parser1.py --- old/pscript-0.7.0/pscript_legacy/parser1.py 2018-11-08 16:25:24.000000000 +0100 +++ new/pscript-0.7.1/pscript_legacy/parser1.py 2019-03-29 22:17:45.000000000 +0100 @@ -851,7 +851,7 @@ return [] if node.root and node.root == '__future__': return [] # stuff to help the parser - if node.root is 'time': + if node.root == 'time': return [] # PScript natively supports time() and perf_counter() raise JSError('PScript does not support imports.') diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pscript-0.7.0/pscript_legacy/stdlib.py new/pscript-0.7.1/pscript_legacy/stdlib.py --- old/pscript-0.7.0/pscript_legacy/stdlib.py 2018-11-08 16:25:24.000000000 +0100 +++ new/pscript-0.7.1/pscript_legacy/stdlib.py 2019-03-29 22:17:45.000000000 +0100 @@ -45,7 +45,7 @@ _update_deps(FUNCTIONS[dep], function_deps, method_deps) for dep in list(method_deps): _update_deps(METHODS[dep], function_deps, method_deps) - + return nargs, sorted(function_deps), sorted(method_deps) def _update_deps(code, function_deps, method_deps): @@ -96,7 +96,7 @@ def get_full_std_lib(indent=0): """ Get the code for the full PScript standard library. - + The given indent specifies how many sets of 4 spaces to prepend. If the full stdlib is made available in JavaScript, multiple snippets of code can be transpiled without inlined stdlib parts by @@ -352,7 +352,7 @@ for (i=0; i<iter.length; i++) {res.push([i, iter[i]]);} return res; }""" - + FUNCTIONS['zip'] = """function () { // nargs: 2 3 4 5 6 7 8 9 var i, j, tup, arg, args = [], res = [], len = 1e20; for (i=0; i<arguments.length; i++) { @@ -378,7 +378,7 @@ if ((typeof iter==="object") && (!Array.isArray(iter))) {iter = Object.keys(iter);} var comp = function (a, b) {a = key(a); b = key(b); if (a<b) {return -1;} if (a>b) {return 1;} return 0;}; - comp = Boolean(key) ? comp : undefined; + comp = Boolean(key) ? comp : undefined; iter = iter.slice().sort(comp); if (reverse) iter.reverse(); return iter; @@ -407,6 +407,13 @@ }""" FUNCTIONS['op_equals'] = """function op_equals (a, b) { // nargs: 2 + var a_type = typeof a; + // If a (or b actually) is of type string, number or boolean, we don't need + // to do all the other type checking below. + if (a_type === "string" || a_type === "boolean" || a_type === "number") { + return a == b; + } + if (a == null || b == null) { } else if (Array.isArray(a) && Array.isArray(b)) { var i = 0, iseq = a.length == b.length; @@ -466,7 +473,7 @@ METHODS['extend'] = """function (x) { // nargs: 1 if (!Array.isArray(this)) return this.KEY.apply(this, arguments); - this.push.apply(this, x); + this.push.apply(this, x); }""" METHODS['insert'] = """function (i, x) { // nargs: 2 @@ -491,7 +498,7 @@ if (!Array.isArray(this)) return this.KEY.apply(this, arguments); var comp = function (a, b) {a = key(a); b = key(b); if (a<b) {return -1;} if (a>b) {return 1;} return 0;}; - comp = Boolean(key) ? comp : undefined; + comp = Boolean(key) ? comp : undefined; this.sort(comp); if (reverse) this.reverse(); }""" @@ -542,14 +549,14 @@ stop = Math.min(this.length, ((stop < 0) ? this.length + stop : stop)); if (Array.isArray(this)) { var count = 0; - for (var i=0; i<this.length; i++) { + for (var i=0; i<this.length; i++) { if (FUNCTION_PREFIXop_equals(this[i], x)) {count+=1;} } return count; } else if (this.constructor == String) { var count = 0, i = start; while (i >= 0 && i < stop) { i = this.indexOf(x, i); - if (i < 0) break; + if (i < 0) break; count += 1; i += Math.max(1, x.length); } return count; @@ -767,7 +774,7 @@ METHODS['join'] = """function (x) { // nargs: 1 if (this.constructor !== String) return this.KEY.apply(this, arguments); - return x.join(this); // call join on the list instead of the string. + return x.join(this); // call join on the list instead of the string. }""" METHODS['ljust'] = """function (w, fill) { // nargs: 1 2 @@ -796,7 +803,7 @@ var i1 = this.indexOf(sep); if (i1 < 0) return [this.slice(0), '', ''] var i2 = i1 + sep.length; - return [this.slice(0, i1), this.slice(i1, i2), this.slice(i2)]; + return [this.slice(0, i1), this.slice(i1, i2), this.slice(i2)]; }""" METHODS['replace'] = """function (s1, s2, count) { // nargs: 2 3 @@ -847,7 +854,7 @@ var i1 = this.lastIndexOf(sep); if (i1 < 0) return ['', '', this.slice(0)] var i2 = i1 + sep.length; - return [this.slice(0, i1), this.slice(i1, i2), this.slice(i2)]; + return [this.slice(0, i1), this.slice(i1, i2), this.slice(i2)]; }""" METHODS['rsplit'] = """function (sep, count) { // nargs: 1 2 @@ -968,7 +975,7 @@ 'FUNCTION_PREFIX', FUNCTION_PREFIX).replace( 'METHOD_PREFIX', METHOD_PREFIX).replace( ', )', ')') - + for key in FUNCTIONS: FUNCTIONS[key] = re.subn(r'METHOD_PREFIX(.+?)\(', r'METHOD_PREFIX\1.call(', FUNCTIONS[key])[0]
participants (1)
-
root