python-minifier
python-minifier copied to clipboard
Transform Python source code into its most compact representation
``` def ruleset(self, value:str) ->None: if True: def write() ->str: return 'update' ``` returns ``` def ruleset(self,value): if True: def A()->str:return'update' ``` expected ``` def ruleset(self,value): if True: def A():return'update'...
`var: str` is a legal annotation but it creates no executable code. Would be nice to remove these. I am using python-minifier for asserting that a commit only changes annotations...
The code ``` def my_func(arg1, arg2=0): pass my_func(12, arg2=13) ``` gets converted into ``` def C(arg1,arg2=0):0 C(12,arg2=13) ``` It seems `arg2` could have been replaced with something shorter? I have...
Last few days i have UnicodeEncodeError. Never had this before until now. There is no matter which code i have in py files. I also tried files which has successfully...
python-minifier does a few checks to ensure that it's safe to minify variables. I've gathered a short list of things which should probably be checked for, along with the checks...
A possible improvement would be const-folding expressions that would be shorter as a constant value. Example: ```py SOME_VARIABLE = (((123 * 456) + 789) // 10) & 0xabcdef ``` can...
There is no semantic difference between `raise X()` and `raise X`, so for the few instances where you are raising an exception with no arguments you can save 2 bytes....