Skip to content

Commit 8b6f8ff

Browse files
committed
Merge remote-tracking branch 'upstream/main' into oh-nodes
2 parents dcb65a2 + b5f72dd commit 8b6f8ff

File tree

303 files changed

+2195
-2680
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

303 files changed

+2195
-2680
lines changed

.pre-commit-config.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ repos:
1111
- id: ruff
1212
args: [--fix]
1313
- id: ruff
14+
name: check-docstrings
1415
alias: check-docstrings
1516
entry: python utils/check_docstrings.py
1617
- repo: https://github.com/codespell-project/codespell

narwhals/__init__.py

Lines changed: 81 additions & 77 deletions
Original file line numberDiff line numberDiff line change
@@ -2,86 +2,90 @@
22

33
import typing as _t
44

5-
from narwhals import dependencies
6-
from narwhals import dtypes
7-
from narwhals import exceptions
8-
from narwhals import selectors
9-
from narwhals.dataframe import DataFrame
10-
from narwhals.dataframe import LazyFrame
11-
from narwhals.dtypes import Array
12-
from narwhals.dtypes import Binary
13-
from narwhals.dtypes import Boolean
14-
from narwhals.dtypes import Categorical
15-
from narwhals.dtypes import Date
16-
from narwhals.dtypes import Datetime
17-
from narwhals.dtypes import Decimal
18-
from narwhals.dtypes import Duration
19-
from narwhals.dtypes import Enum
20-
from narwhals.dtypes import Field
21-
from narwhals.dtypes import Float32
22-
from narwhals.dtypes import Float64
23-
from narwhals.dtypes import Int8
24-
from narwhals.dtypes import Int16
25-
from narwhals.dtypes import Int32
26-
from narwhals.dtypes import Int64
27-
from narwhals.dtypes import Int128
28-
from narwhals.dtypes import List
29-
from narwhals.dtypes import Object
30-
from narwhals.dtypes import String
31-
from narwhals.dtypes import Struct
32-
from narwhals.dtypes import Time
33-
from narwhals.dtypes import UInt8
34-
from narwhals.dtypes import UInt16
35-
from narwhals.dtypes import UInt32
36-
from narwhals.dtypes import UInt64
37-
from narwhals.dtypes import UInt128
38-
from narwhals.dtypes import Unknown
5+
from narwhals import dependencies, dtypes, exceptions, selectors
6+
from narwhals.dataframe import DataFrame, LazyFrame
7+
from narwhals.dtypes import (
8+
Array,
9+
Binary,
10+
Boolean,
11+
Categorical,
12+
Date,
13+
Datetime,
14+
Decimal,
15+
Duration,
16+
Enum,
17+
Field,
18+
Float32,
19+
Float64,
20+
Int8,
21+
Int16,
22+
Int32,
23+
Int64,
24+
Int128,
25+
List,
26+
Object,
27+
String,
28+
Struct,
29+
Time,
30+
UInt8,
31+
UInt16,
32+
UInt32,
33+
UInt64,
34+
UInt128,
35+
Unknown,
36+
)
3937
from narwhals.expr import Expr
40-
from narwhals.functions import all_ as all
41-
from narwhals.functions import all_horizontal
42-
from narwhals.functions import any_horizontal
43-
from narwhals.functions import col
44-
from narwhals.functions import concat
45-
from narwhals.functions import concat_str
46-
from narwhals.functions import exclude
47-
from narwhals.functions import from_arrow
48-
from narwhals.functions import from_dict
49-
from narwhals.functions import from_numpy
50-
from narwhals.functions import get_level
51-
from narwhals.functions import len_ as len
52-
from narwhals.functions import lit
53-
from narwhals.functions import max
54-
from narwhals.functions import max_horizontal
55-
from narwhals.functions import mean
56-
from narwhals.functions import mean_horizontal
57-
from narwhals.functions import median
58-
from narwhals.functions import min
59-
from narwhals.functions import min_horizontal
60-
from narwhals.functions import new_series
61-
from narwhals.functions import nth
62-
from narwhals.functions import read_csv
63-
from narwhals.functions import read_parquet
64-
from narwhals.functions import scan_csv
65-
from narwhals.functions import scan_parquet
66-
from narwhals.functions import show_versions
67-
from narwhals.functions import sum
68-
from narwhals.functions import sum_horizontal
69-
from narwhals.functions import when
38+
from narwhals.functions import (
39+
all_ as all,
40+
all_horizontal,
41+
any_horizontal,
42+
col,
43+
concat,
44+
concat_str,
45+
exclude,
46+
from_arrow,
47+
from_dict,
48+
from_numpy,
49+
get_level,
50+
len_ as len,
51+
lit,
52+
max,
53+
max_horizontal,
54+
mean,
55+
mean_horizontal,
56+
median,
57+
min,
58+
min_horizontal,
59+
new_series,
60+
nth,
61+
read_csv,
62+
read_parquet,
63+
scan_csv,
64+
scan_parquet,
65+
show_versions,
66+
sum,
67+
sum_horizontal,
68+
when,
69+
)
7070
from narwhals.schema import Schema
7171
from narwhals.series import Series
72-
from narwhals.translate import from_native
73-
from narwhals.translate import get_native_namespace
74-
from narwhals.translate import narwhalify
75-
from narwhals.translate import to_native
76-
from narwhals.translate import to_py_scalar
77-
from narwhals.utils import Implementation
78-
from narwhals.utils import generate_temporary_column_name
79-
from narwhals.utils import is_ordered_categorical
80-
from narwhals.utils import maybe_align_index
81-
from narwhals.utils import maybe_convert_dtypes
82-
from narwhals.utils import maybe_get_index
83-
from narwhals.utils import maybe_reset_index
84-
from narwhals.utils import maybe_set_index
72+
from narwhals.translate import (
73+
from_native,
74+
get_native_namespace,
75+
narwhalify,
76+
to_native,
77+
to_py_scalar,
78+
)
79+
from narwhals.utils import (
80+
Implementation,
81+
generate_temporary_column_name,
82+
is_ordered_categorical,
83+
maybe_align_index,
84+
maybe_convert_dtypes,
85+
maybe_get_index,
86+
maybe_reset_index,
87+
maybe_set_index,
88+
)
8589

