@@ -289,7 +289,7 @@ def endswith(self, ending: str) -> bool:
289
289
def split (self , s : str ) -> T .List [str ]:
290
290
return self .fname .split (s )
291
291
292
- def __eq__ (self , other : T . Any ) -> bool :
292
+ def __eq__ (self , other : object ) -> bool :
293
293
if not isinstance (other , File ):
294
294
return NotImplemented
295
295
if self .hash != other .hash :
@@ -327,23 +327,23 @@ class OrderedEnum(Enum):
327
327
"""
328
328
An Enum which additionally offers homogeneous ordered comparison.
329
329
"""
330
- def __ge__ (self , other : T . Any ) -> bool :
331
- if self .__class__ is other .__class__ and isinstance (self .value , int ) and isinstance (other .value , int ):
330
+ def __ge__ (self , other : object ) -> bool :
331
+ if self .__class__ is other .__class__ and isinstance (other , OrderedEnum ) and isinstance ( self .value , int ) and isinstance (other .value , int ):
332
332
return self .value >= other .value
333
333
return NotImplemented
334
334
335
- def __gt__ (self , other : T . Any ) -> bool :
336
- if self .__class__ is other .__class__ and isinstance (self .value , int ) and isinstance (other .value , int ):
335
+ def __gt__ (self , other : object ) -> bool :
336
+ if self .__class__ is other .__class__ and isinstance (other , OrderedEnum ) and isinstance ( self .value , int ) and isinstance (other .value , int ):
337
337
return self .value > other .value
338
338
return NotImplemented
339
339
340
- def __le__ (self , other : T . Any ) -> bool :
341
- if self .__class__ is other .__class__ and isinstance (self .value , int ) and isinstance (other .value , int ):
340
+ def __le__ (self , other : object ) -> bool :
341
+ if self .__class__ is other .__class__ and isinstance (other , OrderedEnum ) and isinstance ( self .value , int ) and isinstance (other .value , int ):
342
342
return self .value <= other .value
343
343
return NotImplemented
344
344
345
- def __lt__ (self , other : T . Any ) -> bool :
346
- if self .__class__ is other .__class__ and isinstance (self .value , int ) and isinstance (other .value , int ):
345
+ def __lt__ (self , other : object ) -> bool :
346
+ if self .__class__ is other .__class__ and isinstance (other , OrderedEnum ) and isinstance ( self .value , int ) and isinstance (other .value , int ):
347
347
return self .value < other .value
348
348
return NotImplemented
349
349
@@ -609,32 +609,32 @@ def __str__(self) -> str:
609
609
def __repr__ (self ) -> str :
610
610
return '<Version: {}>' .format (self ._s )
611
611
612
- def __lt__ (self , other : T . Any ) -> bool :
612
+ def __lt__ (self , other : object ) -> bool :
613
613
if isinstance (other , Version ):
614
614
return self .__cmp (other , operator .lt )
615
615
return NotImplemented
616
616
617
- def __gt__ (self , other : T . Any ) -> bool :
617
+ def __gt__ (self , other : object ) -> bool :
618
618
if isinstance (other , Version ):
619
619
return self .__cmp (other , operator .gt )
620
620
return NotImplemented
621
621
622
- def __le__ (self , other : T . Any ) -> bool :
622
+ def __le__ (self , other : object ) -> bool :
623
623
if isinstance (other , Version ):
624
624
return self .__cmp (other , operator .le )
625
625
return NotImplemented
626
626
627
- def __ge__ (self , other : T . Any ) -> bool :
627
+ def __ge__ (self , other : object ) -> bool :
628
628
if isinstance (other , Version ):
629
629
return self .__cmp (other , operator .ge )
630
630
return NotImplemented
631
631
632
- def __eq__ (self , other : T . Any ) -> bool :
632
+ def __eq__ (self , other : object ) -> bool :
633
633
if isinstance (other , Version ):
634
634
return self ._v == other ._v
635
635
return NotImplemented
636
636
637
- def __ne__ (self , other : T . Any ) -> bool :
637
+ def __ne__ (self , other : object ) -> bool :
638
638
if isinstance (other , Version ):
639
639
return self ._v != other ._v
640
640
return NotImplemented
@@ -1115,7 +1115,7 @@ def unholder(item: T.List[_T]) -> T.List[_T]: ...
1115
1115
@T .overload
1116
1116
def unholder (item : T .List [T .Union [_T , 'ObjectHolder[_T]' ]]) -> T .List [_T ]: ...
1117
1117
1118
- def unholder (item ): # type: ignore # TODO for some reason mypy throws the "Function is missing a type annotation" error
1118
+ def unholder (item ): # type: ignore # TODO fix overload (somehow)
1119
1119
"""Get the held item of an object holder or list of object holders."""
1120
1120
if isinstance (item , list ):
1121
1121
return [i .held_object if hasattr (i , 'held_object' ) else i for i in item ]
0 commit comments