Skip to content

Commit 1d86861

Browse files
WillAydjreback
authored andcommitted
CLN: Cython Py2/3 Compatible Imports (#23940)
1 parent 8b4b38f commit 1d86861

33 files changed

+206
-196
lines changed

pandas/_libs/algos.pxd

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from util cimport numeric
1+
from pandas._libs.util cimport numeric
22

33

44
cdef inline Py_ssize_t swap(numeric *a, numeric *b) nogil:

pandas/_libs/algos.pyx

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,14 @@ from numpy cimport (ndarray,
1919
cnp.import_array()
2020

2121

22-
cimport util
23-
from util cimport numeric, get_nat
22+
cimport pandas._libs.util as util
23+
from pandas._libs.util cimport numeric, get_nat
2424

25-
from khash cimport (khiter_t,
26-
kh_destroy_int64, kh_put_int64,
27-
kh_init_int64, kh_int64_t,
28-
kh_resize_int64, kh_get_int64)
25+
from pandas._libs.khash cimport (
26+
khiter_t, kh_destroy_int64, kh_put_int64, kh_init_int64, kh_int64_t,
27+
kh_resize_int64, kh_get_int64)
2928

30-
import missing
29+
import pandas._libs.missing as missing
3130

3231
cdef float64_t FP_ERR = 1e-13
3332

pandas/_libs/groupby.pyx

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,13 @@ from numpy cimport (ndarray,
1313
cnp.import_array()
1414

1515

16-
from util cimport numeric, get_nat
16+
from pandas._libs.util cimport numeric, get_nat
1717

18-
from algos cimport (swap, TiebreakEnumType, TIEBREAK_AVERAGE, TIEBREAK_MIN,
19-
TIEBREAK_MAX, TIEBREAK_FIRST, TIEBREAK_DENSE)
20-
from algos import take_2d_axis1_float64_float64, groupsort_indexer, tiebreakers
18+
from pandas._libs.algos cimport (swap, TiebreakEnumType, TIEBREAK_AVERAGE,
19+
TIEBREAK_MIN, TIEBREAK_MAX, TIEBREAK_FIRST,
20+
TIEBREAK_DENSE)
21+
from pandas._libs.algos import (take_2d_axis1_float64_float64,
22+
groupsort_indexer, tiebreakers)
2123

2224
cdef int64_t NPY_NAT = get_nat()
2325

pandas/_libs/hashing.pyx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import numpy as np
99
from numpy cimport uint8_t, uint32_t, uint64_t, import_array
1010
import_array()
1111

12-
from util cimport is_nan
12+
from pandas._libs.util cimport is_nan
1313

1414
DEF cROUNDS = 2
1515
DEF dROUNDS = 4

pandas/_libs/hashtable.pxd

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
from khash cimport (kh_int64_t, kh_uint64_t, kh_float64_t, kh_pymap_t,
2-
kh_str_t, uint64_t, int64_t, float64_t)
1+
from pandas._libs.khash cimport (
2+
kh_int64_t, kh_uint64_t, kh_float64_t, kh_pymap_t, kh_str_t, uint64_t,
3+
int64_t, float64_t)
34
from numpy cimport ndarray
45

56
# prototypes for sharing

pandas/_libs/hashtable.pyx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ cdef extern from "numpy/npy_math.h":
1616
float64_t NAN "NPY_NAN"
1717

1818

19-
from khash cimport (
19+
from pandas._libs.khash cimport (
2020
khiter_t,
2121

2222
kh_str_t, kh_init_str, kh_put_str, kh_exist_str,
@@ -37,9 +37,9 @@ from khash cimport (
3737
kh_put_pymap, kh_resize_pymap)
3838

3939

40-
cimport util
40+
cimport pandas._libs.util as util
4141

42-
from missing cimport checknull
42+
from pandas._libs.missing cimport checknull
4343

4444

4545
cdef int64_t NPY_NAT = util.get_nat()

pandas/_libs/index.pyx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,11 @@ from numpy cimport (ndarray, intp_t,
1515
cnp.import_array()
1616

1717

18-
cimport util
18+
cimport pandas._libs.util as util
1919

20-
from tslibs.conversion cimport maybe_datetimelike_to_i8
20+
from pandas._libs.tslibs.conversion cimport maybe_datetimelike_to_i8
2121

22-
from hashtable cimport HashTable
22+
from pandas._libs.hashtable cimport HashTable
2323

2424
from pandas._libs import algos, hashtable as _hash
2525
from pandas._libs.tslibs import Timestamp, Timedelta, period as periodlib

pandas/_libs/internals.pyx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ cdef extern from "compat_helper.h":
1818
Py_ssize_t *slicelength) except -1
1919

2020

21-
from algos import ensure_int64
21+
from pandas._libs.algos import ensure_int64
2222

2323

2424
cdef class BlockPlacement:

pandas/_libs/interval.pyx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,13 @@ from numpy cimport (
1717
cnp.import_array()
1818

1919

20-
cimport util
20+
cimport pandas._libs.util as util
2121
util.import_array()
2222

23-
from hashtable cimport Int64Vector, Int64VectorData
23+
from pandas._libs.hashtable cimport Int64Vector, Int64VectorData
2424

25-
from tslibs import Timestamp
26-
from tslibs.timezones cimport tz_compare
25+
from pandas._libs.tslibs import Timestamp
26+
from pandas._libs.tslibs.timezones cimport tz_compare
2727

2828

2929
_VALID_CLOSED = frozenset(['left', 'right', 'both', 'neither'])

pandas/_libs/join.pyx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -656,7 +656,7 @@ outer_join_indexer_uint64 = outer_join_indexer["uint64_t"]
656656
# asof_join_by
657657
# ----------------------------------------------------------------------
658658

659-
from hashtable cimport (
659+
from pandas._libs.hashtable cimport (
660660
HashTable, PyObjectHashTable, UInt64HashTable, Int64HashTable)
661661

662662
ctypedef fused asof_t:

0 commit comments

Comments
 (0)