From 63b2469fdf409b1c1f26e1b9895f4cb22496f61b Mon Sep 17 00:00:00 2001 From: Brock Mendel Date: Tue, 28 Nov 2017 17:56:23 -0800 Subject: [PATCH 1/3] cleanup unused or implicit imports --- pandas/_libs/tslib.pyx | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/pandas/_libs/tslib.pyx b/pandas/_libs/tslib.pyx index 6d8cf39114f6f..149b347dac515 100644 --- a/pandas/_libs/tslib.pyx +++ b/pandas/_libs/tslib.pyx @@ -5,8 +5,9 @@ # distutils: define_macros=CYTHON_TRACE_NOGIL=0 cimport numpy as np -from numpy cimport int64_t, import_array, ndarray, float64_t +from numpy cimport int64_t, ndarray, float64_t import numpy as np +np.import_array() from cpython cimport PyTypeObject, PyFloat_Check @@ -38,15 +39,12 @@ from tslibs.np_datetime import OutOfBoundsDatetime from .tslibs.parsing import parse_datetime_string cimport cython +from cython cimport Py_ssize_t -import warnings import pytz UTC = pytz.utc -# initialize numpy -import_array() - from tslibs.timedeltas cimport cast_from_unit from tslibs.timedeltas import Timedelta From 355a7058d234685754548793ceb273a56c0fa761 Mon Sep 17 00:00:00 2001 From: Brock Mendel Date: Tue, 28 Nov 2017 17:57:27 -0800 Subject: [PATCH 2/3] remove tslib from conversion cimport --- pandas/_libs/src/inference.pyx | 2 +- pandas/_libs/tslib.pxd | 3 --- pandas/_libs/tslib.pyx | 2 +- 3 files changed, 2 insertions(+), 5 deletions(-) delete mode 100644 pandas/_libs/tslib.pxd diff --git a/pandas/_libs/src/inference.pyx b/pandas/_libs/src/inference.pyx index 6e964077dd56e..cb192fcced318 100644 --- a/pandas/_libs/src/inference.pyx +++ b/pandas/_libs/src/inference.pyx @@ -3,7 +3,7 @@ from decimal import Decimal cimport util cimport cython from tslibs.nattype import NaT -from tslib cimport convert_to_tsobject +from tslibs.conversion cimport convert_to_tsobject from tslibs.timedeltas cimport convert_to_timedelta64 from tslibs.timezones cimport get_timezone from datetime import datetime, timedelta diff --git a/pandas/_libs/tslib.pxd b/pandas/_libs/tslib.pxd deleted file mode 100644 index b74cf5b79c4cb..0000000000000 --- a/pandas/_libs/tslib.pxd +++ /dev/null @@ -1,3 +0,0 @@ -from numpy cimport ndarray, int64_t - -from tslibs.conversion cimport convert_to_tsobject diff --git a/pandas/_libs/tslib.pyx b/pandas/_libs/tslib.pyx index 149b347dac515..020ac812e1c20 100644 --- a/pandas/_libs/tslib.pyx +++ b/pandas/_libs/tslib.pyx @@ -36,7 +36,7 @@ from tslibs.np_datetime cimport (check_dts_bounds, dayofweek, is_leapyear) from tslibs.np_datetime import OutOfBoundsDatetime -from .tslibs.parsing import parse_datetime_string +from tslibs.parsing import parse_datetime_string cimport cython from cython cimport Py_ssize_t From f9cbfe95d4f3352129f2e4778ee8a65cad182bd1 Mon Sep 17 00:00:00 2001 From: Brock Mendel Date: Wed, 29 Nov 2017 09:21:06 -0800 Subject: [PATCH 3/3] declare conversion in lib pxdfiles --- setup.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 37be0b696503d..da897b0b539b6 100755 --- a/setup.py +++ b/setup.py @@ -517,7 +517,9 @@ def pxd(name): 'depends': _pxi_dep['join']}, '_libs.lib': { 'pyxfile': '_libs/lib', - 'pxdfiles': ['_libs/src/util', '_libs/missing'], + 'pxdfiles': ['_libs/src/util', + '_libs/missing', + '_libs/tslibs/conversion'], 'depends': lib_depends + tseries_depends}, '_libs.missing': { 'pyxfile': '_libs/missing',