-
Notifications
You must be signed in to change notification settings - Fork 64
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
bug: Wrong typehint fix #389
Comments
How to reproduce? (fixit) ; cat > a.py
class List:
def __init__(self, data: list):
self.data = data
(fixit) ; fixit fix a.py
🧼 1 file clean 🧼
(fixit) ; |
It must be because of Python version, I am on 3.11.4 so I don't see it: Fixit/src/fixit/rules/use_types_from_typing.py Lines 25 to 31 in 84378a8
But indeed it is a bug that it doesn't auto-import (well, that's a bit tricky to implement since you'd have to |
cool, thanks, I am using python3.9
…---Original---
From: ***@***.***>
Date: Thu, Sep 7, 2023 12:28 PM
To: ***@***.***>;
Cc: "Jia ***@***.******@***.***>;
Subject: Re: [Instagram/Fixit] bug: Wrong typehint fix (Issue #389)
It must be because of Python version, I am on 3.11.4 so I don't see it:
https://github.com/Instagram/Fixit/blob/84378a845746e2633882010061b808f67f836b3d/src/fixit/rules/use_types_from_typing.py#L25-L31
But indeed it is a bug that it doesn't auto-import (well, that's a bit tricky to implement since you'd have to import as; maybe an easier fix would be to return no autofix)
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you authored the thread.Message ID: ***@***.***>
|
Unfortunately, having rules add imports for newly referenced objects is still something that we need to improve. For this specific case, it would probably be easiest to disable this specific rule in your fixit config: disable = ["fixit.rules:UseTypesFromTyping"] See the config guide for details: https://fixit.readthedocs.io/en/stable/guide.html#configuration |
When I define a class named
List
, and use python buildinlist
as type hint, fixit will wrongly fixlist
toList
It seems that fixit is mistaking self defined List for Typing.List
fixit will fix it to
The text was updated successfully, but these errors were encountered: