-
-
Notifications
You must be signed in to change notification settings - Fork 44
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
wish: remove attribute annotations not generating code #95
Comments
Hi @wrohdewald, that's an interesting use of python-minifier! A statement like Consider this program: var = 'hello'
def func():
var: str
print(var) When What python-minifier should be doing is replacing the annotation value with '0', e.g var = 'hello'
def func():
var: 0
print(var) which should preserve the behaviour but make the annotation shorter. |
OK, I see why this cannot be safely removed - at least not without a special option. Shortening is not much of a help - the diff output I have to read does not get shorter. OTOH - what about code under Like in
expecting
typing.cast() would be another candidate. reveal_type() too - it is only recognized by mypy. |
Hi @wrohdewald, that's a good idea |
This works for me, but I do not know enough about ast to finish this. Like when somebody renames or redefines TYPE_CHECKING or cast()
|
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 but not real code. Very helpful for annotating old source code. Or would there be a better tool for this?
The text was updated successfully, but these errors were encountered: