Skip to content

CLN: Remove unused imports in pyx files #21802

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

Closed
wants to merge 2 commits into from
Closed
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
4 changes: 1 addition & 3 deletions pandas/_libs/lib.pyx
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
# cython: profile=False
import operator

cimport cython
from cython cimport Py_ssize_t

Expand Down Expand Up @@ -29,7 +27,7 @@ from cpython.datetime cimport (PyDateTime_Check, PyDate_Check,
PyDateTime_IMPORT)
PyDateTime_IMPORT

from tslib import NaT, array_to_datetime
from tslib import array_to_datetime
from missing cimport checknull


Expand Down
1 change: 0 additions & 1 deletion pandas/_libs/missing.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ cimport util

from tslibs.np_datetime cimport get_timedelta64_value, get_datetime64_value
from tslibs.nattype import NaT
from tslibs.nattype cimport is_null_datetimelike

cdef double INF = <double> np.inf
cdef double NEGINF = -INF
Expand Down
3 changes: 1 addition & 2 deletions pandas/_libs/tslib.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,13 @@ import pytz


from tslibs.timedeltas cimport cast_from_unit
from tslibs.timedeltas import Timedelta, ints_to_pytimedelta # noqa:F841
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just to document, pandas.__init__ essentially grabs Timedelta from here (via pandas._libs.__init__). I think the fix is just to make sure Timedelta is directly grabbed from pandas/_libs/tslibs/timedeltas.pyx

from tslibs.timezones cimport (is_utc, is_tzlocal, is_fixed_offset,
treat_tz_as_pytz, get_dst_info)
from tslibs.conversion cimport (tz_convert_single, _TSObject,
convert_datetime_to_tsobject,
get_datetime64_nanos,
tz_convert_utc_to_tzlocal)
from tslibs.conversion import tz_convert_single, normalize_date # noqa:F841
from tslibs.conversion import tz_convert_single

from tslibs.nattype import NaT, nat_strings, iNaT
from tslibs.nattype cimport checknull_with_nat, NPY_NAT
Expand Down
1 change: 0 additions & 1 deletion pandas/_libs/tslibs/frequencies.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import re
cimport cython

cimport numpy as cnp
from numpy cimport int64_t
cnp.import_array()

from util cimport is_integer_object, is_string_object
Expand Down
2 changes: 0 additions & 2 deletions pandas/_libs/tslibs/offsets.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ from cpython.datetime cimport (PyDateTime_IMPORT, PyDateTime_CheckExact,
PyDateTime_IMPORT

from dateutil.relativedelta import relativedelta
from pytz import UTC

import numpy as np
cimport numpy as cnp
Expand All @@ -24,7 +23,6 @@ from util cimport is_string_object, is_integer_object
from ccalendar import MONTHS, DAYS
from ccalendar cimport get_days_in_month, dayofweek
from conversion cimport tz_convert_single, pydt_to_i8, localize_pydatetime
from frequencies cimport get_freq_code
from nattype cimport NPY_NAT
from np_datetime cimport (pandas_datetimestruct,
dtstruct_to_dt64, dt64_to_dtstruct)
Expand Down
5 changes: 0 additions & 5 deletions pandas/_libs/tslibs/parsing.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,6 @@ Parsing functions for datetime and datetime-like strings.
import sys
import re

from cpython cimport PyString_Check, PyUnicode_Check

from libc.stdlib cimport free

cimport cython
from cython cimport Py_ssize_t

Expand All @@ -34,7 +30,6 @@ else:
# dateutil compat
from dateutil.tz import (tzoffset,
tzlocal as _dateutil_tzlocal,
tzfile as _dateutil_tzfile,
tzutc as _dateutil_tzutc,
tzstr as _dateutil_tzstr)
from dateutil.relativedelta import relativedelta
Expand Down
4 changes: 2 additions & 2 deletions pandas/_libs/tslibs/period.pyx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
# cython: profile=False
from datetime import datetime, date, timedelta
from datetime import datetime, date

from cpython cimport (
PyUnicode_Check,
Expand Down Expand Up @@ -37,7 +37,7 @@ cimport util
from util cimport is_period_object, is_string_object, INT32_MIN

from timestamps import Timestamp
from timezones cimport is_utc, is_tzlocal, get_utcoffset, get_dst_info
from timezones cimport is_utc, is_tzlocal, get_dst_info
from timedeltas cimport delta_to_nanoseconds

cimport ccalendar
Expand Down
4 changes: 1 addition & 3 deletions pandas/_libs/tslibs/resolution.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,10 @@ from pandas._libs.khash cimport (khiter_t,
kh_init_int64, kh_int64_t,
kh_resize_int64, kh_get_int64)

from cpython.datetime cimport datetime

from np_datetime cimport pandas_datetimestruct, dt64_to_dtstruct
from frequencies cimport get_freq_code
from timezones cimport (is_utc, is_tzlocal,
maybe_get_tz, get_dst_info, get_utcoffset)
maybe_get_tz, get_dst_info)
from fields import build_field_sarray
from conversion import tz_convert
from conversion cimport tz_convert_utc_to_tzlocal
Expand Down
1 change: 0 additions & 1 deletion pandas/_libs/tslibs/strptime.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ import numpy as np
from numpy cimport ndarray, int64_t

from datetime import date as datetime_date
from cpython.datetime cimport datetime

from np_datetime cimport (check_dts_bounds,
dtstruct_to_dt64, pandas_datetimestruct)
Expand Down
3 changes: 1 addition & 2 deletions pandas/_libs/window.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,7 @@ cdef extern from "../src/headers/cmath" namespace "std":
cimport util
from util cimport numeric

from skiplist cimport (IndexableSkiplist,
node_t, skiplist_t,
from skiplist cimport (skiplist_t,
skiplist_init, skiplist_destroy,
skiplist_get, skiplist_insert, skiplist_remove)

Expand Down