@@ -161,8 +161,7 @@ def round_nsint64(values, mode, freq):
161161
162162 # if/elif above should catch all rounding modes defined in enum 'RoundTo':
163163 # if flow of control arrives here, it is a bug
164- raise ValueError (" round_nsint64 called with an unrecognized "
165- " rounding mode" )
164+ raise ValueError (" round_nsint64 called with an unrecognized rounding mode" )
166165
167166
168167# ----------------------------------------------------------------------
@@ -324,8 +323,10 @@ class Timestamp(_Timestamp):
324323
325324 Function is not implemented. Use pd.to_datetime().
326325 """
327- raise NotImplementedError (" Timestamp.strptime() is not implemented."
328- " Use to_datetime() to parse date strings." )
326+ raise NotImplementedError (
327+ " Timestamp.strptime() is not implemented. "
328+ " Use to_datetime() to parse date strings."
329+ )
329330
330331 @classmethod
331332 def combine (cls , date , time ):
@@ -381,8 +382,9 @@ class Timestamp(_Timestamp):
381382 if tzinfo is not None :
382383 if not PyTZInfo_Check(tzinfo):
383384 # tzinfo must be a datetime.tzinfo object, GH#17690
384- raise TypeError (f' tzinfo must be a datetime.tzinfo object, '
385- f' not {type(tzinfo)}' )
385+ raise TypeError (
386+ f" tzinfo must be a datetime.tzinfo object, not {type(tzinfo)}"
387+ )
386388 elif tz is not None :
387389 raise ValueError (' Can provide at most one of tz, tzinfo' )
388390
@@ -393,8 +395,10 @@ class Timestamp(_Timestamp):
393395 # User passed a date string to parse.
394396 # Check that the user didn't also pass a date attribute kwarg.
395397 if any (arg is not None for arg in _date_attributes):
396- raise ValueError (' Cannot pass a date attribute keyword '
397- ' argument when passing a date string' )
398+ raise ValueError (
399+ " Cannot pass a date attribute keyword "
400+ " argument when passing a date string"
401+ )
398402
399403 elif ts_input is _no_input:
400404 # User passed keyword arguments.
@@ -578,8 +582,10 @@ timedelta}, default 'raise'
578582 @tz.setter
579583 def tz (self , value ):
580584 # GH 3746: Prevent localizing or converting the index by setting tz
581- raise AttributeError (" Cannot directly set timezone. Use tz_localize() "
582- " or tz_convert() as appropriate" )
585+ raise AttributeError (
586+ " Cannot directly set timezone. "
587+ " Use tz_localize() or tz_convert() as appropriate"
588+ )
583589
584590 def __setstate__ (self , state ):
585591 self .value = state[0 ]
@@ -598,9 +604,10 @@ timedelta}, default 'raise'
598604
599605 if self .tz is not None :
600606 # GH#21333
601- warnings.warn(" Converting to Period representation will "
602- " drop timezone information." ,
603- UserWarning )
607+ warnings.warn(
608+ " Converting to Period representation will drop timezone information." ,
609+ UserWarning ,
610+ )
604611
605612 if freq is None :
606613 freq = self .freq
@@ -810,13 +817,13 @@ default 'raise'
810817 if ambiguous == ' infer' :
811818 raise ValueError (' Cannot infer offset with only one time.' )
812819
813- nonexistent_options = (' raise' , ' NaT' , ' shift_forward' ,
814- ' shift_backward' )
820+ nonexistent_options = (' raise' , ' NaT' , ' shift_forward' , ' shift_backward' )
815821 if nonexistent not in nonexistent_options and not isinstance (
816822 nonexistent, timedelta):
817- raise ValueError (" The nonexistent argument must be one of 'raise', "
818- " 'NaT', 'shift_forward', 'shift_backward' or "
819- " a timedelta object" )
823+ raise ValueError (
824+ " The nonexistent argument must be one of 'raise', "
825+ " 'NaT', 'shift_forward', 'shift_backward' or a timedelta object"
826+ )
820827
821828 if self .tzinfo is None :
822829 # tz naive, localize
@@ -833,8 +840,9 @@ default 'raise'
833840 value = tz_convert_single(self .value, UTC, self .tz)
834841 return Timestamp(value, tz = tz, freq = self .freq)
835842 else :
836- raise TypeError (' Cannot localize tz-aware Timestamp, use '
837- ' tz_convert for conversions' )
843+ raise TypeError (
844+ " Cannot localize tz-aware Timestamp, use tz_convert for conversions"
845+ )
838846
839847 def tz_convert (self , tz ):
840848 """
@@ -857,17 +865,28 @@ default 'raise'
857865 """
858866 if self .tzinfo is None :
859867 # tz naive, use tz_localize
860- raise TypeError (' Cannot convert tz-naive Timestamp, use '
861- ' tz_localize to localize' )
868+ raise TypeError (
869+ " Cannot convert tz-naive Timestamp, use tz_localize to localize"
870+ )
862871 else :
863872 # Same UTC timestamp, different time zone
864873 return Timestamp(self .value, tz = tz, freq = self .freq)
865874
866875 astimezone = tz_convert
867876
868- def replace (self , year = None , month = None , day = None ,
869- hour = None , minute = None , second = None , microsecond = None ,
870- nanosecond = None , tzinfo = object , fold = 0 ):
877+ def replace (
878+ self ,
879+ year = None ,
880+ month = None ,
881+ day = None ,
882+ hour = None ,
883+ minute = None ,
884+ second = None ,
885+ microsecond = None ,
886+ nanosecond = None ,
887+ tzinfo = object ,
888+ fold = 0 ,
889+ ):
871890 """
872891 implements datetime.replace, handles nanoseconds.
873892
@@ -910,8 +929,9 @@ default 'raise'
910929 def validate (k , v ):
911930 """ validate integers """
912931 if not is_integer_object(v):
913- raise ValueError (f" value must be an integer, received "
914- f" {type(v)} for {k}" )
932+ raise ValueError (
933+ f" value must be an integer, received {type(v)} for {k}"
934+ )
915935 return v
916936
917937 if year is not None :
0 commit comments