Skip to content

Commit

Permalink
CI Upgrade isort in pre-commit (#36978)
Browse files Browse the repository at this point in the history
* fixes issue #36879

* Fixup

* sort pxd files

Co-authored-by: Tom Augspurger <tom.w.augspurger@gmail.com>
Co-authored-by: Marco Gorelli <m.e.gorelli@gmail.com>
  • Loading branch information
3 people committed Oct 8, 2020
1 parent 91e8bad commit 028eecb
Show file tree
Hide file tree
Showing 15 changed files with 32 additions and 15 deletions.
4 changes: 3 additions & 1 deletion .pre-commit-config.yaml
Expand Up @@ -21,10 +21,12 @@ repos:
- file
args: [--append-config=flake8/cython-template.cfg]
- repo: https://github.com/PyCQA/isort
rev: 5.2.2
rev: 5.6.0
hooks:
- id: isort
exclude: ^pandas/__init__\.py$|^pandas/core/api\.py$
files: '.pxd$|.py$'
types: [file]
- repo: https://github.com/asottile/pyupgrade
rev: v2.7.2
hooks:
Expand Down
14 changes: 11 additions & 3 deletions pandas/_libs/hashtable.pxd
@@ -1,7 +1,15 @@
from numpy cimport intp_t, ndarray

from pandas._libs.khash cimport (
kh_int64_t, kh_uint64_t, kh_float64_t, kh_pymap_t, kh_str_t, uint64_t,
int64_t, float64_t)
from numpy cimport ndarray, intp_t
float64_t,
int64_t,
kh_float64_t,
kh_int64_t,
kh_pymap_t,
kh_str_t,
kh_uint64_t,
uint64_t,
)

# prototypes for sharing

Expand Down
3 changes: 2 additions & 1 deletion pandas/_libs/khash.pxd
@@ -1,5 +1,6 @@
from cpython.object cimport PyObject
from numpy cimport int64_t, uint64_t, int32_t, uint32_t, float64_t
from numpy cimport float64_t, int32_t, int64_t, uint32_t, uint64_t


cdef extern from "khash_python.h":
ctypedef uint32_t khint_t
Expand Down
1 change: 1 addition & 0 deletions pandas/_libs/missing.pxd
@@ -1,5 +1,6 @@
from numpy cimport ndarray, uint8_t


cpdef bint checknull(object val)
cpdef bint checknull_old(object val)
cpdef ndarray[uint8_t] isnaobj(ndarray arr)
Expand Down
3 changes: 1 addition & 2 deletions pandas/_libs/tslibs/ccalendar.pxd
@@ -1,6 +1,5 @@
from cython cimport Py_ssize_t

from numpy cimport int64_t, int32_t
from numpy cimport int32_t, int64_t

ctypedef (int32_t, int32_t, int32_t) iso_calendar_t

Expand Down
3 changes: 1 addition & 2 deletions pandas/_libs/tslibs/conversion.pxd
@@ -1,6 +1,5 @@
from cpython.datetime cimport datetime, tzinfo

from numpy cimport int64_t, int32_t, ndarray
from numpy cimport int32_t, int64_t, ndarray

from pandas._libs.tslibs.np_datetime cimport npy_datetimestruct

Expand Down
3 changes: 2 additions & 1 deletion pandas/_libs/tslibs/nattype.pxd
@@ -1,6 +1,7 @@
from cpython.datetime cimport datetime

from numpy cimport int64_t


cdef int64_t NPY_NAT

cdef bint _nat_scalar_rules[6]
Expand Down
2 changes: 1 addition & 1 deletion pandas/_libs/tslibs/np_datetime.pxd
@@ -1,6 +1,6 @@
from cpython.datetime cimport date, datetime
from numpy cimport int32_t, int64_t

from numpy cimport int64_t, int32_t

cdef extern from "numpy/ndarrayobject.h":
ctypedef int64_t npy_timedelta
Expand Down
1 change: 1 addition & 0 deletions pandas/_libs/tslibs/offsets.pxd
@@ -1,5 +1,6 @@
from numpy cimport int64_t


cpdef to_offset(object obj)
cdef bint is_offset_object(object obj)
cdef bint is_tick_object(object obj)
Expand Down
1 change: 1 addition & 0 deletions pandas/_libs/tslibs/period.pxd
Expand Up @@ -2,5 +2,6 @@ from numpy cimport int64_t

from .np_datetime cimport npy_datetimestruct


cdef bint is_period_object(object obj)
cdef int64_t get_period_ordinal(npy_datetimestruct *dts, int freq) nogil
1 change: 1 addition & 0 deletions pandas/_libs/tslibs/timedeltas.pxd
@@ -1,6 +1,7 @@
from cpython.datetime cimport timedelta
from numpy cimport int64_t


# Exposed for tslib, not intended for outside use.
cpdef int64_t delta_to_nanoseconds(delta) except? -1
cdef convert_to_timedelta64(object ts, str unit)
Expand Down
1 change: 0 additions & 1 deletion pandas/_libs/tslibs/timestamps.pxd
@@ -1,5 +1,4 @@
from cpython.datetime cimport datetime, tzinfo

from numpy cimport int64_t

from pandas._libs.tslibs.base cimport ABCTimestamp
Expand Down
1 change: 1 addition & 0 deletions pandas/_libs/tslibs/timezones.pxd
@@ -1,5 +1,6 @@
from cpython.datetime cimport datetime, timedelta, tzinfo


cdef tzinfo utc_pytz

cpdef bint is_utc(tzinfo tz)
Expand Down
4 changes: 3 additions & 1 deletion pandas/_libs/tslibs/util.pxd
@@ -1,6 +1,7 @@

from cpython.object cimport PyTypeObject


cdef extern from *:
"""
PyObject* char_to_string(const char* data) {
Expand All @@ -26,7 +27,8 @@ cdef extern from "Python.h":
const char* PyUnicode_AsUTF8AndSize(object obj,
Py_ssize_t* length) except NULL

from numpy cimport int64_t, float64_t
from numpy cimport float64_t, int64_t


cdef extern from "numpy/arrayobject.h":
PyTypeObject PyFloatingArrType_Type
Expand Down
5 changes: 3 additions & 2 deletions pandas/_libs/util.pxd
@@ -1,8 +1,9 @@
from pandas._libs.tslibs.util cimport *

cimport numpy as cnp
from numpy cimport ndarray

from pandas._libs.tslibs.util cimport *


cdef extern from "numpy/ndarraytypes.h":
void PyArray_CLEARFLAGS(ndarray arr, int flags) nogil

Expand Down

0 comments on commit 028eecb

Please sign in to comment.