def run(self) -> None: for filepath in self.filepaths: with open(filepath) as f: file_contents = f.read() document = QTextDocument(file_contents, self) # Base url will be used to keep track of the filepath later document.setBaseUrl(QUrl.fromLocalFile(filepath)) document_info = copy.deepcopy(defaults.document_info_template) parse_document(document, document_info) self.project_structure[filepath] = document_info # Removing filepath key so that the dictionary could be used assuming every value in it is a dictionary del self.project_structure[filepath]["filepath"] self.result = self.project_structure