Skip to content

Commit

Permalink
Add ByNameEnum superclass for Region and Role for name based accessing
Browse files Browse the repository at this point in the history
  • Loading branch information
thearyadev committed Jan 19, 2024
1 parent 92d6136 commit 2b594de
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions leaderboards/leaderboard_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,22 @@

import numpy as np


class Region(Enum):
class ByNameEnum(Enum):
@classmethod
def by_name(cls, name):
for enum_member, _ in cls.__members__.items():
if enum_member == name:
return cls[enum_member]
return None

class Region(ByNameEnum):
AMERICAS = 1
EUROPE = 2
ASIA = 3
ALL = 4


class Role(Enum):
class Role(ByNameEnum):
TANK = 1
DAMAGE = 2
SUPPORT = 3
Expand Down

0 comments on commit 2b594de

Please sign in to comment.