python-minifier
python-minifier copied to clipboard
Transform Python source code into its most compact representation
The code ``` class Test: def my_method(self, argument): return argument + argument ``` gets transformed into ``` class E: def my_method(B,argument):A=argument;return A+A ``` In other words, it seems method names...
Hello! I have a dictionary that looks like this: `translit_map = { u"\u0027": "", u"\u00C0": "A", u"\u00C1": "A", u"\u00C2": "A", u"\u00C3": "A", u"\u00C4": ["A", "AE"], u"\u00C5": ["A", "AA"], u"\u00C6": "AE",...
When I'm trying to minify the code below: ```python {(A:=1,B:=2)} ``` The minifier adds parentheses around the assignment expression, resulting in an increase of 2 bytes per assignment expressions: ```python...
For names in a class namespace, that are used in a load context, place their NameBinding in non-local scope.
**What:** I use a few emojis in my code, green check, red cross...etc. '\u274c' is literally the Unicode for ❌ **Error:** ``` Traceback (most recent call last): File "", line...
Files containing utf-8 would not minify with the error: UnicodeEncodeError: 'charmap' codec can't encode character '\u...' in position ...: character maps to This commit adds `encoding=utf8` to `open()`
If you have multiple files with and `import` statements then `--rename-globals` cannot be used. For the files **program.py** ``` from library1 import NUMBER import library2 instance = library2.SomethingClass() print(NUMBER) ```...
`print("\xd0\x9f\xd1\x80\xd0\xbe\xd1\x84\xd0\xb5\xd1\x81\xd1\x81\xd0\xb8\xd0\xbe\xd0\xbd\xd0\xb0\xd0\xbb\xd1\x8c\xd0\xbd\xd0\xb0\xd1\x8f")` Which decoded to utf-8 gives Профессиональная (Professional) When ran using the minifier it returns `print('Ð\x9fÑ\x80оÑ\x84еÑ\x81Ñ\x81ионалÑ\x8cнаÑ\x8f')`
Hi, there. Thanx for a great app. I'm trying to minify a simple peace of code that contains Latin characters and non-Latin characters (Cyrylic) in a string. All non-Latin characters...