From 83f1379a7e4ff00d34bded2094e825f9ad293fa6 Mon Sep 17 00:00:00 2001 From: BuriedInCode <6057651+Buried-In-Code@users.noreply.github.com> Date: Wed, 22 May 2024 16:23:55 +1200 Subject: [PATCH 1/2] Cleanup empty folders --- perdoo/__main__.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/perdoo/__main__.py b/perdoo/__main__.py index 2c3a40f..59cae62 100644 --- a/perdoo/__main__.py +++ b/perdoo/__main__.py @@ -366,6 +366,13 @@ def start(settings: Settings, force: bool = False) -> None: new_file.parent.mkdir(parents=True, exist_ok=True) shutil.move(file, new_file) + for folder in sorted( + settings.collection_folder.rglob("*"), key=lambda p: len(p.parts), reverse=True + ): + if folder.is_dir() and not any(folder.iterdir()): + folder.rmdir() + LOGGER.info("Deleted empty folder: %s", folder) + def main() -> None: try: From fc27b206036227f819ba01302c96910055afc3ee Mon Sep 17 00:00:00 2001 From: BuriedInCode <6057651+Buried-In-Code@users.noreply.github.com> Date: Thu, 6 Jun 2024 13:57:32 +1200 Subject: [PATCH 2/2] Update dependencies --- .pre-commit-config.yaml | 2 +- pyproject.toml | 10 ++-- requirements-dev.lock | 115 ++++++++++++++++++++++++++++++++++++++++ requirements.lock | 98 ++++++++++++++++++++++++++++++++++ 4 files changed, 220 insertions(+), 5 deletions(-) create mode 100644 requirements-dev.lock create mode 100644 requirements.lock diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 4db4df4..15ba45e 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,6 +1,6 @@ repos: - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.4.4 + rev: v0.4.8 hooks: - id: ruff-format - id: ruff diff --git a/pyproject.toml b/pyproject.toml index 48d44e4..787036e 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -31,7 +31,7 @@ dependencies = [ "mokkari@git+https://github.com/Buried-In-Code/mokkari ; python_version < \"3.10\"", "natsort >= 8.4.0", "pillow >= 10.3.0", - "pydantic >= 2.7.1", + "pydantic >= 2.7.3", "rarfile >= 4.2", "rich >= 13.7.1", "simyan >= 1.2.1", @@ -51,9 +51,6 @@ requires-python = ">= 3.8" cb7 = [ "py7zr >= 0.21.0" ] -dev = [ - "pre-commit >= 3.5.0" -] [project.scripts] Perdoo = "perdoo.__main__:main" @@ -127,3 +124,8 @@ convention = "google" [tool.ruff.lint.pyupgrade] keep-runtime-typing = true + +[tool.rye] +dev-dependencies = [ + "pre-commit >= 3.5.0" +] diff --git a/requirements-dev.lock b/requirements-dev.lock new file mode 100644 index 0000000..0105a79 --- /dev/null +++ b/requirements-dev.lock @@ -0,0 +1,115 @@ +# generated by rye +# use `rye lock` or `rye sync` to update this lockfile +# +# last locked with the following flags: +# pre: false +# features: ["cb7"] +# all-features: false +# with-sources: false +# generate-hashes: false + +-e file:. +annotated-types==0.7.0 + # via pydantic +brotli==1.1.0 + # via py7zr +certifi==2024.6.2 + # via requests +cfgv==3.4.0 + # via pre-commit +charset-normalizer==3.3.2 + # via requests +distlib==0.3.8 + # via virtualenv +esak==1.3.2 + # via perdoo +eval-type-backport==0.2.0 + # via mokkari + # via perdoo + # via simyan +filelock==3.14.0 + # via virtualenv +himon==0.5.0 + # via perdoo +identify==2.5.36 + # via pre-commit +idna==3.7 + # via requests +inflate64==1.0.0 + # via py7zr +markdown-it-py==3.0.0 + # via rich +marshmallow==3.21.2 + # via esak +mdurl==0.1.2 + # via markdown-it-py +mokkari @ git+https://github.com/Buried-In-Code/mokkari@44658ea65af15a672f52bd8b9572ee43ce41238b + # via perdoo +multivolumefile==0.2.3 + # via py7zr +natsort==8.4.0 + # via perdoo +nodeenv==1.9.1 + # via pre-commit +packaging==24.0 + # via marshmallow +pillow==10.3.0 + # via perdoo +platformdirs==4.2.2 + # via virtualenv +pre-commit==3.5.0 +psutil==5.9.8 + # via py7zr +py7zr==0.21.0 + # via perdoo +pybcj==1.0.2 + # via py7zr +pycryptodomex==3.20.0 + # via py7zr +pydantic==2.7.3 + # via himon + # via mokkari + # via perdoo + # via simyan +pydantic-core==2.18.4 + # via pydantic +pygments==2.18.0 + # via rich +pyppmd==1.1.0 + # via py7zr +pyyaml==6.0.1 + # via pre-commit +pyzstd==0.16.0 + # via py7zr +rarfile==4.2 + # via perdoo +ratelimit==2.2.1 + # via himon + # via mokkari + # via simyan +requests==2.32.3 + # via esak + # via himon + # via mokkari + # via simyan +rich==13.7.1 + # via perdoo +simyan==1.2.1 + # via perdoo +texttable==1.7.0 + # via py7zr +tomli==2.0.1 + # via perdoo +tomli-w==1.0.0 + # via perdoo +typing-extensions==4.12.1 + # via annotated-types + # via pydantic + # via pydantic-core + # via rich +urllib3==2.2.1 + # via requests +virtualenv==20.26.2 + # via pre-commit +xmltodict==0.13.0 + # via perdoo diff --git a/requirements.lock b/requirements.lock new file mode 100644 index 0000000..cdaff6e --- /dev/null +++ b/requirements.lock @@ -0,0 +1,98 @@ +# generated by rye +# use `rye lock` or `rye sync` to update this lockfile +# +# last locked with the following flags: +# pre: false +# features: ["cb7"] +# all-features: false +# with-sources: false +# generate-hashes: false + +-e file:. +annotated-types==0.7.0 + # via pydantic +brotli==1.1.0 + # via py7zr +certifi==2024.6.2 + # via requests +charset-normalizer==3.3.2 + # via requests +esak==1.3.2 + # via perdoo +eval-type-backport==0.2.0 + # via mokkari + # via perdoo + # via simyan +himon==0.5.0 + # via perdoo +idna==3.7 + # via requests +inflate64==1.0.0 + # via py7zr +markdown-it-py==3.0.0 + # via rich +marshmallow==3.21.2 + # via esak +mdurl==0.1.2 + # via markdown-it-py +mokkari @ git+https://github.com/Buried-In-Code/mokkari@44658ea65af15a672f52bd8b9572ee43ce41238b + # via perdoo +multivolumefile==0.2.3 + # via py7zr +natsort==8.4.0 + # via perdoo +packaging==24.0 + # via marshmallow +pillow==10.3.0 + # via perdoo +psutil==5.9.8 + # via py7zr +py7zr==0.21.0 + # via perdoo +pybcj==1.0.2 + # via py7zr +pycryptodomex==3.20.0 + # via py7zr +pydantic==2.7.3 + # via himon + # via mokkari + # via perdoo + # via simyan +pydantic-core==2.18.4 + # via pydantic +pygments==2.18.0 + # via rich +pyppmd==1.1.0 + # via py7zr +pyzstd==0.16.0 + # via py7zr +rarfile==4.2 + # via perdoo +ratelimit==2.2.1 + # via himon + # via mokkari + # via simyan +requests==2.32.3 + # via esak + # via himon + # via mokkari + # via simyan +rich==13.7.1 + # via perdoo +simyan==1.2.1 + # via perdoo +texttable==1.7.0 + # via py7zr +tomli==2.0.1 + # via perdoo +tomli-w==1.0.0 + # via perdoo +typing-extensions==4.12.1 + # via annotated-types + # via pydantic + # via pydantic-core + # via rich +urllib3==2.2.1 + # via requests +xmltodict==0.13.0 + # via perdoo