Skip to content

Commit 05780f8

Browse files
WillAydjreback
authored andcommitted
Unpin pycodestyle (#25789)
1 parent a70eb0f commit 05780f8

29 files changed

+98
-71
lines changed

environment.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ dependencies:
1919
- hypothesis>=3.82
2020
- isort
2121
- moto
22-
- pycodestyle=2.4
22+
- pycodestyle
2323
- pytest>=4.0.2
2424
- pytest-mock
2525
- sphinx

pandas/_libs/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22
# flake8: noqa
33

44
from .tslibs import (
5-
iNaT, NaT, Timestamp, Timedelta, OutOfBoundsDatetime, Period)
5+
iNaT, NaT, NaTType, Timestamp, Timedelta, OutOfBoundsDatetime, Period)

pandas/_libs/tslibs/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# flake8: noqa
33

44
from .conversion import normalize_date, localize_pydatetime, tz_convert_single
5-
from .nattype import NaT, iNaT, is_null_datetimelike
5+
from .nattype import NaT, NaTType, iNaT, is_null_datetimelike
66
from .np_datetime import OutOfBoundsDatetime
77
from .period import Period, IncompatibleFrequency
88
from .timestamps import Timestamp

pandas/_libs/tslibs/nattype.pyx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -353,7 +353,7 @@ class NaTType(_NaT):
353353
354354
.. versionadded:: 0.23.0
355355
""")
356-
day_name = _make_nan_func('day_name', # noqa:E128
356+
day_name = _make_nan_func('day_name', # noqa:E128
357357
"""
358358
Return the day name of the Timestamp with specified locale.
359359

pandas/core/arrays/array_.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,12 @@
1+
from typing import Optional, Sequence, Union
2+
3+
import numpy as np
4+
15
from pandas._libs import lib, tslibs
26

37
from pandas.core.dtypes.common import (
48
is_datetime64_ns_dtype, is_extension_array_dtype, is_timedelta64_ns_dtype)
5-
from pandas.core.dtypes.dtypes import registry
9+
from pandas.core.dtypes.dtypes import ExtensionDtype, registry
610

711
from pandas import compat
812

pandas/core/arrays/base.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
without warning.
77
"""
88
import operator
9+
from typing import Any, Callable, Optional, Sequence, Tuple, Union
910

1011
import numpy as np
1112

@@ -15,6 +16,7 @@
1516
from pandas.util._decorators import Appender, Substitution
1617

1718
from pandas.core.dtypes.common import is_list_like
19+
from pandas.core.dtypes.dtypes import ExtensionDtype
1820
from pandas.core.dtypes.generic import ABCIndexClass, ABCSeries
1921
from pandas.core.dtypes.missing import isna
2022

@@ -365,7 +367,7 @@ def isna(self):
365367
raise AbstractMethodError(self)
366368

367369
def _values_for_argsort(self):
368-
# type: () -> ndarray
370+
# type: () -> np.ndarray
369371
"""
370372
Return values for sorting.
371373
@@ -597,7 +599,7 @@ def searchsorted(self, value, side="left", sorter=None):
597599
return arr.searchsorted(value, side=side, sorter=sorter)
598600

599601
def _values_for_factorize(self):
600-
# type: () -> Tuple[ndarray, Any]
602+
# type: () -> Tuple[np.ndarray, Any]
601603
"""
602604
Return an array and missing value suitable for factorization.
603605
@@ -622,7 +624,7 @@ def _values_for_factorize(self):
622624
return self.astype(object), np.nan
623625

624626
def factorize(self, na_sentinel=-1):
625-
# type: (int) -> Tuple[ndarray, ExtensionArray]
627+
# type: (int) -> Tuple[np.ndarray, ExtensionArray]
626628
"""
627629
Encode the extension array as an enumerated type.
628630

pandas/core/arrays/datetimelike.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
# -*- coding: utf-8 -*-
22
from datetime import datetime, timedelta
33
import operator
4+
from typing import Any, Sequence, Tuple, Union
45
import warnings
56

