MCPcopy Create free account
hub / github.com/SpaceZephyr/myskill / save

Method save

docx/scripts/document.py:859–884  ·  view source on GitHub ↗

Save all modified XML files to disk and copy to destination directory. This persists all changes made via add_comment() and reply_to_comment(). Args: destination: Optional path to save to. If None, saves back to original directory. validate: If True

(self, destination=None, validate=True)

Source from the content-addressed store, hash-verified

857 raise ValueError("Redlining validation failed")
858
859 def save(self, destination=None, validate=True) -> None:
860 """
861 Save all modified XML files to disk and copy to destination directory.
862
863 This persists all changes made via add_comment() and reply_to_comment().
864
865 Args:
866 destination: Optional path to save to. If None, saves back to original directory.
867 validate: If True, validates document before saving (default: True).
868 """
869 # Only ensure comment relationships and content types if comment files exist
870 if self.comments_path.exists():
871 self._ensure_comment_relationships()
872 self._ensure_comment_content_types()
873
874 # Save all modified XML files in temp directory
875 for editor in self._editors.values():
876 editor.save()
877
878 # Validate by default
879 if validate:
880 self.validate()
881
882 # Copy contents from temp directory to destination (or original directory)
883 target_path = Path(destination) if destination else self.original_path
884 shutil.copytree(self.unpacked_path, target_path, dirs_exist_ok=True)
885
886 # ==================== Private: Initialization ====================
887

Callers 6

rearrange_presentationFunction · 0.45
convert_to_imagesFunction · 0.45
create_gridsFunction · 0.45
apply_replacementsFunction · 0.45
convertFunction · 0.45
create_validation_imageFunction · 0.45

Calls 4

validateMethod · 0.95
valuesMethod · 0.80

Tested by

no test coverage detected