sc2_datasets.replay_data.sc2_replay_data¶
Classes¶
Module Contents¶
- class AdditionalInformation¶
- replaypack_name: str | None¶
- replaypack_url: str | None¶
- filename: str | None¶
- original_filepath: str | None¶
- static from_dict(d: dict) AdditionalInformation¶
- class SC2ReplayData¶
- filepath: pathlib.Path¶
- messageEvents: list[sc2_datasets.replay_parser.message_events.message_event.MessageEvent] = []¶
- gameEvents: list[sc2_datasets.replay_parser.game_events.game_event.GameEvent] = []¶
- trackerEvents: list[sc2_datasets.replay_parser.tracker_events.tracker_event.TrackerEvent] = []¶
- toonPlayerDescMap: list = []¶
- gameEventsErr: bool = False¶
- messageEventsErr: bool = False¶
- trackerEventsErr: bool = False¶
- additionalInformation: AdditionalInformation | None = None¶
- static from_dict(loaded_data: dict, replay_filepath: str) SC2ReplayData¶
- static from_file(replay_filepath: pathlib.Path | str) SC2ReplayData¶
Static method returning initialized SC2ReplayData class from a dictionary. This helps with the original JSON parsing.
- Parameters:
replay_filepath (Path | str) – Specifies a filepath to a JSON file containing data from parsed .SC2Replay file.
- Returns:
Returns an initialized SC2ReplayData object.
- Return type:
Examples
The factory method
from_fileassists with initializing aSC2ReplayDataclass. All that is required is a known path to the file that should be parsed.>>> replay_data = SC2ReplayData.from_file("test/test_files/single_replay/test_replay.json") >>> assert isinstance(replay_data, SC2ReplayData)
- static sanitize_events(loaded_data: dict)¶
- __hash__() int¶
Custom hashing function based on the fields that were read from replay. This hashing function returns a result of hash() call on a tuple constructed as follows: (game_duration_loops, game_time_utc, game_map, game_version, player_toon_map_len, player_tuple_toon,)
- Returns:
Returns an int (hash) representation of the SC2ReplayData class.
- Return type:
int