67
import numpy as np
78

8-
from pandas._libs import NaT, algos, iNaT, lib
9+
from pandas._libs import NaT, NaTType, Timestamp, algos, iNaT, lib
910
from pandas._libs.tslibs.period import (
1011
DIFFERENT_FREQ, IncompatibleFrequency, Period)
1112
from pandas._libs.tslibs.timedeltas import Timedelta, delta_to_nanoseconds
@@ -350,7 +351,7 @@ def __iter__(self):
350351

351352
@property
352353
def asi8(self):
353-
# type: () -> ndarray
354+
# type: () -> np.ndarray
354355
"""
355356
Integer representation of the values.
356357
@@ -461,10 +462,10 @@ def __getitem__(self, key):
461462
def __setitem__(
462463
self,
463464
key, # type: Union[int, Sequence[int], Sequence[bool], slice]
464-
value, # type: Union[NaTType, Scalar, Sequence[Scalar]]
465+
value, # type: Union[NaTType, Any, Sequence[Any]]
465466
):
466467
# type: (...) -> None
467-
# I'm fudging the types a bit here. The "Scalar" above really depends
468+
# I'm fudging the types a bit here. "Any" above really depends
468469
# on type(self). For PeriodArray, it's Period (or stuff coercible
469470
# to a period in from_sequence). For DatetimeArray, it's Timestamp...
470471
# I don't know if mypy can do that, possibly with Generics.

pandas/core/arrays/datetimes.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# -*- coding: utf-8 -*-
22
from datetime import datetime, time, timedelta
33
import textwrap
4+
from typing import Union
45
import warnings
56

67
import numpy as np

pandas/core/arrays/integer.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -510,7 +510,7 @@ def value_counts(self, dropna=True):
510510
return Series(array, index=index)
511511

512512
def _values_for_argsort(self):
513-
# type: () -> ndarray
513+
# type: () -> np.ndarray
514514
"""Return values for sorting.
515515
516516
Returns

pandas/core/arrays/period.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
# -*- coding: utf-8 -*-
22
from datetime import timedelta
33
import operator
4+
from typing import Any, Callable, Optional, Sequence, Union
45

56
import numpy as np
67

78
from pandas._libs.tslibs import (
8-
NaT, frequencies as libfrequencies, iNaT, period as libperiod)
9+
NaT, NaTType, frequencies as libfrequencies, iNaT, period as libperiod)
910
from pandas._libs.tslibs.fields import isleapyear_arr
1011
from pandas._libs.tslibs.period import (
1112
DIFFERENT_FREQ, IncompatibleFrequency, Period, get_period_field_arr,
@@ -23,7 +24,7 @@
2324
from pandas.core.dtypes.missing import isna, notna
2425

2526
import pandas.core.algorithms as algos
26-
from pandas.core.arrays import datetimelike as dtl
27+
from pandas.core.arrays import ExtensionArray, datetimelike as dtl
2728
import pandas.core.common as com
2829

2930
from pandas.tseries import frequencies
@@ -536,11 +537,14 @@ def _sub_period(self, other):
536537
@Appender(dtl.DatetimeLikeArrayMixin._addsub_int_array.__doc__)
537538
def _addsub_int_array(
538539
self,
539-
other, # type: Union[Index, ExtensionArray, np.ndarray[int]]
540-
op # type: Callable[Any, Any]
540+
other, # type: Union[ExtensionArray, np.ndarray[int]]
541+
op # type: Callable[Any, Any]
541542
):
542543
# type: (...) -> PeriodArray
543544

545+
# TODO: ABCIndexClass is a valid type for other but had to be excluded
546+
# due to length of Py2 compatability comment; add back in once migrated
547+
# to Py3 syntax
544548
assert op in [operator.add, operator.sub]
545549
if op is operator.sub:
546550
other = -other

0 commit comments

Comments
 (0)