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
fromlibimportLibError# OK, explicitly re-exportedfromlib.exceptionsimportLibError# OK, that's where it's definedfromlib.clientimportLibError# WARN: lib.exceptions.LibError is re-exported via lib.clientfromlib.clientimportClient# OK
The reason to warn is that lib.client can change, for example to raise exception.MoreSpecificError instead, which would not be a breaking change is MoreSpecificError inherits from LibError.
However, in that case, LibError may no longer be re-exported via lib.client.
Thus user code that depends on LibError name being present on lib.client is mistaken.
Ideas how this could be implemented:
get the __qualname__ for the imported name
check if the import path is different from qualname
check if the imported name is also available at lib top level or
check if the imported name is available at some intermediate level between lib and qualname
suggest a more direct import
The text was updated successfully, but these errors were encountered:
Consider a library like this:
Then the user code imports these names:
The reason to warn is that lib.client can change, for example to
raise exception.MoreSpecificError
instead, which would not be a breaking change is MoreSpecificError inherits from LibError.However, in that case, LibError may no longer be re-exported via lib.client.
Thus user code that depends on LibError name being present on lib.client is mistaken.
Ideas how this could be implemented:
__qualname__
for the imported nameThe text was updated successfully, but these errors were encountered: