Skip to content

Commit e29d9bb

Browse files
Backport PR pandas-dev#35470: CI: unpin isort 5 (pandas-dev#35134) (pandas-dev#35501)
Co-authored-by: Fangchen Li <[email protected]>
1 parent 000e674 commit e29d9bb

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

+1-1
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

+4-4
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

+1-1
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

+1-1
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

+1-1
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

+1-3
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

+1-1
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

+2-2
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

+5-5
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

+36-12
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

pandas/_libs/hashing.pyx

+5-2
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,13 @@
22
# at https://github.com/veorq/SipHash
33

44
import cython
5-
from libc.stdlib cimport malloc, free
5+
6+
from libc.stdlib cimport free, malloc
67

78
import numpy as np
8-
from numpy cimport ndarray, uint8_t, uint32_t, uint64_t, import_array
9+
10+
from numpy cimport import_array, ndarray, uint8_t, uint32_t, uint64_t
11+
912
import_array()
1013

1114
from pandas._libs.util cimport is_nan

pandas/_libs/hashtable.pyx

+36-39
Original file line numberDiff line numberDiff line change
@@ -1,60 +1,57 @@
11
cimport cython
2-
3-
from cpython.ref cimport PyObject, Py_INCREF
4-
from cpython.mem cimport PyMem_Malloc, PyMem_Free
5-
6-
from libc.stdlib cimport malloc, free
2+
from cpython.mem cimport PyMem_Free, PyMem_Malloc
3+
from cpython.ref cimport Py_INCREF, PyObject
4+
from libc.stdlib cimport free, malloc
75

86
import numpy as np
7+
98
cimport numpy as cnp
10-
from numpy cimport ndarray, uint8_t, uint32_t, float64_t
9+
from numpy cimport float64_t, ndarray, uint8_t, uint32_t
1110
from numpy.math cimport NAN
11+
1212
cnp.import_array()
1313

1414

15+
from pandas._libs cimport util
1516
from pandas._libs.khash cimport (
16-
khiter_t,
17-
kh_str_t,
18-
kh_init_str,
19-
kh_put_str,
20-
kh_exist_str,
21-
kh_get_str,
22-
kh_destroy_str,
23-
kh_resize_str,
24-
kh_put_strbox,
25-
kh_get_strbox,
26-
kh_init_strbox,
27-
kh_int64_t,
28-
kh_init_int64,
29-
kh_resize_int64,
17+
kh_destroy_float64,
3018
kh_destroy_int64,
31-
kh_get_int64,
19+
kh_destroy_pymap,
20+
kh_destroy_str,
21+
kh_destroy_uint64,
22+
kh_exist_float64,
3223
kh_exist_int64,
33-
kh_put_int64,
24+
kh_exist_pymap,
25+
kh_exist_str,
26+
kh_exist_uint64,
3427
kh_float64_t,
35-
kh_exist_float64,
36-
kh_put_float64,
37-
kh_init_float64,
3828
kh_get_float64,
39-
kh_destroy_float64,
40-
kh_resize_float64,
41-
kh_resize_uint64,
42-
kh_exist_uint64,
43-
kh_destroy_uint64,
44-
kh_put_uint64,
29+
kh_get_int64,
30+
kh_get_pymap,
31+
kh_get_str,
32+
kh_get_strbox,
4533
kh_get_uint64,
46-
kh_init_uint64,
47-
kh_destroy_pymap,
48-
kh_exist_pymap,
34+
kh_init_float64,
35+
kh_init_int64,
4936
kh_init_pymap,
50-
kh_get_pymap,
37+
kh_init_str,
38+
kh_init_strbox,
39+
kh_init_uint64,
40+
kh_int64_t,
41+
kh_put_float64,
42+
kh_put_int64,
5143
kh_put_pymap,
44+
kh_put_str,
45+
kh_put_strbox,
46+
kh_put_uint64,
47+
kh_resize_float64,
48+
kh_resize_int64,
5249
kh_resize_pymap,
50+
kh_resize_str,
51+
kh_resize_uint64,
52+
kh_str_t,
53+
khiter_t,
5354
)
54-
55-
56-
from pandas._libs cimport util
57-
5855
from pandas._libs.missing cimport checknull
5956

6057

pandas/_libs/index.pyx

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import warnings
22

33
import numpy as np
4+
45
cimport numpy as cnp
56
from numpy cimport (
67
float32_t,
@@ -16,17 +17,16 @@ from numpy cimport (
1617
uint32_t,
1718
uint64_t,
1819
)
20+
1921
cnp.import_array()
2022

2123

2224
from pandas._libs cimport util
23-
25+
from pandas._libs.hashtable cimport HashTable
2426
from pandas._libs.tslibs.nattype cimport c_NaT as NaT
2527
from pandas._libs.tslibs.period cimport is_period_object
26-
from pandas._libs.tslibs.timestamps cimport _Timestamp
2728
from pandas._libs.tslibs.timedeltas cimport _Timedelta
28-
29-
from pandas._libs.hashtable cimport HashTable
29+
from pandas._libs.tslibs.timestamps cimport _Timestamp
3030

3131
from pandas._libs import algos, hashtable as _hash
3232
from pandas._libs.missing import checknull

pandas/_libs/internals.pyx

+3
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,15 @@ from cython import Py_ssize_t
55

66
from cpython.slice cimport PySlice_GetIndicesEx
77

8+
89
cdef extern from "Python.h":
910
Py_ssize_t PY_SSIZE_T_MAX
1011

1112
import numpy as np
13+
1214
cimport numpy as cnp
1315
from numpy cimport NPY_INT64, int64_t
16+
1417
cnp.import_array()
1518

1619
from pandas._libs.algos import ensure_int64

0 commit comments

Comments
 (0)