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
fromcollections.abcimport ( # Y057 flagged on this line for the forbidden ByteString importAsyncIterator,
Awaitable,
ByteString,
Collection,
Container,
MutableMapping,
MutableSequence,
)
It would be nice if we could have this behaviour instead, where import-related errors were flagged on the line where the import actually occurs when it's part of a multiline import statement:
fromcollections.abcimport (
AsyncIterator,
Awaitable,
ByteString, # Y057 flagged on this line for the forbidden ByteString importCollection,
Container,
MutableMapping,
MutableSequence,
)
As discussed in #411, however, this is pretty hard to do on Python <3.10 due to the fact that ast.alias nodes only have lineno and col_offset attributes on 3.10+. And while we still support Python <3.10, it's good to consistently flag errors on the same line regardless of the Python version being used. So this can't be addressed for now.
Once we drop support for Python 3.9, however, we should change our behaviour to use the more precise line numbers from the ast.alias nodes.
The text was updated successfully, but these errors were encountered:
Currently we have this behaviour:
It would be nice if we could have this behaviour instead, where import-related errors were flagged on the line where the import actually occurs when it's part of a multiline import statement:
As discussed in #411, however, this is pretty hard to do on Python <3.10 due to the fact that
ast.alias
nodes only havelineno
andcol_offset
attributes on 3.10+. And while we still support Python <3.10, it's good to consistently flag errors on the same line regardless of the Python version being used. So this can't be addressed for now.Once we drop support for Python 3.9, however, we should change our behaviour to use the more precise line numbers from the
ast.alias
nodes.The text was updated successfully, but these errors were encountered: