src.constants

 1import logging
 2from pathlib import Path
 3from src.cmd_types.formats import ErrFormat, Attribute
 4
 5LOG_FILE: str = "/var/log/python-lab-2/shell.log"
 6FORMAT: str = '[%(asctime)s] %(message)s'
 7LOGGING_LEVEL: int = logging.DEBUG
 8FORMAT_LOADER: str = "[ %(asctime)s - %(levelname)s ] %(message)s"
 9
10DEFAULT_PWD: Path = Path("~/playground").expanduser()
11
12PLUGINS_DIR: str = "src.plugins"
13PLUGINS_PREFIX: str = "plugin"
14STRICT_PLUGIN_LOADING: bool = False
15
16HISTORY_PATH: Path = Path(DEFAULT_PWD) / ".history"
17TRASH_PATH: Path = Path(DEFAULT_PWD) / ".trash"
18
19TYPE_EXTENSION_ENUM: dict[str, str] = {
20            "gztar": "tar.gz",
21            "zip": "zip"
22        }
23
24ERROR_HANDLERS_MESSAGES_FORMATS: dict[type[Exception], ErrFormat] = {
25    FileNotFoundError: ErrFormat(
26        format_str = "{0}: no such file or directory",
27        attrs = [
28            Attribute("filename", [])
29        ],
30        errcode = 2
31    ),
32    PermissionError: ErrFormat(
33        format_str = "{0}: permission denied",
34        attrs = [
35            Attribute("filename", [])
36        ],
37        errcode = 1
38    ),
39    UnicodeDecodeError: ErrFormat(
40        format_str = "unicode decoding error",
41        attrs = [],
42        errcode = 3
43    )
44}
LOG_FILE: str = '/var/log/python-lab-2/shell.log'
FORMAT: str = '[%(asctime)s] %(message)s'
LOGGING_LEVEL: int = 10
FORMAT_LOADER: str = '[ %(asctime)s - %(levelname)s ] %(message)s'
DEFAULT_PWD: pathlib._local.Path = PosixPath('/home/runner/playground')
PLUGINS_DIR: str = 'src.plugins'
PLUGINS_PREFIX: str = 'plugin'
STRICT_PLUGIN_LOADING: bool = False
HISTORY_PATH: pathlib._local.Path = PosixPath('/home/runner/playground/.history')
TRASH_PATH: pathlib._local.Path = PosixPath('/home/runner/playground/.trash')
TYPE_EXTENSION_ENUM: dict[str, str] = {'gztar': 'tar.gz', 'zip': 'zip'}
ERROR_HANDLERS_MESSAGES_FORMATS: dict[type[Exception], src.cmd_types.formats.ErrFormat] = {<class 'FileNotFoundError'>: ErrFormat(format_str='{0}: no such file or directory', attrs=[Attribute(attr_name='filename', attr_getters=[])], errcode=2), <class 'PermissionError'>: ErrFormat(format_str='{0}: permission denied', attrs=[Attribute(attr_name='filename', attr_getters=[])], errcode=1), <class 'UnicodeDecodeError'>: ErrFormat(format_str='unicode decoding error', attrs=[], errcode=3)}