8690
__version__: str
8791

narwhals/_arrow/dataframe.py

Lines changed: 45 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,41 @@
11
from __future__ import annotations
22

33
from functools import partial
4-
from typing import TYPE_CHECKING
5-
from typing import Any
6-
from typing import Collection
7-
from typing import Iterator
8-
from typing import Literal
9-
from typing import Mapping
10-
from typing import Sequence
11-
from typing import cast
12-
from typing import overload
4+
from typing import (
5+
TYPE_CHECKING,
6+
Any,
7+
Collection,
8+
Iterator,
9+
Literal,
10+
Mapping,
11+
Sequence,
12+
cast,
13+
overload,
14+
)
1315

1416
import pyarrow as pa
1517
import pyarrow.compute as pc
1618

1719
from narwhals._arrow.series import ArrowSeries
18-
from narwhals._arrow.utils import align_series_full_broadcast
19-
from narwhals._arrow.utils import native_to_narwhals_dtype
20+
from narwhals._arrow.utils import align_series_full_broadcast, native_to_narwhals_dtype
2021
from narwhals._compliant import EagerDataFrame
2122
from narwhals._expression_parsing import ExprKind
2223
from narwhals.dependencies import is_numpy_array_1d
2324
from narwhals.exceptions import ShapeError
24-
from narwhals.utils import Implementation
25-
from narwhals.utils import Version
26-
from narwhals.utils import check_column_exists
27-
from narwhals.utils import check_column_names_are_unique
28-
from narwhals.utils import convert_str_slice_to_int_slice
29-
from narwhals.utils import generate_temporary_column_name
30-
from narwhals.utils import not_implemented
31-
from narwhals.utils import parse_columns_to_drop
32-
from narwhals.utils import parse_version
33-
from narwhals.utils import scale_bytes
34-
from narwhals.utils import supports_arrow_c_stream
35-
from narwhals.utils import validate_backend_version
25+
from narwhals.utils import (
26+
Implementation,
27+
Version,
28+
check_column_exists,
29+
check_column_names_are_unique,
30+
convert_str_slice_to_int_slice,
31+
generate_temporary_column_name,
32+
not_implemented,
33+
parse_columns_to_drop,
34+
parse_version,
35+
scale_bytes,
36+
supports_arrow_c_stream,
37+
validate_backend_version,
38+
)
3639

3740
if TYPE_CHECKING:
3841
from io import BytesIO
@@ -41,32 +44,32 @@
4144

4245
import pandas as pd
4346
import polars as pl
44-
from typing_extensions import Self
45-
from typing_extensions import TypeAlias
46-
from typing_extensions import TypeIs
47+
from typing_extensions import Self, TypeAlias, TypeIs
4748

