move util.py into misc folder

This commit is contained in:
Nick Sweeting
2024-09-30 17:25:15 -07:00
parent dfca4b13b2
commit 363a499289
68 changed files with 136 additions and 161 deletions

View File

@@ -9,17 +9,12 @@ SimpleConfigValueDict = Dict[str, SimpleConfigValue]
SimpleConfigValueGetter = Callable[[], SimpleConfigValue]
ConfigValue = Union[SimpleConfigValue, SimpleConfigValueDict, SimpleConfigValueGetter]
# class AttrDict(dict):
# def __init__(self, *args, **kwargs):
# super().__init__(*args, **kwargs)
# self.__dict__ = self
AttrDict = benedict # https://github.com/fabiocaccamo/python-benedict/
class BaseConfig(TypedDict):
pass
class ConfigDict(BaseConfig, AttrDict, total=False):
class ConfigDict(BaseConfig, benedict, total=False):
"""
# Regenerate by pasting this quine into `archivebox shell` 🥚
from archivebox.config import ConfigDict, CONFIG_DEFAULTS

View File

@@ -173,7 +173,7 @@ class ConstantsDict(Mapping):
# actually empty so that we dont clobber someone's home directory or desktop by accident.
# These files are exceptions to the is_empty check when we're trying to init a new dir,
# as they could be from a previous archivebox version, system artifacts, dependencies, etc.
ALLOWED_IN_OUTPUT_DIR: frozenset[str] = frozenset((
ALLOWED_IN_DATA_DIR: frozenset[str] = frozenset((
*INGORED_PATHS,
*PIP_RELATED_NAMES,
*NPM_RELATED_NAMES,
@@ -212,7 +212,7 @@ class ConstantsDict(Mapping):
})
DATA_LOCATIONS = benedict({
"OUTPUT_DIR": {
"DATA_DIR": {
"path": DATA_DIR.resolve(),
"enabled": True,
"is_valid": DATABASE_FILE.exists(),