Skip to content

Commit 9383884

Browse files
authored
TYP: future annotations (#151)
* automatic * manual * flake8-pyi Y022 * flake8 * test * Revert "test" This reverts commit 188c4d9. * mypy 0.971 compatible * Revert "Revert "test"" This reverts commit edb4539. * type_t * str * Revert "str" This reverts commit 40739c2. * npt + _str
1 parent 5f47ff7 commit 9383884

File tree

225 files changed

+2880
-2966
lines changed

Some content is hidden

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

225 files changed

+2880
-2966
lines changed

.github/workflows/test.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ jobs:
77
runs-on: ${{ matrix.os }}
88
timeout-minutes: 10
99
strategy:
10+
fail-fast: false
1011
matrix:
1112
os: [ubuntu-latest, windows-latest, macos-latest]
1213
python-version: ['3.8', '3.9', '3.10']

.pre-commit-config.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ repos:
1616
- id: pyupgrade
1717
types_or: [python, pyi]
1818
types: [text] # overwrite types: [python]
19-
args: [--py38-plus, --keep-runtime-typing]
19+
args: [--py38-plus]
2020
- repo: https://github.com/PyCQA/flake8
2121
rev: 4.0.1
2222
hooks:
@@ -30,7 +30,7 @@ repos:
3030
- flake8-pyi==22.5.1
3131
types: [pyi]
3232
args: [
33-
--ignore=E301 E302 E305 E402 E501 E701 E704 F401 F811 W503 Y019 Y022 Y026 Y027 Y034 Y037,
33+
--ignore=E301 E302 E305 E402 E501 E701 E704 F401 F811 W503 Y019 Y026 Y027 Y034 Y037,
3434
# TypeVars in private files are already private
3535
--per-file-ignores=_*.pyi:Y001
3636
]

pandas-stubs/__init__.pyi

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
from __future__ import annotations
2+
13
import pandas.testing as testing
24

35
from . import (

pandas-stubs/_config/__init__.pyi

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
from __future__ import annotations
2+
13
from .config import (
24
describe_option as describe_option,
35
get_option as get_option,

pandas-stubs/_config/config.pyi

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
from __future__ import annotations
2+
13
from contextlib import ContextDecorator
24
from typing import (
35
Any,

pandas-stubs/_libs/__init__.pyi

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
from __future__ import annotations
2+
13
from .interval import Interval as Interval
24
from .tslibs import (
35
NaT as NaT,

pandas-stubs/_libs/indexing.pyi

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
from __future__ import annotations
2+
13
class _NDFrameIndexerBase:
24
def __init__(self, name: str, obj: object) -> None: ...
35
@property

pandas-stubs/_libs/interval.pyi

Lines changed: 9 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ from typing import (
44
Any,
55
Generic,
66
TypeVar,
7-
Union,
87
overload,
98
)
109

@@ -79,9 +78,7 @@ class Interval(IntervalMixin, Generic[_OrderableT]):
7978
@overload
8079
def __contains__(self: Interval[_OrderableTimesT], _OrderableTimesT) -> bool: ...
8180
@overload
82-
def __contains__(
83-
self: Interval[_OrderableScalarT], key: Union[int, float]
84-
) -> bool: ...
81+
def __contains__(self: Interval[_OrderableScalarT], key: int | float) -> bool: ...
8582
@overload
8683
def __add__(
8784
self: Interval[_OrderableTimesT], y: Timedelta
@@ -91,7 +88,7 @@ class Interval(IntervalMixin, Generic[_OrderableT]):
9188
self: Interval[int], y: _OrderableScalarT
9289
) -> Interval[_OrderableScalarT]: ...
9390
@overload
94-
def __add__(self: Interval[float], y: Union[int, float]) -> Interval[float]: ...
91+
def __add__(self: Interval[float], y: int | float) -> Interval[float]: ...
9592
@overload
9693
def __radd__(
9794
self: Interval[_OrderableTimesT], y: Timedelta
@@ -101,7 +98,7 @@ class Interval(IntervalMixin, Generic[_OrderableT]):
10198
self: Interval[int], y: _OrderableScalarT
10299
) -> Interval[_OrderableScalarT]: ...
103100
@overload
104-
def __radd__(self: Interval[float], y: Union[int, float]) -> Interval[float]: ...
101+
def __radd__(self: Interval[float], y: int | float) -> Interval[float]: ...
105102
@overload
106103
def __sub__(
107104
self: Interval[_OrderableTimesT], y: Timedelta
@@ -111,7 +108,7 @@ class Interval(IntervalMixin, Generic[_OrderableT]):
111108
self: Interval[int], y: _OrderableScalarT
112109
) -> Interval[_OrderableScalarT]: ...
113110
@overload
114-
def __sub__(self: Interval[float], y: Union[int, float]) -> Interval[float]: ...
111+
def __sub__(self: Interval[float], y: int | float) -> Interval[float]: ...
115112
@overload
116113
def __rsub__(
117114
self: Interval[_OrderableTimesT], y: Timedelta
@@ -121,33 +118,31 @@ class Interval(IntervalMixin, Generic[_OrderableT]):
121118
self: Interval[int], y: _OrderableScalarT
122119
) -> Interval[_OrderableScalarT]: ...
123120
@overload
124-
def __rsub__(self: Interval[float], y: Union[int, float]) -> Interval[float]: ...
121+
def __rsub__(self: Interval[float], y: int | float) -> Interval[float]: ...
125122
@overload
126123
def __mul__(
127124
self: Interval[int], y: _OrderableScalarT
128125
) -> Interval[_OrderableScalarT]: ...
129126
@overload
130-
def __mul__(self: Interval[float], y: Union[int, float]) -> Interval[float]: ...
127+
def __mul__(self: Interval[float], y: int | float) -> Interval[float]: ...
131128
@overload
132129
def __rmul__(
133130
self: Interval[int], y: _OrderableScalarT
134131
) -> Interval[_OrderableScalarT]: ...
135132
@overload
136-
def __rmul__(self: Interval[float], y: Union[int, float]) -> Interval[float]: ...
133+
def __rmul__(self: Interval[float], y: int | float) -> Interval[float]: ...
137134
@overload
138135
def __truediv__(
139136
self: Interval[int], y: _OrderableScalarT
140137
) -> Interval[_OrderableScalarT]: ...
141138
@overload
142-
def __truediv__(self: Interval[float], y: Union[int, float]) -> Interval[float]: ...
139+
def __truediv__(self: Interval[float], y: int | float) -> Interval[float]: ...
143140
@overload
144141
def __floordiv__(
145142
self: Interval[int], y: _OrderableScalarT
146143
) -> Interval[_OrderableScalarT]: ...
147144
@overload
148-
def __floordiv__(
149-
self: Interval[float], y: Union[int, float]
150-
) -> Interval[float]: ...
145+
def __floordiv__(self: Interval[float], y: int | float) -> Interval[float]: ...
151146
def overlaps(self: Interval[_OrderableT], other: Interval[_OrderableT]) -> bool: ...
152147

153148
def intervals_to_interval_bounds(

pandas-stubs/_libs/json.pyi

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
from __future__ import annotations
2+
13
def decode(*args, **kwargs): ...
24
def dumps(*args, **kwargs): ...
35
def encode(*args, **kwargs): ...

pandas-stubs/_libs/lib.pyi

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
from __future__ import annotations
2+
13
no_default = None
24

35
def infer_dtype(value: object, skipna: bool = ...) -> str: ...

0 commit comments

Comments
 (0)