4849
from narwhals._arrow.expr import ArrowExpr
4950
from narwhals._arrow.group_by import ArrowGroupBy
5051
from narwhals._arrow.namespace import ArrowNamespace
51-
from narwhals._arrow.typing import ChunkedArrayAny
52-
from narwhals._arrow.typing import Mask # type: ignore[attr-defined]
53-
from narwhals._arrow.typing import Order # type: ignore[attr-defined]
54-
from narwhals._compliant.typing import CompliantDataFrameAny
55-
from narwhals._compliant.typing import CompliantLazyFrameAny
52+
from narwhals._arrow.typing import ( # type: ignore[attr-defined]
53+
ChunkedArrayAny,
54+
Mask,
55+
Order,
56+
)
57+
from narwhals._compliant.typing import CompliantDataFrameAny, CompliantLazyFrameAny
5658
from narwhals._translate import IntoArrowTable
5759
from narwhals.dtypes import DType
5860
from narwhals.schema import Schema
59-
from narwhals.typing import JoinStrategy
60-
from narwhals.typing import SizedMultiIndexSelector
61-
from narwhals.typing import SizedMultiNameSelector
62-
from narwhals.typing import SizeUnit
63-
from narwhals.typing import UniqueKeepStrategy
64-
from narwhals.typing import _1DArray
65-
from narwhals.typing import _2DArray
66-
from narwhals.typing import _SliceIndex
67-
from narwhals.typing import _SliceName
68-
from narwhals.utils import Version
69-
from narwhals.utils import _FullContext
61+
from narwhals.typing import (
62+
JoinStrategy,
63+
SizedMultiIndexSelector,
64+
SizedMultiNameSelector,
65+
SizeUnit,
66+
UniqueKeepStrategy,
67+
_1DArray,
68+
_2DArray,
69+
_SliceIndex,
70+
_SliceName,
71+
)
72+
from narwhals.utils import Version, _FullContext
7073

7174
JoinType: TypeAlias = Literal[
7275
"left semi",

narwhals/_arrow/expr.py

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,24 @@
11
from __future__ import annotations
22

3-
from typing import TYPE_CHECKING
4-
from typing import Any
5-
from typing import Sequence
3+
from typing import TYPE_CHECKING, Any, Sequence
64

75
import pyarrow.compute as pc
86

97
from narwhals._arrow.series import ArrowSeries
108
from narwhals._compliant import EagerExpr
119
from narwhals._expression_parsing import evaluate_output_names_and_aliases
1210
from narwhals.exceptions import ColumnNotFoundError
13-
from narwhals.utils import Implementation
14-
from narwhals.utils import generate_temporary_column_name
15-
from narwhals.utils import not_implemented
11+
from narwhals.utils import Implementation, generate_temporary_column_name, not_implemented
1612

1713
if TYPE_CHECKING:
1814
from typing_extensions import Self
1915

2016
from narwhals._arrow.dataframe import ArrowDataFrame
2117
from narwhals._arrow.namespace import ArrowNamespace
22-
from narwhals._compliant.typing import AliasNames
23-
from narwhals._compliant.typing import EvalNames
24-
from narwhals._compliant.typing import EvalSeries
25-
from narwhals._compliant.typing import ScalarKwargs
18+
from narwhals._compliant.typing import AliasNames, EvalNames, EvalSeries, ScalarKwargs
2619
from narwhals._expression_parsing import ExprMetadata
2720
from narwhals.typing import RankMethod
28-
from narwhals.utils import Version
29-
from narwhals.utils import _FullContext
21+
from narwhals.utils import Version, _FullContext
3022

3123

3224
class ArrowExpr(EagerExpr["ArrowDataFrame", ArrowSeries]):

narwhals/_arrow/group_by.py

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,24 @@
11
from __future__ import annotations
22

33
import collections
4-
from typing import TYPE_CHECKING
5-
from typing import Any
6-
from typing import ClassVar
7-
from typing import Iterator
8-
from typing import Mapping
9-
from typing import Sequence
4+
from typing import TYPE_CHECKING, Any, ClassVar, Iterator, Mapping, Sequence
105

116
import pyarrow as pa
127
import pyarrow.compute as pc
138

14-
from narwhals._arrow.utils import cast_to_comparable_string_types
15-
from narwhals._arrow.utils import extract_py_scalar
9+
from narwhals._arrow.utils import cast_to_comparable_string_types, extract_py_scalar
1610
from narwhals._compliant import EagerGroupBy
1711
from narwhals._expression_parsing import evaluate_output_names_and_aliases
1812
from narwhals.utils import generate_temporary_column_name
1913

2014
if TYPE_CHECKING:
2115
from narwhals._arrow.dataframe import ArrowDataFrame
2216
from narwhals._arrow.expr import ArrowExpr
23-
from narwhals._arrow.typing import AggregateOptions # type: ignore[attr-defined]
24-
from narwhals._arrow.typing import Aggregation # type: ignore[attr-defined]
25-
from narwhals._arrow.typing import Incomplete
17+
from narwhals._arrow.typing import ( # type: ignore[attr-defined]
18+
AggregateOptions,
19+
Aggregation,
20+
Incomplete,
21+
)
2622
from narwhals._compliant.group_by import NarwhalsAggregation
2723
from narwhals.typing import UniqueKeepStrategy
2824

0 commit comments

Comments
 (0)