Skip to content

⬆️ UPGRADE: Autoupdate pre-commit config #52345

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ repos:
types_or: [python, pyi]
additional_dependencies: [black==23.1.0]
- repo: https://github.com/charliermarsh/ruff-pre-commit
rev: v0.0.259
rev: v0.0.260
hooks:
- id: ruff
args: [--exit-non-zero-on-fix]
Expand All @@ -40,13 +40,13 @@ repos:
pass_filenames: true
require_serial: false
- repo: https://github.com/codespell-project/codespell
rev: v2.2.2
rev: v2.2.4
hooks:
- id: codespell
types_or: [python, rst, markdown, cython, c]
additional_dependencies: [tomli]
- repo: https://github.com/MarcoGorelli/cython-lint
rev: v0.12.5
rev: v0.14.0
hooks:
- id: cython-lint
- id: double-quote-cython-strings
Expand Down Expand Up @@ -79,12 +79,12 @@ repos:
'--filter=-readability/casting,-runtime/int,-build/include_subdir,-readability/fn_size'
]
- repo: https://github.com/pycqa/pylint
rev: v2.16.2
rev: v2.17.1
hooks:
- id: pylint
stages: [manual]
- repo: https://github.com/pycqa/pylint
rev: v2.16.2
rev: v2.17.1
hooks:
- id: pylint
alias: redefined-outer-name
Expand Down
9 changes: 2 additions & 7 deletions pandas/_libs/indexing.pyi
Original file line number Diff line number Diff line change
@@ -1,11 +1,6 @@
from typing import (
Generic,
TypeVar,
)
from typing import Generic

from pandas.core.indexing import IndexingMixin

_IndexingMixinT = TypeVar("_IndexingMixinT", bound=IndexingMixin)
_IndexingMixinT = ...

class NDFrameIndexerBase(Generic[_IndexingMixinT]):
name: str
Expand Down
7 changes: 3 additions & 4 deletions pandas/_libs/interval.pyi
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
from typing import (
Any,
Generic,
TypeVar,
overload,
)

