<commit_before>from UM.Workspace.WorkspaceReader import WorkspaceReader


##    Base implementation for reading 3MF workspace files.
class ThreeMFWorkspaceReader(WorkspaceReader):
    def __init__(self):
        super().__init__()
        self._supported_extensions = [".3mf"]

    def preRead(self, file_name):
        return WorkspaceReader.PreReadResult.accepted
        # TODO: Find 3MFFileReader so we can load SceneNodes
        # TODO: Ask user if it's  okay for the scene to be cleared<commit_msg>Added pre-read check for 3mf Reader<commit_after>from UM.Workspace.WorkspaceReader import WorkspaceReader
from UM.Application import Application

from UM.Logger import Logger

##    Base implementation for reading 3MF workspace files.
class ThreeMFWorkspaceReader(WorkspaceReader):
    def __init__(self):
        super().__init__()
        self._supported_extensions = [".3mf"]

        self._3mf_mesh_reader = None

    def preRead(self, file_name):
        self._3mf_mesh_reader = Application.getInstance().getMeshFileHandler().getReaderForFile(file_name)
        if self._3mf_mesh_reader and self._3mf_mesh_reader.preRead(file_name) == WorkspaceReader.PreReadResult.accepted:
            pass
        else:
            Logger.log("w", "Could not find reader that was able to read the scene data for 3MF workspace")
            return WorkspaceReader.PreReadResult.failed
        # TODO: Ask user if it's  okay for the scene to be cleared
        return WorkspaceReader.PreReadResult.accepted

    def read(self, file_name):
        pass
{'fraction_non_alphanumeric': 0.07313915857605179, 'fraction_numerical': 0.007119741100323625, 'mean_word_length': 3.4297994269340975, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '122726', 'n_tokens_mistral': 427, 'n_tokens_neox': 420, 'n_words': 123}