From cfe2da56c02a00b00df3df26a8d87b2603d3a0ca Mon Sep 17 00:00:00 2001 From: Yax <1949284+kianby@users.noreply.github.com> Date: Wed, 1 Nov 2023 16:59:45 +0100 Subject: [PATCH] Revert "Code Quality" This reverts commit 6e46eea8140dae4cdc8a8f890090c124bbf49a0b. --- stacosys/db/dao.py | 12 ++++++------ stacosys/service/configuration.py | 9 ++++----- stacosys/service/mail.py | 10 +++++----- 3 files changed, 15 insertions(+), 16 deletions(-) diff --git a/stacosys/db/dao.py b/stacosys/db/dao.py index 5a91210..7d9abdb 100644 --- a/stacosys/db/dao.py +++ b/stacosys/db/dao.py @@ -28,29 +28,29 @@ def delete_comment(comment: Comment): def find_not_notified_comments(): - return db()(db().comment.notified is None).select() + return db()(db().comment.notified == None).select() def find_not_published_comments(): - return db()(db().comment.published is None).select() + return db()(db().comment.published == None).select() def find_published_comments_by_url(url): - return db()((db().comment.url == url) & (db().comment.published is not None)).select( + return db()((db().comment.url == url) & (db().comment.published != None)).select( orderby=db().comment.published ) def count_published_comments(url): return ( - db()((db().comment.url == url) & (db().comment.published is not None)).count() + db()((db().comment.url == url) & (db().comment.published != None)).count() if url - else db()(db().comment.published is not None).count() + else db()(db().comment.published != None).count() ) def find_recent_published_comments(): - return db()(db().comment.published is not None).select( + return db()(db().comment.published != None).select( orderby=~db().comment.published, limitby=(0, 10) ) diff --git a/stacosys/service/configuration.py b/stacosys/service/configuration.py index 67129a4..986409e 100644 --- a/stacosys/service/configuration.py +++ b/stacosys/service/configuration.py @@ -36,13 +36,12 @@ class Config: def load(self, config_pathname): self._cfg.read(config_pathname) - @staticmethod - def _split_key(key: ConfigParameter): + def _split_key(self, key: ConfigParameter): section, param = str(key.value).split(".") if not param: param = section section = "" - return section, param + return (section, param) def exists(self, key: ConfigParameter): section, param = self._split_key(key) @@ -79,8 +78,8 @@ class Config: def check(self): for key in ConfigParameter: if not self.get(key): - return False, key.value - return True, None + return (False, key.value) + return (True, None) def __repr__(self): dict_repr = {} diff --git a/stacosys/service/mail.py b/stacosys/service/mail.py index 8589e60..d7fe5ca 100644 --- a/stacosys/service/mail.py +++ b/stacosys/service/mail.py @@ -18,11 +18,11 @@ class Mailer: self._site_admin_email: str = "" def configure_smtp( - self, - smtp_host, - smtp_port, - smtp_login, - smtp_password, + self, + smtp_host, + smtp_port, + smtp_login, + smtp_password, ) -> None: self._smtp_host = smtp_host self._smtp_port = smtp_port