Incorporate server and cli into new code #13
|
@ -16,7 +16,7 @@ LOGGING_CONFIG = {
|
||||||
},
|
},
|
||||||
"fmt_detailed": {
|
"fmt_detailed": {
|
||||||
"validate": True,
|
"validate": True,
|
||||||
"format": "%(asctime)s %(levelname)s %(message)s"
|
"format": "%(asctime)s %(levelname)s %(message)s",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
"handlers": {
|
"handlers": {
|
||||||
|
@ -29,8 +29,8 @@ LOGGING_CONFIG = {
|
||||||
"loggers": {
|
"loggers": {
|
||||||
__name__: {
|
__name__: {
|
||||||
"level": "DEBUG",
|
"level": "DEBUG",
|
||||||
"handlers": ["hnd_stderr"]
|
"handlers": ["hnd_stderr"],
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -69,7 +69,7 @@ def add_subcommand(subparsers, module) -> None:
|
||||||
|
|
||||||
def init_logger(args):
|
def init_logger(args):
|
||||||
"""Set up logging based on verbosity args"""
|
"""Set up logging based on verbosity args"""
|
||||||
if (args.verbose):
|
if args.verbose:
|
||||||
handler = LOGGING_CONFIG["handlers"]["hnd_stderr"]
|
handler = LOGGING_CONFIG["handlers"]["hnd_stderr"]
|
||||||
handler["formatter"] = "fmt_detailed"
|
handler["formatter"] = "fmt_detailed"
|
||||||
handler["level"] = "DEBUG"
|
handler["level"] = "DEBUG"
|
||||||
|
|
|
@ -14,7 +14,9 @@ COMMAND_HELP = "Interact with Amanuensis."
|
||||||
LOG = logging.getLogger(__name__)
|
LOG = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
@add_argument("path", metavar="DB_PATH", help="Path to where the database should be created")
|
@add_argument(
|
||||||
|
"path", metavar="DB_PATH", help="Path to where the database should be created"
|
||||||
|
)
|
||||||
@add_argument("--force", "-f", action="store_true", help="Overwrite existing database")
|
@add_argument("--force", "-f", action="store_true", help="Overwrite existing database")
|
||||||
@add_argument("--verbose", "-v", action="store_true", help="Enable db echo")
|
@add_argument("--verbose", "-v", action="store_true", help="Enable db echo")
|
||||||
def command_init_db(args) -> int:
|
def command_init_db(args) -> int:
|
||||||
|
|
|
@ -29,6 +29,7 @@ class EnvironmentConfig(AmanuensisConfig):
|
||||||
|
|
||||||
class CommandLineConfig(AmanuensisConfig):
|
class CommandLineConfig(AmanuensisConfig):
|
||||||
"""Loads config values from command line arguments."""
|
"""Loads config values from command line arguments."""
|
||||||
|
|
||||||
def __init__(self) -> None:
|
def __init__(self) -> None:
|
||||||
parser = ArgumentParser()
|
parser = ArgumentParser()
|
||||||
parser.add_argument("--config-file", default=AmanuensisConfig.CONFIG_FILE)
|
parser.add_argument("--config-file", default=AmanuensisConfig.CONFIG_FILE)
|
||||||
|
|
2
mypy.ini
2
mypy.ini
|
@ -1,4 +1,4 @@
|
||||||
[mypy]
|
[mypy]
|
||||||
ignore_missing_imports = true
|
ignore_missing_imports = true
|
||||||
exclude = "amanuensis/cli/.*|amanuensis/config/.*|amanuensis/lexicon/.*|amanuensis/log/.*|amanuensis/models/.*|amanuensis/resources/.*|amanuensis/server/.*|amanuensis/user/.*|amanuensis/__main__.py"
|
exclude = "|amanuensis/lexicon/.*|amanuensis/models/.*|amanuensis/resources/.*|amanuensis/server/.*|amanuensis/user/.*|amanuensis/__main__.py|"
|
||||||
; mypy stable doesn't support pyproject.toml yet
|
; mypy stable doesn't support pyproject.toml yet
|
|
@ -21,7 +21,7 @@ amanuensis-cli = "amanuensis.cli:main"
|
||||||
amanuensis-server = "amanuensis.server:run"
|
amanuensis-server = "amanuensis.server:run"
|
||||||
|
|
||||||
[tool.black]
|
[tool.black]
|
||||||
extend-exclude = "^/amanuensis/cli/.*|^/amanuensis/config/.*|^/amanuensis/lexicon/.*|^/amanuensis/log/.*|^/amanuensis/models/.*|^/amanuensis/resources/.*|^/amanuensis/server/.*|^/amanuensis/user/.*|^/amanuensis/__main__.py"
|
extend-exclude = "^/amanuensis/lexicon/.*|^/amanuensis/models/.*|^/amanuensis/resources/.*|^/amanuensis/server/.*|^/amanuensis/user/.*|^/amanuensis/__main__.py"
|
||||||
|
|
||||||
[tool.mypy]
|
[tool.mypy]
|
||||||
ignore_missing_imports = true
|
ignore_missing_imports = true
|
||||||
|
|
Loading…
Reference in New Issue