Skip to content
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

Remove unused cimports #17585

Merged
merged 8 commits into from
Sep 23, 2017
Merged
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
2 changes: 0 additions & 2 deletions pandas/_libs/groupby.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@ cimport cython

cnp.import_array()

cimport util

from numpy cimport (ndarray,
double_t,
int8_t, int16_t, int32_t, int64_t, uint8_t, uint16_t,
Expand Down
2 changes: 0 additions & 2 deletions pandas/_libs/join.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@ from cython cimport Py_ssize_t

np.import_array()

cimport util

from numpy cimport (ndarray,
int8_t, int16_t, int32_t, int64_t, uint8_t, uint16_t,
uint32_t, uint64_t, float16_t, float32_t, float64_t)
Expand Down
30 changes: 13 additions & 17 deletions pandas/_libs/period.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,12 @@ from datetime cimport (
INT32_MIN)


cimport util, lib
cimport util
from util cimport is_period_object, is_string_object

from lib cimport is_null_datetimelike, is_period
from pandas._libs import tslib, lib
from pandas._libs.tslib import (Timedelta, Timestamp, iNaT,
NaT)
from lib cimport is_null_datetimelike
from pandas._libs import tslib
from pandas._libs.tslib import Timestamp, iNaT, NaT
from tslibs.timezones cimport (
is_utc, is_tzlocal, get_utcoffset, _get_dst_info, maybe_get_tz)
from tslib cimport _nat_scalar_rules
Expand Down Expand Up @@ -485,7 +484,7 @@ def extract_freq(ndarray[object] values):

try:
# now Timestamp / NaT has freq attr
if is_period(p):
if is_period_object(p):
return p.freq
except AttributeError:
pass
Expand Down Expand Up @@ -728,8 +727,7 @@ cdef class _Period(object):
return hash((self.ordinal, self.freqstr))

def _add_delta(self, other):
if isinstance(other, (timedelta, np.timedelta64,
offsets.Tick, Timedelta)):
if isinstance(other, (timedelta, np.timedelta64, offsets.Tick)):
offset = frequencies.to_offset(self.freq.rule_code)
if isinstance(offset, offsets.Tick):
nanos = tslib._delta_to_nanoseconds(other)
Expand All @@ -754,12 +752,11 @@ cdef class _Period(object):
def __add__(self, other):
if is_period_object(self):
if isinstance(other, (timedelta, np.timedelta64,
offsets.DateOffset,
Timedelta)):
offsets.DateOffset)):
return self._add_delta(other)
elif other is NaT:
return NaT
elif lib.is_integer(other):
elif util.is_integer_object(other):
ordinal = self.ordinal + other * self.freq.n
return Period(ordinal=ordinal, freq=self.freq)
else: # pragma: no cover
Expand All @@ -772,11 +769,10 @@ cdef class _Period(object):
def __sub__(self, other):
if is_period_object(self):
if isinstance(other, (timedelta, np.timedelta64,
offsets.DateOffset,
Timedelta)):
offsets.DateOffset)):
neg_other = -other
return self + neg_other
elif lib.is_integer(other):
elif util.is_integer_object(other):
ordinal = self.ordinal - other * self.freq.n
return Period(ordinal=ordinal, freq=self.freq)
elif is_period_object(other):
Expand Down Expand Up @@ -1159,7 +1155,7 @@ class Period(_Period):
raise ValueError(("Only value or ordinal but not both should be "
"given but not both"))
elif ordinal is not None:
if not lib.is_integer(ordinal):
if not util.is_integer_object(ordinal):
raise ValueError("Ordinal must be an integer")
if freq is None:
raise ValueError('Must supply freq for ordinal value')
Expand Down Expand Up @@ -1196,8 +1192,8 @@ class Period(_Period):
elif is_null_datetimelike(value) or value in tslib._nat_strings:
ordinal = iNaT

elif is_string_object(value) or lib.is_integer(value):
if lib.is_integer(value):
elif is_string_object(value) or util.is_integer_object(value):
if util.is_integer_object(value):
value = str(value)
value = value.upper()
dt, _, reso = parse_time_string(value, freq)
Expand Down
2 changes: 0 additions & 2 deletions pandas/_libs/reshape.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@ from cython cimport Py_ssize_t

np.import_array()

cimport util

from numpy cimport (ndarray,
int8_t, int16_t, int32_t, int64_t, uint8_t, uint16_t,
uint32_t, uint64_t, float16_t, float32_t, float64_t)
Expand Down
Loading