@@ -168,9 +168,9 @@ def __init__(
168168 isinstance (tzinfo , dt_tzinfo )
169169 and hasattr (tzinfo , "localize" )
170170 and hasattr (tzinfo , "zone" )
171- and tzinfo .zone # type: ignore[attr-defined]
171+ and tzinfo .zone
172172 ):
173- tzinfo = parser .TzinfoParser .parse (tzinfo .zone ) # type: ignore[attr-defined]
173+ tzinfo = parser .TzinfoParser .parse (tzinfo .zone )
174174 elif isinstance (tzinfo , str ):
175175 tzinfo = parser .TzinfoParser .parse (tzinfo )
176176
@@ -792,7 +792,6 @@ def __str__(self) -> str:
792792 return self ._datetime .isoformat ()
793793
794794 def __format__ (self , formatstr : str ) -> str :
795-
796795 if len (formatstr ) > 0 :
797796 return self .format (formatstr )
798797
@@ -804,7 +803,6 @@ def __hash__(self) -> int:
804803 # attributes and properties
805804
806805 def __getattr__ (self , name : str ) -> int :
807-
808806 if name == "week" :
809807 return self .isocalendar ()[1 ]
810808
@@ -965,7 +963,6 @@ def replace(self, **kwargs: Any) -> "Arrow":
965963 absolute_kwargs = {}
966964
967965 for key , value in kwargs .items ():
968-
969966 if key in self ._ATTRS :
970967 absolute_kwargs [key ] = value
971968 elif key in ["week" , "quarter" ]:
@@ -1022,7 +1019,6 @@ def shift(self, **kwargs: Any) -> "Arrow":
10221019 additional_attrs = ["weeks" , "quarters" , "weekday" ]
10231020
10241021 for key , value in kwargs .items ():
1025-
10261022 if key in self ._ATTRS_PLURAL or key in additional_attrs :
10271023 relative_kwargs [key ] = value
10281024 else :
@@ -1263,7 +1259,6 @@ def humanize(
12631259 return locale .describe (granularity , delta , only_distance = only_distance )
12641260
12651261 else :
1266-
12671262 if not granularity :
12681263 raise ValueError (
12691264 "Empty granularity list provided. "
@@ -1367,7 +1362,6 @@ def dehumanize(self, input_string: str, locale: str = "en_us") -> "Arrow":
13671362
13681363 # Search input string for each time unit within locale
13691364 for unit , unit_object in locale_obj .timeframes .items ():
1370-
13711365 # Need to check the type of unit_object to create the correct dictionary
13721366 if isinstance (unit_object , Mapping ):
13731367 strings_to_search = unit_object
@@ -1378,7 +1372,6 @@ def dehumanize(self, input_string: str, locale: str = "en_us") -> "Arrow":
13781372 # Needs to cycle all through strings as some locales have strings that
13791373 # could overlap in a regex match, since input validation isn't being performed.
13801374 for time_delta , time_string in strings_to_search .items ():
1381-
13821375 # Replace {0} with regex \d representing digits
13831376 search_string = str (time_string )
13841377 search_string = search_string .format (r"\d+" )
@@ -1718,7 +1711,6 @@ def for_json(self) -> str:
17181711 # math
17191712
17201713 def __add__ (self , other : Any ) -> "Arrow" :
1721-
17221714 if isinstance (other , (timedelta , relativedelta )):
17231715 return self .fromdatetime (self ._datetime + other , self ._datetime .tzinfo )
17241716
@@ -1736,7 +1728,6 @@ def __sub__(self, other: Union[dt_datetime, "Arrow"]) -> timedelta:
17361728 pass # pragma: no cover
17371729
17381730 def __sub__ (self , other : Any ) -> Union [timedelta , "Arrow" ]:
1739-
17401731 if isinstance (other , (timedelta , relativedelta )):
17411732 return self .fromdatetime (self ._datetime - other , self ._datetime .tzinfo )
17421733
@@ -1749,7 +1740,6 @@ def __sub__(self, other: Any) -> Union[timedelta, "Arrow"]:
17491740 return NotImplemented
17501741
17511742 def __rsub__ (self , other : Any ) -> timedelta :
1752-
17531743 if isinstance (other , dt_datetime ):
17541744 return other - self ._datetime
17551745
@@ -1758,42 +1748,36 @@ def __rsub__(self, other: Any) -> timedelta:
17581748 # comparisons
17591749
17601750 def __eq__ (self , other : Any ) -> bool :
1761-
17621751 if not isinstance (other , (Arrow , dt_datetime )):
17631752 return False
17641753
17651754 return self ._datetime == self ._get_datetime (other )
17661755
17671756 def __ne__ (self , other : Any ) -> bool :
1768-
17691757 if not isinstance (other , (Arrow , dt_datetime )):
17701758 return True
17711759
17721760 return not self .__eq__ (other )
17731761
17741762 def __gt__ (self , other : Any ) -> bool :
1775-
17761763 if not isinstance (other , (Arrow , dt_datetime )):
17771764 return NotImplemented
17781765
17791766 return self ._datetime > self ._get_datetime (other )
17801767
17811768 def __ge__ (self , other : Any ) -> bool :
1782-
17831769 if not isinstance (other , (Arrow , dt_datetime )):
17841770 return NotImplemented
17851771
17861772 return self ._datetime >= self ._get_datetime (other )
17871773
17881774 def __lt__ (self , other : Any ) -> bool :
1789-
17901775 if not isinstance (other , (Arrow , dt_datetime )):
17911776 return NotImplemented
17921777
17931778 return self ._datetime < self ._get_datetime (other )
17941779
17951780 def __le__ (self , other : Any ) -> bool :
1796-
17971781 if not isinstance (other , (Arrow , dt_datetime )):
17981782 return NotImplemented
17991783
@@ -1865,7 +1849,6 @@ def _get_frames(cls, name: _T_FRAMES) -> Tuple[str, str, int]:
18651849 def _get_iteration_params (cls , end : Any , limit : Optional [int ]) -> Tuple [Any , int ]:
18661850 """Sets default end and limit values for range method."""
18671851 if end is None :
1868-
18691852 if limit is None :
18701853 raise ValueError ("One of 'end' or 'limit' is required." )
18711854
0 commit comments