Skip to content

Bulk asynchronous downloader for multiple file hosts

refactor: remove duplicated hashing (#1538)

NTFSvolumeabacf0701ea2
diff --git a/cyberdrop_dl/clients/hash_client.py b/cyberdrop_dl/clients/hash_client.py
index d808e743a..689a660d0 100644
--- a/cyberdrop_dl/clients/hash_client.py
+++ b/cyberdrop_dl/clients/hash_client.py
@@ -8,7 +8,7 @@ from typing import TYPE_CHECKING, Literal
from send2trash import send2trash
from cyberdrop_dl import constants
-from cyberdrop_dl.data_structures.hash import Hashing
+from cyberdrop_dl.constants import Hashing
from cyberdrop_dl.ui.prompts.basic_prompts import enter_to_continue
from cyberdrop_dl.utils.logger import log
from cyberdrop_dl.utils.utilities import get_size_or_none
diff --git a/cyberdrop_dl/config/config_model.py b/cyberdrop_dl/config/config_model.py
index de4074b15..ed0a100c4 100755
--- a/cyberdrop_dl/config/config_model.py
+++ b/cyberdrop_dl/config/config_model.py
@@ -7,8 +7,7 @@ from pathlib import Path
from pydantic import BaseModel, ByteSize, NonNegativeInt, PositiveInt, field_serializer, field_validator
from cyberdrop_dl import constants
-from cyberdrop_dl.constants import BROWSERS, DEFAULT_APP_STORAGE, DEFAULT_DOWNLOAD_STORAGE
-from cyberdrop_dl.data_structures.hash import Hashing
+from cyberdrop_dl.constants import BROWSERS, DEFAULT_APP_STORAGE, DEFAULT_DOWNLOAD_STORAGE, Hashing
from cyberdrop_dl.models import HttpAppriseURL
from cyberdrop_dl.models.types import (
ByteSizeSerilized,
diff --git a/cyberdrop_dl/constants.py b/cyberdrop_dl/constants.py
index 8e3cad953..0c2805149 100644
--- a/cyberdrop_dl/constants.py
+++ b/cyberdrop_dl/constants.py
@@ -101,10 +101,7 @@ class Hashing(StrEnum):
@classmethod
def _missing_(cls, value: object) -> "Hashing":
- try:
- return cls[str(value).upper()]
- except KeyError as e:
- raise e
+ return cls[str(value).upper()]
class BROWSERS(StrEnum):
diff --git a/cyberdrop_dl/data_structures/hash.py b/cyberdrop_dl/data_structures/hash.py
deleted file mode 100644
index 2f5379ee7..000000000
--- a/cyberdrop_dl/data_structures/hash.py
+++ /dev/null
@@ -1,14 +0,0 @@
-from enum import StrEnum, auto
-
-
-class Hashing(StrEnum):
- OFF = auto()
- IN_PLACE = auto()
- POST_DOWNLOAD = auto()
-
- @classmethod
- def _missing_(cls, value: object):
- try:
- return cls[str(value).upper()]
- except KeyError as e:
- raise e