From 470155345fc25114cfc0d556639de0e0bcc2829f Mon Sep 17 00:00:00 2001 From: Yax <1949284+kianby@users.noreply.github.com> Date: Sat, 19 Nov 2022 21:18:09 +0100 Subject: [PATCH] black default setting: line length is 88 chars max --- Makefile | 2 +- stacosys/db/dao.py | 4 +--- stacosys/interface/web/admin.py | 4 +--- stacosys/run.py | 11 +++++------ 4 files changed, 8 insertions(+), 13 deletions(-) diff --git a/Makefile b/Makefile index 02911e8..18d62d8 100644 --- a/Makefile +++ b/Makefile @@ -10,4 +10,4 @@ lint: pylint stacosys/ black: - black -l 79 stacosys/ \ No newline at end of file + black stacosys/ \ No newline at end of file diff --git a/stacosys/db/dao.py b/stacosys/db/dao.py index f2876d2..597579d 100644 --- a/stacosys/db/dao.py +++ b/stacosys/db/dao.py @@ -47,9 +47,7 @@ def count_published_comments(url): .where((Comment.url == url) & (Comment.published.is_null(False))) .count() if url - else Comment.select(Comment) - .where(Comment.published.is_null(False)) - .count() + else Comment.select(Comment).where(Comment.published.is_null(False)).count() ) diff --git a/stacosys/interface/web/admin.py b/stacosys/interface/web/admin.py index 735d457..c65ee0a 100644 --- a/stacosys/interface/web/admin.py +++ b/stacosys/interface/web/admin.py @@ -51,9 +51,7 @@ def logout(): @app.route("/web/admin", methods=["GET"]) def admin_homepage(): - if not ( - "user" in session and session["user"] == app.config.get("WEB_USERNAME") - ): + if not ("user" in session and session["user"] == app.config.get("WEB_USERNAME")): # TODO localization flash("Vous avez été déconnecté.") return redirect("/web/login") diff --git a/stacosys/run.py b/stacosys/run.py index df838bb..60f3a58 100644 --- a/stacosys/run.py +++ b/stacosys/run.py @@ -20,12 +20,11 @@ from stacosys.interface.web import admin def configure_logging(level): root_logger = logging.getLogger() root_logger.setLevel(level) - ch = logging.StreamHandler() - ch.setLevel(level) - formatter = logging.Formatter( - "[%(asctime)s] %(name)s %(levelname)s %(message)s") - ch.setFormatter(formatter) - root_logger.addHandler(ch) + handler = logging.StreamHandler() + handler.setLevel(level) + formatter = logging.Formatter("[%(asctime)s] %(name)s %(levelname)s %(message)s") + handler.setFormatter(formatter) + root_logger.addHandler(handler) def stacosys_server(config_pathname):