mirror of
https://github.com/coding-horror/basic-computer-games.git
synced 2025-12-28 05:33:48 -08:00
Fixes the type check failures for python implementations, boxing.py and Stock_Market.py
This commit is contained in:
@@ -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()
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user