2019-04-24 15:36:14 +00:00
|
|
|
from typing import Optional, Dict, Union, Tuple, Callable, Pattern, Type, Any
|
|
|
|
from mypy_extensions import TypedDict
|
|
|
|
|
|
|
|
|
|
|
|
SimpleConfigValue = Union[str, bool, int, None, Pattern, Dict[str, Any]]
|
|
|
|
SimpleConfigValueDict = Dict[str, SimpleConfigValue]
|
|
|
|
SimpleConfigValueGetter = Callable[[], SimpleConfigValue]
|
|
|
|
ConfigValue = Union[SimpleConfigValue, SimpleConfigValueDict, SimpleConfigValueGetter]
|
|
|
|
|
|
|
|
|
|
|
|
class BaseConfig(TypedDict):
|
|
|
|
pass
|
|
|
|
|
|
|
|
class ConfigDict(BaseConfig, total=False):
|
2020-06-30 07:35:20 +00:00
|
|
|
"""
|
|
|
|
# Regenerate by pasting this quine into `archivebox shell` 🥚
|
|
|
|
from archivebox.config import ConfigDict, CONFIG_DEFAULTS
|
|
|
|
print('class ConfigDict(BaseConfig, total=False):')
|
|
|
|
print(' ' + '"'*3 + ConfigDict.__doc__ + '"'*3)
|
|
|
|
for section, configs in CONFIG_DEFAULTS.items():
|
|
|
|
for key, attrs in configs.items():
|
|
|
|
Type, default = attrs['type'], attrs['default']
|
|
|
|
if default is None:
|
|
|
|
print(f' {key}: Optional[{Type.__name__}]')
|
|
|
|
else:
|
|
|
|
print(f' {key}: {Type.__name__}')
|
|
|
|
print()
|
|
|
|
"""
|
2019-04-24 15:36:14 +00:00
|
|
|
IS_TTY: bool
|
|
|
|
USE_COLOR: bool
|
|
|
|
SHOW_PROGRESS: bool
|
|
|
|
|
|
|
|
OUTPUT_DIR: str
|
2019-04-27 21:26:24 +00:00
|
|
|
CONFIG_FILE: str
|
2019-04-24 15:36:14 +00:00
|
|
|
ONLY_NEW: bool
|
|
|
|
TIMEOUT: int
|
|
|
|
MEDIA_TIMEOUT: int
|
|
|
|
OUTPUT_PERMISSIONS: str
|
|
|
|
URL_BLACKLIST: Optional[str]
|
|
|
|
|
2019-05-02 23:15:16 +00:00
|
|
|
SECRET_KEY: str
|
|
|
|
ALLOWED_HOSTS: str
|
|
|
|
DEBUG: bool
|
|
|
|
PUBLIC_INDEX: bool
|
|
|
|
PUBLIC_SNAPSHOTS: bool
|
|
|
|
FOOTER_INFO: str
|
|
|
|
ACTIVE_THEME: str
|
|
|
|
|
2019-04-24 15:36:14 +00:00
|
|
|
SAVE_TITLE: bool
|
|
|
|
SAVE_FAVICON: bool
|
|
|
|
SAVE_WGET: bool
|
|
|
|
SAVE_WGET_REQUISITES: bool
|
|
|
|
SAVE_PDF: bool
|
|
|
|
SAVE_SCREENSHOT: bool
|
|
|
|
SAVE_DOM: bool
|
2020-08-07 03:07:25 +00:00
|
|
|
SAVE_SINGLEFILE: bool
|
2019-04-24 15:36:14 +00:00
|
|
|
SAVE_WARC: bool
|
|
|
|
SAVE_GIT: bool
|
|
|
|
SAVE_MEDIA: bool
|
2020-04-23 01:14:20 +00:00
|
|
|
SAVE_PLAYLISTS: bool
|
2019-04-24 15:36:14 +00:00
|
|
|
SAVE_ARCHIVE_DOT_ORG: bool
|
|
|
|
|
|
|
|
RESOLUTION: str
|
|
|
|
GIT_DOMAINS: str
|
|
|
|
CHECK_SSL_VALIDITY: bool
|
2020-06-30 05:10:21 +00:00
|
|
|
CURL_USER_AGENT: str
|
2019-04-24 15:36:14 +00:00
|
|
|
WGET_USER_AGENT: str
|
|
|
|
CHROME_USER_AGENT: str
|
|
|
|
COOKIES_FILE: Optional[str]
|
|
|
|
CHROME_USER_DATA_DIR: Optional[str]
|
|
|
|
CHROME_HEADLESS: bool
|
|
|
|
CHROME_SANDBOX: bool
|
|
|
|
|
|
|
|
USE_CURL: bool
|
|
|
|
USE_WGET: bool
|
|
|
|
USE_GIT: bool
|
|
|
|
USE_CHROME: bool
|
|
|
|
USE_YOUTUBEDL: bool
|
2020-08-07 03:07:25 +00:00
|
|
|
USE_SINGLEFILE: bool
|
2019-04-24 15:36:14 +00:00
|
|
|
|
|
|
|
CURL_BINARY: Optional[str]
|
|
|
|
GIT_BINARY: Optional[str]
|
|
|
|
WGET_BINARY: Optional[str]
|
|
|
|
YOUTUBEDL_BINARY: Optional[str]
|
|
|
|
CHROME_BINARY: Optional[str]
|
2020-08-07 03:07:25 +00:00
|
|
|
SINGLEFILE_BINARY: Optional[str]
|
2019-04-24 15:36:14 +00:00
|
|
|
|
|
|
|
TERM_WIDTH: Callable[[], int]
|
|
|
|
USER: str
|
|
|
|
ANSI: Dict[str, str]
|
|
|
|
REPO_DIR: str
|
|
|
|
PYTHON_DIR: str
|
|
|
|
TEMPLATES_DIR: str
|
|
|
|
ARCHIVE_DIR: str
|
|
|
|
SOURCES_DIR: str
|
|
|
|
LOGS_DIR: str
|
|
|
|
|
|
|
|
URL_BLACKLIST_PTN: Optional[Pattern]
|
|
|
|
WGET_AUTO_COMPRESSION: bool
|
|
|
|
|
|
|
|
ARCHIVEBOX_BINARY: str
|
|
|
|
VERSION: str
|
|
|
|
GIT_SHA: str
|
|
|
|
|
|
|
|
PYTHON_BINARY: str
|
|
|
|
PYTHON_ENCODING: str
|
|
|
|
PYTHON_VERSION: str
|
|
|
|
|
|
|
|
DJANGO_BINARY: str
|
|
|
|
DJANGO_VERSION: str
|
|
|
|
|
|
|
|
CURL_VERSION: str
|
|
|
|
WGET_VERSION: str
|
|
|
|
YOUTUBEDL_VERSION: str
|
|
|
|
GIT_VERSION: str
|
|
|
|
CHROME_VERSION: str
|
|
|
|
|
|
|
|
DEPENDENCIES: Dict[str, SimpleConfigValueDict]
|
|
|
|
CODE_LOCATIONS: Dict[str, SimpleConfigValueDict]
|
|
|
|
CONFIG_LOCATIONS: Dict[str, SimpleConfigValueDict]
|
|
|
|
DATA_LOCATIONS: Dict[str, SimpleConfigValueDict]
|
|
|
|
CHROME_OPTIONS: Dict[str, SimpleConfigValue]
|
|
|
|
|
|
|
|
|
|
|
|
ConfigDefaultValueGetter = Callable[[ConfigDict], ConfigValue]
|
|
|
|
ConfigDefaultValue = Union[ConfigValue, ConfigDefaultValueGetter]
|
|
|
|
|
|
|
|
ConfigDefault = TypedDict('ConfigDefault', {
|
|
|
|
'default': ConfigDefaultValue,
|
|
|
|
'type': Optional[Type],
|
|
|
|
'aliases': Optional[Tuple[str, ...]],
|
|
|
|
}, total=False)
|
|
|
|
|
|
|
|
ConfigDefaultDict = Dict[str, ConfigDefault]
|