|
1 | 1 | from __future__ import annotations |
2 | 2 |
|
3 | | -import sys |
4 | 3 | from functools import partial |
5 | 4 | from operator import methodcaller |
6 | 5 | from typing import TYPE_CHECKING |
|
30 | 29 | from narwhals._compliant.typing import EagerSeriesT |
31 | 30 | from narwhals._compliant.typing import LazyExprT |
32 | 31 | from narwhals._compliant.typing import NativeExprT |
| 32 | +from narwhals._typing_compat import Protocol38 |
| 33 | +from narwhals._typing_compat import deprecated |
33 | 34 | from narwhals.dependencies import get_numpy |
34 | 35 | from narwhals.dependencies import is_numpy_array |
35 | 36 | from narwhals.dtypes import DType |
36 | 37 | from narwhals.utils import _StoresCompliant |
37 | | -from narwhals.utils import deprecated |
38 | 38 | from narwhals.utils import not_implemented |
39 | 39 |
|
40 | | -if not TYPE_CHECKING: # pragma: no cover |
41 | | - if sys.version_info >= (3, 9): |
42 | | - from typing import Protocol as Protocol38 |
43 | | - else: |
44 | | - from typing import Generic as Protocol38 |
45 | | -else: # pragma: no cover |
46 | | - # TODO @dangotbanned: Remove after dropping `3.8` (#2084) |
47 | | - # - https://github.com/narwhals-dev/narwhals/pull/2064#discussion_r1965921386 |
48 | | - from typing import Protocol as Protocol38 |
49 | | - |
50 | 40 | if TYPE_CHECKING: |
51 | 41 | from typing import Mapping |
52 | 42 |
|
@@ -214,37 +204,19 @@ def ewm_mean( |
214 | 204 | ) -> Self: ... |
215 | 205 |
|
216 | 206 | def rolling_sum( |
217 | | - self, |
218 | | - window_size: int, |
219 | | - *, |
220 | | - min_samples: int, |
221 | | - center: bool, |
| 207 | + self, window_size: int, *, min_samples: int, center: bool |
222 | 208 | ) -> Self: ... |
223 | 209 |
|
224 | 210 | def rolling_mean( |
225 | | - self, |
226 | | - window_size: int, |
227 | | - *, |
228 | | - min_samples: int, |
229 | | - center: bool, |
| 211 | + self, window_size: int, *, min_samples: int, center: bool |
230 | 212 | ) -> Self: ... |
231 | 213 |
|
232 | 214 | def rolling_var( |
233 | | - self, |
234 | | - window_size: int, |
235 | | - *, |
236 | | - min_samples: int, |
237 | | - center: bool, |
238 | | - ddof: int, |
| 215 | + self, window_size: int, *, min_samples: int, center: bool, ddof: int |
239 | 216 | ) -> Self: ... |
240 | 217 |
|
241 | 218 | def rolling_std( |
242 | | - self, |
243 | | - window_size: int, |
244 | | - *, |
245 | | - min_samples: int, |
246 | | - center: bool, |
247 | | - ddof: int, |
| 219 | + self, window_size: int, *, min_samples: int, center: bool, ddof: int |
248 | 220 | ) -> Self: ... |
249 | 221 |
|
250 | 222 | @deprecated("Since `1.22.0`") |
@@ -831,9 +803,7 @@ def rolling_var( |
831 | 803 | ) |
832 | 804 |
|
833 | 805 | def map_batches( |
834 | | - self, |
835 | | - function: Callable[[Any], Any], |
836 | | - return_dtype: DType | type[DType] | None, |
| 806 | + self, function: Callable[[Any], Any], return_dtype: DType | type[DType] | None |
837 | 807 | ) -> Self: |
838 | 808 | def func(df: EagerDataFrameT) -> Sequence[EagerSeriesT]: |
839 | 809 | input_series_list = self(df) |
|
0 commit comments