2
2
3
3
from typing import NamedTuple
4
4
5
- __version__ = "1.0 .0"
5
+ __version__ = "1.1 .0"
6
6
7
7
8
8
class VersionNo (NamedTuple ):
@@ -13,7 +13,9 @@ class VersionNo(NamedTuple):
13
13
def __str__ (self ) -> str :
14
14
return f"{ self .major } .{ self .minor } .{ self .patch } "
15
15
16
- def __gt__ (self , other : VersionNo ) -> bool :
16
+ def __gt__ (self , other : object ) -> bool :
17
+ if not isinstance (other , VersionNo ):
18
+ return False
17
19
if self == other :
18
20
return False
19
21
if self .major > other .major :
@@ -28,17 +30,18 @@ def __gt__(self, other: VersionNo) -> bool:
28
30
return True
29
31
return False
30
32
31
- def __eq__ (self , other : VersionNo ) -> bool :
33
+ def __eq__ (self , other : object ) -> bool :
32
34
return (
33
- self .major == other .major
35
+ isinstance (other , VersionNo )
36
+ and self .major == other .major
34
37
and self .minor == other .minor
35
38
and self .patch == other .patch
36
39
)
37
40
38
- def __ne__ (self , other : VersionNo ) -> bool :
41
+ def __ne__ (self , other : object ) -> bool :
39
42
return not self .__eq__ (other )
40
43
41
-
42
- def process_version (version : str ) -> VersionNo :
43
- major , minor , patch = version .split ("." )
44
- return VersionNo (int (major ), int (minor ), int (patch ))
44
+ @ staticmethod
45
+ def process_version (version : str ) -> VersionNo :
46
+ major , minor , patch = version .split ("." )
47
+ return VersionNo (int (major ), int (minor ), int (patch ))
0 commit comments