Skip to content

Commit

Permalink
Remove unused cimports (pandas-dev#17585)
Browse files Browse the repository at this point in the history
  • Loading branch information
jbrockmendel authored and alanbato committed Nov 10, 2017
1 parent 29eb4ed commit 65cc398
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 392 deletions.
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

0 comments on commit 65cc398

Please sign in to comment.