55from datetime import time
66from datetime import timedelta
77from typing import TYPE_CHECKING
8- from typing import Optional
98from typing import cast
109from typing import overload
1110
2120
2221
2322if TYPE_CHECKING :
24- from typing_extensions import Literal
23+ from typing import Literal
24+
2525 from typing_extensions import Self
2626 from typing_extensions import SupportsIndex
2727
@@ -174,7 +174,7 @@ def __sub__(self, other: time) -> pendulum.Duration: ...
174174 def __sub__ (self , other : datetime .timedelta ) -> Time : ...
175175
176176 def __sub__ (self , other : time | datetime .timedelta ) -> pendulum .Duration | Time :
177- if not isinstance (other , ( Time , time , timedelta ) ):
177+ if not isinstance (other , Time | time | timedelta ):
178178 return NotImplemented
179179
180180 if isinstance (other , timedelta ):
@@ -197,7 +197,7 @@ def __rsub__(self, other: time) -> pendulum.Duration: ...
197197 def __rsub__ (self , other : datetime .timedelta ) -> Time : ...
198198
199199 def __rsub__ (self , other : time | datetime .timedelta ) -> pendulum .Duration | Time :
200- if not isinstance (other , ( Time , time ) ):
200+ if not isinstance (other , Time | time ):
201201 return NotImplemented
202202
203203 if isinstance (other , time ):
@@ -284,7 +284,7 @@ def replace(
284284 minute ,
285285 second ,
286286 microsecond ,
287- tzinfo = cast ("Optional[ datetime.tzinfo] " , tzinfo ),
287+ tzinfo = cast ("datetime.tzinfo | None " , tzinfo ),
288288 fold = fold ,
289289 )
290290 return self .__class__ (
0 commit comments