Skip to content

Commit

Permalink
fixes
Browse files Browse the repository at this point in the history
Signed-off-by: Anatoly Myachev <[email protected]>
  • Loading branch information
anmyachev committed May 12, 2024
1 parent d460258 commit 4edd7ee
Show file tree
Hide file tree
Showing 9 changed files with 16 additions and 25 deletions.
1 change: 1 addition & 0 deletions environment-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ dependencies:
- pytest-benchmark>=4.0.0
- pytest-cov>=4.0.0
- pytest-xdist>=3.2.0
- typing_extensions

# code linters
- black>=24.1.0
Expand Down
29 changes: 8 additions & 21 deletions modin/pandas/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,7 @@
import re
import warnings
from functools import cached_property
from typing import (
TYPE_CHECKING,
Any,
Callable,
Hashable,
Literal,
Optional,
Sequence,
Union,
)
from typing import TYPE_CHECKING, Any, Callable, Hashable, Literal, Optional, Sequence

import numpy as np
import pandas
Expand Down Expand Up @@ -851,9 +842,7 @@ def align(
)

@abc.abstractmethod
def _reduce_dimension(
self, query_compiler: BaseQueryCompiler
) -> Union[Series, Scalar]:
def _reduce_dimension(self, query_compiler: BaseQueryCompiler) -> Series | Scalar:
"""
Reduce the dimension of data from the `query_compiler`.
Expand All @@ -864,7 +853,7 @@ def _reduce_dimension(
Returns
-------
Union[Series, Scalar]
Series | Scalar
"""
pass

Expand Down Expand Up @@ -2019,12 +2008,10 @@ def iloc(self) -> _iLocIndexer: # noqa: RT01, D200
return _iLocIndexer(self)

@_inherit_docstrings(pandas.DataFrame.kurt, apilink="pandas.DataFrame.kurt")
def kurt(
self, axis=0, skipna=True, numeric_only=False, **kwargs
) -> Series | Scalar:
def kurt(self, axis=0, skipna=True, numeric_only=False, **kwargs) -> Series | float:
return self._stat_operation("kurt", axis, skipna, numeric_only, **kwargs)

kurtosis: Series | Scalar = kurt
kurtosis: Series | float = kurt

def last(self, offset) -> Self: # noqa: PR01, RT01, D200
"""
Expand Down Expand Up @@ -2159,7 +2146,7 @@ def min(
def _stat_operation(
self,
op_name: str,
axis: Union[int, str],
axis: int | str,
skipna: bool,
numeric_only: Optional[bool] = False,
**kwargs,
Expand Down Expand Up @@ -2279,7 +2266,7 @@ def notna(self) -> Self: # noqa: RT01, D200

notnull: Self = notna

def nunique(self, axis=0, dropna=True) -> Series | Scalar: # noqa: PR01, RT01, D200
def nunique(self, axis=0, dropna=True) -> Series | int: # noqa: PR01, RT01, D200
"""
Return number of unique elements in the `BasePandasDataset`.
"""
Expand Down Expand Up @@ -2599,7 +2586,7 @@ def resample(
kind: Optional[str] = lib.no_default,
on: Level = None,
level: Level = None,
origin: Union[str, TimestampConvertibleTypes] = "start_day",
origin: str | TimestampConvertibleTypes = "start_day",
offset: Optional[TimedeltaConvertibleTypes] = None,
group_keys=False,
) -> Resampler: # noqa: PR01, RT01, D200
Expand Down
4 changes: 1 addition & 3 deletions modin/pandas/dataframe.py
Original file line number Diff line number Diff line change
Expand Up @@ -3157,9 +3157,7 @@ def _validate_eval_query(self, expr, **kwargs) -> None:
"'Not' nodes are not implemented."
) # pragma: no cover

def _reduce_dimension(
self, query_compiler: BaseQueryCompiler
) -> Union[Series, Scalar]:
def _reduce_dimension(self, query_compiler: BaseQueryCompiler) -> Series:
"""
Reduce the dimension of data from the `query_compiler`.
Expand Down
2 changes: 1 addition & 1 deletion modin/pandas/series.py
Original file line number Diff line number Diff line change
Expand Up @@ -2395,7 +2395,7 @@ def _qcut(self, q, **kwargs): # noqa: PR01, RT01, D200
"""
return self._default_to_pandas(pandas.qcut, q, **kwargs)

def _reduce_dimension(self, query_compiler) -> Union[Series, Scalar]:
def _reduce_dimension(self, query_compiler) -> Series | Scalar:
"""
Try to reduce the dimension of data from the `query_compiler`.
Expand Down
1 change: 1 addition & 0 deletions requirements-dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ pytest>=7.3.2
pytest-benchmark>=4.0.0
pytest-cov>=4.0.0
pytest-xdist>=3.2.0
typing_extensions

## code linters
black>=24.1.0
Expand Down
1 change: 1 addition & 0 deletions requirements/env_hdk.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ dependencies:
- pytest>=7.3.2
- pytest-cov>=4.0.0
- pytest-xdist>=3.2.0
- typing_extensions

# code linters
- black>=24.1.0
Expand Down
1 change: 1 addition & 0 deletions requirements/env_unidist_linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ dependencies:
- pytest>=7.3.2
- pytest-cov>=4.0.0
- pytest-xdist>=3.2.0
- typing_extensions

# code linters
- black>=24.1.0
Expand Down
1 change: 1 addition & 0 deletions requirements/env_unidist_win.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ dependencies:
- pytest>=7.3.2
- pytest-cov>=4.0.0
- pytest-xdist>=3.2.0
- typing_extensions

# code linters
- black>=24.1.0
Expand Down
1 change: 1 addition & 0 deletions requirements/requirements-no-engine.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ dependencies:
- pytest>=7.3.2
- pytest-cov>=4.0.0
- pytest-xdist>=3.2.0
- typing_extensions

# code linters
- black>=24.1.0
Expand Down

0 comments on commit 4edd7ee

Please sign in to comment.