python-minifier 2.10.0__py3-none-any.whl → 2.11.0__py3-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.
@@ -32,11 +32,15 @@ class MiniString(object):
32
32
 
33
33
  try:
34
34
  eval(self.quote + s + self.quote)
35
- except UnicodeDecodeError:
36
- if self._safe_mode:
35
+ except (UnicodeDecodeError, UnicodeEncodeError) as e:
36
+ if self.safe_mode:
37
37
  raise
38
38
 
39
- self._safe_mode = True
39
+ self.safe_mode = True
40
+ if len(self.quote) == 1:
41
+ s = self.to_short()
42
+ else:
43
+ s = self.to_long()
40
44
 
41
45
  assert eval(self.quote + s + self.quote) == self._s
42
46
 
@@ -754,17 +754,29 @@ class ModulePrinter(ExpressionPrinter):
754
754
  self.printer.delimiter(':')
755
755
  self._expression(node.bound)
756
756
 
757
+ if hasattr(node, 'default_value') and node.default_value is not None:
758
+ self.printer.delimiter('=')
759
+ self._expression(node.default_value)
760
+
757
761
  def visit_TypeVarTuple(self, node):
758
762
  assert isinstance(node, ast.TypeVarTuple)
759
763
  self.printer.operator('*')
760
764
  self.printer.identifier(node.name)
761
765
 
766
+ if hasattr(node, 'default_value') and node.default_value is not None:
767
+ self.printer.delimiter('=')
768
+ self._expression(node.default_value)
769
+
762
770
  def visit_ParamSpec(self, node):
763
771
  assert isinstance(node, ast.ParamSpec)
764
772
  self.printer.operator('*')
765
773
  self.printer.operator('*')
766
774
  self.printer.identifier(node.name)
767
775
 
776
+ if hasattr(node, 'default_value') and node.default_value is not None:
777
+ self.printer.delimiter('=')
778
+ self._expression(node.default_value)
779
+
768
780
  # endregion
769
781
 
770
782
  def visit_Module(self, node):
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: python_minifier
3
- Version: 2.10.0
3
+ Version: 2.11.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
@@ -8,6 +8,7 @@ Author-email: daniel@flook.org
8
8
  License: MIT
9
9
  Project-URL: Issues, https://github.com/dflook/python-minifier/issues
10
10
  Project-URL: Documentation, https://dflook.github.io/python-minifier/
11
+ Project-URL: Changelog, https://github.com/dflook/python-minifier/blob/main/CHANGELOG.md
11
12
  Keywords: minify minifier
12
13
  Classifier: Development Status :: 5 - Production/Stable
13
14
  Classifier: License :: OSI Approved :: MIT License
@@ -23,13 +24,14 @@ Classifier: Programming Language :: Python :: 3.9
23
24
  Classifier: Programming Language :: Python :: 3.10
24
25
  Classifier: Programming Language :: Python :: 3.11
25
26
  Classifier: Programming Language :: Python :: 3.12
27
+ Classifier: Programming Language :: Python :: 3.13
26
28
  Classifier: Programming Language :: Python :: 2
27
29
  Classifier: Programming Language :: Python :: 2.7
28
30
  Classifier: Programming Language :: Python :: Implementation :: CPython
29
31
  Classifier: Programming Language :: Python :: Implementation :: PyPy
30
32
  Classifier: Intended Audience :: Developers
31
33
  Classifier: Topic :: Software Development
32
- Requires-Python: >=2.7, !=3.0.*, !=3.1.*, !=3.2.*, <3.13
34
+ Requires-Python: >=2.7, !=3.0.*, !=3.1.*, !=3.2.*, <3.14
33
35
  Description-Content-Type: text/markdown
34
36
  License-File: LICENSE
35
37
 
@@ -39,7 +41,7 @@ Transforms Python source code into its most compact representation.
39
41
 
