Closed nchj closed 10 months ago
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) ;
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:
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)
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:
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