Skip to content

Commit 7b4878f

Browse files
authored
Merge pull request #82 from narwhals-dev/public
use fewer private imports
2 parents c346c2d + 3cbe661 commit 7b4878f

File tree

7 files changed

+14
-13
lines changed

7 files changed

+14
-13
lines changed

narwhals_daft/dataframe.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@
3232
from pathlib import Path
3333
from types import ModuleType
3434

35-
from narwhals._compliant.typing import CompliantDataFrameAny
3635
from narwhals._utils import _LimitedContext
36+
from narwhals.compliant import CompliantDataFrame
3737
from narwhals.dataframe import LazyFrame
3838
from narwhals.dtypes import DType
3939
from narwhals.typing import JoinStrategy
@@ -124,7 +124,7 @@ def columns(self) -> list[str]:
124124

125125
def collect(
126126
self, backend: ModuleType | Implementation | str | None, **kwargs: Any
127-
) -> CompliantDataFrameAny:
127+
) -> CompliantDataFrame[Any, Any, Any, Any]:
128128
if backend is None or backend is Implementation.PYARROW:
129129
from narwhals._arrow.dataframe import ArrowDataFrame
130130

narwhals_daft/expr.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,12 @@
55

66
import daft.functions as F
77
from daft import Window, col, lit
8-
from narwhals._compliant import CompliantExpr
98
from narwhals._expression_parsing import (
109
combine_alias_output_names,
1110
combine_evaluate_output_names,
1211
)
1312
from narwhals._utils import Implementation, not_implemented
13+
from narwhals.compliant import CompliantExpr
1414

1515
from narwhals_daft.expr_dt import ExprDateTimeNamesSpace
1616
from narwhals_daft.expr_name import ExprNameNamespace
@@ -21,7 +21,6 @@
2121
from collections.abc import Callable, Sequence
2222

2323
from daft import Expression
24-
from narwhals._compliant.typing import AliasNames, EvalNames, EvalSeries
2524
from narwhals._utils import Version, _LimitedContext
2625
from narwhals.dtypes import DType
2726
from narwhals.typing import RankMethod
@@ -33,6 +32,8 @@
3332
WindowFunction: TypeAlias = Callable[
3433
[DaftLazyFrame, "WindowInputs"], Sequence[Expression]
3534
]
35+
AliasNames: TypeAlias = Callable[[Sequence[str]], Sequence[str]]
36+
EvalNames: TypeAlias = Callable[[DaftLazyFrame], Sequence[str]]
3637

3738

3839
class WindowInputs:
@@ -53,7 +54,7 @@ def __init__(
5354
call: Callable[[DaftLazyFrame], Sequence[Expression]],
5455
window_function: WindowFunction | None = None,
5556
*,
56-
evaluate_output_names: EvalNames[DaftLazyFrame],
57+
evaluate_output_names: EvalNames,
5758
alias_output_names: AliasNames | None,
5859
version: Version,
5960
) -> None:
@@ -226,7 +227,7 @@ def fn(names: Sequence[str]) -> Sequence[str]:
226227
@classmethod
227228
def from_column_names(
228229
cls: type[DaftExpr],
229-
evaluate_column_names: EvalNames[DaftLazyFrame],
230+
evaluate_column_names: EvalNames,
230231
/,
231232
*,
232233
context: _LimitedContext,
@@ -280,7 +281,7 @@ def window_function(
280281

281282
def _callable_to_eval_series(
282283
self, call: Callable[..., Expression], /, **expressifiable_args: DaftExpr
283-
) -> EvalSeries[DaftLazyFrame, Expression]:
284+
) -> Callable[[DaftLazyFrame], Sequence[Expression]]:
284285
def func(df: DaftLazyFrame) -> list[Expression]:
285286
native_series_list = self(df)
286287
other_native_series = {

narwhals_daft/expr_dt.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
from typing import TYPE_CHECKING
44

55
import daft.functions as F
6-
from narwhals._compliant.any_namespace import DateTimeNamespace
76
from narwhals._utils import not_implemented
7+
from narwhals.compliant import DateTimeNamespace
88

99
if TYPE_CHECKING:
1010
from narwhals_daft.expr import DaftExpr

narwhals_daft/expr_name.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
from narwhals._compliant.expr import CompliantExprNameNamespace
66

77
if TYPE_CHECKING:
8-
from narwhals._compliant.typing import AliasName
8+
from collections.abc import Callable
99

1010
from narwhals_daft.expr import DaftExpr
1111

@@ -14,7 +14,7 @@ class ExprNameNamespace(CompliantExprNameNamespace["DaftExpr"]):
1414
def __init__(self, expr: DaftExpr, /) -> None:
1515
self._compliant_expr = expr
1616

17-
def _from_callable(self, func: AliasName | None) -> DaftExpr:
17+
def _from_callable(self, func: Callable[[str], str] | None) -> DaftExpr:
1818
expr = self.compliant
1919
output_names = self._alias_output_names(func) if func else None
2020
return expr._with_alias_output_names(output_names)

narwhals_daft/expr_str.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
import daft.functions as F
66
from daft import lit
77
from daft.expressions import col
8-
from narwhals._compliant.any_namespace import StringNamespace
98
from narwhals._utils import not_implemented
9+
from narwhals.compliant import StringNamespace
1010

1111
if TYPE_CHECKING:
1212
from daft import Expression

narwhals_daft/group_by.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
from itertools import chain
44
from typing import TYPE_CHECKING
55

6-
from narwhals._compliant.group_by import CompliantGroupBy
76
from narwhals._utils import is_sequence_of
7+
from narwhals.compliant import CompliantGroupBy
88

99
if TYPE_CHECKING:
1010
from collections.abc import Iterable, Iterator, Sequence

narwhals_daft/namespace.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77

88
import daft
99
import daft.functions as F
10-
from narwhals._compliant.namespace import CompliantNamespace
1110
from narwhals._utils import Implementation, not_implemented
11+
from narwhals.compliant import CompliantNamespace
1212

1313
from narwhals_daft.dataframe import DaftLazyFrame
1414
from narwhals_daft.expr import DaftExpr

0 commit comments

Comments
 (0)