From fdea0e4a762d76f075c74bff56879d7b57fc4001 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 3 Jul 2024 12:02:08 +0000 Subject: [PATCH 01/13] Bump twine from 5.0.0 to 5.1.1 Bumps [twine](https://github.com/pypa/twine) from 5.0.0 to 5.1.1. - [Release notes](https://github.com/pypa/twine/releases) - [Changelog](https://github.com/pypa/twine/blob/main/docs/changelog.rst) - [Commits](https://github.com/pypa/twine/compare/5.0.0...v5.1.1) --- updated-dependencies: - dependency-name: twine dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 20e5c97a..e4dedb79 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -71,7 +71,7 @@ build = [ "build==1.2.1", "cx_Freeze==7.0.0", - "twine==5.0.0", + "twine==5.1.1", "psutil==5.9.8", ] lint = ["black==24.4.2", "isort==5.13.2"] From b90670ca538588932b11162749eb512bfe8796d3 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 3 Jul 2024 12:02:08 +0000 Subject: [PATCH 02/13] Bump mypy from 1.10.0 to 1.10.1 Bumps [mypy](https://github.com/python/mypy) from 1.10.0 to 1.10.1. - [Changelog](https://github.com/python/mypy/blob/master/CHANGELOG.md) - [Commits](https://github.com/python/mypy/compare/v1.10.0...v1.10.1) --- updated-dependencies: - dependency-name: mypy dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 20e5c97a..c861df1a 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -82,7 +82,7 @@ "python-dotenv==1.0.1", ] tools = ["pyperclip==1.8.2"] - type = ["mypy==1.10.0"] + type = ["mypy==1.10.1"] [tool.pytest.ini_options] addopts = "--cov=src/subsearch" From 113deeba197c19b5637ff6898f4876bc5fd9dfa5 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 3 Jul 2024 12:02:13 +0000 Subject: [PATCH 03/13] Bump psutil from 5.9.8 to 6.0.0 Bumps [psutil](https://github.com/giampaolo/psutil) from 5.9.8 to 6.0.0. - [Changelog](https://github.com/giampaolo/psutil/blob/master/HISTORY.rst) - [Commits](https://github.com/giampaolo/psutil/compare/release-5.9.8...release-6.0.0) --- updated-dependencies: - dependency-name: psutil dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 20e5c97a..9c4dc869 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -72,7 +72,7 @@ "build==1.2.1", "cx_Freeze==7.0.0", "twine==5.0.0", - "psutil==5.9.8", + "psutil==6.0.0", ] lint = ["black==24.4.2", "isort==5.13.2"] tests = [ From b4dcd9f5f99065338821088a5d4e5d7832035a92 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 3 Jul 2024 12:02:26 +0000 Subject: [PATCH 04/13] Bump requests from 2.31.0 to 2.32.3 Bumps [requests](https://github.com/psf/requests) from 2.31.0 to 2.32.3. - [Release notes](https://github.com/psf/requests/releases) - [Changelog](https://github.com/psf/requests/blob/main/HISTORY.md) - [Commits](https://github.com/psf/requests/compare/v2.31.0...v2.32.3) --- updated-dependencies: - dependency-name: requests dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 20e5c97a..eef56fdc 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -22,7 +22,7 @@ "packaging==24.0", "pillow==10.3.0", "pystray==0.19.5", - "requests==2.31.0", + "requests==2.32.3", "selectolax==0.3.21", "toml==0.10.2", ] From 94019f20cb3d85bc61ffa6a669f5fd35a64a886d Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 3 Jul 2024 12:03:04 +0000 Subject: [PATCH 05/13] Bump packaging from 24.0 to 24.1 Bumps [packaging](https://github.com/pypa/packaging) from 24.0 to 24.1. - [Release notes](https://github.com/pypa/packaging/releases) - [Changelog](https://github.com/pypa/packaging/blob/main/CHANGELOG.rst) - [Commits](https://github.com/pypa/packaging/compare/24.0...24.1) --- updated-dependencies: - dependency-name: packaging dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 20e5c97a..e752ef3a 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -19,7 +19,7 @@ "picologging==0.9.3", "cloudscraper==1.2.71", "num2words==0.5.13", - "packaging==24.0", + "packaging==24.1", "pillow==10.3.0", "pystray==0.19.5", "requests==2.31.0", From 5f5ef36244641bd6c599f287566f8ba71eb20776 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 3 Jul 2024 12:03:09 +0000 Subject: [PATCH 06/13] Bump pillow from 10.3.0 to 10.4.0 Bumps [pillow](https://github.com/python-pillow/Pillow) from 10.3.0 to 10.4.0. - [Release notes](https://github.com/python-pillow/Pillow/releases) - [Changelog](https://github.com/python-pillow/Pillow/blob/main/CHANGES.rst) - [Commits](https://github.com/python-pillow/Pillow/compare/10.3.0...10.4.0) --- updated-dependencies: - dependency-name: pillow dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 20e5c97a..db25ae9b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -20,7 +20,7 @@ "cloudscraper==1.2.71", "num2words==0.5.13", "packaging==24.0", - "pillow==10.3.0", + "pillow==10.4.0", "pystray==0.19.5", "requests==2.31.0", "selectolax==0.3.21", From 33e5643d4c7be38e34bcee94e2665e77431bb6a6 Mon Sep 17 00:00:00 2001 From: vagabondHustler Date: Wed, 15 May 2024 03:59:21 +0200 Subject: [PATCH 07/13] Refactor update comment --- .gitignore | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 708d97ae..c9c02a9e 100644 --- a/.gitignore +++ b/.gitignore @@ -155,7 +155,7 @@ tools/spritesheet_generator/.input tools/spritesheet_generator/package-lock.json tools/spritesheet_generator/node_modules -#Misc +# Test, .env, log related files and folders tests/__subsearch__.log src/subsearch/subsearch.log src/*test* From 4834c43816411ffed343d3b43d5b052d0cfa7860 Mon Sep 17 00:00:00 2001 From: vagabondHustler Date: Wed, 15 May 2024 04:00:29 +0200 Subject: [PATCH 08/13] Refactor remove python 311 and 310 --- tox.ini | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) diff --git a/tox.ini b/tox.ini index 8f712bcf..531e5193 100644 --- a/tox.ini +++ b/tox.ini @@ -1,16 +1,12 @@ [tox] minversion = 4.0 env_list = - py310 - py311 py312 labels = - test = py310, py311 + test = py312 [gh-actions] python = - 3.10: py310 - 3.11: py311 3.12: py312 [testenv] @@ -19,14 +15,6 @@ passenv = PYTHONPATH deps = -e .[tests] isolated_build = true -[testenv:py310] -description = Python 3.10 -commands = pytest --cov - -[testenv:py311] -description = Python 3.11 -commands = pytest --cov - [testenv:py312] description = Python 3.12 commands = pytest --cov \ No newline at end of file From 5cc3e6198dd25aafaaf0b5635f93f3baba9385ce Mon Sep 17 00:00:00 2001 From: vagabondHustler Date: Wed, 15 May 2024 03:54:15 +0200 Subject: [PATCH 09/13] Refactor update type hints - Added generic `DataClass` class for type hinting --- src/subsearch/core.py | 16 ++++++---------- src/subsearch/globals/__init__.py | 4 ++-- src/subsearch/globals/_logging.py | 15 +++++++-------- src/subsearch/globals/dataclasses.py | 8 ++++++-- src/subsearch/providers/yifysubtitles.py | 2 +- 5 files changed, 22 insertions(+), 23 deletions(-) diff --git a/src/subsearch/core.py b/src/subsearch/core.py index 8b734875..325f6c72 100644 --- a/src/subsearch/core.py +++ b/src/subsearch/core.py @@ -8,7 +8,7 @@ from subsearch.globals.dataclasses import Subtitle from subsearch.gui import screen_manager, system_tray from subsearch.gui.screens import download_manager -from subsearch.providers import opensubtitles, yifysubtitles +from subsearch.providers import opensubtitles, yifysubtitles from subsearch.utils import io_file_system, io_toml, string_parser @@ -102,24 +102,20 @@ def _create_threads(self, *tasks) -> None: task_thread.start() task_thread.join() - def start_search(self, provider, flag: str = "") -> None: + def _start_search(self, provider, flag: str) -> None: search_provider = provider(**self.search_kwargs) - if flag: - search_provider.start_search(flag=flag) - else: - search_provider.start_search() + search_provider.start_search(flag=flag) self.accepted_subtitles.extend(search_provider.accepted_subtitles) self.rejected_subtitles.extend(search_provider.rejected_subtitles) @decorators.call_func def opensubtitles(self) -> None: - self.start_search(provider=opensubtitles.OpenSubtitles, flag="hash") - self.start_search(provider=opensubtitles.OpenSubtitles, flag="site") - + self._start_search(provider=opensubtitles.OpenSubtitles, flag="hash") + self._start_search(provider=opensubtitles.OpenSubtitles, flag="site") @decorators.call_func def yifysubtitles(self) -> None: - self.start_search(provider=yifysubtitles.YifiSubtitles) + self._start_search(provider=yifysubtitles.YifiSubtitles, flag="site") @decorators.call_func def download_files(self) -> None: diff --git a/src/subsearch/globals/__init__.py b/src/subsearch/globals/__init__.py index a60c8fc7..d3006f16 100644 --- a/src/subsearch/globals/__init__.py +++ b/src/subsearch/globals/__init__.py @@ -1,3 +1,3 @@ -from ._logging import StdoutHandler +from ._logging import Logger -log = StdoutHandler() +log = Logger() diff --git a/src/subsearch/globals/_logging.py b/src/subsearch/globals/_logging.py index cec5e78f..783bc57f 100644 --- a/src/subsearch/globals/_logging.py +++ b/src/subsearch/globals/_logging.py @@ -3,17 +3,16 @@ import threading from datetime import datetime from pathlib import Path -from typing import Optional, TypeVar +from typing import Callable, Optional import picologging as logging from subsearch.globals import metaclasses from subsearch.globals.constants import APP_PATHS, FILE_PATHS +from subsearch.globals.dataclasses import GenericDataClass -DATACLASS = TypeVar("DATACLASS") - -def capture_call_info(func): +def capture_call_info(func) -> Callable[..., None]: def wrapper(*args, **kwargs): frame = inspect.currentframe().f_back # type: ignore current_time = datetime.now().time() @@ -36,7 +35,7 @@ class ANSIEscapeSequences: UNDERLINE = "\033[4m" -class Logger(metaclass=metaclasses.Singleton): +class _Logging(metaclass=metaclasses.Singleton): def __init__(self, *args, **kwargs) -> None: self.logger_name = kwargs.get("logger_name", "subsearch") if not APP_PATHS.appdata_subsearch.exists(): @@ -98,9 +97,9 @@ def _color_print(self, message: str, hex_color: str, style: str) -> None: print(f"{style_code}{color_code}{message}{self._ansi.RESET}") -class StdoutHandler(metaclass=metaclasses.Singleton): +class Logger(metaclass=metaclasses.Singleton): def __init__(self) -> None: - self._logger = Logger() + self._logger = _Logging() def __call__(self, message: str, **kwargs) -> None: self.log(message, **kwargs) @@ -153,7 +152,7 @@ def file_system_action(self, action_type: str, src: Path, dst: Optional[Path] = self(message, **kwargs) @capture_call_info - def dataclass(self, instance: DATACLASS, **kwargs) -> None: + def dataclass(self, instance: GenericDataClass, **kwargs) -> None: if not dataclasses.is_dataclass(instance): raise ValueError("Input is not a dataclass instance.") instance_name = f"--- [{instance.__class__.__name__}] ---" diff --git a/src/subsearch/globals/dataclasses.py b/src/subsearch/globals/dataclasses.py index cbf8d596..8a5a9449 100644 --- a/src/subsearch/globals/dataclasses.py +++ b/src/subsearch/globals/dataclasses.py @@ -1,6 +1,6 @@ -from dataclasses import dataclass +from dataclasses import Field, dataclass from pathlib import Path -from typing import Any +from typing import Any, ClassVar, Protocol @dataclass(order=True) @@ -112,3 +112,7 @@ class WindowsRegistryPaths: shell: str subsearch: str subsearch_command: str + + +class GenericDataClass(Protocol): + __dataclass_fields__: ClassVar[dict[str, Field[Any]]] diff --git a/src/subsearch/providers/yifysubtitles.py b/src/subsearch/providers/yifysubtitles.py index a1257e2a..72e01bb2 100644 --- a/src/subsearch/providers/yifysubtitles.py +++ b/src/subsearch/providers/yifysubtitles.py @@ -42,7 +42,7 @@ def __init__(self, **kwargs) -> None: YifySubtitlesScraper.__init__(self, **kwargs) self.provider_name = self.__class__.__name__.lower() - def start_search(self) -> list[Subtitle] | None: + def start_search(self, **kwargs) -> list[Subtitle] | None: subtitle_data = self.get_subtitle(self.url_yifysubtitles, self.current_language, self.hi_sub, self.non_hi_sub) if not subtitle_data: From a98a4e188846cd1ee41fde17f4be6e52e5ca45a1 Mon Sep 17 00:00:00 2001 From: vagabondHustler Date: Wed, 15 May 2024 04:03:36 +0200 Subject: [PATCH 10/13] Refactor update MANIFEST.in - Include readme and license file - Exclude .pyc files --- MANIFEST.in | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/MANIFEST.in b/MANIFEST.in index 27857839..48112e01 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -1,3 +1,6 @@ +include README.md +include LICENSE + graft src exclude tox.ini @@ -6,4 +9,6 @@ prune assets prune tests prune */.pytest_cache -global-exclude */__pycache__/* *.log \ No newline at end of file +global-exclude */__pycache__/* +global-exclude *.log +global-exclude *.pyc \ No newline at end of file From 99f5edf0df4495758fc201d480cf6a04e0e37069 Mon Sep 17 00:00:00 2001 From: vagabondHustler Date: Wed, 15 May 2024 02:06:31 +0000 Subject: [PATCH 11/13] Bump version to 2.46.0dev0 --- .github/configs/version_control.json | 4 ++-- src/subsearch/data/version.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/configs/version_control.json b/.github/configs/version_control.json index 548b940e..22060a33 100644 --- a/.github/configs/version_control.json +++ b/.github/configs/version_control.json @@ -1,5 +1,5 @@ { - "current_version": "2.45.1", - "previous_version": "2.45.1dev0", + "current_version": "2.46.0dev0", + "previous_version": "2.45.1", "last_stable_release": "2.45.1" } \ No newline at end of file diff --git a/src/subsearch/data/version.py b/src/subsearch/data/version.py index 99ca0c3d..8b83e387 100644 --- a/src/subsearch/data/version.py +++ b/src/subsearch/data/version.py @@ -1 +1 @@ -__version__ = "2.45.1" +__version__ = "2.46.0dev0" From 77de369450bf8b25ba129a4e7adc7cc8a777c37c Mon Sep 17 00:00:00 2001 From: vagabondHustler Date: Wed, 15 May 2024 13:26:01 +0000 Subject: [PATCH 12/13] Bump version to 2.46.0 --- .github/configs/version_control.json | 6 +++--- src/subsearch/data/version.py | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/configs/version_control.json b/.github/configs/version_control.json index 22060a33..8ac6b33f 100644 --- a/.github/configs/version_control.json +++ b/.github/configs/version_control.json @@ -1,5 +1,5 @@ { - "current_version": "2.46.0dev0", - "previous_version": "2.45.1", - "last_stable_release": "2.45.1" + "current_version": "2.46.0", + "previous_version": "2.46.0dev0", + "last_stable_release": "2.46.0" } \ No newline at end of file diff --git a/src/subsearch/data/version.py b/src/subsearch/data/version.py index 8b83e387..9c6da0a4 100644 --- a/src/subsearch/data/version.py +++ b/src/subsearch/data/version.py @@ -1 +1 @@ -__version__ = "2.46.0dev0" +__version__ = "2.46.0" From b442645938a6a6dbc8ba0a54ee30fbde869f0637 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 3 Jul 2024 12:10:07 +0000 Subject: [PATCH 13/13] Bump tox from 4.15.0 to 4.16.0 Bumps [tox](https://github.com/tox-dev/tox) from 4.15.0 to 4.16.0. - [Release notes](https://github.com/tox-dev/tox/releases) - [Changelog](https://github.com/tox-dev/tox/blob/main/docs/changelog.rst) - [Commits](https://github.com/tox-dev/tox/compare/4.15.0...4.16.0) --- updated-dependencies: - dependency-name: tox dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 20e5c97a..04c35708 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -78,7 +78,7 @@ tests = [ "pytest-cov==5.0.0", "pytest==8.2.0", - "tox==4.15.0", + "tox==4.16.0", "python-dotenv==1.0.1", ] tools = ["pyperclip==1.8.2"]