Fixes the type check failures for python implementations, boxing.py and Stock_Market.py

This commit is contained in:
Aldrin Misquitta
2024-09-24 15:02:21 +04:00
parent 6a4936c088
commit a56a42f52b
2 changed files with 3 additions and 3 deletions

View File

@@ -3,7 +3,7 @@ import json
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):
@@ -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()
}

View File

@@ -34,7 +34,7 @@ class Stock_Market:
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))
)