You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Don't issue no-redef with conditional imports #13914
@hauntsaninja I may be missing something, but the code example I posted in #13914 (comment) still issues the same mypy error:
C:\Code\project>mypy --version
mypy 1.0.0+dev.a4da89e0543ee0d213b30216c9e15a5d00fcd578 (compiled: no)
C:\Code\project>mypy --no-incremental project\project.py
project\project.py:6: error: Name "overrides" already defined (possibly by an import) [no-redef]
Found 1 error in 1 file (checked 1 source file)
Activity
bersbersbers commentedon Oct 17, 2022
bersbersbers commentedon Oct 17, 2022
A workaround can be found in mkorpela/overrides#109 (comment).
Better story for import redefinitions (#13969)
bersbersbers commentedon Nov 3, 2022
@hauntsaninja I may be missing something, but the code example I posted in #13914 (comment) still issues the same
mypyerror:Using
overrides==7.3.1bersbersbers commentedon Feb 7, 2023
Just for the record (because I had been hoping it might have been fixed), this is still an issue on 1.0.0.
bersbersbers commentedon Feb 12, 2023
Some more details:
The workaround works , but stops working when removing
overrides:This is a problem if one uses a construct such as this to import
typing.override(from Python 3.12 on):For the record, this works:
Workaround mypy false no-redef message