dflook/python-minifier

pyminify strips typing from NamedTuple replacing them with 0s?

NoahCardoza opened this issue · 3 comments

Example:
class MyTuple(NamedTuple):url:0;domain:0;sitekey:0;kind:0;action:0

Should be:
class MyTuple(NamedTuple):url:str;domain:str;sitekey:str;kind:CaptchaKindEnum;action:str

Is there any way to keep this from happening?

Never mind! I must have skipped over --no-remove-annotations.

Thanks!

On second thought, could some type of "--smart-no-remove-annotations" be possible? Where it removed typing from function declarations but detected things like NamedTuples that need typing?

After some messing around with the source I was able to achieve what I mentioned above. I also noticed you had already set it up to not strip typing on dataclasses, so I added the logic in that section.

Hopefully I submit a PR soon.