40
42
  [Try it out!](https://python-minifier.com)
41
43
 
42
- python-minifier currently supports Python 2.7 and Python 3.3 to 3.12. Previous releases supported Python 2.6.
44
+ python-minifier currently supports Python 2.7 and Python 3.3 to 3.13. Previous releases supported Python 2.6.
43
45
 
44
46
  * [PyPI](https://pypi.org/project/python-minifier/)
45
47
  * [Documentation](https://dflook.github.io/python-minifier/)
@@ -139,10 +141,13 @@ To install python-minifier use pip:
139
141
  $ pip install python-minifier
140
142
  ```
141
143
 
142
- Note that python-minifier depends on the python interpreter for parsing source code,
143
- so install using a version of python appropriate for your source.
144
+ Note that python-minifier depends on the python interpreter for parsing source code,
145
+ and outputs source code compatible with the version of the interpreter it is run with.
144
146
 
145
- python-minifier runs with and can minify code written for Python 2.7 and Python 3.3 to 3.12.
147
+ This means that if you minify code written for Python 3.11 using python-minifier running with Python 3.12,
148
+ the minified code may only run with Python 3.12.
149
+
150
+ python-minifier runs with and can minify code written for Python 2.7 and Python 3.3 to 3.13.
146
151
 
147
152
  ## Usage
148
153
 
@@ -167,4 +172,4 @@ Documentation is available at [dflook.github.io/python-minifier/](https://dflook
167
172
 
168
173
  Available under the MIT License. Full text is in the [LICENSE](LICENSE) file.
169
174
 
170
- Copyright (c) 2020 Daniel Flook
175
+ Copyright (c) 2024 Daniel Flook
@@ -6,8 +6,8 @@ python_minifier/ast_compat.py,sha256=ZOcHXNiIh9NFjFbLMndiewuT664ZtB_w0_AtlUV710Q
6
6
  python_minifier/ast_printer.py,sha256=Nsh-8FM6-tsuLMfQBr9s32idQGnk8WZomJkJT_zLuAE,3222
7
7
  python_minifier/expression_printer.py,sha256=7r0Z0WDgYAaLwHg0STMNp70zSt4aVa45MJUGmTxxkqY,22423
8
8
  python_minifier/f_string.py,sha256=30cSPIzqQ7_oUX4UPWJWuXjWfPWWni9RWI85Qt_HisY,14036
9
- python_minifier/ministring.py,sha256=qQzkPNiMS0R4Jc0xaph2b-N__xLnzAXWHN2GSzg-4kU,4227
10
- python_minifier/module_printer.py,sha256=8gxP61To-bjGYXvJ77WYp2zwMuNwnlL6pnsKuyZ2eVI,24838
9
+ python_minifier/ministring.py,sha256=1J_nVWakRpW98yT706xe57mP0Rf45N1ivjAk7-AnOTA,4378
10
+ python_minifier/module_printer.py,sha256=IXkvwC-EtPxNmzArGACqJhYF0sVX-rpHOxwSsoqFbYU,25342
11
11
  python_minifier/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
12
12
  python_minifier/token_printer.py,sha256=PKstW8JBpmk_C7S3t-SCx3nO-HStE1Ac3RxYl4XX_2g,9337
13
13
  python_minifier/util.py,sha256=hmMW4z8rTyO90b5cASxOVZyNGx_ohFWI5Pr4vAeodpo,1535
@@ -35,10 +35,10 @@ python_minifier/transforms/remove_object_base.py,sha256=MvI1XwwB9zcwdClhyTeoD6Wo
35
35
  python_minifier/transforms/remove_pass.py,sha256=A2c4psmYxQ6cYnk6u2KISZW6XhpDEaY-1zFx9Gy6RqI,781
36
36
  python_minifier/transforms/remove_posargs.py,sha256=ecLdKGr0kKx6uf7OXiB_SgF57xWRiDq6ixn5OBSVi7Y,330
37
37
  python_minifier/transforms/suite_transformer.py,sha256=zzQKf8QIVCHJ0IGF8i0yBi7kbyazaDQxrnu6eB4v6bg,6246
38
- python_minifier-2.10.0.dist-info/LICENSE,sha256=FzsyDHb8pAZupSGFjIOuHcHMlFf6N-aIxq9gOYGbNyE,1069
39
- python_minifier-2.10.0.dist-info/METADATA,sha256=7UNblJ7uEaz8KajUzqkVXwl19y5ULp7L8y5PulwxkMc,6138
40
- python_minifier-2.10.0.dist-info/WHEEL,sha256=5Mi1sN9lKoFv_gxcPtisEVrJZihrm_beibeg5R6xb4I,91
41
- python_minifier-2.10.0.dist-info/entry_points.txt,sha256=ew5TjfSuFJMd5wefRaK3zeoPc_MNQ_o4XN2JiJC5v8Q,59
42
- python_minifier-2.10.0.dist-info/top_level.txt,sha256=4SRDfWKi_KMq7LDrjlzUFoDCs6INYPtxc1Pun4z8LsU,16
43
- python_minifier-2.10.0.dist-info/zip-safe,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1
44
- python_minifier-2.10.0.dist-info/RECORD,,
38
+ python_minifier-2.11.0.dist-info/LICENSE,sha256=FzsyDHb8pAZupSGFjIOuHcHMlFf6N-aIxq9gOYGbNyE,1069
39
+ python_minifier-2.11.0.dist-info/METADATA,sha256=2XhuwZVdMgra5uJscQUFLRv2Xan1DzsMl75uJZwrCVo,6455
40
+ python_minifier-2.11.0.dist-info/WHEEL,sha256=GV9aMThwP_4oNCtvEC2ec3qUYutgWeAzklro_0m4WJQ,91
41
+ python_minifier-2.11.0.dist-info/entry_points.txt,sha256=ew5TjfSuFJMd5wefRaK3zeoPc_MNQ_o4XN2JiJC5v8Q,59
42
+ python_minifier-2.11.0.dist-info/top_level.txt,sha256=4SRDfWKi_KMq7LDrjlzUFoDCs6INYPtxc1Pun4z8LsU,16
43
+ python_minifier-2.11.0.dist-info/zip-safe,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1
44
+ python_minifier-2.11.0.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (75.0.0)
2
+ Generator: setuptools (75.1.0)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5