python-minifier
Advanced tools
+1
-1
| Metadata-Version: 2.1 | ||
| Name: python_minifier | ||
| Version: 2.11.1 | ||
| Version: 2.11.2 | ||
| Summary: Transform Python source code into it's most compact representation | ||
@@ -5,0 +5,0 @@ Home-page: https://github.com/dflook/python-minifier |
+1
-1
@@ -31,3 +31,3 @@ import os.path | ||
| python_requires='>=2.7, !=3.0.*, !=3.1.*, !=3.2.*, <3.14', | ||
| version='2.11.1', | ||
| version='2.11.2', | ||
@@ -34,0 +34,0 @@ classifiers=[ |
| Metadata-Version: 2.1 | ||
| Name: python_minifier | ||
| Version: 2.11.1 | ||
| Version: 2.11.2 | ||
| Summary: Transform Python source code into it's most compact representation | ||
@@ -5,0 +5,0 @@ Home-page: https://github.com/dflook/python-minifier |
@@ -88,3 +88,4 @@ import python_minifier.ast_compat as ast | ||
| if isinstance(func.namespace, ast.ClassDef) and not isinstance(func, ast.Lambda): | ||
| if len(func.args.args) > 0 and node is func.args.args[0]: | ||
| all_args = (func.args.posonlyargs if hasattr(func.args, 'posonlyargs') else []) + func.args.args | ||
| if len(all_args) > 0 and node is all_args[0]: | ||
| if len(func.decorator_list) == 0: | ||
@@ -91,0 +92,0 @@ # rename 'self' |
@@ -167,2 +167,81 @@ """ | ||
| def test_rename_posargs_in_place(): | ||
| if sys.version_info < (3, 8): | ||
| pytest.skip('No posonlyargs in python < 3.8') | ||
| source = ''' | ||
| def test(arg, /, arg2): return arg, arg2 | ||
| class TestClass(): | ||
| def mymethod(self, arg, /, arg2): return arg, arg2 | ||
| @classmethod | ||
| def mymethod(cls, arg, /, arg2): return arg, arg2 | ||
| ''' | ||
| expected = ''' | ||
| def test(A,/,arg2):return A,arg2 | ||
| class TestClass: | ||
| def mymethod(B,A,/,arg2):return A,arg2 | ||
| @classmethod | ||
| def mymethod(B,A,/,arg2):return A,arg2 | ||
| ''' | ||
| expected_ast = ast.parse(expected) | ||
| actual_ast = rename_locals(source) | ||
| assert_code(expected_ast, actual_ast) | ||
| def test_rename_kwargonlyargs_in_place(): | ||
| if sys.version_info < (3, 0): | ||
| pytest.skip('No kwonlyargs in python < 3.0') | ||
| source = ''' | ||
| def test(arg, arg2, *, arg3): return arg, arg2, arg3 | ||
| class TestClass(): | ||
| def mymethod(self, arg, arg2, *, arg3): return arg, arg2, arg3 | ||
| @classmethod | ||
| def mymethod(cls, arg, arg2, *, arg3): return arg, arg2, arg3 | ||
| ''' | ||
| expected = ''' | ||
| def test(arg,arg2,*,arg3):return arg,arg2,arg3 | ||
| class TestClass: | ||
| def mymethod(A,arg,arg2,*,arg3):return arg,arg2,arg3 | ||
| @classmethod | ||
| def mymethod(A,arg,arg2,*,arg3):return arg,arg2,arg3 | ||
| ''' | ||
| expected_ast = ast.parse(expected) | ||
| actual_ast = rename_locals(source) | ||
| assert_code(expected_ast, actual_ast) | ||
| def test_rename_posargs_kwargonlyargs_in_place(): | ||
| if sys.version_info < (3, 8): | ||
| pytest.skip('No posonlyargs in python < 3.8') | ||
| source = ''' | ||
| def test(arg, /, arg2, *, arg3): return arg, arg2, arg3 | ||
| class TestClass(): | ||
| def mymethod(self, arg, /, arg2, *, arg3): return arg, arg2, arg3 | ||
| @classmethod | ||
| def mymethod(cls, arg, /, arg2, *, arg3): return arg, arg2, arg3 | ||
| ''' | ||
| expected = ''' | ||
| def test(A,/,arg2,*,arg3):return A,arg2,arg3 | ||
| class TestClass: | ||
| def mymethod(B,A,/,arg2,*,arg3):return A,arg2,arg3 | ||
| @classmethod | ||
| def mymethod(B,A,/,arg2,*,arg3):return A,arg2,arg3 | ||
| ''' | ||
| expected_ast = ast.parse(expected) | ||
| actual_ast = rename_locals(source) | ||
| assert_code(expected_ast, actual_ast) | ||
| def test_no_rename_long_arg(): | ||
@@ -169,0 +248,0 @@ source = ''' |
Alert delta unavailable
Currently unable to show alert delta for PyPI packages.
401933
0.54%10419
0.59%