python-minifier 2.11.2__py2-none-any.whl → 3.0.0__py2-none-any.whl
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.
- python_minifier/__init__.py +14 -9
- python_minifier/__init__.pyi +8 -3
- python_minifier/__main__.py +77 -15
- python_minifier/ast_annotation/__init__.py +82 -0
- python_minifier/ast_compare.py +12 -14
- python_minifier/ast_compat.py +38 -0
- python_minifier/ast_printer.py +8 -5
- python_minifier/expression_printer.py +14 -13
- python_minifier/f_string.py +44 -45
- python_minifier/ministring.py +3 -3
- python_minifier/module_printer.py +19 -16
- python_minifier/rename/__init__.py +1 -1
- python_minifier/rename/bind_names.py +2 -1
- python_minifier/rename/binding.py +39 -40
- python_minifier/rename/mapper.py +66 -50
- python_minifier/rename/rename_literals.py +17 -15
- python_minifier/rename/renamer.py +26 -28
- python_minifier/rename/resolve_names.py +8 -7
- python_minifier/rename/util.py +7 -5
- python_minifier/token_printer.py +12 -1
- python_minifier/transforms/combine_imports.py +0 -1
- python_minifier/transforms/constant_folding.py +16 -10
- python_minifier/transforms/remove_annotations.py +18 -16
- python_minifier/transforms/remove_annotations_options.py +3 -1
- python_minifier/transforms/remove_annotations_options.pyi +8 -7
- python_minifier/transforms/remove_asserts.py +1 -2
- python_minifier/transforms/remove_debug.py +4 -3
- python_minifier/transforms/remove_exception_brackets.py +12 -7
- python_minifier/transforms/remove_explicit_return_none.py +5 -4
- python_minifier/transforms/remove_literal_statements.py +5 -6
- python_minifier/transforms/remove_object_base.py +2 -1
- python_minifier/transforms/remove_pass.py +1 -2
- python_minifier/transforms/remove_posargs.py +3 -4
- python_minifier/transforms/suite_transformer.py +6 -5
- python_minifier/util.py +12 -18
- {python_minifier-2.11.2.dist-info → python_minifier-3.0.0.dist-info}/METADATA +2 -2
- python_minifier-3.0.0.dist-info/RECORD +45 -0
- python_minifier-2.11.2.dist-info/RECORD +0 -44
- {python_minifier-2.11.2.dist-info → python_minifier-3.0.0.dist-info}/LICENSE +0 -0
- {python_minifier-2.11.2.dist-info → python_minifier-3.0.0.dist-info}/WHEEL +0 -0
- {python_minifier-2.11.2.dist-info → python_minifier-3.0.0.dist-info}/entry_points.txt +0 -0
- {python_minifier-2.11.2.dist-info → python_minifier-3.0.0.dist-info}/top_level.txt +0 -0
- {python_minifier-2.11.2.dist-info → python_minifier-3.0.0.dist-info}/zip-safe +0 -0
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
import python_minifier.ast_compat as ast
|
|
2
1
|
import sys
|
|
3
2
|
|
|
3
|
+
import python_minifier.ast_compat as ast
|
|
4
|
+
from python_minifier.ast_annotation import get_parent
|
|
5
|
+
|
|
4
6
|
from python_minifier.transforms.remove_annotations_options import RemoveAnnotationsOptions
|
|
5
7
|
from python_minifier.transforms.suite_transformer import SuiteTransformer
|
|
6
8
|
|
|
@@ -71,20 +73,20 @@ class RemoveAnnotations(SuiteTransformer):
|
|
|
71
73
|
if sys.version_info < (3, 7):
|
|
72
74
|
return False
|
|
73
75
|
|
|
74
|
-
if not isinstance(node
|
|
76
|
+
if not isinstance(get_parent(node), ast.ClassDef):
|
|
75
77
|
return False
|
|
76
78
|
|
|
77
|
-
if len(node.
|
|
79
|
+
if len(get_parent(node).decorator_list) == 0:
|
|
78
80
|
return False
|
|
79
81
|
|
|
80
|
-
for
|
|
81
|
-
if isinstance(
|
|
82
|
+
for decorator_node in get_parent(node).decorator_list:
|
|
83
|
+
if isinstance(decorator_node, ast.Name) and decorator_node.id == 'dataclass':
|
|
82
84
|
return True
|
|
83
|
-
elif isinstance(
|
|
85
|
+
elif isinstance(decorator_node, ast.Attribute) and decorator_node.attr == 'dataclass':
|
|
84
86
|
return True
|
|
85
|
-
elif isinstance(
|
|
87
|
+
elif isinstance(decorator_node, ast.Call) and isinstance(decorator_node.func, ast.Name) and decorator_node.func.id == 'dataclass':
|
|
86
88
|
return True
|
|
87
|
-
elif isinstance(
|
|
89
|
+
elif isinstance(decorator_node, ast.Call) and isinstance(decorator_node.func, ast.Attribute) and decorator_node.func.attr == 'dataclass':
|
|
88
90
|
return True
|
|
89
91
|
|
|
90
92
|
return False
|
|
@@ -93,24 +95,24 @@ class RemoveAnnotations(SuiteTransformer):
|
|
|
93
95
|
if sys.version_info < (3, 5):
|
|
94
96
|
return False
|
|
95
97
|
|
|
96
|
-
if not isinstance(node
|
|
98
|
+
if not isinstance(get_parent(node), ast.ClassDef):
|
|
97
99
|
return False
|
|
98
100
|
|
|
99
|
-
if len(node.
|
|
101
|
+
if len(get_parent(node).bases) == 0:
|
|
100
102
|
return False
|
|
101
103
|
|
|
102
104
|
tricky_types = ['NamedTuple', 'TypedDict']
|
|
103
105
|
|
|
104
|
-
for
|
|
105
|
-
if isinstance(
|
|
106
|
+
for base_node in get_parent(node).bases:
|
|
107
|
+
if isinstance(base_node, ast.Name) and base_node.id in tricky_types:
|
|
106
108
|
return True
|
|
107
|
-
elif isinstance(
|
|
109
|
+
elif isinstance(base_node, ast.Attribute) and base_node.attr in tricky_types:
|
|
108
110
|
return True
|
|
109
111
|
|
|
110
112
|
return False
|
|
111
113
|
|
|
112
114
|
# is this a class attribute or a variable?
|
|
113
|
-
if isinstance(node
|
|
115
|
+
if isinstance(get_parent(node), ast.ClassDef):
|
|
114
116
|
if not self._options.remove_class_attribute_annotations:
|
|
115
117
|
return node
|
|
116
118
|
else:
|
|
@@ -120,11 +122,11 @@ class RemoveAnnotations(SuiteTransformer):
|
|
|
120
122
|
if is_dataclass_field(node) or is_typing_sensitive(node):
|
|
121
123
|
return node
|
|
122
124
|
elif node.value:
|
|
123
|
-
return self.add_child(ast.Assign([node.target], node.value), parent=node
|
|
125
|
+
return self.add_child(ast.Assign([node.target], node.value), parent=get_parent(node), namespace=node.namespace)
|
|
124
126
|
else:
|
|
125
127
|
# Valueless annotations cause the interpreter to treat the variable as a local.
|
|
126
128
|
# I don't know of another way to do that without assigning to it, so
|
|
127
129
|
# keep it as an AnnAssign, but replace the annotation with '0'
|
|
128
130
|
|
|
129
|
-
node.annotation = self.add_child(ast.Num(0), parent=node
|
|
131
|
+
node.annotation = self.add_child(ast.Num(0), parent=get_parent(node), namespace=node.namespace)
|
|
130
132
|
return node
|
|
@@ -26,7 +26,9 @@ class RemoveAnnotationsOptions(object):
|
|
|
26
26
|
self.remove_class_attribute_annotations = remove_class_attribute_annotations
|
|
27
27
|
|
|
28
28
|
def __repr__(self):
|
|
29
|
-
return 'RemoveAnnotationsOptions(remove_variable_annotations=%r, remove_return_annotations=%r, remove_argument_annotations=%r, remove_class_attribute_annotations=%r)' % (
|
|
29
|
+
return 'RemoveAnnotationsOptions(remove_variable_annotations=%r, remove_return_annotations=%r, remove_argument_annotations=%r, remove_class_attribute_annotations=%r)' % (
|
|
30
|
+
self.remove_variable_annotations, self.remove_return_annotations, self.remove_argument_annotations, self.remove_class_attribute_annotations
|
|
31
|
+
)
|
|
30
32
|
|
|
31
33
|
def __nonzero__(self):
|
|
32
34
|
return any((self.remove_variable_annotations, self.remove_return_annotations, self.remove_argument_annotations, self.remove_class_attribute_annotations))
|
|
@@ -1,17 +1,18 @@
|
|
|
1
1
|
class RemoveAnnotationsOptions:
|
|
2
|
-
|
|
3
2
|
remove_variable_annotations: bool
|
|
4
3
|
remove_return_annotations: bool
|
|
5
4
|
remove_argument_annotations: bool
|
|
6
5
|
remove_class_attribute_annotations: bool
|
|
7
6
|
|
|
8
|
-
def __init__(
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
7
|
+
def __init__(
|
|
8
|
+
self,
|
|
9
|
+
remove_variable_annotations: bool = ...,
|
|
10
|
+
remove_return_annotations: bool = ...,
|
|
11
|
+
remove_argument_annotations: bool = ...,
|
|
12
|
+
remove_class_attribute_annotations: bool = ...
|
|
13
|
+
):
|
|
13
14
|
...
|
|
14
15
|
|
|
15
|
-
def __repr__(self) -> str: ...
|
|
16
16
|
def __nonzero__(self) -> bool: ...
|
|
17
|
+
|
|
17
18
|
def __bool__(self) -> bool: ...
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import python_minifier.ast_compat as ast
|
|
2
2
|
|
|
3
3
|
from python_minifier.transforms.suite_transformer import SuiteTransformer
|
|
4
|
-
from python_minifier.util import is_ast_node
|
|
5
4
|
|
|
6
5
|
|
|
7
6
|
class RemoveAsserts(SuiteTransformer):
|
|
@@ -15,7 +14,7 @@ class RemoveAsserts(SuiteTransformer):
|
|
|
15
14
|
return self.visit(node)
|
|
16
15
|
|
|
17
16
|
def suite(self, node_list, parent):
|
|
18
|
-
without_assert = [self.visit(a) for a in filter(lambda n: not
|
|
17
|
+
without_assert = [self.visit(a) for a in filter(lambda n: not isinstance(n, ast.Assert), node_list)]
|
|
19
18
|
|
|
20
19
|
if len(without_assert) == 0:
|
|
21
20
|
if isinstance(parent, ast.Module):
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import python_minifier.ast_compat as ast
|
|
2
1
|
import sys
|
|
3
2
|
|
|
3
|
+
import python_minifier.ast_compat as ast
|
|
4
|
+
|
|
4
5
|
from python_minifier.transforms.suite_transformer import SuiteTransformer
|
|
5
|
-
from python_minifier.util import
|
|
6
|
+
from python_minifier.util import is_constant_node
|
|
6
7
|
|
|
7
8
|
|
|
8
9
|
class RemoveDebug(SuiteTransformer):
|
|
@@ -18,7 +19,7 @@ class RemoveDebug(SuiteTransformer):
|
|
|
18
19
|
def constant_value(self, node):
|
|
19
20
|
if sys.version_info < (3, 4):
|
|
20
21
|
return node.id == 'True'
|
|
21
|
-
elif
|
|
22
|
+
elif is_constant_node(node, ast.NameConstant):
|
|
22
23
|
return node.value
|
|
23
24
|
return None
|
|
24
25
|
|
|
@@ -8,11 +8,14 @@ When printed, this essentially removes the brackets from the exception name.
|
|
|
8
8
|
We can't generally know if a name refers to an exception, so we only do this for builtin exceptions
|
|
9
9
|
"""
|
|
10
10
|
|
|
11
|
-
import python_minifier.ast_compat as ast
|
|
12
11
|
import sys
|
|
13
12
|
|
|
13
|
+
import python_minifier.ast_compat as ast
|
|
14
|
+
from python_minifier.ast_annotation import get_parent, set_parent
|
|
15
|
+
|
|
14
16
|
from python_minifier.rename.binding import BuiltinBinding
|
|
15
17
|
|
|
18
|
+
|
|
16
19
|
# These are always exceptions, in every version of python
|
|
17
20
|
builtin_exceptions = [
|
|
18
21
|
'SyntaxError', 'Exception', 'ValueError', 'BaseException', 'MemoryError', 'RuntimeError', 'DeprecationWarning', 'UnicodeEncodeError', 'KeyError', 'LookupError', 'TypeError', 'BufferError',
|
|
@@ -73,22 +76,24 @@ builtin_exceptions_3_11 = [
|
|
|
73
76
|
'BaseExceptionGroup',
|
|
74
77
|
]
|
|
75
78
|
|
|
79
|
+
|
|
76
80
|
def _remove_empty_call(binding):
|
|
77
81
|
assert isinstance(binding, BuiltinBinding)
|
|
78
82
|
|
|
79
83
|
for name_node in binding.references:
|
|
80
84
|
# For this to be a builtin, all references must be name nodes as it is not defined anywhere
|
|
81
|
-
assert isinstance(name_node, ast.Name)
|
|
85
|
+
assert isinstance(name_node, ast.Name)
|
|
86
|
+
assert isinstance(name_node.ctx, ast.Load)
|
|
82
87
|
|
|
83
|
-
if not isinstance(name_node
|
|
88
|
+
if not isinstance(get_parent(name_node), ast.Call):
|
|
84
89
|
# This is not a call
|
|
85
90
|
continue
|
|
86
|
-
call_node = name_node
|
|
91
|
+
call_node = get_parent(name_node)
|
|
87
92
|
|
|
88
|
-
if not isinstance(call_node
|
|
93
|
+
if not isinstance(get_parent(call_node), ast.Raise):
|
|
89
94
|
# This is not a raise statement
|
|
90
95
|
continue
|
|
91
|
-
raise_node = call_node
|
|
96
|
+
raise_node = get_parent(call_node)
|
|
92
97
|
|
|
93
98
|
if len(call_node.args) > 0 or len(call_node.keywords) > 0:
|
|
94
99
|
# This is a call with arguments
|
|
@@ -101,7 +106,7 @@ def _remove_empty_call(binding):
|
|
|
101
106
|
raise_node.exc = name_node
|
|
102
107
|
elif raise_node.cause is call_node:
|
|
103
108
|
raise_node.cause = name_node
|
|
104
|
-
name_node
|
|
109
|
+
set_parent(name_node, raise_node)
|
|
105
110
|
|
|
106
111
|
|
|
107
112
|
def remove_no_arg_exception_call(module):
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import python_minifier.ast_compat as ast
|
|
2
1
|
import sys
|
|
3
2
|
|
|
3
|
+
import python_minifier.ast_compat as ast
|
|
4
|
+
|
|
4
5
|
from python_minifier.transforms.suite_transformer import SuiteTransformer
|
|
5
|
-
from python_minifier.util import
|
|
6
|
+
from python_minifier.util import is_constant_node
|
|
6
7
|
|
|
7
8
|
|
|
8
9
|
class RemoveExplicitReturnNone(SuiteTransformer):
|
|
@@ -17,13 +18,13 @@ class RemoveExplicitReturnNone(SuiteTransformer):
|
|
|
17
18
|
if sys.version_info < (3, 4) and isinstance(node.value, ast.Name) and node.value.id == 'None':
|
|
18
19
|
node.value = None
|
|
19
20
|
|
|
20
|
-
elif sys.version_info >= (3, 4) and
|
|
21
|
+
elif sys.version_info >= (3, 4) and is_constant_node(node.value, ast.NameConstant) and node.value.value is None:
|
|
21
22
|
node.value = None
|
|
22
23
|
|
|
23
24
|
return node
|
|
24
25
|
|
|
25
26
|
def visit_FunctionDef(self, node):
|
|
26
|
-
assert
|
|
27
|
+
assert isinstance(node, (ast.FunctionDef, ast.AsyncFunctionDef))
|
|
27
28
|
|
|
28
29
|
node.body = [self.visit(a) for a in node.body]
|
|
29
30
|
|
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
import python_minifier.ast_compat as ast
|
|
2
2
|
|
|
3
3
|
from python_minifier.transforms.suite_transformer import SuiteTransformer
|
|
4
|
-
from python_minifier.util import
|
|
4
|
+
from python_minifier.util import is_constant_node
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
def find_doc(node):
|
|
8
8
|
|
|
9
|
-
if isinstance(node, ast.Attribute):
|
|
10
|
-
|
|
11
|
-
raise ValueError('__doc__ found!')
|
|
9
|
+
if isinstance(node, ast.Attribute) and node.attr == '__doc__':
|
|
10
|
+
raise ValueError('__doc__ found!')
|
|
12
11
|
|
|
13
12
|
for child in ast.iter_child_nodes(node):
|
|
14
13
|
find_doc(child)
|
|
@@ -18,7 +17,7 @@ def _doc_in_module(module):
|
|
|
18
17
|
try:
|
|
19
18
|
find_doc(module)
|
|
20
19
|
return False
|
|
21
|
-
except:
|
|
20
|
+
except Exception:
|
|
22
21
|
return True
|
|
23
22
|
|
|
24
23
|
|
|
@@ -47,7 +46,7 @@ class RemoveLiteralStatements(SuiteTransformer):
|
|
|
47
46
|
if not isinstance(node, ast.Expr):
|
|
48
47
|
return False
|
|
49
48
|
|
|
50
|
-
return
|
|
49
|
+
return is_constant_node(node.value, (ast.Num, ast.Str, ast.NameConstant, ast.Bytes))
|
|
51
50
|
|
|
52
51
|
def suite(self, node_list, parent):
|
|
53
52
|
without_literals = [self.visit(n) for n in node_list if not self.is_literal_statement(n)]
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import python_minifier.ast_compat as ast
|
|
2
2
|
|
|
3
3
|
from python_minifier.transforms.suite_transformer import SuiteTransformer
|
|
4
|
-
from python_minifier.util import is_ast_node
|
|
5
4
|
|
|
6
5
|
|
|
7
6
|
class RemovePass(SuiteTransformer):
|
|
@@ -15,7 +14,7 @@ class RemovePass(SuiteTransformer):
|
|
|
15
14
|
return self.visit(node)
|
|
16
15
|
|
|
17
16
|
def suite(self, node_list, parent):
|
|
18
|
-
without_pass = [self.visit(a) for a in filter(lambda n: not
|
|
17
|
+
without_pass = [self.visit(a) for a in filter(lambda n: not isinstance(n, ast.Pass), node_list)]
|
|
19
18
|
|
|
20
19
|
if len(without_pass) == 0:
|
|
21
20
|
if isinstance(parent, ast.Module):
|
|
@@ -2,10 +2,9 @@ import python_minifier.ast_compat as ast
|
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
def remove_posargs(node):
|
|
5
|
-
if isinstance(node, ast.arguments):
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
node.posonlyargs = []
|
|
5
|
+
if isinstance(node, ast.arguments) and hasattr(node, 'posonlyargs'):
|
|
6
|
+
node.args = node.posonlyargs + node.args
|
|
7
|
+
node.posonlyargs = []
|
|
9
8
|
|
|
10
9
|
for child in ast.iter_child_nodes(node):
|
|
11
10
|
remove_posargs(child)
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import python_minifier.ast_compat as ast
|
|
2
|
+
from python_minifier.ast_annotation import get_parent, add_parent as add_node_parent
|
|
2
3
|
|
|
3
4
|
from python_minifier.rename.mapper import add_parent
|
|
4
|
-
from python_minifier.util import is_ast_node
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
class NodeVisitor(object):
|
|
@@ -13,7 +13,7 @@ class NodeVisitor(object):
|
|
|
13
13
|
|
|
14
14
|
def generic_visit(self, node):
|
|
15
15
|
"""Called if no explicit visitor function exists for a node."""
|
|
16
|
-
for
|
|
16
|
+
for _field, value in ast.iter_fields(node):
|
|
17
17
|
if isinstance(value, list):
|
|
18
18
|
for item in value:
|
|
19
19
|
if isinstance(item, ast.AST):
|
|
@@ -185,12 +185,13 @@ class SuiteTransformer(NodeVisitor):
|
|
|
185
185
|
|
|
186
186
|
"""
|
|
187
187
|
|
|
188
|
-
if
|
|
188
|
+
if isinstance(node, (ast.FunctionDef, ast.Module, ast.AsyncFunctionDef)):
|
|
189
189
|
return node
|
|
190
|
-
return nearest_function_namespace(node
|
|
190
|
+
return nearest_function_namespace(get_parent(node))
|
|
191
191
|
|
|
192
192
|
if namespace is None:
|
|
193
193
|
namespace = nearest_function_namespace(parent)
|
|
194
194
|
|
|
195
|
-
|
|
195
|
+
add_node_parent(child, parent=parent)
|
|
196
|
+
add_parent(child, namespace=namespace)
|
|
196
197
|
return child
|
python_minifier/util.py
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import python_minifier.ast_compat as ast
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
|
|
4
|
+
def is_constant_node(node, types):
|
|
4
5
|
"""
|
|
5
6
|
Is a node one of the specified node types
|
|
6
7
|
|
|
7
|
-
A node type may be an actual ast class
|
|
8
|
-
types is a single node type or an iterable of many.
|
|
8
|
+
A node type may be an actual ast class or a tuple of many.
|
|
9
9
|
|
|
10
|
-
If
|
|
10
|
+
If types includes a specific Constant type (Str, Bytes, Num etc),
|
|
11
11
|
returns true for Constant nodes of the correct type.
|
|
12
12
|
|
|
13
13
|
:type node: ast.AST
|
|
@@ -19,29 +19,23 @@ def is_ast_node(node, types):
|
|
|
19
19
|
if not isinstance(types, tuple):
|
|
20
20
|
types = (types,)
|
|
21
21
|
|
|
22
|
-
actual_types = []
|
|
23
22
|
for node_type in types:
|
|
24
|
-
|
|
25
|
-
node_type = getattr(ast, node_type, None)
|
|
26
|
-
if node_type is not None:
|
|
27
|
-
actual_types.append(node_type)
|
|
28
|
-
else:
|
|
29
|
-
actual_types.append(node_type)
|
|
23
|
+
assert not isinstance(node_type, str)
|
|
30
24
|
|
|
31
|
-
if isinstance(node,
|
|
25
|
+
if isinstance(node, types):
|
|
32
26
|
return True
|
|
33
27
|
|
|
34
|
-
if
|
|
28
|
+
if isinstance(node, ast.Constant):
|
|
35
29
|
if type(node.value) in [type(None), type(True), type(False)]:
|
|
36
|
-
return ast.NameConstant in
|
|
30
|
+
return ast.NameConstant in types
|
|
37
31
|
elif isinstance(node.value, (int, float, complex)):
|
|
38
|
-
return ast.Num in
|
|
32
|
+
return ast.Num in types
|
|
39
33
|
elif isinstance(node.value, str):
|
|
40
|
-
return ast.Str in
|
|
34
|
+
return ast.Str in types
|
|
41
35
|
elif isinstance(node.value, bytes):
|
|
42
|
-
return ast.Bytes in
|
|
36
|
+
return ast.Bytes in types
|
|
43
37
|
elif node.value == Ellipsis:
|
|
44
|
-
return ast.Ellipsis in
|
|
38
|
+
return ast.Ellipsis in types
|
|
45
39
|
else:
|
|
46
40
|
raise RuntimeError('Unknown Constant value %r' % type(node.value))
|
|
47
41
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: python-minifier
|
|
3
|
-
Version:
|
|
3
|
+
Version: 3.0.0
|
|
4
4
|
Summary: Transform Python source code into it's most compact representation
|
|
5
5
|
Home-page: https://github.com/dflook/python-minifier
|
|
6
6
|
Author: Daniel Flook
|
|
@@ -130,7 +130,7 @@ def handler(event,context):
|
|
|
130
130
|
|
|
131
131
|
## Why?
|
|
132
132
|
|
|
133
|
-
AWS Cloudformation templates may have AWS lambda function source code embedded in them, but only if the function is less
|
|
133
|
+
AWS Cloudformation templates may have AWS lambda function source code embedded in them, but only if the function is less
|
|
134
134
|
than 4KiB. I wrote this package so I could write python normally and still embed the module in a template.
|
|
135
135
|
|
|
136
136
|
## Installation
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
python_minifier/__init__.py,sha256=Q95ufDbd7hadjVtJZYclsJqX9S4NsKZSpqCui0Fw7oI,9542
|
|
2
|
+
python_minifier/__init__.pyi,sha256=-xLoKXbQsV7ko_YzyXL9WkI2vmGc6yn4AW5biK_GJXE,1233
|
|
3
|
+
python_minifier/__main__.py,sha256=r7_Vh9n-aoc4jd5CERKO3KqJeqXHeWoycDRlvV7xTFM,14053
|
|
4
|
+
python_minifier/ast_compare.py,sha256=TlkEdQyiEXZZxbu3NrOgmYE7d8nV8dYhHDMysni44-Q,3249
|
|
5
|
+
python_minifier/ast_compat.py,sha256=nubno_yFHtuoxbT7a7CtlcAfdNj9yhniKSfNoOsQ3Fw,2209
|
|
6
|
+
python_minifier/ast_printer.py,sha256=TlkyKl9_9ScWeop3W1TwXZ46MJWINfkJ7NvmULpwt4A,3254
|
|
7
|
+
python_minifier/expression_printer.py,sha256=AwkDTs-NJhLyDppE_zlgQdtQQTVQlxdOdgTtSt_DxT8,22465
|
|
8
|
+
python_minifier/f_string.py,sha256=9Zkb2SksoTdx0-dfQKy_Q76KrOR4cxPokR5tnF7jldY,14131
|
|
9
|
+
python_minifier/ministring.py,sha256=R0xaAZqMlLu1Jm0aBVSI0n8KZiZV7PTs4RE4UbCmTy8,4359
|
|
10
|
+
python_minifier/module_printer.py,sha256=CZFZ3WDBgH57_Q2pmC0ySFdRcvQR_7uVQeXKfvT1BN0,25566
|
|
11
|
+
python_minifier/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
12
|
+
python_minifier/token_printer.py,sha256=TbN7VDGM_icmruLnBLgtWpHz1iY4pagGKsWCBMWSisA,9640
|
|
13
|
+
python_minifier/util.py,sha256=60iT3XkKlPlZhXQ1NuLB27Wv3ihl-gBC_WjOjEiFn-Q,1184
|
|
14
|
+
python_minifier/ast_annotation/__init__.py,sha256=BJ4gyS-_bytIZf0SP8JJG6FECWf8MUaUi3vOAfD60qQ,2259
|
|
15
|
+
python_minifier/rename/__init__.py,sha256=8DLEFgliakf_5T_m-l1Nd35QxKpM4h7RJyFVpjsxjWA,375
|
|
16
|
+
python_minifier/rename/bind_names.py,sha256=CCL2ZT2px___1yE5euO_Wv423DLQFIp5-D7m5RDV7d8,6918
|
|
17
|
+
python_minifier/rename/binding.py,sha256=WPospKLbZN7nnzDayJ55HMxuS-E5zvOE78RJkKiyPrE,15335
|
|
18
|
+
python_minifier/rename/mapper.py,sha256=h3dgg3JgUGQhW7oGwBX1syUgmt5AuaF_OP8dW5ImS5o,6482
|
|
19
|
+
python_minifier/rename/name_generator.py,sha256=70Klx2DteYRpBT8dr6jYDB31ARfinS42e08kKlWAzLg,1269
|
|
20
|
+
python_minifier/rename/rename_literals.py,sha256=dBe-6MsPDjzgQ_B5iz184PkEylxdOeBiTuZgeSME4bU,7246
|
|
21
|
+
python_minifier/rename/renamer.py,sha256=B9kNiTkWDw7i7tKQASrCZ4fXsjKf9AspFSUfuxQWZFs,6600
|
|
22
|
+
python_minifier/rename/resolve_names.py,sha256=VbePyUUqggvvcF3fAC6XMv6b3Kmb_cmlO9G7vf5Ti-c,4320
|
|
23
|
+
python_minifier/rename/util.py,sha256=ItJykxM_QRjIePMcKYo-LngmP5hLQZK-bOZIefg1cKA,5469
|
|
24
|
+
python_minifier/transforms/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
25
|
+
python_minifier/transforms/combine_imports.py,sha256=7DkNBsTLiiEw01Epa2xj8zkAyVMG3pCTJNlZktqDwDI,2297
|
|
26
|
+
python_minifier/transforms/constant_folding.py,sha256=wcCtjHa0WfYHI0Encs3IPHjZgumkN-ijNerMZgXu_g4,4538
|
|
27
|
+
python_minifier/transforms/remove_annotations.py,sha256=qUCdl42yvq1g7B43d88EOz6Jf51A5zogYBlFHGnyugU,4938
|
|
28
|
+
python_minifier/transforms/remove_annotations_options.py,sha256=kzg-gEPwhrCZxsuzdpEWjqnhsyF89hnIPv1t-IRty64,1889
|
|
29
|
+
python_minifier/transforms/remove_annotations_options.pyi,sha256=jZp8hUQ-BfqU1qA_nsPiluMM-1jznSX3pzbmysvKv-c,518
|
|
30
|
+
python_minifier/transforms/remove_asserts.py,sha256=obccCHRSK6j5z0Slb4vVvK5kPVKobZNQo1HjJeX1N0g,738
|
|
31
|
+
python_minifier/transforms/remove_debug.py,sha256=vuWJPFBMPYZEcSU8oRZ8w41tWl16B0mxpVvxEu4PiwY,1869
|
|
32
|
+
python_minifier/transforms/remove_exception_brackets.py,sha256=hOUxrfsl9-u8M1kLbqJ6wR8PFtKWSmmyKdTDkh-XsDA,4214
|
|
33
|
+
python_minifier/transforms/remove_explicit_return_none.py,sha256=drXry0dejtMWLZJCkGh4d7fc89MqiUVCXgaonn6Como,1301
|
|
34
|
+
python_minifier/transforms/remove_literal_statements.py,sha256=mrxgSNtI2J1Nv9DaSiXMlrqvEj1lDAAY5_niWh8PmZg,1631
|
|
35
|
+
python_minifier/transforms/remove_object_base.py,sha256=j4se6OXyZK1lr_ABmGT0OivuCI55ZRzCMD_SNmrHwTU,703
|
|
36
|
+
python_minifier/transforms/remove_pass.py,sha256=S9e59nBEZ8rBBifvAhbPRDTfUA7s8_a7pSIsZbFZD2A,735
|
|
37
|
+
python_minifier/transforms/remove_posargs.py,sha256=aV0wFnGiDXu4uQBQP7-cB1uLSF3mamIq5-txvDg8BVo,314
|
|
38
|
+
python_minifier/transforms/suite_transformer.py,sha256=WZCVkkBSniWeEtBybVweeMmy-A1wC3lBIYSgxCHelBU,6324
|
|
39
|
+
python_minifier-3.0.0.dist-info/LICENSE,sha256=FzsyDHb8pAZupSGFjIOuHcHMlFf6N-aIxq9gOYGbNyE,1069
|
|
40
|
+
python_minifier-3.0.0.dist-info/METADATA,sha256=qyng9Qp0kOp9hiup4wcfJW2DQJT3_hCjbFemSrIpTpU,6451
|
|
41
|
+
python_minifier-3.0.0.dist-info/WHEEL,sha256=1VPi6hfNQaRRNuEdK_3dv9o8COtLGnHWJghhj4CQ28k,92
|
|
42
|
+
python_minifier-3.0.0.dist-info/entry_points.txt,sha256=aS7ZUWQeeys8lAbrmmEa2__Bg-anH1tUMyi9cKdTbO4,60
|
|
43
|
+
python_minifier-3.0.0.dist-info/top_level.txt,sha256=4SRDfWKi_KMq7LDrjlzUFoDCs6INYPtxc1Pun4z8LsU,16
|
|
44
|
+
python_minifier-3.0.0.dist-info/zip-safe,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1
|
|
45
|
+
python_minifier-3.0.0.dist-info/RECORD,,
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
python_minifier/__init__.py,sha256=mr0_t3hEk5R7K2fcidew9nys0PTBrEGKaPaizDEgWqk,9456
|
|
2
|
-
python_minifier/__init__.pyi,sha256=_B0ywdLZ_iES6Ubq3ajuHbBS6Lr9J_InxJWbPo38iuQ,1214
|
|
3
|
-
python_minifier/__main__.py,sha256=q2BU9CC5G328DFdfHmxg8auAwZTEc6pbM869p6583I4,11746
|
|
4
|
-
python_minifier/ast_compare.py,sha256=ZxPTh7JwiuMo81e7jpOAnHsRAq7BXj3jCAeBu4K5kyI,3164
|
|
5
|
-
python_minifier/ast_compat.py,sha256=ZOcHXNiIh9NFjFbLMndiewuT664ZtB_w0_AtlUV710Q,1620
|
|
6
|
-
python_minifier/ast_printer.py,sha256=Nsh-8FM6-tsuLMfQBr9s32idQGnk8WZomJkJT_zLuAE,3222
|
|
7
|
-
python_minifier/expression_printer.py,sha256=7r0Z0WDgYAaLwHg0STMNp70zSt4aVa45MJUGmTxxkqY,22423
|
|
8
|
-
python_minifier/f_string.py,sha256=30cSPIzqQ7_oUX4UPWJWuXjWfPWWni9RWI85Qt_HisY,14036
|
|
9
|
-
python_minifier/ministring.py,sha256=1J_nVWakRpW98yT706xe57mP0Rf45N1ivjAk7-AnOTA,4378
|
|
10
|
-
python_minifier/module_printer.py,sha256=IXkvwC-EtPxNmzArGACqJhYF0sVX-rpHOxwSsoqFbYU,25342
|
|
11
|
-
python_minifier/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
12
|
-
python_minifier/token_printer.py,sha256=PKstW8JBpmk_C7S3t-SCx3nO-HStE1Ac3RxYl4XX_2g,9337
|
|
13
|
-
python_minifier/util.py,sha256=hmMW4z8rTyO90b5cASxOVZyNGx_ohFWI5Pr4vAeodpo,1535
|
|
14
|
-
python_minifier/rename/__init__.py,sha256=i-Su9VHxOwWGPMmURH1GUaFdtDZNYkKlbYdTUevgRi0,375
|
|
15
|
-
python_minifier/rename/bind_names.py,sha256=TaR8VIjmKVRJvnMBjxbc52uTFVgS6OE9vm67i-mavJM,6941
|
|
16
|
-
python_minifier/rename/binding.py,sha256=yOP3RFXzP7E0mVqdARNuWuKGmeqQyh42L8WhSXI51EE,15347
|
|
17
|
-
python_minifier/rename/mapper.py,sha256=FU-rGFvd6N8vlTixWsEeNrQbL4ku9bldFJUL_O01EkU,6598
|
|
18
|
-
python_minifier/rename/name_generator.py,sha256=70Klx2DteYRpBT8dr6jYDB31ARfinS42e08kKlWAzLg,1269
|
|
19
|
-
python_minifier/rename/rename_literals.py,sha256=n_XHME6mhT9pR_RTiRjWo3YWvVuQoPNBERyCOgNrpBQ,7156
|
|
20
|
-
python_minifier/rename/renamer.py,sha256=RitT7xFr8G1V3wQtxTvxgr1EXbQM6puUeK39CSUYtMo,6706
|
|
21
|
-
python_minifier/rename/resolve_names.py,sha256=J3Yv32uc2KPfsTa-p9hUNNCEbQDDS-b0na6EUqVeGAo,4356
|
|
22
|
-
python_minifier/rename/util.py,sha256=UchrXPibRr338POF-64zWRfl5OoxwUrE4uOnQstni2s,5451
|
|
23
|
-
python_minifier/transforms/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
24
|
-
python_minifier/transforms/combine_imports.py,sha256=rXbX8ygOMgDti1B_zwU5trEIRoDrGjUpQcC8VvQMioI,2298
|
|
25
|
-
python_minifier/transforms/constant_folding.py,sha256=LWH2z210i9ZTFY8rgjEayifB7DPYkb6XSdHEQATurF4,4435
|
|
26
|
-
python_minifier/transforms/remove_annotations.py,sha256=uBjka4wt22hPJQ66xpCj5B5HaFL3gZ6gr6OsGgq9yo4,4704
|
|
27
|
-
python_minifier/transforms/remove_annotations_options.py,sha256=K-E9-TQlCyGRO-YKDfri0kyLevYxQweZhyViwiRAM7Y,1867
|
|
28
|
-
python_minifier/transforms/remove_annotations_options.pyi,sha256=BUz465OPI88YKMpDLyLfPwiJ50sL0nBJtUf6Vot23Sc,575
|
|
29
|
-
python_minifier/transforms/remove_asserts.py,sha256=jatGfsPeSzPuEHhTg9c6XaJRInM_t74zRmSEB1FoYYE,784
|
|
30
|
-
python_minifier/transforms/remove_debug.py,sha256=2LoWJVZchhXx2O5rf1nou-_IlWkqYOu3_V5t2Wllly0,1856
|
|
31
|
-
python_minifier/transforms/remove_exception_brackets.py,sha256=_-fQnjiiZCCkljC-GoG4XH9YzvRwQNfFy1KbA6_UG04,4110
|
|
32
|
-
python_minifier/transforms/remove_explicit_return_none.py,sha256=1k4dzPneDPg9UJBKrj-b9YKDkyXlFVd9TzyuAjjzjSg,1287
|
|
33
|
-
python_minifier/transforms/remove_literal_statements.py,sha256=dlYONJ-m5oj1zZITHsLY7O6QZ52rl1k2hHWbkqdxJNM,1619
|
|
34
|
-
python_minifier/transforms/remove_object_base.py,sha256=MvI1XwwB9zcwdClhyTeoD6Won4VmzNdZZ0kcB4yBgt8,702
|
|
35
|
-
python_minifier/transforms/remove_pass.py,sha256=A2c4psmYxQ6cYnk6u2KISZW6XhpDEaY-1zFx9Gy6RqI,781
|
|
36
|
-
python_minifier/transforms/remove_posargs.py,sha256=ecLdKGr0kKx6uf7OXiB_SgF57xWRiDq6ixn5OBSVi7Y,330
|
|
37
|
-
python_minifier/transforms/suite_transformer.py,sha256=zzQKf8QIVCHJ0IGF8i0yBi7kbyazaDQxrnu6eB4v6bg,6246
|
|
38
|
-
python_minifier-2.11.2.dist-info/LICENSE,sha256=FzsyDHb8pAZupSGFjIOuHcHMlFf6N-aIxq9gOYGbNyE,1069
|
|
39
|
-
python_minifier-2.11.2.dist-info/METADATA,sha256=OmFILwGLprKDfar9hQ6pN66fBekDGxIU7fUluDCXLZs,6453
|
|
40
|
-
python_minifier-2.11.2.dist-info/WHEEL,sha256=1VPi6hfNQaRRNuEdK_3dv9o8COtLGnHWJghhj4CQ28k,92
|
|
41
|
-
python_minifier-2.11.2.dist-info/entry_points.txt,sha256=aS7ZUWQeeys8lAbrmmEa2__Bg-anH1tUMyi9cKdTbO4,60
|
|
42
|
-
python_minifier-2.11.2.dist-info/top_level.txt,sha256=4SRDfWKi_KMq7LDrjlzUFoDCs6INYPtxc1Pun4z8LsU,16
|
|
43
|
-
python_minifier-2.11.2.dist-info/zip-safe,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1
|
|
44
|
-
python_minifier-2.11.2.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|