Skip to content

Commit e29d9bb

Browse files
Backport PR #35470: CI: unpin isort 5 (#35134) (#35501)
Co-authored-by: Fangchen Li <fangchen.li@outlook.com>
1 parent 000e674 commit e29d9bb

File tree

97 files changed

+612
-432
lines changed

Some content is hidden

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

97 files changed

+612
-432
lines changed

asv_bench/benchmarks/frame_ctor.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
from .pandas_vb_common import tm
77

88
try:
9-
from pandas.tseries.offsets import Nano, Hour
9+
from pandas.tseries.offsets import Hour, Nano
1010
except ImportError:
1111
# For compatibility with older versions
1212
from pandas.core.datetools import * # noqa

asv_bench/benchmarks/gil.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,14 @@
77

88
try:
99
from pandas import (
10-
rolling_median,
10+
rolling_kurt,
11+
rolling_max,
1112
rolling_mean,
13+
rolling_median,
1214
rolling_min,
13-
rolling_max,
14-
rolling_var,
1515
rolling_skew,
16-
rolling_kurt,
1716
rolling_std,
17+
rolling_var,
1818
)
1919

2020
have_rolling_methods = True

asv_bench/benchmarks/io/parsers.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22

33
try:
44
from pandas._libs.tslibs.parsing import (
5-
concat_date_cols,
65
_does_string_look_like_datetime,
6+
concat_date_cols,
77
)
88
except ImportError:
99
# Avoid whole benchmark suite import failure on asv (currently 0.4)

