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
$ mypy t.py t.py:3: error: Incompatible types in assignment (expression has type "str", variable has type "int")Found 1 error in 1 file (checked 1 source file)
Here's a real world example:
importpkgutilfromsomemodimport_plugins# trigger an import of all of the plugins# https://github.com/python/mypy/issues/1422plugins_path: str=_plugins.__path__# type: ignoremod_infos=pkgutil.walk_packages(plugins_path, f'{_plugins.__name__}.')
for_, name, _inmod_infos:
__import__(name, fromlist=['_trash'])
pyupgrade/_data.py:101: error: Incompatible types in assignment (expression has type "bool", variable has type "Union[MetaPathFinder, PathEntryFinder]")
Pitch
The discarded _ variable here is immediately clobbered before it could possibly be read, I'd like this to pass without error
(I couldn't find this searching, though I suspect there's a duplicate -- sorry in advance).
The text was updated successfully, but these errors were encountered:
We already support some forms of this, so seems reasonable to get it to work here as well (#465). As a workaround, you can put _: Any on the line before
Feature
Here is a silly example:
The current output (mypy 0.800)
Here's a real world example:
Pitch
The discarded
_
variable here is immediately clobbered before it could possibly be read, I'd like this to pass without error(I couldn't find this searching, though I suspect there's a duplicate -- sorry in advance).
The text was updated successfully, but these errors were encountered: