diff options
| author | Dmitrii Morozov <snoopdesigns@gmail.com> | 2024-03-28 19:17:12 +0100 | 
|---|---|---|
| committer | Dmitrii Morozov <snoopdesigns@gmail.com> | 2024-03-28 19:17:12 +0100 | 
| commit | 657eff0289301ece411b07751113b6a36c6ce79b (patch) | |
| tree | ed87abbbabfdc4c00c2cd656394dad619ccfb2e8 | |
| parent | 30696764787d49c25d90b4241f97cf64523a5678 (diff) | |
| -rw-r--r-- | FortniteStatus.py | 16 | 
1 files changed, 16 insertions, 0 deletions
diff --git a/FortniteStatus.py b/FortniteStatus.py index 8b5054e..7702482 100644 --- a/FortniteStatus.py +++ b/FortniteStatus.py @@ -15,6 +15,11 @@ class FortniteStatus:          def __init__(self, serviceStatuses):              self.serviceStatuses = serviceStatuses +         +        def __eq__(self, other):  +            if not isinstance(other, FortniteStatus.Status): +                return NotImplemented +            return sorted(self.serviceStatuses) == sorted(other.serviceStatuses)          def prettify(self):              return 'Fortnite services status:\n' + '\n'.join([serviceStatus.prettify() for serviceStatus in self.serviceStatuses]) @@ -26,6 +31,17 @@ class FortniteStatus:          def __init__(self, serviceName, status):              self.serviceName = serviceName              self.status = status +         +        def __lt__(self, other): +            if not isinstance(other, FortniteStatus.ServiceStatus): +                return NotImplemented +            return self.serviceName < other.serviceName     +         +        def __eq__(self, other):  +            if not isinstance(other, FortniteStatus.ServiceStatus): +                return NotImplemented +            return self.serviceName == other.serviceName and self.status == other.status +          def prettify(self):              return f'{self.serviceName}, {self.status}'  | 
