Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: refactor following ruff guidelines, removing flake8 #13

Merged
merged 3 commits into from
Jul 6, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
chore: remove if blocks in favor of match
  • Loading branch information
RakuJa committed Jul 6, 2023
commit 06608b412934b31865b3026abb58efaf7f2273fe
82 changes: 42 additions & 40 deletions app/core/resources/schema/enum/difficulty_enum.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,45 +15,47 @@ class DifficultyEnum(Enum):
# I have to introduce a level for impossible things, Needs balancing Paizo help

def get_base_xp_budget(self: Self) -> int:
if self == DifficultyEnum.TRIVIAL:
return 40
if self == DifficultyEnum.LOW:
return 60
if self == DifficultyEnum.MODERATE:
return 80
if self == DifficultyEnum.SEVERE:
return 120
if self == DifficultyEnum.EXTREME:
return 160
if self == DifficultyEnum.IMPOSSIBLE:
return 320

msg = (
f"This enumerator: {self.value} has not been implemented yet,"
f" contact the developer"
)
raise NotImplementedError(
msg,
)
match self:
case DifficultyEnum.TRIVIAL:
return 40
case DifficultyEnum.LOW:
return 60
case DifficultyEnum.MODERATE:
return 80
case DifficultyEnum.SEVERE:
return 120
case DifficultyEnum.EXTREME:
return 160
case DifficultyEnum.IMPOSSIBLE:
return 320
case _:
msg = (
f"This enumerator: {self.value} has not been implemented yet,"
f" contact the developer"
)
raise NotImplementedError(
msg,
)

def get_xp_adjustment(self: Self) -> int:
if self == DifficultyEnum.TRIVIAL:
return 10
if self == DifficultyEnum.LOW:
return 15
if self == DifficultyEnum.MODERATE:
return 20
if self == DifficultyEnum.SEVERE:
return 30
if self == DifficultyEnum.EXTREME:
return 40
if self == DifficultyEnum.IMPOSSIBLE:
return 60

msg = (
f"This enumerator: {self.value} has not been implemented yet,"
f" contact the developer"
)
raise NotImplementedError(
msg,
)
match self:
case DifficultyEnum.TRIVIAL:
return 10
case DifficultyEnum.LOW:
return 15
case DifficultyEnum.MODERATE:
return 20
case DifficultyEnum.SEVERE:
return 30
case DifficultyEnum.EXTREME:
return 40
case DifficultyEnum.IMPOSSIBLE:
return 60
case _:
msg = (
f"This enumerator: {self.value} has not been implemented yet,"
f" contact the developer"
)
raise NotImplementedError(
msg,
)