123456789101112131415161718192021222324 |
- #!/usr/bin/env python2
- class Team:
- teamId = ""
- points = 0
- region = ""
- def __init__(self, _input):
- if len(_input) < 2 or len(_input) > 3:
- raise ValueError()
- self.teamId = "/".join(sorted(_input[0].split("/"), key=lambda a: int(a))) if "/" in _input[0] else _input[0]
- self.region = _input[1].upper()
- if len(_input) == 3:
- self.points = int(_input[2])
- def __eq__(self, other):
- return type(self) == type(other) and self.teamId == other.teamId and self.region == other.region
- def __ne__(self, other):
- return not __eq(self, other)
- def __hash__(self):
- return hash(self.teamId + "\x0E\x0F" + self.region)
|