Skip to content

Commit

Permalink
feat(version): add all operators to TripletVersion class (#15)
Browse files Browse the repository at this point in the history
  • Loading branch information
MartinBelthle authored Sep 24, 2024
1 parent acb56e8 commit 6a8c43f
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/antares/study/version/model/study_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,17 @@ def __lt__(self, other):
def __le__(self, other):
return self.__lt__(other) or self.__eq__(other)

def __gt__(self, other):
if isinstance(other, _TripletVersion):
return (self.major, self.minor, self.patch).__gt__((other.major, other.minor, other.patch))
elif isinstance(other, (int, str, t.Sequence, t.Mapping)):
return self.__gt__(self.parse(other))
else:
return NotImplemented

def __ge__(self, other):
return self.__gt__(other) or self.__eq__(other)

# Format method

def __format__(self, format_spec: str) -> str:
Expand Down

0 comments on commit 6a8c43f

Please sign in to comment.