From fd67415b6f19a06bfc0c8d1f7462c02fd830578e Mon Sep 17 00:00:00 2001 From: Kaszanas <34846245+Kaszanas@users.noreply.github.com> Date: Sat, 26 Apr 2025 13:09:12 +0000 Subject: [PATCH 1/7] feat: turned most of sc2data to dataclasses --- .../replay_data/sc2_replay_data.py | 128 ++++++------------ .../replay_parser/details/details.py | 17 +-- .../game_events/events/camera_save.py | 25 ++-- .../game_events/events/camera_update.py | 39 ++---- .../replay_parser/game_events/events/cmd.py | 25 ++-- .../events/cmd_update_target_point.py | 19 +-- .../events/cmd_update_target_unit.py | 19 +-- .../events/command_manager_state.py | 22 ++- .../events/control_group_update.py | 22 ++- .../game_events/events/game_user_leave.py | 19 +-- .../game_events/events/nested/target_2d.py | 9 +- .../game_events/events/selection_delta.py | 22 ++- .../game_events/events/user_options.py | 58 +++----- .../replay_parser/header/header.py | 14 +- .../init_data/game_description.py | 35 ++--- .../replay_parser/init_data/init_data.py | 7 +- .../message_events/events/chat.py | 25 ++-- .../replay_parser/metadata/metadata.py | 19 +-- .../toon_player_desc_map/toon_player_desc.py | 13 +- .../tracker_events/events/player_setup.py | 25 ++-- .../events/player_stats/player_stats.py | 19 +-- .../events/player_stats/stats.py | 125 ++++++----------- .../tracker_events/events/unit_born.py | 35 ++--- .../tracker_events/events/unit_died.py | 37 ++--- .../tracker_events/events/unit_done.py | 19 +-- .../tracker_events/events/unit_init.py | 35 ++--- .../events/unit_owner_change.py | 26 ++-- .../tracker_events/events/unit_positions.py | 20 ++- .../tracker_events/events/unit_type_change.py | 22 ++- .../tracker_events/events/upgrade.py | 22 ++- 30 files changed, 332 insertions(+), 590 deletions(-) diff --git a/src/sc2_datasets/replay_data/sc2_replay_data.py b/src/sc2_datasets/replay_data/sc2_replay_data.py index 8b6ee2b..a0d0225 100644 --- a/src/sc2_datasets/replay_data/sc2_replay_data.py +++ b/src/sc2_datasets/replay_data/sc2_replay_data.py @@ -1,5 +1,6 @@ import json import logging +from dataclasses import dataclass, field from pathlib import Path from typing import Any, Dict @@ -19,16 +20,20 @@ ) +@dataclass class SC2ReplayData: - """ - Specifies a data type that holds information parsed from json representation of a replay. - - Parameters - ---------- - loaded_replay_object : Any - Specifies a parsed Python deserialized json object\ - loaded into memory - """ + filepath: Path + header: Header + initData: InitData + details: Details + metadata: Metadata + messageEvents: list = field(default_factory=list) + gameEvents: list = field(default_factory=list) + trackerEvents: list = field(default_factory=list) + toonPlayerDescMap: list = field(default_factory=list) + gameEventsErr: bool = False + messageEventsErr: bool = False + trackerEventsErr: bool = False @staticmethod def from_file(replay_filepath: str) -> "SC2ReplayData": @@ -61,47 +66,35 @@ def from_file(replay_filepath: str) -> "SC2ReplayData": logging.info(f"Attempting to parse: {str(replay_path)}") with replay_path.open(mode="r", encoding="utf-8") as replay_file: loaded_data = json.load(replay_file) - return SC2ReplayData(filepath=replay_path, loaded_replay_object=loaded_data) - - def __init__(self, filepath: Path, loaded_replay_object: Any) -> None: - # Replay data must contain the path to the json it comes from - # to allow for debugging: - self._filepath = filepath - - self._header = Header.from_dict(d=loaded_replay_object["header"]) - self._initData = InitData.from_dict(d=loaded_replay_object["initData"]) - self._details = Details.from_dict(d=loaded_replay_object["details"]) - self._metadata = Metadata.from_dict(d=loaded_replay_object["metadata"]) - # TODO: We might want this to be a IterableDataset using PyTorch class: - self._messageEvents = [] - if loaded_replay_object["messageEvents"]: - for event_dict in loaded_replay_object["messageEvents"]: - self._messageEvents.append(MessageEventsParser.from_dict(d=event_dict)) - # TODO: We might want this to be a IterableDataset using PyTorch class: - self._gameEvents = [] - if loaded_replay_object["gameEvents"]: - for event_dict in loaded_replay_object["gameEvents"]: - self._gameEvents.append(GameEventsParser.from_dict(d=event_dict)) - # TODO: We might want this to be a IterableDataset using PyTorch class: - self._trackerEvents = [] - if loaded_replay_object["trackerEvents"]: - for event_dict in loaded_replay_object["trackerEvents"]: - self._trackerEvents.append(TrackerEventsParser.from_dict(d=event_dict)) - # TODO: We might want this to be a IterableDataset using PyTorch class: - toon_player_desc_dict: Dict[str, Dict[str, Any]] = loaded_replay_object[ - "ToonPlayerDescMap" - ] - - self._toonPlayerDescMap = [ - ToonPlayerDesc.from_dict(toon=toon, d=player_dict) - for toon, player_dict in toon_player_desc_dict.items() - ] - - self._gameEventsErr: bool = loaded_replay_object["gameEventsErr"] - self._messageEventsErr: bool = loaded_replay_object["messageEventsErr"] - self._trackerEventsErr: bool = loaded_replay_object["trackerEvtsErr"] + return SC2ReplayData( + filepath=replay_path, + header=Header.from_dict(d=loaded_data["header"]), + initData=InitData.from_dict(d=loaded_data["initData"]), + details=Details.from_dict(d=loaded_data["details"]), + metadata=Metadata.from_dict(d=loaded_data["metadata"]), + messageEvents=[ + MessageEventsParser.from_dict(d=event_dict) + for event_dict in loaded_data.get("messageEvents", []) + ], + gameEvents=[ + GameEventsParser.from_dict(d=event_dict) + for event_dict in loaded_data.get("gameEvents", []) + ], + trackerEvents=[ + TrackerEventsParser.from_dict(d=event_dict) + for event_dict in loaded_data.get("trackerEvents", []) + ], + toonPlayerDescMap=[ + ToonPlayerDesc.from_dict(toon=toon, d=player_dict) + for toon, player_dict in loaded_data.get( + "ToonPlayerDescMap", {} + ).items() + ], + gameEventsErr=loaded_data.get("gameEventsErr", False), + messageEventsErr=loaded_data.get("messageEventsErr", False), + trackerEventsErr=loaded_data.get("trackerEvtsErr", False), + ) - # REVIEW: Should the __hash__ be tested? def __hash__(self) -> int: """ Custom hashing function based on the fields that were read from replay. @@ -133,40 +126,3 @@ def __hash__(self) -> int: player_tuple_toon, ) ) - - # REVIEW: Should the properties be documented? - @property - def filepath(self): - return self._filepath - - @property - def initData(self): - return self._initData - - @property - def header(self): - return self._header - - @property - def details(self): - return self._details - - @property - def metadata(self): - return self._metadata - - @property - def messageEvents(self): - return self._messageEvents - - @property - def gameEvents(self): - return self._gameEvents - - @property - def trackerEvents(self): - return self._trackerEvents - - @property - def toonPlayerDescMap(self): - return self._toonPlayerDescMap diff --git a/src/sc2_datasets/replay_parser/details/details.py b/src/sc2_datasets/replay_parser/details/details.py index c00449f..d112796 100644 --- a/src/sc2_datasets/replay_parser/details/details.py +++ b/src/sc2_datasets/replay_parser/details/details.py @@ -1,6 +1,8 @@ +from dataclasses import dataclass from typing import Any, Dict +@dataclass class Details: """ Data type containing details about a StarCraft II game. @@ -18,7 +20,10 @@ class Details: Denotes the time at which the game was started in Coordinated Universal Time. """ - # REVIEW: Doctests for this: + gameSpeed: str + isBlizzardMap: bool + timeUTC: str + @staticmethod def from_dict(d: Dict[str, Any]) -> "Details": """ @@ -62,13 +67,3 @@ def from_dict(d: Dict[str, Any]) -> "Details": isBlizzardMap=d["isBlizzardMap"], timeUTC=d["timeUTC"], ) - - def __init__( - self, - gameSpeed: str, - isBlizzardMap: bool, - timeUTC: str, - ) -> None: - self.gameSpeed = gameSpeed - self.isBlizzardMap = isBlizzardMap - self.timeUTC = timeUTC diff --git a/src/sc2_datasets/replay_parser/game_events/events/camera_save.py b/src/sc2_datasets/replay_parser/game_events/events/camera_save.py index 77ec730..24dc422 100644 --- a/src/sc2_datasets/replay_parser/game_events/events/camera_save.py +++ b/src/sc2_datasets/replay_parser/game_events/events/camera_save.py @@ -1,9 +1,11 @@ +from dataclasses import dataclass from typing import Dict from sc2_datasets.replay_parser.game_events.events.nested.target_2d import Target2D from sc2_datasets.replay_parser.game_events.game_event import GameEvent +@dataclass class CameraSave(GameEvent): """ CameraSave represents replay information regarding a saved camera location within the game. @@ -14,7 +16,7 @@ class CameraSave(GameEvent): Identifier for the CameraSave object. Multiple elements may share the same ID. loop : int Game loop number (game-engine tick) when the event occurred. - target : Target + target : Target2D Target class object containing x and y coordinates where the camera location was set in the game. userid : int ID of the player who saved the camera location. @@ -22,7 +24,12 @@ class CameraSave(GameEvent): Hotkey [0-9] to which the camera location was set. """ - # REVIEW: Doctests here: + id: int + loop: int + target: Target2D + userid: int + which: int + @staticmethod def from_dict(d: Dict) -> "CameraSave": """ @@ -79,17 +86,3 @@ def from_dict(d: Dict) -> "CameraSave": userid=d["userid"]["userId"], which=d["which"], ) - - def __init__( - self, - id: int, - loop: int, - target: Target2D, - userid: int, - which: int, - ) -> None: - self.id = id - self.loop = loop - self.target = target - self.userid = userid - self.which = which diff --git a/src/sc2_datasets/replay_parser/game_events/events/camera_update.py b/src/sc2_datasets/replay_parser/game_events/events/camera_update.py index 3458070..fd1a3c1 100644 --- a/src/sc2_datasets/replay_parser/game_events/events/camera_update.py +++ b/src/sc2_datasets/replay_parser/game_events/events/camera_update.py @@ -1,3 +1,4 @@ +from dataclasses import dataclass from types import NoneType from typing import Dict @@ -5,6 +6,7 @@ from sc2_datasets.replay_parser.game_events.game_event import GameEvent +@dataclass class CameraUpdate(GameEvent): """ CameraUpdate represents replay data regarding updated camera locations in the game. @@ -23,7 +25,7 @@ class CameraUpdate(GameEvent): Angle in the vertical plane, representing the vertical elevation of the camera. reason : None, str No valuable information about this parameter. - target : Target + target : Target2D | None Target class object containing x and y coordinates where the camera location was set. userid : int ID of the player who saved the camera location. @@ -31,9 +33,18 @@ class CameraUpdate(GameEvent): Angle in the horizontal plane of the camera. """ - # REVIEW: Doctests here: + distance: NoneType | float | int + follow: bool + id: int + loop: int + pitch: NoneType | float | int + reason: NoneType | str + target: Target2D | None + userid: int + yaw: NoneType | float | int + @staticmethod - def from_dict(d: Dict): + def from_dict(d: Dict) -> "CameraUpdate": """ Static method returning initialized CameraUpdate class from a dictionary. This aids in parsing the original JSON file extracted from a processed .SC2Replay file. @@ -107,25 +118,3 @@ def from_dict(d: Dict): userid=d["userid"]["userId"], yaw=d["yaw"], ) - - def __init__( - self, - distance: NoneType | float | int, - follow: bool, - id: int, - loop: int, - pitch: NoneType | float | int, - reason: NoneType | str, - target: Target2D | None, - userid: int, - yaw: NoneType | float | int, - ) -> None: - self.distance = distance - self.follow = follow - self.id = id - self.loop = loop - self.pitch = pitch - self.reason = reason - self.target = target - self.userid = userid - self.yaw = yaw diff --git a/src/sc2_datasets/replay_parser/game_events/events/cmd.py b/src/sc2_datasets/replay_parser/game_events/events/cmd.py index 770e532..22e5c0b 100644 --- a/src/sc2_datasets/replay_parser/game_events/events/cmd.py +++ b/src/sc2_datasets/replay_parser/game_events/events/cmd.py @@ -1,3 +1,4 @@ +from dataclasses import dataclass from types import NoneType from typing import Dict @@ -7,6 +8,7 @@ # Should this be encoded somehow if there is a NoneType detected? +@dataclass class Cmd(GameEvent): """ Cmd contains specific details about command interface events. @@ -31,6 +33,13 @@ class Cmd(GameEvent): """ + id: int + loop: int + otherUnit: NoneType + sequence: int + unitGroup: NoneType | int + userid: int + @staticmethod def from_dict(d: Dict) -> "Cmd": """ @@ -57,19 +66,3 @@ def from_dict(d: Dict) -> "Cmd": unitGroup=d["unitGroup"], userid=d["userid"]["userId"], ) - - def __init__( - self, - id: int, - loop: int, - otherUnit: NoneType, - sequence: int, - unitGroup: NoneType | int, - userid: int, - ) -> None: - self.id = id - self.loop = loop - self.otherUnit = otherUnit - self.sequence = sequence - self.unitGroup = unitGroup - self.userid = userid diff --git a/src/sc2_datasets/replay_parser/game_events/events/cmd_update_target_point.py b/src/sc2_datasets/replay_parser/game_events/events/cmd_update_target_point.py index f4446ce..559aa33 100644 --- a/src/sc2_datasets/replay_parser/game_events/events/cmd_update_target_point.py +++ b/src/sc2_datasets/replay_parser/game_events/events/cmd_update_target_point.py @@ -1,9 +1,11 @@ +from dataclasses import dataclass from typing import Dict from sc2_datasets.replay_parser.game_events.events.nested.target_3d import Target3D from sc2_datasets.replay_parser.game_events.game_event import GameEvent +@dataclass class CmdUpdateTargetPoint(GameEvent): """ Data type containing information about a command update issued to a target point. @@ -20,6 +22,11 @@ class CmdUpdateTargetPoint(GameEvent): Specifies the user ID that issued the command. """ + id: int + loop: int + target: Target3D + userid: int + @staticmethod def from_dict(d: Dict) -> "CmdUpdateTargetPoint": """ @@ -42,15 +49,3 @@ def from_dict(d: Dict) -> "CmdUpdateTargetPoint": target=Target3D(x=d["target"]["x"], y=d["target"]["y"], z=d["target"]["z"]), userid=d["userid"]["userId"], ) - - def __init__( - self, - id: int, - loop: int, - target: Target3D, - userid: int, - ) -> None: - self.id = id - self.loop = loop - self.target = target - self.userid = userid diff --git a/src/sc2_datasets/replay_parser/game_events/events/cmd_update_target_unit.py b/src/sc2_datasets/replay_parser/game_events/events/cmd_update_target_unit.py index 66478a1..93682de 100644 --- a/src/sc2_datasets/replay_parser/game_events/events/cmd_update_target_unit.py +++ b/src/sc2_datasets/replay_parser/game_events/events/cmd_update_target_unit.py @@ -1,9 +1,11 @@ +from dataclasses import dataclass from typing import Dict from sc2_datasets.replay_parser.game_events.events.nested.target_unit import TargetUnit from sc2_datasets.replay_parser.game_events.game_event import GameEvent +@dataclass class CmdUpdateTargetUnit(GameEvent): """ Data type containing information about a command update issued to a specific target unit. @@ -20,6 +22,11 @@ class CmdUpdateTargetUnit(GameEvent): Specifies the user ID that issued the command. """ + id: int + loop: int + target: TargetUnit + userid: int + @staticmethod def from_dict(d: Dict) -> "CmdUpdateTargetUnit": """ @@ -42,15 +49,3 @@ def from_dict(d: Dict) -> "CmdUpdateTargetUnit": target=d["target"], userid=d["userid"]["userId"], ) - - def __init__( - self, - id: int, - loop: int, - target: TargetUnit, - userid: int, - ) -> None: - self.id = id - self.loop = loop - self.target = target - self.userid = userid diff --git a/src/sc2_datasets/replay_parser/game_events/events/command_manager_state.py b/src/sc2_datasets/replay_parser/game_events/events/command_manager_state.py index 480445b..75092c6 100644 --- a/src/sc2_datasets/replay_parser/game_events/events/command_manager_state.py +++ b/src/sc2_datasets/replay_parser/game_events/events/command_manager_state.py @@ -1,8 +1,10 @@ +from dataclasses import dataclass from typing import Dict from sc2_datasets.replay_parser.game_events.game_event import GameEvent +@dataclass class CommandManagerState(GameEvent): """ CommandManagerState type contains information about some states during the game, like time, player, etc. @@ -21,6 +23,12 @@ class CommandManagerState(GameEvent): Specifies the ID number of the player who managed the state. For example, in a 1v1 game: [0,1]. """ + id: int + loop: int + sequence: int + state: int + userid: int + @staticmethod def from_dict(d: Dict) -> "CommandManagerState": """ @@ -46,17 +54,3 @@ def from_dict(d: Dict) -> "CommandManagerState": state=d["state"], userid=d["userid"]["userId"], ) - - def __init__( - self, - id: int, - loop: int, - sequence: int, - state: int, - userid: int, - ) -> None: - self.id = id - self.loop = loop - self.sequence = sequence - self.state = state - self.userid = userid diff --git a/src/sc2_datasets/replay_parser/game_events/events/control_group_update.py b/src/sc2_datasets/replay_parser/game_events/events/control_group_update.py index b0fb9cf..e9b3ee9 100644 --- a/src/sc2_datasets/replay_parser/game_events/events/control_group_update.py +++ b/src/sc2_datasets/replay_parser/game_events/events/control_group_update.py @@ -1,8 +1,10 @@ +from dataclasses import dataclass from typing import Dict from sc2_datasets.replay_parser.game_events.game_event import GameEvent +@dataclass class ControlGroupUpdate(GameEvent): """ ControlGroupUpdate is containing some "details" information about @@ -24,6 +26,12 @@ class ControlGroupUpdate(GameEvent): Specifies id number of player who has updated the group control the game. """ + controlGroupIndex: int + controlGroupUpdate: int + id: int + loop: int + userid: int + @staticmethod def from_dict(d: Dict) -> "ControlGroupUpdate": """ @@ -48,17 +56,3 @@ def from_dict(d: Dict) -> "ControlGroupUpdate": loop=d["loop"], userid=d["userid"]["userId"], ) - - def __init__( - self, - controlGroupIndex: int, - controlGroupUpdate: int, - id: int, - loop: int, - userid: int, - ) -> None: - self.controlGroupIndex = controlGroupIndex - self.controlGroupUpdate = controlGroupUpdate - self.id = id - self.loop = loop - self.userid = userid diff --git a/src/sc2_datasets/replay_parser/game_events/events/game_user_leave.py b/src/sc2_datasets/replay_parser/game_events/events/game_user_leave.py index ddfb9c5..e9c60a0 100644 --- a/src/sc2_datasets/replay_parser/game_events/events/game_user_leave.py +++ b/src/sc2_datasets/replay_parser/game_events/events/game_user_leave.py @@ -1,8 +1,10 @@ +from dataclasses import dataclass from typing import Dict from sc2_datasets.replay_parser.game_events.game_event import GameEvent +@dataclass class GameUserLeave(GameEvent): """ Represents information about a player leaving the game. @@ -19,6 +21,11 @@ class GameUserLeave(GameEvent): The ID number of the player who left the game. """ + id: int + leaveReason: int + loop: int + userid: int + @staticmethod def from_dict(d: Dict) -> "GameUserLeave": """ @@ -41,15 +48,3 @@ def from_dict(d: Dict) -> "GameUserLeave": loop=d["loop"], userid=d["userid"]["userId"], ) - - def __init__( - self, - id: int, - leaveReason: int, - loop: int, - userid: int, - ) -> None: - self.id = id - self.leaveReason = leaveReason - self.loop = loop - self.userid = userid diff --git a/src/sc2_datasets/replay_parser/game_events/events/nested/target_2d.py b/src/sc2_datasets/replay_parser/game_events/events/nested/target_2d.py index 074a710..7788432 100644 --- a/src/sc2_datasets/replay_parser/game_events/events/nested/target_2d.py +++ b/src/sc2_datasets/replay_parser/game_events/events/nested/target_2d.py @@ -1,3 +1,7 @@ +from dataclasses import dataclass + + +@dataclass class Target2D: """ Data type holding information about a 2D target point in space. @@ -10,6 +14,5 @@ class Target2D: Specifies the y value of the target. """ - def __init__(self, x: float, y: float) -> None: - self.x = x - self.y = y + x: float + y: float diff --git a/src/sc2_datasets/replay_parser/game_events/events/selection_delta.py b/src/sc2_datasets/replay_parser/game_events/events/selection_delta.py index e5526bc..15bf4f6 100644 --- a/src/sc2_datasets/replay_parser/game_events/events/selection_delta.py +++ b/src/sc2_datasets/replay_parser/game_events/events/selection_delta.py @@ -1,9 +1,11 @@ +from dataclasses import dataclass from typing import Dict from sc2_datasets.replay_parser.game_events.events.nested.delta import Delta from sc2_datasets.replay_parser.game_events.game_event import GameEvent +@dataclass class SelectionDelta(GameEvent): """ SelectionDelta contains details about a player's selection during the game. @@ -22,6 +24,12 @@ class SelectionDelta(GameEvent): Specifies the ID number of the player who executed the selection option in the game. """ + controlGroupId: int + delta: Delta + id: int + loop: int + userid: int + @staticmethod def from_dict(d: Dict) -> "SelectionDelta": """ @@ -44,17 +52,3 @@ def from_dict(d: Dict) -> "SelectionDelta": loop=d["loop"], userid=d["userid"]["userId"], ) - - def __init__( - self, - controlGroupId: int, - delta: Delta, - id: int, - loop: int, - userid: int, - ) -> None: - self.controlGroupId = controlGroupId - self.delta = delta - self.id = id - self.loop = loop - self.userid = userid diff --git a/src/sc2_datasets/replay_parser/game_events/events/user_options.py b/src/sc2_datasets/replay_parser/game_events/events/user_options.py index b1ae2a3..656b72f 100644 --- a/src/sc2_datasets/replay_parser/game_events/events/user_options.py +++ b/src/sc2_datasets/replay_parser/game_events/events/user_options.py @@ -1,8 +1,10 @@ +from dataclasses import dataclass from typing import Dict from sc2_datasets.replay_parser.game_events.game_event import GameEvent +@dataclass class UserOptions(GameEvent): """ Represents UserOptions containing detailed information about a player's settings, @@ -46,6 +48,24 @@ class UserOptions(GameEvent): Availability of information about version flags, default value is 0. """ + baseBuildNum: int + buildNum: int + cameraFollow: bool + debugPauseEnabled: bool + developmentCheatsEnabled: bool + gameFullyDownloaded: bool + hotkeyProfile: str + id: int + isMapToMapTransition: bool + loop: int + multiplayerCheatsEnabled: bool + platformMac: bool + syncChecksummingEnabled: bool + testCheatsEnabled: bool + useGalaxyAsserts: bool + userid: int + versionFlags: int + @staticmethod def from_dict(d: Dict) -> "UserOptions": """ @@ -83,41 +103,3 @@ def from_dict(d: Dict) -> "UserOptions": userid=d["userid"]["userId"], versionFlags=d["versionFlags"], ) - - def __init__( - self, - baseBuildNum: int, - buildNum: int, - cameraFollow: bool, - debugPauseEnabled: bool, - developmentCheatsEnabled: bool, - gameFullyDownloaded: bool, - hotkeyProfile: str, - id: int, - isMapToMapTransition: bool, - loop: int, - multiplayerCheatsEnabled: bool, - platformMac: bool, - syncChecksummingEnabled: bool, - testCheatsEnabled: bool, - useGalaxyAsserts: bool, - userid: int, - versionFlags: int, - ) -> None: - self.baseBuildNum = baseBuildNum - self.buildNum = buildNum - self.cameraFollow = cameraFollow - self.debugPauseEnabled = debugPauseEnabled - self.developmentCheatsEnabled = developmentCheatsEnabled - self.gameFullyDownloaded = gameFullyDownloaded - self.hotkeyProfile = hotkeyProfile - self.id = id - self.isMapToMapTransition = isMapToMapTransition - self.loop = loop - self.multiplayerCheatsEnabled = multiplayerCheatsEnabled - self.platformMac = platformMac - self.syncChecksummingEnabled = syncChecksummingEnabled - self.testCheatsEnabled = testCheatsEnabled - self.useGalaxyAsserts = useGalaxyAsserts - self.userid = userid - self.versionFlags = versionFlags diff --git a/src/sc2_datasets/replay_parser/header/header.py b/src/sc2_datasets/replay_parser/header/header.py index 93d401a..1469287 100644 --- a/src/sc2_datasets/replay_parser/header/header.py +++ b/src/sc2_datasets/replay_parser/header/header.py @@ -1,6 +1,8 @@ +from dataclasses import dataclass from typing import Any, Dict +@dataclass class Header: """ Class representing the parameters of a replay header. @@ -14,6 +16,9 @@ class Header: The game version used by players during the game. """ + elapsedGameLoops: int + version: str + @staticmethod def from_dict(d: Dict[str, Any]) -> "Header": """ @@ -69,16 +74,7 @@ def from_dict(d: Dict[str, Any]) -> "Header": TypeError: unsupported operand type(s) ... """ - return Header( elapsedGameLoops=d["elapsedGameLoops"], version=d["version"], ) - - def __init__( - self, - elapsedGameLoops: int, - version: str, - ) -> None: - self.elapsedGameLoops = elapsedGameLoops - self.version = version diff --git a/src/sc2_datasets/replay_parser/init_data/game_description.py b/src/sc2_datasets/replay_parser/init_data/game_description.py index c489d0b..1a9113d 100644 --- a/src/sc2_datasets/replay_parser/init_data/game_description.py +++ b/src/sc2_datasets/replay_parser/init_data/game_description.py @@ -1,8 +1,10 @@ +from dataclasses import dataclass from typing import Any, Dict from sc2_datasets.replay_parser.init_data.game_options import GameOptions +@dataclass class GameDescription: """ Specifies essential parameters for a StarCraft II replay in the GameDescription. @@ -12,8 +14,7 @@ class GameDescription: gameOptions : GameOptions Options within the game, including settings like fog, random races, competitive mode, etc. gameSpeed : str - The speed at which the game runs.\ - Enumeration: [Slower, Slow, Normal, Fast, Faster]. Default is Faster. + The speed at which the game runs. Enumeration: [Slower, Slow, Normal, Fast, Faster]. Default is Faster. isBlizzardMap : bool Indicates if the map was created by Blizzard. mapAuthorName : str @@ -28,6 +29,15 @@ class GameDescription: The maximum number of players allowed on this map simultaneously. """ + gameOptions: GameOptions + gameSpeed: str + isBlizzardMap: bool + mapAuthorName: str + mapFileSyncChecksum: int + mapSizeX: int + mapSizeY: int + maxPlayers: int + @staticmethod def from_dict(d: Dict[str, Any]) -> "GameDescription": """ @@ -139,7 +149,6 @@ def from_dict(d: Dict[str, Any]) -> "GameDescription": ... TypeError: unsupported operand type(s) ... """ - return GameDescription( gameOptions=GameOptions.from_dict(d=d["gameOptions"]), gameSpeed=d["gameSpeed"], @@ -150,23 +159,3 @@ def from_dict(d: Dict[str, Any]) -> "GameDescription": mapSizeY=d["mapSizeY"], maxPlayers=d["maxPlayers"], ) - - def __init__( - self, - gameOptions: GameOptions, - gameSpeed: str, - isBlizzardMap: bool, - mapAuthorName: str, - mapFileSyncChecksum: int, - mapSizeX: int, - mapSizeY: int, - maxPlayers: int, - ) -> None: - self.gameOptions = gameOptions - self.gameSpeed = gameSpeed - self.isBlizzardMap = isBlizzardMap - self.mapAuthorName = mapAuthorName - self.mapFileSyncChecksum = mapFileSyncChecksum - self.mapSizeX = mapSizeX - self.mapSizeY = mapSizeY - self.maxPlayers = maxPlayers diff --git a/src/sc2_datasets/replay_parser/init_data/init_data.py b/src/sc2_datasets/replay_parser/init_data/init_data.py index b12bfbb..2d5ed69 100644 --- a/src/sc2_datasets/replay_parser/init_data/init_data.py +++ b/src/sc2_datasets/replay_parser/init_data/init_data.py @@ -1,8 +1,10 @@ +from dataclasses import dataclass from typing import Any, Dict from sc2_datasets.replay_parser.init_data.game_description import GameDescription +@dataclass class InitData: """ Data type representing initialization data for a StarCraft II game. @@ -13,6 +15,8 @@ class InitData: An object containing a list of parameters describing the game. """ + gameDescription: GameDescription + @staticmethod def from_dict(d: Dict[str, Any]) -> "InitData": """ @@ -149,6 +153,3 @@ def from_dict(d: Dict[str, Any]) -> "InitData": return InitData( gameDescription=GameDescription.from_dict(d=d["gameDescription"]) ) - - def __init__(self, gameDescription: GameDescription) -> None: - self.gameDescription = gameDescription diff --git a/src/sc2_datasets/replay_parser/message_events/events/chat.py b/src/sc2_datasets/replay_parser/message_events/events/chat.py index 353a761..6a5e04d 100644 --- a/src/sc2_datasets/replay_parser/message_events/events/chat.py +++ b/src/sc2_datasets/replay_parser/message_events/events/chat.py @@ -1,8 +1,10 @@ +from dataclasses import dataclass from typing import Dict from sc2_datasets.replay_parser.message_events.message_event import MessageEvent +@dataclass class Chat(MessageEvent): """ Chat holds information about messages exchanged between players during the game. @@ -21,6 +23,12 @@ class Chat(MessageEvent): Specifies the user ID causing the event. """ + id: int + loop: int + recipient: int + string: str + userid: int + @staticmethod def from_dict(d: Dict) -> "Chat": """ @@ -82,7 +90,7 @@ def from_dict(d: Dict) -> "Chat": >>> assert chat_object.recipient >= 0 >>> assert chat_object.userid >= 0 - **Incorrect Usage Examples:** + **Incorrect Usage Examples:** >>> gameOptions_value_wrong = "False" >>> gameSpeed_value_wrong = True @@ -106,7 +114,6 @@ def from_dict(d: Dict) -> "Chat": ... TypeError: unsupported operand type(s) ... """ - return Chat( id=d["id"], loop=d["loop"], @@ -114,17 +121,3 @@ def from_dict(d: Dict) -> "Chat": string=d["string"], userid=d["userid"]["userId"], ) - - def __init__( - self, - id: int, - loop: int, - recipient: int, - string: str, - userid: int, - ) -> None: - self.id = id - self.loop = loop - self.recipient = recipient - self.string = string - self.userid = userid diff --git a/src/sc2_datasets/replay_parser/metadata/metadata.py b/src/sc2_datasets/replay_parser/metadata/metadata.py index af07fa9..6145c12 100644 --- a/src/sc2_datasets/replay_parser/metadata/metadata.py +++ b/src/sc2_datasets/replay_parser/metadata/metadata.py @@ -1,6 +1,8 @@ +from dataclasses import dataclass from typing import Any, Dict +@dataclass class Metadata: """ Specifies a class which includes parameters about the game, @@ -18,6 +20,11 @@ class Metadata: Specifies a name of the map on which the game was played. """ + baseBuild: str + dataBuild: str + gameVersion: str + mapName: str + @staticmethod def from_dict(d: Dict[str, Any]) -> "Metadata": """ @@ -40,15 +47,3 @@ def from_dict(d: Dict[str, Any]) -> "Metadata": gameVersion=d["gameVersion"], mapName=d["mapName"], ) - - def __init__( - self, - baseBuild: str, - dataBuild: str, - gameVersion: str, - mapName: str, - ) -> None: - self.baseBuild = baseBuild - self.dataBuild = dataBuild - self.gameVersion = gameVersion - self.mapName = mapName diff --git a/src/sc2_datasets/replay_parser/toon_player_desc_map/toon_player_desc.py b/src/sc2_datasets/replay_parser/toon_player_desc_map/toon_player_desc.py index 561ac4b..c491788 100644 --- a/src/sc2_datasets/replay_parser/toon_player_desc_map/toon_player_desc.py +++ b/src/sc2_datasets/replay_parser/toon_player_desc_map/toon_player_desc.py @@ -1,3 +1,4 @@ +from dataclasses import dataclass from typing import Any, Dict # pylama:ignore=E501 @@ -6,6 +7,7 @@ ) +@dataclass class ToonPlayerDesc: """ Specifies ToonPlayerDesc class representation. @@ -18,6 +20,9 @@ class ToonPlayerDesc: Specific a ToonPlayerInfo class object, which includes a list of parameters. """ + toon: str + toon_player_info: ToonPlayerInfo + @staticmethod def from_dict(toon: str, d: Dict[str, Any]) -> "ToonPlayerDesc": """ @@ -34,11 +39,3 @@ def from_dict(toon: str, d: Dict[str, Any]) -> "ToonPlayerDesc": toon=toon, toon_player_info=ToonPlayerInfo.from_dict(d=d), ) - - def __init__( - self, - toon: str, - toon_player_info: ToonPlayerInfo, - ) -> None: - self.toon = toon - self.toon_player_info = toon_player_info diff --git a/src/sc2_datasets/replay_parser/tracker_events/events/player_setup.py b/src/sc2_datasets/replay_parser/tracker_events/events/player_setup.py index 86a9e57..726b1dc 100644 --- a/src/sc2_datasets/replay_parser/tracker_events/events/player_setup.py +++ b/src/sc2_datasets/replay_parser/tracker_events/events/player_setup.py @@ -1,8 +1,10 @@ +from dataclasses import dataclass from typing import Dict from sc2_datasets.replay_parser.tracker_events.tracker_event import TrackerEvent +@dataclass class PlayerSetup(TrackerEvent): """ Data type that denotes a player setup event which is available in tracker events. @@ -24,6 +26,13 @@ class PlayerSetup(TrackerEvent): Specifies the setup user id for the player. """ + id: int + loop: int + playerId: int + slotId: int + type: int + userId: int + @staticmethod def from_dict(d: Dict) -> "PlayerSetup": """ @@ -49,19 +58,3 @@ def from_dict(d: Dict) -> "PlayerSetup": type=d["type"], userId=d["userId"], ) - - def __init__( - self, - id: int, - loop: int, - playerId: int, - slotId: int, - type: int, - userId: int, - ) -> None: - self.id = id - self.loop = loop - self.playerId = playerId - self.slotId = slotId - self.type = type - self.userId = userId diff --git a/src/sc2_datasets/replay_parser/tracker_events/events/player_stats/player_stats.py b/src/sc2_datasets/replay_parser/tracker_events/events/player_stats/player_stats.py index c96a7df..f284cf2 100644 --- a/src/sc2_datasets/replay_parser/tracker_events/events/player_stats/player_stats.py +++ b/src/sc2_datasets/replay_parser/tracker_events/events/player_stats/player_stats.py @@ -1,3 +1,4 @@ +from dataclasses import dataclass from typing import Dict from sc2_datasets.replay_parser.tracker_events.events.player_stats.stats import Stats @@ -6,6 +7,7 @@ from sc2_datasets.replay_parser.tracker_events.tracker_event import TrackerEvent +@dataclass class PlayerStats(TrackerEvent): """ PlayerStats holds information about player economy @@ -22,6 +24,11 @@ class PlayerStats(TrackerEvent): Specifies a custom data type holding the statistics. """ + id: int + loop: int + playerId: int + stats: Stats + @staticmethod def from_dict(d: Dict) -> "PlayerStats": """ @@ -45,15 +52,3 @@ def from_dict(d: Dict) -> "PlayerStats": playerId=d["playerId"], stats=Stats.from_dict(d=d["stats"]), ) - - def __init__( - self, - id: int, - loop: int, - playerId: int, - stats: Stats, - ) -> None: - self.id = id - self.loop = loop - self.playerId = playerId - self.stats = stats diff --git a/src/sc2_datasets/replay_parser/tracker_events/events/player_stats/stats.py b/src/sc2_datasets/replay_parser/tracker_events/events/player_stats/stats.py index 2c75f0e..034bd26 100644 --- a/src/sc2_datasets/replay_parser/tracker_events/events/player_stats/stats.py +++ b/src/sc2_datasets/replay_parser/tracker_events/events/player_stats/stats.py @@ -1,8 +1,10 @@ +from dataclasses import dataclass from typing import Dict from sc2_datasets.replay_parser.tracker_events.tracker_event import TrackerEvent +@dataclass class Stats(TrackerEvent): """ Stats holds specific fields on the economy of a player and is used in PlayerStats event. @@ -100,6 +102,46 @@ class Stats(TrackerEvent): Specifies the number of workers that the player has. """ + foodMade: int + foodUsed: int + mineralsCollectionRate: int + mineralsCurrent: int + mineralsFriendlyFireArmy: int + mineralsFriendlyFireEconomy: int + mineralsFriendlyFireTechnology: int + mineralsKilledArmy: int + mineralsKilledEconomy: int + mineralsKilledTechnology: int + mineralsLostArmy: int + mineralsLostEconomy: int + mineralsLostTechnology: int + mineralsUsedActiveForces: int + mineralsUsedCurrentArmy: int + mineralsUsedCurrentEconomy: int + mineralsUsedCurrentTechnology: int + mineralsUsedInProgressArmy: int + mineralsUsedInProgressEconomy: int + mineralsUsedInProgressTechnology: int + vespeneCollectionRate: int + vespeneCurrent: int + vespeneFriendlyFireArmy: int + vespeneFriendlyFireEconomy: int + vespeneFriendlyFireTechnology: int + vespeneKilledArmy: int + vespeneKilledEconomy: int + vespeneKilledTechnology: int + vespeneLostArmy: int + vespeneLostEconomy: int + vespeneLostTechnology: int + vespeneUsedActiveForces: int + vespeneUsedCurrentArmy: int + vespeneUsedCurrentEconomy: int + vespeneUsedCurrentTechnology: int + vespeneUsedInProgressArmy: int + vespeneUsedInProgressEconomy: int + vespeneUsedInProgressTechnology: int + workersActiveCount: int + @staticmethod def from_dict(d: Dict) -> "Stats": """ @@ -164,86 +206,3 @@ def from_dict(d: Dict) -> "Stats": ], workersActiveCount=d["scoreValueWorkersActiveCount"], ) - - def __init__( - self, - foodMade: int, - foodUsed: int, - mineralsCollectionRate: int, - mineralsCurrent: int, - mineralsFriendlyFireArmy: int, - mineralsFriendlyFireEconomy: int, - mineralsFriendlyFireTechnology: int, - mineralsKilledArmy: int, - mineralsKilledEconomy: int, - mineralsKilledTechnology: int, - mineralsLostArmy: int, - mineralsLostEconomy: int, - mineralsLostTechnology: int, - mineralsUsedActiveForces: int, - mineralsUsedCurrentArmy: int, - mineralsUsedCurrentEconomy: int, - mineralsUsedCurrentTechnology: int, - mineralsUsedInProgressArmy: int, - mineralsUsedInProgressEconomy: int, - mineralsUsedInProgressTechnology: int, - vespeneCollectionRate: int, - vespeneCurrent: int, - vespeneFriendlyFireArmy: int, - vespeneFriendlyFireEconomy: int, - vespeneFriendlyFireTechnology: int, - vespeneKilledArmy: int, - vespeneKilledEconomy: int, - vespeneKilledTechnology: int, - vespeneLostArmy: int, - vespeneLostEconomy: int, - vespeneLostTechnology: int, - vespeneUsedActiveForces: int, - vespeneUsedCurrentArmy: int, - vespeneUsedCurrentEconomy: int, - vespeneUsedCurrentTechnology: int, - vespeneUsedInProgressArmy: int, - vespeneUsedInProgressEconomy: int, - vespeneUsedInProgressTechnology: int, - workersActiveCount: int, - ) -> None: - # This calculation is required for raw data ingestion: - self.foodMade = int(foodMade / 4096) - self.foodUsed = int(foodUsed / 4096) - self.mineralsCollectionRate = mineralsCollectionRate - self.mineralsCurrent = mineralsCurrent - self.mineralsFriendlyFireArmy = mineralsFriendlyFireArmy - self.mineralsFriendlyFireEconomy = mineralsFriendlyFireEconomy - self.mineralsFriendlyFireTechnology = mineralsFriendlyFireTechnology - self.mineralsKilledArmy = mineralsKilledArmy - self.mineralsKilledEconomy = mineralsKilledEconomy - self.mineralsKilledTechnology = mineralsKilledTechnology - self.mineralsLostArmy = mineralsLostArmy - self.mineralsLostEconomy = mineralsLostEconomy - self.mineralsLostTechnology = mineralsLostTechnology - self.mineralsUsedActiveForces = mineralsUsedActiveForces - self.mineralsUsedCurrentArmy = mineralsUsedCurrentArmy - self.mineralsUsedCurrentEconomy = mineralsUsedCurrentEconomy - self.mineralsUsedCurrentTechnology = mineralsUsedCurrentTechnology - self.mineralsUsedInProgressArmy = mineralsUsedInProgressArmy - self.mineralsUsedInProgressEconomy = mineralsUsedInProgressEconomy - self.mineralsUsedInProgressTechnology = mineralsUsedInProgressTechnology - self.vespeneCollectionRate = vespeneCollectionRate - self.vespeneCurrent = vespeneCurrent - self.vespeneFriendlyFireArmy = vespeneFriendlyFireArmy - self.vespeneFriendlyFireEconomy = vespeneFriendlyFireEconomy - self.vespeneFriendlyFireTechnology = vespeneFriendlyFireTechnology - self.vespeneKilledArmy = vespeneKilledArmy - self.vespeneKilledEconomy = vespeneKilledEconomy - self.vespeneKilledTechnology = vespeneKilledTechnology - self.vespeneLostArmy = vespeneLostArmy - self.vespeneLostEconomy = vespeneLostEconomy - self.vespeneLostTechnology = vespeneLostTechnology - self.vespeneUsedActiveForces = vespeneUsedActiveForces - self.vespeneUsedCurrentArmy = vespeneUsedCurrentArmy - self.vespeneUsedCurrentEconomy = vespeneUsedCurrentEconomy - self.vespeneUsedCurrentTechnology = vespeneUsedCurrentTechnology - self.vespeneUsedInProgressArmy = vespeneUsedInProgressArmy - self.vespeneUsedInProgressEconomy = vespeneUsedInProgressEconomy - self.vespeneUsedInProgressTechnology = vespeneUsedInProgressTechnology - self.workersActiveCount = workersActiveCount diff --git a/src/sc2_datasets/replay_parser/tracker_events/events/unit_born.py b/src/sc2_datasets/replay_parser/tracker_events/events/unit_born.py index 1b51f37..a99a334 100644 --- a/src/sc2_datasets/replay_parser/tracker_events/events/unit_born.py +++ b/src/sc2_datasets/replay_parser/tracker_events/events/unit_born.py @@ -1,8 +1,10 @@ +from dataclasses import dataclass from typing import Dict from sc2_datasets.replay_parser.tracker_events.tracker_event import TrackerEvent +@dataclass class UnitBorn(TrackerEvent): """ UnitBorn contains some "details" information about unit @@ -30,6 +32,17 @@ class UnitBorn(TrackerEvent): Specifies y coordinate of map in pixels where the object was created. """ + controlPlayerId: int + id: int + loop: int + unitTagIndex: int + unitTagRecycle: int + unitTypeName: str + upkeepPlayerId: int + x: int + y: int + + @staticmethod def from_dict(d: Dict) -> "UnitBorn": """ Static method returning initialized UnitBorn class from a dictionary. @@ -57,25 +70,3 @@ def from_dict(d: Dict) -> "UnitBorn": x=d["x"], y=d["y"], ) - - def __init__( - self, - controlPlayerId: int, - id: int, - loop: int, - unitTagIndex: int, - unitTagRecycle: int, - unitTypeName: str, - upkeepPlayerId: int, - x: int, - y: int, - ) -> None: - self.controlPlayerId = controlPlayerId - self.id = id - self.loop = loop - self.unitTagIndex = unitTagIndex - self.unitTagRecycle = unitTagRecycle - self.unitTypeName = unitTypeName - self.upkeepPlayerId = upkeepPlayerId - self.x = x - self.y = y diff --git a/src/sc2_datasets/replay_parser/tracker_events/events/unit_died.py b/src/sc2_datasets/replay_parser/tracker_events/events/unit_died.py index 2194fa7..a99cf9d 100644 --- a/src/sc2_datasets/replay_parser/tracker_events/events/unit_died.py +++ b/src/sc2_datasets/replay_parser/tracker_events/events/unit_died.py @@ -1,8 +1,10 @@ +from dataclasses import dataclass from typing import Dict from sc2_datasets.replay_parser.tracker_events.tracker_event import TrackerEvent +@dataclass class UnitDied(TrackerEvent): """ UnitDied contains some "details" information about unit @@ -30,6 +32,17 @@ class UnitDied(TrackerEvent): Specifies y coordinate of map in pixels where the object was destroyed. """ + id: int + killerPlayerId: int + killerUnitTagIndex: int + killerUnitTagRecycle: int + loop: int + unitTagIndex: int + unitTagRecycle: int + x: int + y: int + + @staticmethod def from_dict(d: Dict) -> "UnitDied": """ Static method returning initialized UnitDied class from a dictionary. @@ -53,29 +66,7 @@ def from_dict(d: Dict) -> "UnitDied": killerUnitTagRecycle=d["killerUnitTagRecycle"], loop=d["loop"], unitTagIndex=d["unitTagIndex"], - unitTagRecycle=["unitTagRecycle"], + unitTagRecycle=d["unitTagRecycle"], x=d["x"], y=d["y"], ) - - def __init__( - self, - id: int, - killerPlayerId: int, - killerUnitTagIndex: int, - killerUnitTagRecycle: int, - loop: int, - unitTagIndex: int, - unitTagRecycle: int, - x: int, - y: int, - ) -> None: - self.id = id - self.killerPlayerId = killerPlayerId - self.killerUnitTagIndex = killerUnitTagIndex - self.killerUnitTagRecycle = killerUnitTagRecycle - self.loop = loop - self.unitTagIndex = unitTagIndex - self.unitTagRecycle = unitTagRecycle - self.x = x - self.y = y diff --git a/src/sc2_datasets/replay_parser/tracker_events/events/unit_done.py b/src/sc2_datasets/replay_parser/tracker_events/events/unit_done.py index f4d687f..8a47bb3 100644 --- a/src/sc2_datasets/replay_parser/tracker_events/events/unit_done.py +++ b/src/sc2_datasets/replay_parser/tracker_events/events/unit_done.py @@ -1,8 +1,10 @@ +from dataclasses import dataclass from typing import Dict from sc2_datasets.replay_parser.tracker_events.tracker_event import TrackerEvent +@dataclass class UnitDone(TrackerEvent): """ UnitDone is containing some "details" information about unit at the moment @@ -20,6 +22,11 @@ class UnitDone(TrackerEvent): There is no specific information about this parameter. """ + id: int + loop: int + unitTagIndex: int + unitTagRecycle: int + @staticmethod def from_dict(d: Dict) -> "UnitDone": """ @@ -43,15 +50,3 @@ def from_dict(d: Dict) -> "UnitDone": unitTagIndex=d["unitTagIndex"], unitTagRecycle=d["unitTagRecycle"], ) - - def __init__( - self, - id: int, - loop: int, - unitTagIndex: int, - unitTagRecycle: int, - ) -> None: - self.id = id - self.loop = loop - self.unitTagIndex = unitTagIndex - self.unitTagRecycle = unitTagRecycle diff --git a/src/sc2_datasets/replay_parser/tracker_events/events/unit_init.py b/src/sc2_datasets/replay_parser/tracker_events/events/unit_init.py index 4a7a61e..18f3a73 100644 --- a/src/sc2_datasets/replay_parser/tracker_events/events/unit_init.py +++ b/src/sc2_datasets/replay_parser/tracker_events/events/unit_init.py @@ -1,8 +1,10 @@ +from dataclasses import dataclass from typing import Dict from sc2_datasets.replay_parser.tracker_events.tracker_event import TrackerEvent +@dataclass class UnitInit(TrackerEvent): """ UnitInit holds information about initializing object in the game. @@ -29,6 +31,17 @@ class UnitInit(TrackerEvent): Specifies y coordinate of map in pixels where the object was initialized. """ + controlPlayerId: int + id: int + loop: int + unitTagIndex: int + unitTagRecycle: int + unitTypeName: str + upkeepPlayerId: int + x: int + y: int + + @staticmethod def from_dict(d: Dict) -> "UnitInit": """ Static method returning initialized UnitInit class from a dictionary. @@ -56,25 +69,3 @@ def from_dict(d: Dict) -> "UnitInit": x=d["x"], y=d["y"], ) - - def __init__( - self, - controlPlayerId: int, - id: int, - loop: int, - unitTagIndex: int, - unitTagRecycle: int, - unitTypeName: str, - upkeepPlayerId: int, - x: int, - y: int, - ) -> None: - self.controlPlayerId = controlPlayerId - self.id = id - self.loop = loop - self.unitTagIndex = unitTagIndex - self.unitTagRecycle = unitTagRecycle - self.unitTypeName = unitTypeName - self.upkeepPlayerId = upkeepPlayerId - self.x = x - self.y = y diff --git a/src/sc2_datasets/replay_parser/tracker_events/events/unit_owner_change.py b/src/sc2_datasets/replay_parser/tracker_events/events/unit_owner_change.py index 905f9e1..6e7fc44 100644 --- a/src/sc2_datasets/replay_parser/tracker_events/events/unit_owner_change.py +++ b/src/sc2_datasets/replay_parser/tracker_events/events/unit_owner_change.py @@ -1,8 +1,10 @@ +from dataclasses import dataclass from typing import Dict from sc2_datasets.replay_parser.tracker_events.tracker_event import TrackerEvent +@dataclass class UnitOwnerChange(TrackerEvent): """ UnitOwnerChange holds some detail information about how the unit position @@ -24,6 +26,14 @@ class UnitOwnerChange(TrackerEvent): Specifies an id number of player who was having the control of the unit in the game. """ + controlPlayerId: int + id: int + loop: int + unitTagIndex: int + unitTagRecycle: int + upkeepPlayerId: int + + @staticmethod def from_dict(d: Dict[str, int]) -> "UnitOwnerChange": """ Static method returning initialized UnitOwnerChange class from a dictionary. @@ -48,19 +58,3 @@ def from_dict(d: Dict[str, int]) -> "UnitOwnerChange": unitTagRecycle=d["unitTagRecycle"], upkeepPlayerId=d["upkeepPlayerId"], ) - - def __init__( - self, - controlPlayerId: int, - id: int, - loop: int, - unitTagIndex: int, - unitTagRecycle: int, - upkeepPlayerId: int, - ) -> None: - self.controlPlayerId = controlPlayerId - self.id = id - self.loop = loop - self.unitTagIndex = unitTagIndex - self.unitTagRecycle = unitTagRecycle - self.upkeepPlayerId = upkeepPlayerId diff --git a/src/sc2_datasets/replay_parser/tracker_events/events/unit_positions.py b/src/sc2_datasets/replay_parser/tracker_events/events/unit_positions.py index 146f861..87e5e15 100644 --- a/src/sc2_datasets/replay_parser/tracker_events/events/unit_positions.py +++ b/src/sc2_datasets/replay_parser/tracker_events/events/unit_positions.py @@ -1,8 +1,10 @@ +from dataclasses import dataclass from typing import Dict, List from sc2_datasets.replay_parser.tracker_events.tracker_event import TrackerEvent +@dataclass class UnitPositions(TrackerEvent): """ UnitPositions holds some detail information about how @@ -21,6 +23,12 @@ class UnitPositions(TrackerEvent): Specifies the game loop number (game-engine tick) when at which the event occurred. """ + firstUnitIndex: int + id: int + items: List[int] + loop: int + + @staticmethod def from_dict(d: Dict) -> "UnitPositions": """ Static method returning initialized UnitPositions class from a dictionary. @@ -43,15 +51,3 @@ def from_dict(d: Dict) -> "UnitPositions": items=d["items"], loop=d["loop"], ) - - def __init__( - self, - firstUnitIndex: int, - id: int, - items: List[int], - loop: int, - ) -> None: - self.firstUnitIndex = firstUnitIndex - self.id = id - self.items = items - self.loop = loop diff --git a/src/sc2_datasets/replay_parser/tracker_events/events/unit_type_change.py b/src/sc2_datasets/replay_parser/tracker_events/events/unit_type_change.py index a89ab62..25ea3a0 100644 --- a/src/sc2_datasets/replay_parser/tracker_events/events/unit_type_change.py +++ b/src/sc2_datasets/replay_parser/tracker_events/events/unit_type_change.py @@ -1,8 +1,10 @@ +from dataclasses import dataclass from typing import Dict from sc2_datasets.replay_parser.tracker_events.tracker_event import TrackerEvent +@dataclass class UnitTypeChange(TrackerEvent): """ UnitTypeChange holds the information about how things were changing during the game. @@ -21,6 +23,12 @@ class UnitTypeChange(TrackerEvent): Specifies an in-game object name, who was doing some changes. """ + id: int + loop: int + unitTagIndex: int + unitTagRecycle: int + unitTypeName: str + @staticmethod def from_dict(d: Dict) -> "UnitTypeChange": """ @@ -45,17 +53,3 @@ def from_dict(d: Dict) -> "UnitTypeChange": unitTagRecycle=d["unitTagRecycle"], unitTypeName=d["unitTypeName"], ) - - def __init__( - self, - id: int, - loop: int, - unitTagIndex: int, - unitTagRecycle: int, - unitTypeName: str, - ) -> None: - self.id = id - self.loop = loop - self.unitTagIndex = unitTagIndex - self.unitTagRecycle = unitTagRecycle - self.unitTypeName = unitTypeName diff --git a/src/sc2_datasets/replay_parser/tracker_events/events/upgrade.py b/src/sc2_datasets/replay_parser/tracker_events/events/upgrade.py index d58a69c..98f5fb1 100644 --- a/src/sc2_datasets/replay_parser/tracker_events/events/upgrade.py +++ b/src/sc2_datasets/replay_parser/tracker_events/events/upgrade.py @@ -1,8 +1,10 @@ +from dataclasses import dataclass from typing import Dict from sc2_datasets.replay_parser.tracker_events.tracker_event import TrackerEvent +@dataclass class Upgrade(TrackerEvent): """ Upgrade type containing some "details" information @@ -23,6 +25,12 @@ class Upgrade(TrackerEvent): Specifies a name that upgrade has in the game. """ + count: int + id: int + loop: int + playerId: int + upgradeTypeName: str + @staticmethod def from_dict(d: Dict) -> "Upgrade": """ @@ -47,17 +55,3 @@ def from_dict(d: Dict) -> "Upgrade": playerId=d["playerId"], upgradeTypeName=d["upgradeTypeName"], ) - - def __init__( - self, - count: int, - id: int, - loop: int, - playerId: int, - upgradeTypeName: str, - ) -> None: - self.count = count - self.id = id - self.loop = loop - self.playerId = playerId - self.upgradeTypeName = upgradeTypeName From 6eaf1a6a44e256a610dda048be8ed0833ddd7027 Mon Sep 17 00:00:00 2001 From: Kaszanas <34846245+Kaszanas@users.noreply.github.com> Date: Sat, 26 Apr 2025 14:24:59 +0000 Subject: [PATCH 2/7] feat: full refactor to dataclasses --- .../game_events/events/nested/target_3d.py | 11 +-- .../game_events/events/nested/target_unit.py | 27 +++----- .../toon_player_desc_map/toon_player_info.py | 67 +++++++------------ 3 files changed, 40 insertions(+), 65 deletions(-) diff --git a/src/sc2_datasets/replay_parser/game_events/events/nested/target_3d.py b/src/sc2_datasets/replay_parser/game_events/events/nested/target_3d.py index e31bd41..3e7a5d6 100644 --- a/src/sc2_datasets/replay_parser/game_events/events/nested/target_3d.py +++ b/src/sc2_datasets/replay_parser/game_events/events/nested/target_3d.py @@ -1,3 +1,7 @@ +from dataclasses import dataclass + + +@dataclass class Target3D: """ Data type holding information about a 3D target point in space. @@ -12,7 +16,6 @@ class Target3D: Specifies the z value of the target. """ - def __init__(self, x: float, y: float, z: float) -> None: - self.x = x - self.y = y - self.z = z + x: float + y: float + z: float diff --git a/src/sc2_datasets/replay_parser/game_events/events/nested/target_unit.py b/src/sc2_datasets/replay_parser/game_events/events/nested/target_unit.py index 750865e..6e584b3 100644 --- a/src/sc2_datasets/replay_parser/game_events/events/nested/target_unit.py +++ b/src/sc2_datasets/replay_parser/game_events/events/nested/target_unit.py @@ -1,6 +1,9 @@ +from dataclasses import dataclass + from sc2_datasets.replay_parser.game_events.events.nested.target_3d import Target3D +@dataclass class TargetUnit: """ Specifies information about a targeted unit, although the precise meaning of this data type isn't verified. @@ -23,20 +26,10 @@ class TargetUnit: An unknown parameter. """ - def __init__( - self, - snapshotControlPlayerId: int, - snapshotPoint: Target3D, - snapshotUnitLink: int, - snapshotUpkeepPlayerId: int, - tag: int, - targetUnitFlags: int, - timer: int, - ) -> None: - self.snapshotControlPlayerId = snapshotControlPlayerId - self.snapshotPoint = snapshotPoint - self.snapshotUnitLink = snapshotUnitLink - self.snapshotUpkeepPlayerId = snapshotUpkeepPlayerId - self.tag = tag - self.targetUnitFlags = targetUnitFlags - self.timer = timer + snapshotControlPlayerId: int + snapshotPoint: Target3D + snapshotUnitLink: int + snapshotUpkeepPlayerId: int + tag: int + targetUnitFlags: int + timer: int diff --git a/src/sc2_datasets/replay_parser/toon_player_desc_map/toon_player_info.py b/src/sc2_datasets/replay_parser/toon_player_desc_map/toon_player_info.py index 5a2e8a5..8abb95d 100644 --- a/src/sc2_datasets/replay_parser/toon_player_desc_map/toon_player_info.py +++ b/src/sc2_datasets/replay_parser/toon_player_desc_map/toon_player_info.py @@ -1,8 +1,10 @@ +from dataclasses import dataclass from typing import Any, Dict from sc2_datasets.replay_parser.toon_player_desc_map.color import Color +@dataclass class ToonPlayerInfo: """ Specifies ToonPlayerInfo class representation. @@ -53,6 +55,27 @@ class ToonPlayerInfo: Specifies the color RGBA palette of the player. """ + nickname: str + playerID: int + userID: int + SQ: int + supplyCappedPercent: int + startDir: int + startLocX: int + startLocY: int + race: str + selectedRace: str + APM: int + MMR: int + result: str + region: str + realm: str + highestLeague: str + isInClan: bool + clanTag: str + handicap: int + color: Color + @staticmethod def from_dict(d: Dict[str, Any]) -> "ToonPlayerInfo": """ @@ -92,47 +115,3 @@ def from_dict(d: Dict[str, Any]) -> "ToonPlayerInfo": handicap=d["handicap"], color=Color.from_dict(d=d["color"]), ) - - def __init__( - self, - nickname: str, - playerID: int, - userID: int, - SQ: int, - supplyCappedPercent: int, - startDir: int, - startLocX: int, - startLocY: int, - race: str, - selectedRace: str, - APM: int, - MMR: int, - result: str, - region: str, - realm: str, - highestLeague: str, - isInClan: bool, - clanTag: str, - handicap: int, - color: Color, - ) -> None: - self.nickname = nickname - self.playerID = playerID - self.userID = userID - self.SQ = SQ - self.supplyCappedPercent = supplyCappedPercent - self.startDir = startDir - self.startLocX = startLocX - self.startLocY = startLocY - self.race = race - self.selectedRace = selectedRace - self.APM = APM - self.MMR = MMR - self.result = result - self.region = region - self.realm = realm - self.highestLeague = highestLeague - self.isInClan = isInClan - self.clanTag = clanTag - self.handicap = handicap - self.color = color From a80c0f25d0ffb0a463970f562806fa9737ccb5f0 Mon Sep 17 00:00:00 2001 From: Kaszanas <34846245+Kaszanas@users.noreply.github.com> Date: Sat, 26 Apr 2025 14:25:39 +0000 Subject: [PATCH 3/7] refactor: removed unused import --- src/sc2_datasets/replay_data/sc2_replay_data.py | 1 - 1 file changed, 1 deletion(-) diff --git a/src/sc2_datasets/replay_data/sc2_replay_data.py b/src/sc2_datasets/replay_data/sc2_replay_data.py index a0d0225..652b2b7 100644 --- a/src/sc2_datasets/replay_data/sc2_replay_data.py +++ b/src/sc2_datasets/replay_data/sc2_replay_data.py @@ -2,7 +2,6 @@ import logging from dataclasses import dataclass, field from pathlib import Path -from typing import Any, Dict from sc2_datasets.replay_parser.details.details import Details from sc2_datasets.replay_parser.game_events.game_events_parser import GameEventsParser From 0030a63034853043492885368d34a1cce9b270e2 Mon Sep 17 00:00:00 2001 From: Kaszanas <34846245+Kaszanas@users.noreply.github.com> Date: Sat, 26 Apr 2025 14:32:27 +0000 Subject: [PATCH 4/7] build: bumped package versions --- pyproject.toml | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 7d0584b..a0a0d42 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -13,19 +13,19 @@ version_files = ["pyproject.toml:version"] [tool.poetry.dependencies] python = "^3.11" pytorch-lightning = "^2.5.0" -pandas = "^2.1.4" -tqdm = "^4.66.1" +pandas = "^2.2.3" +tqdm = "^4.67.1" requests = "^2.32.3" [tool.poetry.group.dev.dependencies] pytest = "^8.3.5" -pytest-cov = "^6.0.0" -myst-nb = "^1.0.0" -sphinx-autoapi = "^3.0.0" +pytest-cov = "^6.1.1" +myst-nb = "^1.2.0" +sphinx-autoapi = "^3.6.0" furo = "^2024.8.6" -pre-commit = "^4.1.0" -ruff = "^0.9.10" -commitizen = "^4.4.1" +pre-commit = "^4.2.0" +ruff = "^0.11.7" +commitizen = "^4.6.0" [tool.ruff] target-version = "py311" From f759cf0496e8915767e28d28c638cb1a08f02809 Mon Sep 17 00:00:00 2001 From: Kaszanas <34846245+Kaszanas@users.noreply.github.com> Date: Sat, 26 Apr 2025 14:37:02 +0000 Subject: [PATCH 5/7] build(poetry.lock): fixing poetry lock after version bumps --- poetry.lock | 172 +++++++++++++++++++++++++++------------------------- 1 file changed, 89 insertions(+), 83 deletions(-) diff --git a/poetry.lock b/poetry.lock index bbe0f43..a49bc8b 100644 --- a/poetry.lock +++ b/poetry.lock @@ -1,4 +1,4 @@ -# This file is automatically @generated by Poetry 2.1.1 and should not be changed by hand. +# This file is automatically @generated by Poetry 2.1.2 and should not be changed by hand. [[package]] name = "aiohappyeyeballs" @@ -520,14 +520,14 @@ test = ["pytest"] [[package]] name = "commitizen" -version = "4.4.1" +version = "4.6.0" description = "Python commitizen client tool" optional = false python-versions = "<4.0,>=3.9" groups = ["dev"] files = [ - {file = "commitizen-4.4.1-py3-none-any.whl", hash = "sha256:98dbee784cc74fd1b24915e265e99ce81caccd64e54cb42b347a37d1dd2a4cd8"}, - {file = "commitizen-4.4.1.tar.gz", hash = "sha256:626d9f545fb9b2db42305e16ef35d6348a35081a80527bad863a05a7ba0bec21"}, + {file = "commitizen-4.6.0-py3-none-any.whl", hash = "sha256:d8861707b553c03c8b1993b7abd9e036384fdd1c57f95f6f38d5f215c53041a9"}, + {file = "commitizen-4.6.0.tar.gz", hash = "sha256:cc1c9f8937e59a7c54321443aa49dd246e07b829e305c7cbff1d7f7e32e449fe"}, ] [package.dependencies] @@ -1549,14 +1549,14 @@ files = [ [[package]] name = "myst-nb" -version = "1.1.1" +version = "1.2.0" description = "A Jupyter Notebook Sphinx reader built on top of the MyST markdown parser." optional = false python-versions = ">=3.9" groups = ["dev"] files = [ - {file = "myst_nb-1.1.1-py3-none-any.whl", hash = "sha256:8b8f9085287d948eef46cb3764aafc21915e0e981882b8c742719f5b1a84c36f"}, - {file = "myst_nb-1.1.1.tar.gz", hash = "sha256:74227c11f76d03494f43b7788659b161b94f4dedef230a2912412bc8c3c9e553"}, + {file = "myst_nb-1.2.0-py3-none-any.whl", hash = "sha256:0e09909877848c0cf45e1aecee97481512efa29a0c4caa37870a03bba11c56c1"}, + {file = "myst_nb-1.2.0.tar.gz", hash = "sha256:af459ec753b341952182b45b0a80b4776cebf80c9ee6aaca2a3f4027b440c9de"}, ] [package.dependencies] @@ -1573,8 +1573,8 @@ typing-extensions = "*" [package.extras] code-style = ["pre-commit"] -rtd = ["alabaster", "altair", "bokeh", "coconut (>=1.4.3,<3.1.0)", "ipykernel (>=5.5,<7.0)", "ipywidgets", "jupytext (>=1.11.2,<1.16.0)", "matplotlib", "numpy", "pandas", "plotly", "sphinx-book-theme (>=0.3)", "sphinx-copybutton", "sphinx-design (>=0.4.0,<0.5.0)", "sphinxcontrib-bibtex", "sympy"] -testing = ["beautifulsoup4", "coverage (>=6.4,<8.0)", "ipykernel (>=5.5,<7.0)", "ipython (!=8.1.0,<8.17)", "ipywidgets (>=8)", "jupytext (>=1.11.2,<1.16.0)", "matplotlib (==3.7.*)", "nbdime", "numpy", "pandas (==1.5.*)", "pyarrow", "pytest (>=7.1,<8.0)", "pytest-cov (>=3,<5)", "pytest-param-files (>=0.3.3,<0.4.0)", "pytest-regressions", "sympy (>=1.10.1)"] +rtd = ["alabaster", "altair", "bokeh", "coconut (>=1.4.3)", "ipykernel (>=5.5)", "ipywidgets", "jupytext (>=1.11.2)", "matplotlib", "numpy", "pandas", "plotly", "sphinx-book-theme (>=0.3)", "sphinx-copybutton", "sphinx-design", "sphinxcontrib-bibtex", "sympy"] +testing = ["beautifulsoup4", "coverage (>=6.4)", "ipykernel (>=5.5)", "ipython (!=8.1.0)", "ipywidgets (>=8)", "jupytext (>=1.11.2)", "matplotlib (==3.7.*)", "nbdime", "numpy", "pandas", "pyarrow", "pytest", "pytest-cov (>=3)", "pytest-param-files", "pytest-regressions", "sympy (>=1.10.1)"] [[package]] name = "myst-parser" @@ -1935,41 +1935,54 @@ files = [ [[package]] name = "pandas" -version = "2.2.2" +version = "2.2.3" description = "Powerful data structures for data analysis, time series, and statistics" optional = false python-versions = ">=3.9" groups = ["main"] files = [ - {file = "pandas-2.2.2-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:90c6fca2acf139569e74e8781709dccb6fe25940488755716d1d354d6bc58bce"}, - {file = "pandas-2.2.2-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:c7adfc142dac335d8c1e0dcbd37eb8617eac386596eb9e1a1b77791cf2498238"}, - {file = "pandas-2.2.2-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:4abfe0be0d7221be4f12552995e58723c7422c80a659da13ca382697de830c08"}, - {file = "pandas-2.2.2-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:8635c16bf3d99040fdf3ca3db669a7250ddf49c55dc4aa8fe0ae0fa8d6dcc1f0"}, - {file = "pandas-2.2.2-cp310-cp310-musllinux_1_1_aarch64.whl", hash = "sha256:40ae1dffb3967a52203105a077415a86044a2bea011b5f321c6aa64b379a3f51"}, - {file = "pandas-2.2.2-cp310-cp310-musllinux_1_1_x86_64.whl", hash = "sha256:8e5a0b00e1e56a842f922e7fae8ae4077aee4af0acb5ae3622bd4b4c30aedf99"}, - {file = "pandas-2.2.2-cp310-cp310-win_amd64.whl", hash = "sha256:ddf818e4e6c7c6f4f7c8a12709696d193976b591cc7dc50588d3d1a6b5dc8772"}, - {file = "pandas-2.2.2-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:696039430f7a562b74fa45f540aca068ea85fa34c244d0deee539cb6d70aa288"}, - {file = "pandas-2.2.2-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:8e90497254aacacbc4ea6ae5e7a8cd75629d6ad2b30025a4a8b09aa4faf55151"}, - {file = "pandas-2.2.2-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:58b84b91b0b9f4bafac2a0ac55002280c094dfc6402402332c0913a59654ab2b"}, - {file = "pandas-2.2.2-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:6d2123dc9ad6a814bcdea0f099885276b31b24f7edf40f6cdbc0912672e22eee"}, - {file = "pandas-2.2.2-cp311-cp311-musllinux_1_1_aarch64.whl", hash = "sha256:2925720037f06e89af896c70bca73459d7e6a4be96f9de79e2d440bd499fe0db"}, - {file = "pandas-2.2.2-cp311-cp311-musllinux_1_1_x86_64.whl", hash = "sha256:0cace394b6ea70c01ca1595f839cf193df35d1575986e484ad35c4aeae7266c1"}, - {file = "pandas-2.2.2-cp311-cp311-win_amd64.whl", hash = "sha256:873d13d177501a28b2756375d59816c365e42ed8417b41665f346289adc68d24"}, - {file = "pandas-2.2.2-cp312-cp312-macosx_10_9_x86_64.whl", hash = "sha256:9dfde2a0ddef507a631dc9dc4af6a9489d5e2e740e226ad426a05cabfbd7c8ef"}, - {file = "pandas-2.2.2-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:e9b79011ff7a0f4b1d6da6a61aa1aa604fb312d6647de5bad20013682d1429ce"}, - {file = "pandas-2.2.2-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:1cb51fe389360f3b5a4d57dbd2848a5f033350336ca3b340d1c53a1fad33bcad"}, - {file = "pandas-2.2.2-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:eee3a87076c0756de40b05c5e9a6069c035ba43e8dd71c379e68cab2c20f16ad"}, - {file = "pandas-2.2.2-cp312-cp312-musllinux_1_1_aarch64.whl", hash = "sha256:3e374f59e440d4ab45ca2fffde54b81ac3834cf5ae2cdfa69c90bc03bde04d76"}, - {file = "pandas-2.2.2-cp312-cp312-musllinux_1_1_x86_64.whl", hash = "sha256:43498c0bdb43d55cb162cdc8c06fac328ccb5d2eabe3cadeb3529ae6f0517c32"}, - {file = "pandas-2.2.2-cp312-cp312-win_amd64.whl", hash = "sha256:d187d355ecec3629624fccb01d104da7d7f391db0311145817525281e2804d23"}, - {file = "pandas-2.2.2-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:0ca6377b8fca51815f382bd0b697a0814c8bda55115678cbc94c30aacbb6eff2"}, - {file = "pandas-2.2.2-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:9057e6aa78a584bc93a13f0a9bf7e753a5e9770a30b4d758b8d5f2a62a9433cd"}, - {file = "pandas-2.2.2-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:001910ad31abc7bf06f49dcc903755d2f7f3a9186c0c040b827e522e9cef0863"}, - {file = "pandas-2.2.2-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:66b479b0bd07204e37583c191535505410daa8df638fd8e75ae1b383851fe921"}, - {file = "pandas-2.2.2-cp39-cp39-musllinux_1_1_aarch64.whl", hash = "sha256:a77e9d1c386196879aa5eb712e77461aaee433e54c68cf253053a73b7e49c33a"}, - {file = "pandas-2.2.2-cp39-cp39-musllinux_1_1_x86_64.whl", hash = "sha256:92fd6b027924a7e178ac202cfbe25e53368db90d56872d20ffae94b96c7acc57"}, - {file = "pandas-2.2.2-cp39-cp39-win_amd64.whl", hash = "sha256:640cef9aa381b60e296db324337a554aeeb883ead99dc8f6c18e81a93942f5f4"}, - {file = "pandas-2.2.2.tar.gz", hash = "sha256:9e79019aba43cb4fda9e4d983f8e88ca0373adbb697ae9c6c43093218de28b54"}, + {file = "pandas-2.2.3-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:1948ddde24197a0f7add2bdc4ca83bf2b1ef84a1bc8ccffd95eda17fd836ecb5"}, + {file = "pandas-2.2.3-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:381175499d3802cde0eabbaf6324cce0c4f5d52ca6f8c377c29ad442f50f6348"}, + {file = "pandas-2.2.3-cp310-cp310-manylinux2014_aarch64.manylinux_2_17_aarch64.whl", hash = "sha256:d9c45366def9a3dd85a6454c0e7908f2b3b8e9c138f5dc38fed7ce720d8453ed"}, + {file = "pandas-2.2.3-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:86976a1c5b25ae3f8ccae3a5306e443569ee3c3faf444dfd0f41cda24667ad57"}, + {file = "pandas-2.2.3-cp310-cp310-musllinux_1_2_aarch64.whl", hash = "sha256:b8661b0238a69d7aafe156b7fa86c44b881387509653fdf857bebc5e4008ad42"}, + {file = "pandas-2.2.3-cp310-cp310-musllinux_1_2_x86_64.whl", hash = "sha256:37e0aced3e8f539eccf2e099f65cdb9c8aa85109b0be6e93e2baff94264bdc6f"}, + {file = "pandas-2.2.3-cp310-cp310-win_amd64.whl", hash = "sha256:56534ce0746a58afaf7942ba4863e0ef81c9c50d3f0ae93e9497d6a41a057645"}, + {file = "pandas-2.2.3-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:66108071e1b935240e74525006034333f98bcdb87ea116de573a6a0dccb6c039"}, + {file = "pandas-2.2.3-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:7c2875855b0ff77b2a64a0365e24455d9990730d6431b9e0ee18ad8acee13dbd"}, + {file = "pandas-2.2.3-cp311-cp311-manylinux2014_aarch64.manylinux_2_17_aarch64.whl", hash = "sha256:cd8d0c3be0515c12fed0bdbae072551c8b54b7192c7b1fda0ba56059a0179698"}, + {file = "pandas-2.2.3-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:c124333816c3a9b03fbeef3a9f230ba9a737e9e5bb4060aa2107a86cc0a497fc"}, + {file = "pandas-2.2.3-cp311-cp311-musllinux_1_2_aarch64.whl", hash = "sha256:63cc132e40a2e084cf01adf0775b15ac515ba905d7dcca47e9a251819c575ef3"}, + {file = "pandas-2.2.3-cp311-cp311-musllinux_1_2_x86_64.whl", hash = "sha256:29401dbfa9ad77319367d36940cd8a0b3a11aba16063e39632d98b0e931ddf32"}, + {file = "pandas-2.2.3-cp311-cp311-win_amd64.whl", hash = "sha256:3fc6873a41186404dad67245896a6e440baacc92f5b716ccd1bc9ed2995ab2c5"}, + {file = "pandas-2.2.3-cp312-cp312-macosx_10_9_x86_64.whl", hash = "sha256:b1d432e8d08679a40e2a6d8b2f9770a5c21793a6f9f47fdd52c5ce1948a5a8a9"}, + {file = "pandas-2.2.3-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:a5a1595fe639f5988ba6a8e5bc9649af3baf26df3998a0abe56c02609392e0a4"}, + {file = "pandas-2.2.3-cp312-cp312-manylinux2014_aarch64.manylinux_2_17_aarch64.whl", hash = "sha256:5de54125a92bb4d1c051c0659e6fcb75256bf799a732a87184e5ea503965bce3"}, + {file = "pandas-2.2.3-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:fffb8ae78d8af97f849404f21411c95062db1496aeb3e56f146f0355c9989319"}, + {file = "pandas-2.2.3-cp312-cp312-musllinux_1_2_aarch64.whl", hash = "sha256:6dfcb5ee8d4d50c06a51c2fffa6cff6272098ad6540aed1a76d15fb9318194d8"}, + {file = "pandas-2.2.3-cp312-cp312-musllinux_1_2_x86_64.whl", hash = "sha256:062309c1b9ea12a50e8ce661145c6aab431b1e99530d3cd60640e255778bd43a"}, + {file = "pandas-2.2.3-cp312-cp312-win_amd64.whl", hash = "sha256:59ef3764d0fe818125a5097d2ae867ca3fa64df032331b7e0917cf5d7bf66b13"}, + {file = "pandas-2.2.3-cp313-cp313-macosx_10_13_x86_64.whl", hash = "sha256:f00d1345d84d8c86a63e476bb4955e46458b304b9575dcf71102b5c705320015"}, + {file = "pandas-2.2.3-cp313-cp313-macosx_11_0_arm64.whl", hash = "sha256:3508d914817e153ad359d7e069d752cdd736a247c322d932eb89e6bc84217f28"}, + {file = "pandas-2.2.3-cp313-cp313-manylinux2014_aarch64.manylinux_2_17_aarch64.whl", hash = "sha256:22a9d949bfc9a502d320aa04e5d02feab689d61da4e7764b62c30b991c42c5f0"}, + {file = "pandas-2.2.3-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:f3a255b2c19987fbbe62a9dfd6cff7ff2aa9ccab3fc75218fd4b7530f01efa24"}, + {file = "pandas-2.2.3-cp313-cp313-musllinux_1_2_aarch64.whl", hash = "sha256:800250ecdadb6d9c78eae4990da62743b857b470883fa27f652db8bdde7f6659"}, + {file = "pandas-2.2.3-cp313-cp313-musllinux_1_2_x86_64.whl", hash = "sha256:6374c452ff3ec675a8f46fd9ab25c4ad0ba590b71cf0656f8b6daa5202bca3fb"}, + {file = "pandas-2.2.3-cp313-cp313-win_amd64.whl", hash = "sha256:61c5ad4043f791b61dd4752191d9f07f0ae412515d59ba8f005832a532f8736d"}, + {file = "pandas-2.2.3-cp313-cp313t-macosx_10_13_x86_64.whl", hash = "sha256:3b71f27954685ee685317063bf13c7709a7ba74fc996b84fc6821c59b0f06468"}, + {file = "pandas-2.2.3-cp313-cp313t-macosx_11_0_arm64.whl", hash = "sha256:38cf8125c40dae9d5acc10fa66af8ea6fdf760b2714ee482ca691fc66e6fcb18"}, + {file = "pandas-2.2.3-cp313-cp313t-manylinux2014_aarch64.manylinux_2_17_aarch64.whl", hash = "sha256:ba96630bc17c875161df3818780af30e43be9b166ce51c9a18c1feae342906c2"}, + {file = "pandas-2.2.3-cp313-cp313t-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:1db71525a1538b30142094edb9adc10be3f3e176748cd7acc2240c2f2e5aa3a4"}, + {file = "pandas-2.2.3-cp313-cp313t-musllinux_1_2_aarch64.whl", hash = "sha256:15c0e1e02e93116177d29ff83e8b1619c93ddc9c49083f237d4312337a61165d"}, + {file = "pandas-2.2.3-cp313-cp313t-musllinux_1_2_x86_64.whl", hash = "sha256:ad5b65698ab28ed8d7f18790a0dc58005c7629f227be9ecc1072aa74c0c1d43a"}, + {file = "pandas-2.2.3-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:bc6b93f9b966093cb0fd62ff1a7e4c09e6d546ad7c1de191767baffc57628f39"}, + {file = "pandas-2.2.3-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:5dbca4c1acd72e8eeef4753eeca07de9b1db4f398669d5994086f788a5d7cc30"}, + {file = "pandas-2.2.3-cp39-cp39-manylinux2014_aarch64.manylinux_2_17_aarch64.whl", hash = "sha256:8cd6d7cc958a3910f934ea8dbdf17b2364827bb4dafc38ce6eef6bb3d65ff09c"}, + {file = "pandas-2.2.3-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:99df71520d25fade9db7c1076ac94eb994f4d2673ef2aa2e86ee039b6746d20c"}, + {file = "pandas-2.2.3-cp39-cp39-musllinux_1_2_aarch64.whl", hash = "sha256:31d0ced62d4ea3e231a9f228366919a5ea0b07440d9d4dac345376fd8e1477ea"}, + {file = "pandas-2.2.3-cp39-cp39-musllinux_1_2_x86_64.whl", hash = "sha256:7eee9e7cea6adf3e3d24e304ac6b8300646e2a5d1cd3a3c2abed9101b0846761"}, + {file = "pandas-2.2.3-cp39-cp39-win_amd64.whl", hash = "sha256:4850ba03528b6dd51d6c5d273c46f183f39a9baf3f0143e566b89450965b105e"}, + {file = "pandas-2.2.3.tar.gz", hash = "sha256:4f18ba62b61d7e192368b84517265a99b4d7ee8912f8708660fb4a366cc82667"}, ] [package.dependencies] @@ -2073,14 +2086,14 @@ testing = ["pytest", "pytest-benchmark"] [[package]] name = "pre-commit" -version = "4.1.0" +version = "4.2.0" description = "A framework for managing and maintaining multi-language pre-commit hooks." optional = false python-versions = ">=3.9" groups = ["dev"] files = [ - {file = "pre_commit-4.1.0-py2.py3-none-any.whl", hash = "sha256:d29e7cb346295bcc1cc75fc3e92e343495e3ea0196c9ec6ba53f49f10ab6ae7b"}, - {file = "pre_commit-4.1.0.tar.gz", hash = "sha256:ae3f018575a588e30dfddfab9a05448bfbd6b73d78709617b5a2b853549716d4"}, + {file = "pre_commit-4.2.0-py2.py3-none-any.whl", hash = "sha256:a009ca7205f1eb497d10b845e52c838a98b6cdd2102a6c8e4540e94ee75c58bd"}, + {file = "pre_commit-4.2.0.tar.gz", hash = "sha256:601283b9757afd87d40c4c4a9b2b5de9637a8ea02eaff7adc2d0fb4e04841146"}, ] [package.dependencies] @@ -2214,14 +2227,14 @@ dev = ["argcomplete", "attrs (>=19.2)", "hypothesis (>=3.56)", "mock", "pygments [[package]] name = "pytest-cov" -version = "6.0.0" +version = "6.1.1" description = "Pytest plugin for measuring coverage." optional = false python-versions = ">=3.9" groups = ["dev"] files = [ - {file = "pytest-cov-6.0.0.tar.gz", hash = "sha256:fde0b595ca248bb8e2d76f020b465f3b107c9632e6a1d1705f17834c89dcadc0"}, - {file = "pytest_cov-6.0.0-py3-none-any.whl", hash = "sha256:eee6f1b9e61008bd34975a4d5bab25801eb31898b032dd55addc93e96fcaaa35"}, + {file = "pytest_cov-6.1.1-py3-none-any.whl", hash = "sha256:bddf29ed2d0ab6f4df17b4c55b0a657287db8684af9c42ea546b21b1041b3dde"}, + {file = "pytest_cov-6.1.1.tar.gz", hash = "sha256:46935f7aaefba760e716c2ebfbe1c216240b9592966e7da99ea8292d4d3e2a0a"}, ] [package.dependencies] @@ -2667,30 +2680,30 @@ files = [ [[package]] name = "ruff" -version = "0.9.10" +version = "0.11.7" description = "An extremely fast Python linter and code formatter, written in Rust." optional = false python-versions = ">=3.7" groups = ["dev"] files = [ - {file = "ruff-0.9.10-py3-none-linux_armv6l.whl", hash = "sha256:eb4d25532cfd9fe461acc83498361ec2e2252795b4f40b17e80692814329e42d"}, - {file = "ruff-0.9.10-py3-none-macosx_10_12_x86_64.whl", hash = "sha256:188a6638dab1aa9bb6228a7302387b2c9954e455fb25d6b4470cb0641d16759d"}, - {file = "ruff-0.9.10-py3-none-macosx_11_0_arm64.whl", hash = "sha256:5284dcac6b9dbc2fcb71fdfc26a217b2ca4ede6ccd57476f52a587451ebe450d"}, - {file = "ruff-0.9.10-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:47678f39fa2a3da62724851107f438c8229a3470f533894b5568a39b40029c0c"}, - {file = "ruff-0.9.10-py3-none-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:99713a6e2766b7a17147b309e8c915b32b07a25c9efd12ada79f217c9c778b3e"}, - {file = "ruff-0.9.10-py3-none-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:524ee184d92f7c7304aa568e2db20f50c32d1d0caa235d8ddf10497566ea1a12"}, - {file = "ruff-0.9.10-py3-none-manylinux_2_17_ppc64.manylinux2014_ppc64.whl", hash = "sha256:df92aeac30af821f9acf819fc01b4afc3dfb829d2782884f8739fb52a8119a16"}, - {file = "ruff-0.9.10-py3-none-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:de42e4edc296f520bb84954eb992a07a0ec5a02fecb834498415908469854a52"}, - {file = "ruff-0.9.10-py3-none-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:d257f95b65806104b6b1ffca0ea53f4ef98454036df65b1eda3693534813ecd1"}, - {file = "ruff-0.9.10-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:b60dec7201c0b10d6d11be00e8f2dbb6f40ef1828ee75ed739923799513db24c"}, - {file = "ruff-0.9.10-py3-none-musllinux_1_2_aarch64.whl", hash = "sha256:d838b60007da7a39c046fcdd317293d10b845001f38bcb55ba766c3875b01e43"}, - {file = "ruff-0.9.10-py3-none-musllinux_1_2_armv7l.whl", hash = "sha256:ccaf903108b899beb8e09a63ffae5869057ab649c1e9231c05ae354ebc62066c"}, - {file = "ruff-0.9.10-py3-none-musllinux_1_2_i686.whl", hash = "sha256:f9567d135265d46e59d62dc60c0bfad10e9a6822e231f5b24032dba5a55be6b5"}, - {file = "ruff-0.9.10-py3-none-musllinux_1_2_x86_64.whl", hash = "sha256:5f202f0d93738c28a89f8ed9eaba01b7be339e5d8d642c994347eaa81c6d75b8"}, - {file = "ruff-0.9.10-py3-none-win32.whl", hash = "sha256:bfb834e87c916521ce46b1788fbb8484966e5113c02df216680102e9eb960029"}, - {file = "ruff-0.9.10-py3-none-win_amd64.whl", hash = "sha256:f2160eeef3031bf4b17df74e307d4c5fb689a6f3a26a2de3f7ef4044e3c484f1"}, - {file = "ruff-0.9.10-py3-none-win_arm64.whl", hash = "sha256:5fd804c0327a5e5ea26615550e706942f348b197d5475ff34c19733aee4b2e69"}, - {file = "ruff-0.9.10.tar.gz", hash = "sha256:9bacb735d7bada9cfb0f2c227d3658fc443d90a727b47f206fb33f52f3c0eac7"}, + {file = "ruff-0.11.7-py3-none-linux_armv6l.whl", hash = "sha256:d29e909d9a8d02f928d72ab7837b5cbc450a5bdf578ab9ebee3263d0a525091c"}, + {file = "ruff-0.11.7-py3-none-macosx_10_12_x86_64.whl", hash = "sha256:dd1fb86b168ae349fb01dd497d83537b2c5541fe0626e70c786427dd8363aaee"}, + {file = "ruff-0.11.7-py3-none-macosx_11_0_arm64.whl", hash = "sha256:d3d7d2e140a6fbbc09033bce65bd7ea29d6a0adeb90b8430262fbacd58c38ada"}, + {file = "ruff-0.11.7-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:4809df77de390a1c2077d9b7945d82f44b95d19ceccf0c287c56e4dc9b91ca64"}, + {file = "ruff-0.11.7-py3-none-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:f3a0c2e169e6b545f8e2dba185eabbd9db4f08880032e75aa0e285a6d3f48201"}, + {file = "ruff-0.11.7-py3-none-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:49b888200a320dd96a68e86736cf531d6afba03e4f6cf098401406a257fcf3d6"}, + {file = "ruff-0.11.7-py3-none-manylinux_2_17_ppc64.manylinux2014_ppc64.whl", hash = "sha256:2b19cdb9cf7dae00d5ee2e7c013540cdc3b31c4f281f1dacb5a799d610e90db4"}, + {file = "ruff-0.11.7-py3-none-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:64e0ee994c9e326b43539d133a36a455dbaab477bc84fe7bfbd528abe2f05c1e"}, + {file = "ruff-0.11.7-py3-none-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:bad82052311479a5865f52c76ecee5d468a58ba44fb23ee15079f17dd4c8fd63"}, + {file = "ruff-0.11.7-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:7940665e74e7b65d427b82bffc1e46710ec7f30d58b4b2d5016e3f0321436502"}, + {file = "ruff-0.11.7-py3-none-musllinux_1_2_aarch64.whl", hash = "sha256:169027e31c52c0e36c44ae9a9c7db35e505fee0b39f8d9fca7274a6305295a92"}, + {file = "ruff-0.11.7-py3-none-musllinux_1_2_armv7l.whl", hash = "sha256:305b93f9798aee582e91e34437810439acb28b5fc1fee6b8205c78c806845a94"}, + {file = "ruff-0.11.7-py3-none-musllinux_1_2_i686.whl", hash = "sha256:a681db041ef55550c371f9cd52a3cf17a0da4c75d6bd691092dfc38170ebc4b6"}, + {file = "ruff-0.11.7-py3-none-musllinux_1_2_x86_64.whl", hash = "sha256:07f1496ad00a4a139f4de220b0c97da6d4c85e0e4aa9b2624167b7d4d44fd6b6"}, + {file = "ruff-0.11.7-py3-none-win32.whl", hash = "sha256:f25dfb853ad217e6e5f1924ae8a5b3f6709051a13e9dad18690de6c8ff299e26"}, + {file = "ruff-0.11.7-py3-none-win_amd64.whl", hash = "sha256:0a931d85959ceb77e92aea4bbedfded0a31534ce191252721128f77e5ae1f98a"}, + {file = "ruff-0.11.7-py3-none-win_arm64.whl", hash = "sha256:778c1e5d6f9e91034142dfd06110534ca13220bfaad5c3735f6cb844654f6177"}, + {file = "ruff-0.11.7.tar.gz", hash = "sha256:655089ad3224070736dc32844fde783454f8558e71f501cb207485fe4eee23d4"}, ] [[package]] @@ -2783,27 +2796,24 @@ test = ["cython (>=3.0)", "defusedxml (>=0.7.1)", "pytest (>=8.0)", "setuptools [[package]] name = "sphinx-autoapi" -version = "3.2.1" +version = "3.6.0" description = "Sphinx API documentation generator" optional = false -python-versions = ">=3.8" +python-versions = ">=3.9" groups = ["dev"] files = [ - {file = "sphinx_autoapi-3.2.1-py2.py3-none-any.whl", hash = "sha256:72fe556abc579528a46494f4fcbeaeaaf3e0b031f6514f7b496f6c36754c5430"}, - {file = "sphinx_autoapi-3.2.1.tar.gz", hash = "sha256:1f9d56b3a98d5653d1fad5644abeed2c042cec304a126ef72c236dae4af16b90"}, + {file = "sphinx_autoapi-3.6.0-py3-none-any.whl", hash = "sha256:f3b66714493cab140b0e896d33ce7137654a16ac1edb6563edcbd47bf975f711"}, + {file = "sphinx_autoapi-3.6.0.tar.gz", hash = "sha256:c685f274e41d0842ae7e199460c322c4bd7fec816ccc2da8d806094b4f64af06"}, ] [package.dependencies] astroid = [ {version = ">=2.7", markers = "python_version < \"3.12\""}, - {version = ">=3.0.0a1", markers = "python_version >= \"3.12\""}, + {version = ">=3", markers = "python_version >= \"3.12\""}, ] Jinja2 = "*" PyYAML = "*" -sphinx = ">=6.1.0" - -[package.extras] -docs = ["furo", "sphinx", "sphinx-design"] +sphinx = ">=7.4.0" [[package]] name = "sphinx-basic-ng" @@ -3196,21 +3206,22 @@ files = [ [[package]] name = "tqdm" -version = "4.66.5" +version = "4.67.1" description = "Fast, Extensible Progress Meter" optional = false python-versions = ">=3.7" groups = ["main"] files = [ - {file = "tqdm-4.66.5-py3-none-any.whl", hash = "sha256:90279a3770753eafc9194a0364852159802111925aa30eb3f9d85b0e805ac7cd"}, - {file = "tqdm-4.66.5.tar.gz", hash = "sha256:e1020aef2e5096702d8a025ac7d16b1577279c9d63f8375b63083e9a5f0fcbad"}, + {file = "tqdm-4.67.1-py3-none-any.whl", hash = "sha256:26445eca388f82e72884e0d580d5464cd801a3ea01e63e5601bdff9ba6a48de2"}, + {file = "tqdm-4.67.1.tar.gz", hash = "sha256:f8aef9c52c08c13a65f30ea34f4e5aac3fd1a34959879d7e59e63027286627f2"}, ] [package.dependencies] colorama = {version = "*", markers = "platform_system == \"Windows\""} [package.extras] -dev = ["pytest (>=6)", "pytest-cov", "pytest-timeout", "pytest-xdist"] +dev = ["nbval", "pytest (>=6)", "pytest-asyncio (>=0.24)", "pytest-cov", "pytest-timeout"] +discord = ["requests"] notebook = ["ipywidgets (>=6)"] slack = ["slack-sdk"] telegram = ["requests"] @@ -3245,11 +3256,6 @@ files = [ {file = "triton-3.0.0-1-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.whl", hash = "sha256:34e509deb77f1c067d8640725ef00c5cbfcb2052a1a3cb6a6d343841f92624eb"}, {file = "triton-3.0.0-1-cp38-cp38-manylinux2014_x86_64.manylinux_2_17_x86_64.whl", hash = "sha256:bcbf3b1c48af6a28011a5c40a5b3b9b5330530c3827716b5fbf6d7adcc1e53e9"}, {file = "triton-3.0.0-1-cp39-cp39-manylinux2014_x86_64.manylinux_2_17_x86_64.whl", hash = "sha256:6e5727202f7078c56f91ff13ad0c1abab14a0e7f2c87e91b12b6f64f3e8ae609"}, - {file = "triton-3.0.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:39b052da883351fdf6be3d93cedae6db3b8e3988d3b09ed221bccecfa9612230"}, - {file = "triton-3.0.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:cd34f19a8582af96e6291d4afce25dac08cb2a5d218c599163761e8e0827208e"}, - {file = "triton-3.0.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:0d5e10de8c011adeb7c878c6ce0dd6073b14367749e34467f1cff2bde1b78253"}, - {file = "triton-3.0.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:e8903767951bf86ec960b4fe4e21bc970055afc65e9d57e916d79ae3c93665e3"}, - {file = "triton-3.0.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:41004fb1ae9a53fcb3e970745feb87f0e3c94c6ce1ba86e95fa3b8537894bef7"}, ] [package.dependencies] @@ -3458,4 +3464,4 @@ test = ["big-O", "importlib-resources ; python_version < \"3.9\"", "jaraco.funct [metadata] lock-version = "2.1" python-versions = "^3.11" -content-hash = "72455894601a01f08bd51f5a0a6f206aa8e366f091f8622e41ebaccdf3807c45" +content-hash = "3b64b87c06a9e49dbad3a3c4f873b48ecc2493e95ec35edced24401b32a068a5" From f24d03544f9871f7c378ad15f411fd5d93fba9c2 Mon Sep 17 00:00:00 2001 From: Kaszanas <34846245+Kaszanas@users.noreply.github.com> Date: Sat, 26 Apr 2025 14:50:40 +0000 Subject: [PATCH 6/7] test: adjusted tests for dataclasses, fix attempt --- tests/test_cases/replay_data/replay_data_test.py | 6 ++++-- tests/test_files/empty_replay.json | 0 2 files changed, 4 insertions(+), 2 deletions(-) create mode 100644 tests/test_files/empty_replay.json diff --git a/tests/test_cases/replay_data/replay_data_test.py b/tests/test_cases/replay_data/replay_data_test.py index 77bbc11..a7052b6 100644 --- a/tests/test_cases/replay_data/replay_data_test.py +++ b/tests/test_cases/replay_data/replay_data_test.py @@ -26,12 +26,14 @@ def setUpClass(cls) -> None: cls.test_replay = test_utils.get_specific_asset_path( filename="test_replay.json" ) + cls.empty_replay = test_utils.get_specific_asset_path( + filename="empty_replay.json" + ) def test_loading_json(self): sc2_replay_data = SC2ReplayData.from_file(replay_filepath=self.test_replay) self.assertIsInstance(sc2_replay_data, SC2ReplayData) def test_empty_json(self): - # Empty json should raise a KeyError: with self.assertRaises(KeyError): - _ = SC2ReplayData(filepath=Path(""), loaded_replay_object={}) + _ = SC2ReplayData.from_file(replay_filepath=self.empty_replay) diff --git a/tests/test_files/empty_replay.json b/tests/test_files/empty_replay.json new file mode 100644 index 0000000..e69de29 From 581f553ab4ffd96f4f21ee9d7c7539fbe9db4faa Mon Sep 17 00:00:00 2001 From: Kaszanas <34846245+Kaszanas@users.noreply.github.com> Date: Sat, 26 Apr 2025 17:14:37 +0200 Subject: [PATCH 7/7] test(replay_data_test): fixed tests, added test for empty json object --- .dockerignore | 2 ++ tests/test_cases/replay_data/replay_data_test.py | 13 +++++++++---- .../{empty_replay.json => empty_json.json} | 0 tests/test_files/empty_json_object.json | 1 + 4 files changed, 12 insertions(+), 4 deletions(-) rename tests/test_files/{empty_replay.json => empty_json.json} (100%) create mode 100644 tests/test_files/empty_json_object.json diff --git a/.dockerignore b/.dockerignore index ab6b9f6..5baec6a 100644 --- a/.dockerignore +++ b/.dockerignore @@ -14,3 +14,5 @@ venv* .venv test_output/* + +.ruff_cache/ diff --git a/tests/test_cases/replay_data/replay_data_test.py b/tests/test_cases/replay_data/replay_data_test.py index a7052b6..4e6167a 100644 --- a/tests/test_cases/replay_data/replay_data_test.py +++ b/tests/test_cases/replay_data/replay_data_test.py @@ -1,5 +1,5 @@ import unittest -from pathlib import Path +from json import JSONDecodeError import pytest @@ -26,8 +26,9 @@ def setUpClass(cls) -> None: cls.test_replay = test_utils.get_specific_asset_path( filename="test_replay.json" ) - cls.empty_replay = test_utils.get_specific_asset_path( - filename="empty_replay.json" + cls.empty_json = test_utils.get_specific_asset_path(filename="empty_json.json") + cls.empty_json_object = test_utils.get_specific_asset_path( + filename="empty_json_object.json" ) def test_loading_json(self): @@ -35,5 +36,9 @@ def test_loading_json(self): self.assertIsInstance(sc2_replay_data, SC2ReplayData) def test_empty_json(self): + with self.assertRaises(JSONDecodeError): + _ = SC2ReplayData.from_file(replay_filepath=self.empty_json) + + def test_empty_object(self): with self.assertRaises(KeyError): - _ = SC2ReplayData.from_file(replay_filepath=self.empty_replay) + _ = SC2ReplayData.from_file(replay_filepath=self.empty_json_object) diff --git a/tests/test_files/empty_replay.json b/tests/test_files/empty_json.json similarity index 100% rename from tests/test_files/empty_replay.json rename to tests/test_files/empty_json.json diff --git a/tests/test_files/empty_json_object.json b/tests/test_files/empty_json_object.json new file mode 100644 index 0000000..0967ef4 --- /dev/null +++ b/tests/test_files/empty_json_object.json @@ -0,0 +1 @@ +{}