From e097917633260623a7190159ec25a92df9bcba71 Mon Sep 17 00:00:00 2001 From: Tim Van Baak Date: Tue, 15 Jun 2021 16:59:17 -0700 Subject: [PATCH] Style pass for newly integrated modules --- amanuensis/cli/__init__.py | 8 ++++---- amanuensis/cli/admin.py | 4 +++- amanuensis/config.py | 1 + mypy.ini | 2 +- pyproject.toml | 2 +- 5 files changed, 10 insertions(+), 7 deletions(-) diff --git a/amanuensis/cli/__init__.py b/amanuensis/cli/__init__.py index e6cfe68..7f50868 100644 --- a/amanuensis/cli/__init__.py +++ b/amanuensis/cli/__init__.py @@ -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" diff --git a/amanuensis/cli/admin.py b/amanuensis/cli/admin.py index be9a60c..c7e7f30 100644 --- a/amanuensis/cli/admin.py +++ b/amanuensis/cli/admin.py @@ -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: diff --git a/amanuensis/config.py b/amanuensis/config.py index ed1747b..e159a7f 100644 --- a/amanuensis/config.py +++ b/amanuensis/config.py @@ -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) diff --git a/mypy.ini b/mypy.ini index febf6cd..8f9adcf 100644 --- a/mypy.ini +++ b/mypy.ini @@ -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 \ No newline at end of file diff --git a/pyproject.toml b/pyproject.toml index 7b8a2e8..5bd1698 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -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