Skip to content

Commit 9e9f840

Browse files
authored
flake8-pyi's Y027: use collections.abc in pyi files (#479)
1 parent 0c5b0cd commit 9e9f840

Some content is hidden

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

59 files changed

+168
-126
lines changed

.pre-commit-config.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ repos:
3030
- flake8-pyi==22.11.0
3131
types: [pyi]
3232
args: [
33-
--ignore=E301 E302 E305 E402 E501 E701 E704 F401 F811 W503 Y019 Y027 Y034 Y037 Y041 Y042,
33+
--ignore=E301 E302 E305 E402 E501 E701 E704 F401 F811 W503 Y019 Y034 Y037 Y041 Y042,
3434
# TypeVars in private files are already private
3535
--per-file-ignores=_*.pyi:Y001
3636
]

pandas-stubs/_config/config.pyi

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1+
from collections.abc import Iterable
12
from contextlib import ContextDecorator
23
from typing import (
34
Any,
4-
Iterable,
55
Literal,
66
overload,
77
)

pandas-stubs/_libs/properties.pyi

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from typing import Callable
1+
from collections.abc import Callable
22

33
class CachedProperty:
44
def __init__(self, func: Callable) -> None: ...

pandas-stubs/_libs/tslibs/offsets.pyi

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
from collections.abc import Collection
12
from datetime import (
23
date,
34
datetime,
@@ -6,7 +7,6 @@ from datetime import (
67
)
78
from typing import (
89
Any,
9-
Collection,
1010
Literal,
1111
TypeVar,
1212
overload,

pandas-stubs/_libs/tslibs/vectorized.pyi

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from typing import Sequence
1+
from collections.abc import Sequence
22

33
import numpy as np
44

pandas-stubs/_testing/__init__.pyi

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1+
from collections.abc import Generator
12
from contextlib import contextmanager
23
from typing import (
34
Any,
4-
Generator,
55
Literal,
66
overload,
77
)

pandas-stubs/_typing.pyi

+8-6
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,19 @@
11
from builtins import type as type_t
2-
import datetime
3-
from os import PathLike
4-
from typing import (
5-
Any,
2+
from collections.abc import (
63
Callable,
74
Hashable,
85
Iterator,
9-
Literal,
106
Mapping,
117
MutableSequence,
8+
Sequence,
9+
)
10+
import datetime
11+
from os import PathLike
12+
from typing import (
13+
Any,
14+
Literal,
1215
Optional,
1316
Protocol,
14-
Sequence,
1517
TypedDict,
1618
TypeVar,
1719
Union,

pandas-stubs/core/algorithms.pyi

+2-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
1-
from typing import (
2-
Sequence,
3-
overload,
4-
)
1+
from collections.abc import Sequence
2+
from typing import overload
53

64
import numpy as np
75
from pandas import (

pandas-stubs/core/arrays/base.pyi

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from typing import Sequence
1+
from collections.abc import Sequence
22

33
import numpy as np
44

pandas-stubs/core/arrays/categorical.pyi

+4-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
1+
from collections.abc import (
2+
Callable,
3+
Sequence,
4+
)
15
from typing import (
26
Any,
3-
Callable,
47
Literal,
5-
Sequence,
68
overload,
79
)
810

pandas-stubs/core/arrays/datetimelike.pyi

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from typing import Sequence
1+
from collections.abc import Sequence
22

33
import numpy as np
44
from pandas.core.arrays.base import (

pandas-stubs/core/arrays/period.pyi

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from typing import Sequence
1+
from collections.abc import Sequence
22

33
import numpy as np
44
from pandas.core.arrays.datetimelike import (

pandas-stubs/core/arrays/timedeltas.pyi

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1+
from collections.abc import Sequence
12
from datetime import timedelta
2-
from typing import Sequence
33

44
from pandas.core.arrays.datetimelike import (
55
DatetimeLikeArrayMixin,

pandas-stubs/core/common.pyi

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from typing import (
1+
from collections.abc import (
22
Collection,
33
Iterable,
44
)

pandas-stubs/core/computation/eval.pyi

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1+
from collections.abc import Mapping
12
from typing import (
23
Any,
34
Literal,
4-
Mapping,
55
)
66

77
from pandas import (

pandas-stubs/core/computation/parsing.pyi

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1+
from collections.abc import Iterator
12
import tokenize
2-
from typing import Iterator
33

44
BACKTICK_QUOTED_STRING: int
55

pandas-stubs/core/construction.pyi

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from typing import Sequence
1+
from collections.abc import Sequence
22

33
import numpy as np
44
from pandas.core.indexes.api import Index

pandas-stubs/core/frame.pyi

+9-7
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,18 @@
1-
import datetime
2-
import datetime as _dt
3-
from typing import (
4-
Any,
1+
from collections.abc import (
52
Callable,
6-
ClassVar,
73
Hashable,
84
Iterable,
95
Iterator,
10-
Literal,
116
Mapping,
12-
Pattern,
137
Sequence,
8+
)
9+
import datetime
10+
import datetime as _dt
11+
from re import Pattern
12+
from typing import (
13+
Any,
14+
ClassVar,
15+
Literal,
1416
TypeVar,
1517
overload,
1618
)

pandas-stubs/core/generic.pyi

+7-5
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
1-
import sqlite3
2-
from typing import (
3-
Any,
1+
from collections.abc import (
42
Callable,
5-
ClassVar,
63
Hashable,
74
Iterable,
8-
Literal,
95
Mapping,
106
Sequence,
7+
)
8+
import sqlite3
9+
from typing import (
10+
Any,
11+
ClassVar,
12+
Literal,
1113
final,
1214
overload,
1315
)

pandas-stubs/core/groupby/base.pyi

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# from pandas.core.dtypes.common import is_list_like as is_list_like, is_scalar as is_scalar
2+
from collections.abc import Hashable
23
import dataclasses
3-
from typing import Hashable
44

55
@dataclasses.dataclass(order=True, frozen=True)
66
class OutputKey:

pandas-stubs/core/groupby/generic.pyi

+6-4
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
1-
from typing import (
2-
Any,
1+
from collections.abc import (
32
Callable,
4-
Generic,
53
Iterable,
64
Iterator,
5+
Sequence,
6+
)
7+
from typing import (
8+
Any,
9+
Generic,
710
Literal,
811
NamedTuple,
9-
Sequence,
1012
Union,
1113
overload,
1214
)

pandas-stubs/core/groupby/groupby.pyi

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from typing import (
1+
from collections.abc import (
22
Callable,
33
Hashable,
44
)

pandas-stubs/core/groupby/grouper.pyi

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from typing import Hashable
1+
from collections.abc import Hashable
22

33
import numpy as np
44
from pandas import (

pandas-stubs/core/groupby/ops.pyi

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from typing import Sequence
1+
from collections.abc import Sequence
22

33
import numpy as np
44
from pandas import (

pandas-stubs/core/indexes/base.pyi

+5-3
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
1-
from typing import (
1+
from collections.abc import (
22
Callable,
3-
ClassVar,
43
Hashable,
54
Iterable,
65
Iterator,
7-
Literal,
86
Sequence,
7+
)
8+
from typing import (
9+
ClassVar,
10+
Literal,
911
overload,
1012
)
1113

pandas-stubs/core/indexes/datetimes.pyi

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1+
from collections.abc import (
2+
Hashable,
3+
Sequence,
4+
)
15
from datetime import (
26
timedelta,
37
tzinfo,
48
)
5-
from typing import (
6-
Hashable,
7-
Sequence,
8-
overload,
9-
)
9+
from typing import overload
1010

1111
import numpy as np
1212
from pandas import (

pandas-stubs/core/indexes/interval.pyi

+4-2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
1+
from collections.abc import (
2+
Hashable,
3+
Sequence,
4+
)
15
import datetime as dt
26
from typing import (
37
Generic,
4-
Hashable,
58
Literal,
6-
Sequence,
79
Union,
810
overload,
911
)

pandas-stubs/core/indexes/multi.pyi

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
from typing import (
1+
from collections.abc import (
22
Callable,
33
Hashable,
4-
Literal,
54
Sequence,
65
)
6+
from typing import Literal
77

88
import numpy as np
99
import pandas as pd

pandas-stubs/core/indexes/numeric.pyi

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from typing import Iterable
1+
from collections.abc import Iterable
22

33
from pandas.core.indexes.base import Index
44

pandas-stubs/core/indexes/period.pyi

+2-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
1-
from typing import (
2-
Hashable,
3-
overload,
4-
)
1+
from collections.abc import Hashable
2+
from typing import overload
53

64
import numpy as np
75
import pandas as pd

pandas-stubs/core/indexes/timedeltas.pyi

+4-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
1+
from collections.abc import (
2+
Hashable,
3+
Sequence,
4+
)
15
import datetime as dt
26
from typing import (
3-
Hashable,
47
Literal,
5-
Sequence,
68
overload,
79
)
810

pandas-stubs/core/interchange/dataframe_protocol.pyi

+4-2
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,13 @@ from abc import (
33
ABC,
44
abstractmethod,
55
)
6+
from collections.abc import (
7+
Iterable,
8+
Sequence,
9+
)
610
import enum
711
from typing import (
812
Any,
9-
Iterable,
10-
Sequence,
1113
TypedDict,
1214
)
1315

pandas-stubs/core/resample.pyi

+5-3
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
1-
from typing import (
1+
from collections.abc import (
22
Callable,
33
Generator,
4-
Generic,
54
Hashable,
6-
Literal,
75
Mapping,
6+
)
7+
from typing import (
8+
Generic,
9+
Literal,
810
overload,
911
)
1012

pandas-stubs/core/reshape/concat.pyi

+4-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
1-
from typing import (
1+
from collections.abc import (
22
Iterable,
3-
Literal,
43
Mapping,
54
Sequence,
5+
)
6+
from typing import (
7+
Literal,
68
overload,
79
)
810

pandas-stubs/core/reshape/encoding.pyi

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from typing import (
1+
from collections.abc import (
22
Hashable,
33
Iterable,
44
)

pandas-stubs/core/reshape/melt.pyi

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from typing import Hashable
1+
from collections.abc import Hashable
22

33
import numpy as np
44
from pandas.core.frame import DataFrame

0 commit comments

Comments
 (0)