fix: typing issues

This commit is contained in:
283375 2023-11-02 00:21:33 +08:00
parent 0764308638
commit 92fcc53015
Signed by: 283375
SSH Key Fingerprint: SHA256:UcX0qg6ZOSDOeieKPGokA5h7soykG61nz2uxuQgVLSk
3 changed files with 13 additions and 14 deletions

View File

@ -29,4 +29,4 @@ profile = "black"
src_paths = ["src/arcaea_offline"]
[tool.pyright]
ignore = ["**/__debug*.*"]
ignore = ["build/"]

View File

@ -97,9 +97,8 @@ class LegacyMapStepBooster(StepBooster):
def final_value(self) -> Decimal:
stamina_multiplier = Decimal(self.stamina)
if self.fragments is None:
fragments_multiplier = Decimal(1)
elif self.fragments == 100:
fragments_multiplier = Decimal(1)
if self.fragments == 100:
fragments_multiplier = Decimal("1.1")
elif self.fragments == 250:
fragments_multiplier = Decimal("1.25")
@ -118,7 +117,7 @@ def calculate_step_original(
*,
partner_bonus: Optional[PartnerBonus] = None,
step_booster: Optional[StepBooster] = None,
):
) -> Decimal:
ptt = play_result.play_rating
step = play_result.partner_step
if partner_bonus:
@ -128,13 +127,13 @@ def calculate_step_original(
partner_bonus_step = Decimal("0")
partner_bonus_multiplier = Decimal("1.0")
play_result = (Decimal("2.45") * ptt.sqrt() + Decimal("2.5")) * (step / 50)
play_result += partner_bonus_step
play_result *= partner_bonus_multiplier
result = (Decimal("2.45") * ptt.sqrt() + Decimal("2.5")) * (step / 50)
result += partner_bonus_step
result *= partner_bonus_multiplier
if step_booster:
play_result *= step_booster.final_value()
result *= step_booster.final_value()
return play_result
return result
def calculate_step(
@ -142,12 +141,12 @@ def calculate_step(
*,
partner_bonus: Optional[PartnerBonus] = None,
step_booster: Optional[StepBooster] = None,
):
play_result_original = calculate_step_original(
) -> Decimal:
result_original = calculate_step_original(
play_result, partner_bonus=partner_bonus, step_booster=step_booster
)
return round(play_result_original, 1)
return round(result_original, 1)
def calculate_play_rating_from_step(

View File

@ -86,7 +86,7 @@ class ArcaeaParser:
# or maybe a `pathlib.Path` subset
# or an `importlib.resources.abc.Traversable` like object
# e.g. `zipfile.Path`
file_handle = self.filepath.open(mode="r", encoding="utf-8")
file_handle = self.filepath.open(mode="r", encoding="utf-8") # type: ignore
except Exception as e:
raise ValueError("Invalid `filepath`.") from e