Expand All @@ -16,9 +15,9 @@ from pandas._typing import (

VALID_CLOSED: frozenset[str]

_OrderableScalarT = TypeVar("_OrderableScalarT", int, float)
_OrderableTimesT = TypeVar("_OrderableTimesT", Timestamp, Timedelta)
_OrderableT = TypeVar("_OrderableT", int, float, Timestamp, Timedelta)
_OrderableScalarT = ...
_OrderableTimesT = ...
_OrderableT = ...

class _LengthDescriptor:
@overload
Expand Down
6 changes: 3 additions & 3 deletions pandas/_libs/lib.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,15 @@ from pandas._typing import (
)

# placeholder until we can specify np.ndarray[object, ndim=2]
ndarray_obj_2d = np.ndarray
ndarray_obj_2d = ...

from enum import Enum

class _NoDefault(Enum):
no_default = ...

no_default: Final = _NoDefault.no_default
NoDefault = Literal[_NoDefault.no_default]
no_default: Final = ...
NoDefault = ...

i8max: int
u8max: int
Expand Down
6 changes: 2 additions & 4 deletions pandas/_libs/ops.pyi
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
from typing import (
Any,
Callable,
Iterable,
Literal,
overload,
Expand All @@ -10,8 +8,8 @@ import numpy as np

from pandas._typing import npt

_BinOp = Callable[[Any, Any], Any]
_BoolOp = Callable[[Any, Any], bool]
_BinOp = ...
_BoolOp = ...

def scalar_compare(
values: np.ndarray, # object[:]
Expand Down
2 changes: 1 addition & 1 deletion pandas/_libs/properties.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ from pandas._typing import (
# note: this is a lie to make type checkers happy (they special
# case property). cache_readonly uses attribute names similar to
# property (fget) but it does not provide fset and fdel.
cache_readonly = property
cache_readonly = ...

class AxisProperty:
axis: int
Expand Down
10 changes: 2 additions & 8 deletions pandas/_libs/tslibs/nattype.pyi
Original file line number Diff line number Diff line change
@@ -1,18 +1,12 @@
from datetime import (
datetime,
timedelta,
tzinfo as _tzinfo,
)
from datetime import tzinfo as _tzinfo

import numpy as np

from pandas._libs.tslibs.period import Period

NaT: NaTType
iNaT: int
nat_strings: set[str]

_NaTComparisonTypes = datetime | timedelta | Period | np.datetime64 | np.timedelta64
_NaTComparisonTypes = ...
Comment on lines -15 to +9
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤔 is this from ruff? looks a bit odd, will look into it

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Might need to declare it as a TypeAlias explicitly. _NaTComparisonTypes: TypeAlias = datetime | ...

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

astral-sh/ruff#3860 will hopefully take care of at least the TypeVar cases. But we might need to add TypeAlias to non-TypeVar cases.


class _NatComparison:
def __call__(self, other: _NaTComparisonTypes) -> bool: ...
Expand Down
19 changes: 9 additions & 10 deletions pandas/_libs/tslibs/offsets.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ from typing import (
Any,
Collection,
Literal,
TypeVar,
overload,
)

Expand All @@ -20,9 +19,9 @@ from pandas._typing import (

from .timedeltas import Timedelta

_BaseOffsetT = TypeVar("_BaseOffsetT", bound=BaseOffset)
_DatetimeT = TypeVar("_DatetimeT", bound=datetime)
_TimedeltaT = TypeVar("_TimedeltaT", bound=timedelta)
_BaseOffsetT = ...
_DatetimeT = ...
_TimedeltaT = ...

_relativedelta_kwds: set[str]
prefix_mapping: dict[str, type]
Expand Down Expand Up @@ -262,12 +261,12 @@ class CustomBusinessMonthBegin(_CustomBusinessMonth): ...
class OffsetMeta(type): ...
class DateOffset(RelativeDeltaOffset, metaclass=OffsetMeta): ...

BDay = BusinessDay
BMonthEnd = BusinessMonthEnd
BMonthBegin = BusinessMonthBegin
CBMonthEnd = CustomBusinessMonthEnd
CBMonthBegin = CustomBusinessMonthBegin
CDay = CustomBusinessDay
BDay = ...
BMonthEnd = ...
BMonthBegin = ...
CBMonthEnd = ...
CBMonthBegin = ...
CDay = ...

def roll_qtrday(
other: datetime, n: int, month: int, day_opt: str, modby: int
Expand Down
48 changes: 2 additions & 46 deletions pandas/_libs/tslibs/timedeltas.pyi
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
from datetime import timedelta
from typing import (
ClassVar,
Literal,
TypeVar,
overload,
)

Expand All @@ -19,50 +17,8 @@ from pandas._typing import (

# This should be kept consistent with the keys in the dict timedelta_abbrevs
# in pandas/_libs/tslibs/timedeltas.pyx
UnitChoices = Literal[
"Y",
"y",
"M",
"W",
"w",
"D",
"d",
"days",
"day",
"hours",
"hour",
"hr",
"h",
"m",
"minute",
"min",
"minutes",
"t",
"s",
"seconds",
"sec",
"second",
"ms",
"milliseconds",
"millisecond",
"milli",
"millis",
"l",
"us",
"microseconds",
"microsecond",
"µs",
"micro",
"micros",
"u",
"ns",
"nanoseconds",
"nano",
"nanos",
"nanosecond",
"n",
]
_S = TypeVar("_S", bound=timedelta)
UnitChoices = ...
_S = ...

def ints_to_pytimedelta(
arr: npt.NDArray[np.timedelta64],
Expand Down
3 changes: 1 addition & 2 deletions pandas/_libs/tslibs/timestamps.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ from datetime import (
from time import struct_time
from typing import (
ClassVar,
TypeVar,
overload,
)

Expand All @@ -23,7 +22,7 @@ from pandas._libs.tslibs import (
)
from pandas._typing import Self

_DatetimeT = TypeVar("_DatetimeT", bound=datetime)
_DatetimeT = ...

def integer_op_not_supported(obj: object) -> TypeError: ...

Expand Down
4 changes: 2 additions & 2 deletions typings/numba.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -39,5 +39,5 @@ def jit(
parallel: bool = ...,
) -> Callable[[F], F]: ...

njit = jit
generated_jit = jit
njit = ...
generated_jit = ...