Incorporate server and cli into new code #13

Merged
Jaculabilis merged 16 commits from tvb/server into develop 2021-06-16 03:53:07 +00:00
5 changed files with 10 additions and 7 deletions
Showing only changes of commit e097917633 - Show all commits

View File

@ -16,7 +16,7 @@ LOGGING_CONFIG = {
},
"fmt_detailed": {
"validate": True,
"format": "%(asctime)s %(levelname)s %(message)s"
"format": "%(asctime)s %(levelname)s %(message)s",
},
},
"handlers": {
@ -29,8 +29,8 @@ LOGGING_CONFIG = {
"loggers": {
__name__: {
"level": "DEBUG",
"handlers": ["hnd_stderr"]
}
"handlers": ["hnd_stderr"],
},
},
}
@ -69,7 +69,7 @@ def add_subcommand(subparsers, module) -> None:
def init_logger(args):
"""Set up logging based on verbosity args"""
if (args.verbose):
if args.verbose:
handler = LOGGING_CONFIG["handlers"]["hnd_stderr"]
handler["formatter"] = "fmt_detailed"
handler["level"] = "DEBUG"

View File

@ -14,7 +14,9 @@ COMMAND_HELP = "Interact with Amanuensis."
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("--verbose", "-v", action="store_true", help="Enable db echo")
def command_init_db(args) -> int:

View File

@ -29,6 +29,7 @@ class EnvironmentConfig(AmanuensisConfig):
class CommandLineConfig(AmanuensisConfig):
"""Loads config values from command line arguments."""
def __init__(self) -> None:
parser = ArgumentParser()
parser.add_argument("--config-file", default=AmanuensisConfig.CONFIG_FILE)

View File

@ -1,4 +1,4 @@
[mypy]
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

View File

@ -21,7 +21,7 @@ amanuensis-cli = "amanuensis.cli:main"
amanuensis-server = "amanuensis.server:run"
[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]
ignore_missing_imports = true