Skip to content

Commit 2a32ee2

Browse files
committed
Merge remote-tracking branch 'upstream/main' into fix_concat_with_none
2 parents eb3edaa + 23b35e4 commit 2a32ee2

Some content is hidden

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

60 files changed

+1596
-1416
lines changed

.pre-commit-config.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,15 @@ ci:
33
autofix_prs: false
44
repos:
55
- repo: https://github.com/python/black
6-
rev: 23.12.1
6+
rev: 24.1.1
77
hooks:
88
- id: black
99
- repo: https://github.com/PyCQA/isort
1010
rev: 5.13.2
1111
hooks:
1212
- id: isort
1313
- repo: https://github.com/astral-sh/ruff-pre-commit
14-
rev: v0.1.9
14+
rev: v0.2.1
1515
hooks:
1616
- id: ruff
1717
args: [

pandas-stubs/_libs/lib.pyi

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ from typing import (
55
)
66

77
import numpy as np
8-
from pandas import Interval
98
from typing_extensions import (
109
TypeAlias,
1110
TypeGuard,
@@ -21,7 +20,6 @@ def infer_dtype(value: object, skipna: bool = ...) -> str: ...
2120
def is_iterator(obj: object) -> bool: ...
2221
def is_scalar(val: object) -> bool: ...
2322
def is_list_like(obj: object, allow_sets: bool = ...) -> bool: ...
24-
def is_interval(val: object) -> TypeGuard[Interval]: ...
2523
def is_complex(val: object) -> TypeGuard[complex]: ...
2624
def is_bool(val: object) -> TypeGuard[bool | np.bool_]: ...
2725
def is_integer(val: object) -> TypeGuard[int | np.integer]: ...

pandas-stubs/_libs/tslibs/nattype.pyi

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,13 @@ from datetime import (
55
)
66

77
import numpy as np
8-
from typing_extensions import TypeAlias
8+
from typing_extensions import (
9+
Self,
10+
TypeAlias,
11+
)
912

1013
from pandas._libs.tslibs.period import Period
14+
from pandas._typing import TimeUnit
1115

1216
NaT: NaTType
1317
iNaT: int
@@ -121,3 +125,6 @@ class NaTType:
121125
__le__: _NatComparison
122126
__gt__: _NatComparison
123127
__ge__: _NatComparison
128+
@property
129+
def unit(self) -> TimeUnit: ...
130+
def as_unit(self, unit: TimeUnit, round_ok: bool = ...) -> Self: ...

pandas-stubs/_libs/tslibs/period.pyi

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -60,12 +60,9 @@ class PeriodMixin:
6060
class Period(PeriodMixin):
6161
def __init__(
6262
self,
63-
value: Period
64-
| str
65-
| datetime.datetime
66-
| datetime.date
67-
| Timestamp
68-
| None = ...,
63+
value: (
64+
Period | str | datetime.datetime | datetime.date | Timestamp | None
65+
) = ...,
6966
freq: str | BaseOffset | None = ...,
7067
ordinal: int | None = ...,
7168
year: int | None = ...,

pandas-stubs/_libs/tslibs/timedeltas.pyi

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,10 @@ from pandas._libs.tslibs import (
3131
)
3232
from pandas._libs.tslibs.period import Period
3333
from pandas._libs.tslibs.timestamps import Timestamp
34-
from pandas._typing import npt
34+
from pandas._typing import (
35+
TimeUnit,
36+
npt,
37+
)
3538

3639
class Components(NamedTuple):
3740
days: int
@@ -390,3 +393,6 @@ class Timedelta(timedelta):
390393
@property
391394
def components(self) -> Components: ...
392395
def view(self, dtype: npt.DTypeLike = ...) -> object: ...
396+
@property
397+
def unit(self) -> TimeUnit: ...
398+
def as_unit(self, unit: TimeUnit, round_ok: bool = ...) -> Self: ...

pandas-stubs/_libs/tslibs/timestamps.pyi

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ from pandas._libs.tslibs import (
3838
Timedelta,
3939
)
4040
from pandas._typing import (
41+
TimeUnit,
4142
np_ndarray_bool,
4243
npt,
4344
)
@@ -310,3 +311,6 @@ class Timestamp(datetime):
310311
def days_in_month(self) -> int: ...
311312
@property
312313
def daysinmonth(self) -> int: ...
314+
@property
315+
def unit(self) -> TimeUnit: ...
316+
def as_unit(self, unit: TimeUnit, round_ok: bool = ...) -> Self: ...

pandas-stubs/_typing.pyi

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -581,7 +581,7 @@ SequenceIndexer: TypeAlias = slice | list[int] | np.ndarray
581581
PositionalIndexer: TypeAlias = ScalarIndexer | SequenceIndexer
582582
TakeIndexer: TypeAlias = Sequence[int] | Sequence[np.integer] | npt.NDArray[np.integer]
583583

584-
IgnoreRaiseCoerce: TypeAlias = Literal["ignore", "raise", "coerce"]
584+
RaiseCoerce: TypeAlias = Literal["raise", "coerce"]
585585

586586
# Shared by functions such as drop and astype
587587
IgnoreRaise: TypeAlias = Literal["ignore", "raise"]
@@ -775,6 +775,7 @@ RandomState: TypeAlias = (
775775
| np.random.RandomState
776776
)
777777
Frequency: TypeAlias = str | BaseOffset
778+
TimeUnit: TypeAlias = Literal["s", "ms", "us", "ns"]
778779
TimeGrouperOrigin: TypeAlias = (
779780
Timestamp | Literal["epoch", "start", "start_day", "end", "end_day"]
780781
)

pandas-stubs/api/types/__init__.pyi

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ from pandas.core.dtypes.api import (
1919
is_hashable as is_hashable,
2020
is_integer as is_integer,
2121
is_integer_dtype as is_integer_dtype,
22-
is_interval as is_interval,
2322
is_iterator as is_iterator,
2423
is_list_like as is_list_like,
2524
is_named_tuple as is_named_tuple,

pandas-stubs/core/arrays/datetimelike.pyi

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,21 @@ from pandas.core.arrays.base import (
55
ExtensionArray,
66
ExtensionOpsMixin,
77
)
8+
from typing_extensions import Self
89

910
from pandas._libs import (
1011
NaT as NaT,
1112
NaTType as NaTType,
1213
)
14+
from pandas._typing import TimeUnit
1315

1416
class DatelikeOps:
1517
def strftime(self, date_format): ...
1618

1719
class TimelikeOps:
20+
@property
21+
def unit(self) -> TimeUnit: ...
22+
def as_unit(self, unit: TimeUnit) -> Self: ...
1823
def round(self, freq, ambiguous: str = ..., nonexistent: str = ...): ...
1924
def floor(self, freq, ambiguous: str = ..., nonexistent: str = ...): ...
2025
def ceil(self, freq, ambiguous: str = ..., nonexistent: str = ...): ...

pandas-stubs/core/dtypes/api.pyi

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ from pandas.core.dtypes.common import (
1717
is_hashable as is_hashable,
1818
is_integer as is_integer,
1919
is_integer_dtype as is_integer_dtype,
20-
is_interval as is_interval,
2120
is_iterator as is_iterator,
2221
is_list_like as is_list_like,
2322
is_named_tuple as is_named_tuple,

pandas-stubs/core/dtypes/common.pyi

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ from pandas.core.dtypes.inference import (
1717
is_float as is_float,
1818
is_hashable as is_hashable,
1919
is_integer as is_integer,
20-
is_interval as is_interval,
2120
is_iterator as is_iterator,
2221
is_list_like as is_list_like,
2322
is_named_tuple as is_named_tuple,

pandas-stubs/core/dtypes/inference.pyi

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ is_integer = lib.is_integer
55
is_float = lib.is_float
66
is_complex = lib.is_complex
77
is_scalar = lib.is_scalar
8-
is_interval = lib.is_interval
98
is_list_like = lib.is_list_like
109
is_iterator = lib.is_iterator
1110

0 commit comments

Comments
 (0)