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
This is a common pattern when annotating using types that cannot be imported:
from __future__ import annotations
from typing import TYPE_CHECKING
class X:
def f(self, s: Signal):
# This import makes the definition work.
from .signal import Signal
t = Signal("blah")
if TYPE_CHECKING:
# This import makes the annotations work.
from .signal import Signal
Unfortunately, this gives
Redefining name 'Signal' from outer scope (line 10) (redefined-outer-name)
The import may not be possible to do at the top of the file because of circular imports. Perhaps two imports that are from the same place should not produce this error.
The text was updated successfully, but these errors were encountered:
This is a common pattern when annotating using types that cannot be imported:
Unfortunately, this gives
The import may not be possible to do at the top of the file because of circular imports. Perhaps two imports that are from the same place should not produce this error.
The text was updated successfully, but these errors were encountered: