| |
| |
| import os |
| import zipfile |
|
|
| from toolbox.to_markdown.common.params import Params |
|
|
|
|
| class BaseToMarkdown(Params): |
| def __init__(self, filename: str): |
| self.filename = filename |
|
|
| def get_md_text(self, *args, **kwargs): |
| raise NotImplementedError |
|
|
| @staticmethod |
| def zip_directory(src_dir, output_zip): |
| with zipfile.ZipFile(output_zip, "w", zipfile.ZIP_DEFLATED) as f: |
| for root, dirs, files in os.walk(src_dir): |
| for file in files: |
| file_path = os.path.join(root, file) |
| arc_name = os.path.relpath(file_path, start=src_dir) |
| f.write(file_path, arcname=arc_name) |
|
|
| def save_to_zip(self, output_dir: str) -> str: |
| raise NotImplementedError |
|
|
|
|
| if __name__ == "__main__": |
| pass |
|
|