@@ -27,13 +27,12 @@ from datetime cimport (
2727 INT32_MIN)
2828
2929
30- cimport util, lib
30+ cimport util
3131from util cimport is_period_object, is_string_object
3232
33- from lib cimport is_null_datetimelike, is_period
34- from pandas._libs import tslib, lib
35- from pandas._libs.tslib import (Timedelta, Timestamp, iNaT,
36- NaT)
33+ from lib cimport is_null_datetimelike
34+ from pandas._libs import tslib
35+ from pandas._libs.tslib import Timestamp, iNaT, NaT
3736from tslibs.timezones cimport (
3837 is_utc, is_tzlocal, get_utcoffset, _get_dst_info, maybe_get_tz)
3938from tslib cimport _nat_scalar_rules
@@ -485,7 +484,7 @@ def extract_freq(ndarray[object] values):
485484
486485 try :
487486 # now Timestamp / NaT has freq attr
488- if is_period (p):
487+ if is_period_object (p):
489488 return p.freq
490489 except AttributeError :
491490 pass
@@ -728,8 +727,7 @@ cdef class _Period(object):
728727 return hash ((self .ordinal, self .freqstr))
729728
730729 def _add_delta (self , other ):
731- if isinstance (other, (timedelta, np.timedelta64,
732- offsets.Tick, Timedelta)):
730+ if isinstance (other, (timedelta, np.timedelta64, offsets.Tick)):
733731 offset = frequencies.to_offset(self .freq.rule_code)
734732 if isinstance (offset, offsets.Tick):
735733 nanos = tslib._delta_to_nanoseconds(other)
@@ -754,12 +752,11 @@ cdef class _Period(object):
754752 def __add__ (self , other ):
755753 if is_period_object(self ):
756754 if isinstance (other, (timedelta, np.timedelta64,
757- offsets.DateOffset,
758- Timedelta)):
755+ offsets.DateOffset)):
759756 return self ._add_delta(other)
760757 elif other is NaT:
761758 return NaT
762- elif lib.is_integer (other):
759+ elif util.is_integer_object (other):
763760 ordinal = self .ordinal + other * self .freq.n
764761 return Period(ordinal = ordinal, freq = self .freq)
765762 else : # pragma: no cover
@@ -772,11 +769,10 @@ cdef class _Period(object):
772769 def __sub__ (self , other ):
773770 if is_period_object(self ):
774771 if isinstance (other, (timedelta, np.timedelta64,
775- offsets.DateOffset,
776- Timedelta)):
772+ offsets.DateOffset)):
777773 neg_other = - other
778774 return self + neg_other
779- elif lib.is_integer (other):
775+ elif util.is_integer_object (other):
780776 ordinal = self .ordinal - other * self .freq.n
781777 return Period(ordinal = ordinal, freq = self .freq)
782778 elif is_period_object(other):
@@ -1159,7 +1155,7 @@ class Period(_Period):
11591155 raise ValueError ((" Only value or ordinal but not both should be "
11601156 " given but not both" ))
11611157 elif ordinal is not None :
1162- if not lib.is_integer (ordinal):
1158+ if not util.is_integer_object (ordinal):
11631159 raise ValueError (" Ordinal must be an integer" )
11641160 if freq is None :
11651161 raise ValueError (' Must supply freq for ordinal value' )
@@ -1196,8 +1192,8 @@ class Period(_Period):
11961192 elif is_null_datetimelike(value) or value in tslib._nat_strings:
11971193 ordinal = iNaT
11981194
1199- elif is_string_object(value) or lib.is_integer (value):
1200- if lib.is_integer (value):
1195+ elif is_string_object(value) or util.is_integer_object (value):
1196+ if util.is_integer_object (value):
12011197 value = str (value)
12021198 value = value.upper()
12031199 dt, _, reso = parse_time_string(value, freq)
0 commit comments