Skip to content

Commit 8e51fd3

Browse files
jbrockmendeljreback
authored andcommitted
update tslibs imports (#21816)
1 parent 5380fcd commit 8e51fd3

40 files changed

+124
-137
lines changed

pandas/_libs/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# -*- coding: utf-8 -*-
22
# flake8: noqa
33

4-
from .tslib import iNaT, NaT, Timestamp, Timedelta, OutOfBoundsDatetime
4+
from .tslibs import iNaT, NaT, Timestamp, Timedelta, OutOfBoundsDatetime
55

66
# TODO
77
# period is directly dependent on tslib and imports python

pandas/_libs/index.pyx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,7 @@ from tslibs.conversion cimport maybe_datetimelike_to_i8
2525
from hashtable cimport HashTable
2626

2727
from pandas._libs import algos, hashtable as _hash
28-
from pandas._libs.tslibs import period as periodlib
29-
from pandas._libs.tslib import Timestamp, Timedelta
28+
from pandas._libs.tslibs import Timestamp, Timedelta, period as periodlib
3029
from pandas._libs.missing import checknull
3130

3231
cdef int64_t iNaT = util.get_nat()

pandas/_libs/interval.pyx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ cimport util
55
cimport cython
66
import cython
77
from numpy cimport ndarray
8-
from tslib import Timestamp
8+
from tslibs import Timestamp
99
from tslibs.timezones cimport tz_compare
1010

1111
from cpython.object cimport (Py_EQ, Py_NE, Py_GT, Py_LT, Py_GE, Py_LE,

pandas/_libs/lib.pyx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1+
# -*- coding: utf-8 -*-
12
# cython: profile=False
2-
import operator
3-
43
cimport cython
54
from cython cimport Py_ssize_t
65

pandas/_libs/missing.pyx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ cimport util
1515

1616
from tslibs.np_datetime cimport get_timedelta64_value, get_datetime64_value
1717
from tslibs.nattype import NaT
18-
from tslibs.nattype cimport is_null_datetimelike
1918

2019
cdef double INF = <double> np.inf
2120
cdef double NEGINF = -INF

pandas/_libs/reshape.pyx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,9 @@ cimport cython
44
from cython cimport Py_ssize_t
55

66
import numpy as np
7-
cimport numpy as cnp
87
from numpy cimport (ndarray,
98
int8_t, int16_t, int32_t, int64_t, uint8_t, uint16_t,
109
uint32_t, uint64_t, float32_t, float64_t)
11-
cnp.import_array()
1210

1311

1412
cdef double NaN = <double> np.NaN

pandas/_libs/src/util.pxd

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,7 @@ cdef extern from "headers/stdint.h":
100100
enum: INT64_MAX
101101
enum: INT64_MIN
102102

103+
103104
cdef inline object get_value_at(ndarray arr, object loc):
104105
cdef:
105106
Py_ssize_t i, sz
@@ -119,6 +120,7 @@ cdef inline object get_value_at(ndarray arr, object loc):
119120

120121
return get_value_1d(arr, i)
121122

123+
122124
cdef inline set_value_at_unsafe(ndarray arr, object loc, object value):
123125
"""Sets a value into the array without checking the writeable flag.
124126
@@ -153,12 +155,14 @@ cdef inline set_value_at(ndarray arr, object loc, object value):
153155
cdef inline is_array(object o):
154156
return cnp.PyArray_Check(o)
155157

158+
156159
cdef inline bint _checknull(object val):
157160
try:
158161
return val is None or (cpython.PyFloat_Check(val) and val != val)
159162
except ValueError:
160163
return False
161164

165+
162166
cdef inline bint is_period_object(object val):
163167
return getattr(val, '_typ', '_typ') == 'period'
164168

pandas/_libs/tslib.pyx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,14 +38,12 @@ import pytz
3838

3939

4040
from tslibs.timedeltas cimport cast_from_unit
41-
from tslibs.timedeltas import Timedelta, ints_to_pytimedelta # noqa:F841
4241
from tslibs.timezones cimport (is_utc, is_tzlocal, is_fixed_offset,
4342
treat_tz_as_pytz, get_dst_info)
4443
from tslibs.conversion cimport (tz_convert_single, _TSObject,
4544
convert_datetime_to_tsobject,
4645
get_datetime64_nanos,
4746
tz_convert_utc_to_tzlocal)
48-
from tslibs.conversion import tz_convert_single, normalize_date # noqa:F841
4947

5048
from tslibs.nattype import NaT, nat_strings, iNaT
5149
from tslibs.nattype cimport checknull_with_nat, NPY_NAT

pandas/_libs/tslibs/frequencies.pyx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import re
55
cimport cython
66

77
cimport numpy as cnp
8-
from numpy cimport int64_t
98
cnp.import_array()
109

1110
from util cimport is_integer_object, is_string_object

pandas/_libs/tslibs/offsets.pyx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ from cpython.datetime cimport (PyDateTime_IMPORT, PyDateTime_CheckExact,
1111
PyDateTime_IMPORT
1212

1313
from dateutil.relativedelta import relativedelta
14-
from pytz import UTC
1514

1615
import numpy as np
1716
cimport numpy as cnp
@@ -24,7 +23,6 @@ from util cimport is_string_object, is_integer_object
2423
from ccalendar import MONTHS, DAYS
2524
from ccalendar cimport get_days_in_month, dayofweek
2625
from conversion cimport tz_convert_single, pydt_to_i8, localize_pydatetime
27-
from frequencies cimport get_freq_code
2826
from nattype cimport NPY_NAT
2927
from np_datetime cimport (pandas_datetimestruct,
3028
dtstruct_to_dt64, dt64_to_dtstruct)

0 commit comments

Comments
 (0)