@@ -194,8 +194,6 @@ def rollback(self, someDate):
194194
195195 def rollforward (self , dt ):
196196 """Roll provided date forward to next offset only if not on offset"""
197- if isinstance (dt , np .datetime64 ):
198- dt = Timestamp (dt )
199197 if not self .onOffset (dt ):
200198 dt = dt + self .__class__ (1 , ** self .kwds )
201199 return dt
@@ -297,8 +295,6 @@ def apply(self, other):
297295 'datetime or timedelta!' )
298296 @classmethod
299297 def onOffset (cls , dt ):
300- if isinstance (dt , np .datetime64 ):
301- dt = Timestamp (dt )
302298 return dt .weekday () < 5
303299
304300
@@ -636,8 +632,6 @@ def apply(self, other):
636632 first = _get_firstbday (wkday )
637633
638634 monthsSince = (other .month - self .startingMonth ) % 3
639- if monthsSince == 3 : # on offset
640- monthsSince = 0
641635
642636 if n <= 0 and monthsSince != 0 : # make sure to roll forward so negate
643637 monthsSince = monthsSince - 3
@@ -728,9 +722,6 @@ def apply(self, other):
728722
729723 monthsSince = (other .month - self .startingMonth ) % 3
730724
731- if monthsSince == 3 : # on an offset
732- monthsSince = 0
733-
734725 if n <= 0 and monthsSince != 0 :
735726 # make sure you roll forward, so negate
736727 monthsSince = monthsSince - 3
@@ -756,7 +747,7 @@ def __init__(self, n=1, **kwds):
756747 self .month = kwds .get ('month' , 12 )
757748
758749 if self .month < 1 or self .month > 12 :
759- raise Exception ('Month must go from 1 to 12' )
750+ raise ValueError ('Month must go from 1 to 12' )
760751
761752 DateOffset .__init__ (self , n = n , ** kwds )
762753
@@ -803,7 +794,7 @@ def __init__(self, n=1, **kwds):
803794 self .month = kwds .get ('month' , 1 )
804795
805796 if self .month < 1 or self .month > 12 :
806- raise Exception ('Month must go from 1 to 12' )
797+ raise ValueError ('Month must go from 1 to 12' )
807798
808799 DateOffset .__init__ (self , n = n , ** kwds )
809800
@@ -845,7 +836,7 @@ def __init__(self, n=1, **kwds):
845836 self .month = kwds .get ('month' , 12 )
846837
847838 if self .month < 1 or self .month > 12 :
848- raise Exception ('Month must go from 1 to 12' )
839+ raise ValueError ('Month must go from 1 to 12' )
849840
850841 DateOffset .__init__ (self , n = n , ** kwds )
851842
@@ -911,7 +902,7 @@ def __init__(self, n=1, **kwds):
911902 self .month = kwds .get ('month' , 12 )
912903
913904 if self .month < 1 or self .month > 12 :
914- raise Exception ('Month must go from 1 to 12' )
905+ raise ValueError ('Month must go from 1 to 12' )
915906
916907 DateOffset .__init__ (self , n = n , ** kwds )
917908
@@ -1012,7 +1003,7 @@ def _delta_to_tick(delta):
10121003 return Milli (nanos // 1000000 )
10131004 elif nanos % 1000 == 0 :
10141005 return Micro (nanos // 1000 )
1015- else :
1006+ else : # pragma: no cover
10161007 return Nano (nanos )
10171008
10181009def _delta_to_nanoseconds (delta ):
@@ -1114,9 +1105,6 @@ def generate_range(start=None, end=None, periods=None,
11141105 end = None
11151106 periods = 0
11161107
1117- if _count_not_none (start , end , periods ) < 2 :
1118- raise ValueError ('Must specify 2 of start, end, periods' )
1119-
11201108 if end is None :
11211109 end = start + (periods - 1 ) * offset
11221110
0 commit comments