Skip to content

Commit

Permalink
Fixes the type check failures for python implementations, boxing.py a…
Browse files Browse the repository at this point in the history
…nd Stock_Market.py
  • Loading branch information
aldrinm committed Sep 24, 2024
1 parent 6a4936c commit a56a42f
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions 15_Boxing/python/boxing.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import random
from dataclasses import dataclass
from pathlib import Path
from typing import Dict, Literal, NamedTuple, Tuple
from typing import Dict, Literal, NamedTuple, Tuple, cast


class PunchProfile(NamedTuple):
Expand Down Expand Up @@ -70,7 +70,7 @@ def read_punch_profiles(filepath: Path) -> Dict[Literal[1, 2, 3, 4], PunchProfil
with open(filepath) as f:
punch_profile_dict = json.load(f)
return {
int(key): PunchProfile(**value)
cast(Literal[1, 2, 3, 4], int(key)): PunchProfile(**value)
for key, value in punch_profile_dict.items()
}

Expand Down
2 changes: 1 addition & 1 deletion 83_Stock_Market/python/Stock_Market.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def total_assets(self) -> float:
return self.cash_assets + self.stock_assets

def _generate_day_change(self) -> None:
self.changes = []
self.changes: List[float] = []
self.changes.extend(
round(random.uniform(-5, 5), 2) for _ in range(len(self.data))
)
Expand Down

0 comments on commit a56a42f

Please sign in to comment.