sc2_datasets.validators.singleprocess_validator =============================================== .. py:module:: sc2_datasets.validators.singleprocess_validator Functions --------- .. autoapisummary:: sc2_datasets.validators.singleprocess_validator.validate_integrity_persist_sp sc2_datasets.validators.singleprocess_validator.validate_integrity_sp Module Contents --------------- .. py:function:: validate_integrity_persist_sp(list_of_replays: list[pathlib.Path], validation_file_path: pathlib.Path) -> set[pathlib.Path] Exposes the logic for validating replays using a single process. This function uses a validation file that persists the files which were previously checked. :param list_of_replays: Specifies the list of replays that are supposed to be validated. :type list_of_replays: list[Path] :param validation_file_path: Specifies the path to the validation file which will be read to obtain the :type validation_file_path: Path :returns: Returns a set of files that should be skipped in further processing. :rtype: set[Path] .. rubric:: Examples Persistent validators save the validation information to a specified filepath. Only the files that ought to be skipped are returned as a set from this function. >>> from pathlib import Path >>> replays_to_skip = validate_integrity_persist_sp( ... list_of_replays=[ ... Path("test/test_files/single_replay/test_replay.json"), ... Path("test/test_files/single_replay/test_bit_flip_example.json"), ... ], ... validation_file_path=Path("validator_file.json"), ... ) >>> assert len(replays_to_skip) == 1 .. py:function:: validate_integrity_sp(list_of_replays: list[pathlib.Path]) -> tuple[set[pathlib.Path], set[pathlib.Path]] Exposes logic for single process integrity validation of a replay. :param list_of_replays: Specifies the SC2ReplayInfo information of the files that will be validated. :type list_of_replays: list[Path] :returns: Returns a tuple that contains (validated replays, files to be skipped). :rtype: tuple[set[Path], set[Path]] .. rubric:: Examples Validators can be used to check if a file is correct before loading it for some modeling task. Below you will find a sample execution which should contain one correct file and one incorrect file. This results in the final tuple containing two sets. The first tuple denotes correctly validated files, whereas the second tuple denotes the files that should be skipped in modeling tasks. >>> validated_replays = validate_integrity_sp( ... list_of_replays=[ ... Path("./test/test_files/single_replay/test_replay.json"), ... Path("./test/test_files/single_replay/test_bit_flip_example.json"), ... ], ... ) >>> assert len(validated_replays[0]) == 2 >>> assert len(validated_replays[1]) == 1