Skip to content

CI: unpin isort 5 (#35134) #35470

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 1, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion asv_bench/benchmarks/frame_ctor.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from .pandas_vb_common import tm

try:
from pandas.tseries.offsets import Nano, Hour
from pandas.tseries.offsets import Hour, Nano
except ImportError:
# For compatibility with older versions
from pandas.core.datetools import * # noqa
Expand Down
8 changes: 4 additions & 4 deletions asv_bench/benchmarks/gil.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@

try:
from pandas import (
rolling_median,
rolling_kurt,
rolling_max,
rolling_mean,
rolling_median,
rolling_min,
rolling_max,
rolling_var,
rolling_skew,
rolling_kurt,
rolling_std,
rolling_var,
)

have_rolling_methods = True
Expand Down
2 changes: 1 addition & 1 deletion asv_bench/benchmarks/io/parsers.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

try:
from pandas._libs.tslibs.parsing import (
concat_date_cols,
_does_string_look_like_datetime,
concat_date_cols,
)
except ImportError:
# Avoid whole benchmark suite import failure on asv (currently 0.4)
Expand Down
2 changes: 1 addition & 1 deletion asv_bench/benchmarks/tslibs/normalize.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
try:
from pandas._libs.tslibs import normalize_i8_timestamps, is_date_array_normalized
from pandas._libs.tslibs import is_date_array_normalized, normalize_i8_timestamps
except ImportError:
from pandas._libs.tslibs.conversion import (
normalize_i8_timestamps,
Expand Down
2 changes: 1 addition & 1 deletion ci/code_checks.sh
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ if [[ -z "$CHECK" || "$CHECK" == "lint" ]]; then

# Imports - Check formatting using isort see setup.cfg for settings
MSG='Check import format using isort' ; echo $MSG
ISORT_CMD="isort --quiet --recursive --check-only pandas asv_bench scripts"
ISORT_CMD="isort --quiet --check-only pandas asv_bench scripts"
if [[ "$GITHUB_ACTIONS" == "true" ]]; then
eval $ISORT_CMD | awk '{print "##[error]" $0}'; RET=$(($RET + ${PIPESTATUS[0]}))
else
Expand Down
4 changes: 1 addition & 3 deletions doc/source/development/contributing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -751,7 +751,7 @@ Imports are alphabetically sorted within these sections.

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

isort --recursive --check-only pandas
isort --check-only pandas

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

Expand All @@ -770,8 +770,6 @@ You should run::

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

The `--recursive` flag can be passed to sort all files in a directory.

Alternatively, you can run a command similar to what was suggested for ``black`` and ``flake8`` :ref:`right above <contributing.code-formatting>`::

git diff upstream/master --name-only -- "*.py" | xargs -r isort
Expand Down
2 changes: 1 addition & 1 deletion environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ dependencies:
- flake8<3.8.0 # temporary pin, GH#34150
- flake8-comprehensions>=3.1.0 # used by flake8, linting of unnecessary comprehensions
- flake8-rst>=0.6.0,<=0.7.0 # linting of code blocks in rst files
- isort=4.3.21 # check that imports are in the right order
- isort>=5.2.1 # check that imports are in the right order
- mypy=0.730
- pycodestyle # used by flake8

Expand Down
4 changes: 2 additions & 2 deletions pandas/_config/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -442,8 +442,8 @@ def register_option(
ValueError if `validator` is specified and `defval` is not a valid value.

"""
import tokenize
import keyword
import tokenize

key = key.lower()

Expand Down Expand Up @@ -660,8 +660,8 @@ def _build_option_description(k: str) -> str:

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

def pp(name: str, ks: Iterable[str]) -> List[str]:
pfx = "- " + name + ".[" if name else ""
Expand Down
10 changes: 5 additions & 5 deletions pandas/_libs/algos.pyx
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
import cython
from cython import Py_ssize_t

from libc.stdlib cimport malloc, free
from libc.string cimport memmove
from libc.math cimport fabs, sqrt
from libc.stdlib cimport free, malloc
from libc.string cimport memmove

import numpy as np

cimport numpy as cnp
from numpy cimport (
NPY_FLOAT32,
Expand All @@ -31,12 +32,11 @@ from numpy cimport (
uint32_t,
uint64_t,
)

cnp.import_array()


cimport pandas._libs.util as util
from pandas._libs.util cimport numeric, get_nat

from pandas._libs.khash cimport (
kh_destroy_int64,
kh_get_int64,
Expand All @@ -46,7 +46,7 @@ from pandas._libs.khash cimport (
kh_resize_int64,
khiter_t,
)

from pandas._libs.util cimport get_nat, numeric

import pandas._libs.missing as missing

Expand Down
48 changes: 36 additions & 12 deletions pandas/_libs/groupby.pyx
Original file line number Diff line number Diff line change
@@ -1,27 +1,51 @@
import cython
from cython import Py_ssize_t
from cython cimport floating

from libc.stdlib cimport malloc, free
from cython cimport floating
from libc.stdlib cimport free, malloc

import numpy as np

cimport numpy as cnp
from numpy cimport (ndarray,
int8_t, int16_t, int32_t, int64_t, uint8_t, uint16_t,
uint32_t, uint64_t, float32_t, float64_t, complex64_t, complex128_t)
from numpy cimport (
complex64_t,
complex128_t,
float32_t,
float64_t,
int8_t,
int16_t,
int32_t,
int64_t,
ndarray,
uint8_t,
uint16_t,
uint32_t,
uint64_t,
)
from numpy.math cimport NAN
cnp.import_array()

from pandas._libs.util cimport numeric, get_nat
cnp.import_array()

from pandas._libs.algos cimport (swap, TiebreakEnumType, TIEBREAK_AVERAGE,
TIEBREAK_MIN, TIEBREAK_MAX, TIEBREAK_FIRST,
TIEBREAK_DENSE)
from pandas._libs.algos import (take_2d_axis1_float64_float64,
groupsort_indexer, tiebreakers)
from pandas._libs.algos cimport (
TIEBREAK_AVERAGE,
TIEBREAK_DENSE,
TIEBREAK_FIRST,
TIEBREAK_MAX,
TIEBREAK_MIN,
TiebreakEnumType,
swap,
)
from pandas._libs.util cimport get_nat, numeric

from pandas._libs.algos import (
groupsort_indexer,
take_2d_axis1_float64_float64,
tiebreakers,
)

from pandas._libs.missing cimport checknull


cdef int64_t NPY_NAT = get_nat()
_int64_max = np.iinfo(np.int64).max

Expand Down
7 changes: 5 additions & 2 deletions pandas/_libs/hashing.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,13 @@
# at https://github.com/veorq/SipHash

import cython
from libc.stdlib cimport malloc, free

from libc.stdlib cimport free, malloc

import numpy as np
from numpy cimport ndarray, uint8_t, uint32_t, uint64_t, import_array

from numpy cimport import_array, ndarray, uint8_t, uint32_t, uint64_t

import_array()

from pandas._libs.util cimport is_nan
Expand Down
75 changes: 36 additions & 39 deletions pandas/_libs/hashtable.pyx
Original file line number Diff line number Diff line change
@@ -1,60 +1,57 @@
cimport cython

from cpython.ref cimport PyObject, Py_INCREF
from cpython.mem cimport PyMem_Malloc, PyMem_Free

from libc.stdlib cimport malloc, free
from cpython.mem cimport PyMem_Free, PyMem_Malloc
from cpython.ref cimport Py_INCREF, PyObject
from libc.stdlib cimport free, malloc

import numpy as np

cimport numpy as cnp
from numpy cimport ndarray, uint8_t, uint32_t, float64_t
from numpy cimport float64_t, ndarray, uint8_t, uint32_t
from numpy.math cimport NAN

cnp.import_array()


from pandas._libs cimport util
from pandas._libs.khash cimport (
khiter_t,
kh_str_t,
kh_init_str,
kh_put_str,
kh_exist_str,
kh_get_str,
kh_destroy_str,
kh_resize_str,
kh_put_strbox,
kh_get_strbox,
kh_init_strbox,
kh_int64_t,
kh_init_int64,
kh_resize_int64,
kh_destroy_float64,
kh_destroy_int64,
kh_get_int64,
kh_destroy_pymap,
kh_destroy_str,
kh_destroy_uint64,
kh_exist_float64,
kh_exist_int64,
kh_put_int64,
kh_exist_pymap,
kh_exist_str,
kh_exist_uint64,
kh_float64_t,
kh_exist_float64,
kh_put_float64,
kh_init_float64,
kh_get_float64,
kh_destroy_float64,
kh_resize_float64,
kh_resize_uint64,
kh_exist_uint64,
kh_destroy_uint64,
kh_put_uint64,
kh_get_int64,
kh_get_pymap,
kh_get_str,
kh_get_strbox,
kh_get_uint64,
kh_init_uint64,
kh_destroy_pymap,
kh_exist_pymap,
kh_init_float64,
kh_init_int64,
kh_init_pymap,
kh_get_pymap,
kh_init_str,
kh_init_strbox,
kh_init_uint64,
kh_int64_t,
kh_put_float64,
kh_put_int64,
kh_put_pymap,
kh_put_str,
kh_put_strbox,
kh_put_uint64,
kh_resize_float64,
kh_resize_int64,
kh_resize_pymap,
kh_resize_str,
kh_resize_uint64,
kh_str_t,
khiter_t,
)


from pandas._libs cimport util

from pandas._libs.missing cimport checknull


Expand Down
8 changes: 4 additions & 4 deletions pandas/_libs/index.pyx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import warnings

import numpy as np

cimport numpy as cnp
from numpy cimport (
float32_t,
Expand All @@ -16,17 +17,16 @@ from numpy cimport (
uint32_t,
uint64_t,
)

cnp.import_array()


from pandas._libs cimport util

from pandas._libs.hashtable cimport HashTable
from pandas._libs.tslibs.nattype cimport c_NaT as NaT
from pandas._libs.tslibs.period cimport is_period_object
from pandas._libs.tslibs.timestamps cimport _Timestamp
from pandas._libs.tslibs.timedeltas cimport _Timedelta

from pandas._libs.hashtable cimport HashTable
from pandas._libs.tslibs.timestamps cimport _Timestamp

from pandas._libs import algos, hashtable as _hash
from pandas._libs.missing import checknull
Expand Down
3 changes: 3 additions & 0 deletions pandas/_libs/internals.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,15 @@ from cython import Py_ssize_t

from cpython.slice cimport PySlice_GetIndicesEx


cdef extern from "Python.h":
Py_ssize_t PY_SSIZE_T_MAX

import numpy as np

cimport numpy as cnp
from numpy cimport NPY_INT64, int64_t

cnp.import_array()

from pandas._libs.algos import ensure_int64
Expand Down
Loading