asv_bench/benchmarks/tslibs/normalize.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
try:
2-
from pandas._libs.tslibs import normalize_i8_timestamps, is_date_array_normalized
2+
from pandas._libs.tslibs import is_date_array_normalized, normalize_i8_timestamps
33
except ImportError:
44
from pandas._libs.tslibs.conversion import (
55
normalize_i8_timestamps,

ci/code_checks.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ if [[ -z "$CHECK" || "$CHECK" == "lint" ]]; then
121121

122122
# Imports - Check formatting using isort see setup.cfg for settings
123123
MSG='Check import format using isort' ; echo $MSG
124-
ISORT_CMD="isort --quiet --recursive --check-only pandas asv_bench scripts"
124+
ISORT_CMD="isort --quiet --check-only pandas asv_bench scripts"
125125
if [[ "$GITHUB_ACTIONS" == "true" ]]; then
126126
eval $ISORT_CMD | awk '{print "##[error]" $0}'; RET=$(($RET + ${PIPESTATUS[0]}))
127127
else

doc/source/development/contributing.rst

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -751,7 +751,7 @@ Imports are alphabetically sorted within these sections.
751751

752752
As part of :ref:`Continuous Integration <contributing.ci>` checks we run::
753753

754-
isort --recursive --check-only pandas
754+
isort --check-only pandas
755755

756756
to check that imports are correctly formatted as per the `setup.cfg`.
757757

@@ -770,8 +770,6 @@ You should run::
770770

771771
to automatically format imports correctly. This will modify your local copy of the files.
772772

773-
The `--recursive` flag can be passed to sort all files in a directory.
774-
775773
Alternatively, you can run a command similar to what was suggested for ``black`` and ``flake8`` :ref:`right above <contributing.code-formatting>`::
776774

777775
git diff upstream/master --name-only -- "*.py" | xargs -r isort

environment.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ dependencies:
2121
- flake8<3.8.0 # temporary pin, GH#34150
2222
- flake8-comprehensions>=3.1.0 # used by flake8, linting of unnecessary comprehensions
2323
- flake8-rst>=0.6.0,<=0.7.0 # linting of code blocks in rst files
24-
- isort=4.3.21 # check that imports are in the right order
24+
- isort>=5.2.1 # check that imports are in the right order
2525
- mypy=0.730
2626
- pycodestyle # used by flake8
2727

pandas/_config/config.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -442,8 +442,8 @@ def register_option(
442442
ValueError if `validator` is specified and `defval` is not a valid value.
443443
444444
"""
445-
import tokenize
446445
import keyword
446+
import tokenize
447447

448448
key = key.lower()
449449

@@ -660,8 +660,8 @@ def _build_option_description(k: str) -> str:
660660

661661
def pp_options_list(keys: Iterable[str], width=80, _print: bool = False):
662662
""" Builds a concise listing of available options, grouped by prefix """
663-
from textwrap import wrap
664663
from itertools import groupby
664+
from textwrap import wrap
665665

666666
def pp(name: str, ks: Iterable[str]) -> List[str]:
667667
pfx = "- " + name + ".[" if name else ""

pandas/_libs/algos.pyx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
import cython
22
from cython import Py_ssize_t
33

4-
from libc.stdlib cimport malloc, free
5-
from libc.string cimport memmove
64
from libc.math cimport fabs, sqrt
5+
from libc.stdlib cimport free, malloc
6+
from libc.string cimport memmove
77

88
import numpy as np
9+
910
cimport numpy as cnp
1011
from numpy cimport (
1112
NPY_FLOAT32,
@@ -31,12 +32,11 @@ from numpy cimport (
3132
uint32_t,
3233
uint64_t,
3334
)
35+
3436
cnp.import_array()
3537

3638

3739
cimport pandas._libs.util as util
38-
from pandas._libs.util cimport numeric, get_nat
39-
4040
from pandas._libs.khash cimport (
4141
kh_destroy_int64,
4242
kh_get_int64,
@@ -46,7 +46,7 @@ from pandas._libs.khash cimport (
4646
kh_resize_int64,
4747
khiter_t,
4848
)
49-
49+
from pandas._libs.util cimport get_nat, numeric
5050

5151
import pandas._libs.missing as missing
5252

pandas/_libs/groupby.pyx

Lines changed: 36 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,51 @@
11
import cython
22
from cython import Py_ssize_t
3-
from cython cimport floating
43

5-
from libc.stdlib cimport malloc, free
4+
from cython cimport floating
5+
from libc.stdlib cimport free, malloc
66

77
import numpy as np
8+
89
cimport numpy as cnp
9-
from numpy cimport (ndarray,
10-
int8_t, int16_t, int32_t, int64_t, uint8_t, uint16_t,
11-
uint32_t, uint64_t, float32_t, float64_t, complex64_t, complex128_t)
10+
from numpy cimport (
11+
complex64_t,
12+
complex128_t,
13+
float32_t,
14+
float64_t,
15+
int8_t,
16+
int16_t,
17+
int32_t,
18+
int64_t,
19+
ndarray,
20+
uint8_t,
21+
uint16_t,
22+
uint32_t,
23+
uint64_t,
24+
)
1225
from numpy.math cimport NAN
13-
cnp.import_array()
1426

15-
from pandas._libs.util cimport numeric, get_nat
27+
cnp.import_array()
1628

17-
from pandas._libs.algos cimport (swap, TiebreakEnumType, TIEBREAK_AVERAGE,
18-
TIEBREAK_MIN, TIEBREAK_MAX, TIEBREAK_FIRST,
19-
TIEBREAK_DENSE)
20-
from pandas._libs.algos import (take_2d_axis1_float64_float64,
21-
groupsort_indexer, tiebreakers)
29+
from pandas._libs.algos cimport (
30+
TIEBREAK_AVERAGE,
31+
TIEBREAK_DENSE,
32+
TIEBREAK_FIRST,
33+
TIEBREAK_MAX,
34+
TIEBREAK_MIN,
35+
TiebreakEnumType,
36+
swap,
37+
)
38+
from pandas._libs.util cimport get_nat, numeric
39+
40+
from pandas._libs.algos import (
41+
groupsort_indexer,
42+
take_2d_axis1_float64_float64,
43+
tiebreakers,
44+
)
2245

2346
from pandas._libs.missing cimport checknull
2447

48+
2549
cdef int64_t NPY_NAT = get_nat()
2650
_int64_max = np.iinfo(np.int64).max
2751

0 commit comments

Comments
 (0)