Skip to content

Commit 8fbac37

Browse files
authored
refactor(typing): Use a forward ref for IntoCompliantExpr (#2088)
1 parent 033db4f commit 8fbac37

File tree

1 file changed

+4
-8
lines changed

1 file changed

+4
-8
lines changed

narwhals/typing.py

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,10 @@ class SupportsNativeNamespace(Protocol):
132132
def __native_namespace__(self) -> ModuleType: ...
133133

134134

135+
IntoCompliantExpr: TypeAlias = (
136+
"CompliantExpr[CompliantFrameT_contra, CompliantSeriesT_co] | CompliantSeriesT_co"
137+
)
138+
135139
IntoExpr: TypeAlias = Union["Expr", str, "Series[Any]"]
136140
"""Anything which can be converted to an expression.
137141
@@ -321,14 +325,6 @@ class DTypes:
321325
Unknown: type[dtypes.Unknown]
322326

323327

324-
if TYPE_CHECKING:
325-
# This one needs to be in TYPE_CHECKING to pass on 3.9,
326-
# and can only be defined after CompliantExpr has been defined
327-
IntoCompliantExpr: TypeAlias = (
328-
CompliantExpr[CompliantFrameT_contra, CompliantSeriesT_co] | CompliantSeriesT_co
329-
)
330-
331-
332328
__all__ = [
333329
"CompliantDataFrame",
334330
"CompliantLazyFrame",

0 commit comments

Comments
 (0)