From 09aa6dc86d4fc05f8a653ef61651050dc8e2919a Mon Sep 17 00:00:00 2001 From: "D.S. Ljungmark" Date: Thu, 18 Apr 2024 17:27:15 +0200 Subject: [PATCH] Re-run modern black on the code --- caramel/config.py | 2 +- caramel/models.py | 7 ++----- caramel/scripts/generate_ca.py | 2 +- caramel/views.py | 4 ++-- 4 files changed, 6 insertions(+), 9 deletions(-) diff --git a/caramel/config.py b/caramel/config.py index f55b355..d1ef2fd 100644 --- a/caramel/config.py +++ b/caramel/config.py @@ -221,7 +221,7 @@ def get_log_level(argument_level, logger=None, env=None): logger = logging.getLogger() current_level = logger.level - argument_verbosity = logging.ERROR - argument_level * 10 # level steps are 10 + argument_verbosity = logging.ERROR - argument_level * 10 # level steps are 10 verbosity = min(argument_verbosity, env_level, current_level) log_level = ( verbosity if logging.DEBUG <= verbosity <= logging.ERROR else logging.ERROR diff --git a/caramel/models.py b/caramel/models.py index 62efb73..836d7e6 100644 --- a/caramel/models.py +++ b/caramel/models.py @@ -2,10 +2,7 @@ # vim: expandtab shiftwidth=4 softtabstop=4 tabstop=17 filetype=python : import sqlalchemy as _sa -from sqlalchemy.ext.declarative import ( - declared_attr, - as_declarative -) +from sqlalchemy.ext.declarative import declared_attr, as_declarative import sqlalchemy.orm as _orm from zope.sqlalchemy import register @@ -98,7 +95,7 @@ class Base(object): @declared_attr # type: ignore def __tablename__(cls) -> str: # pylint: disable=no-self-argument - return cls.__name__.lower() # pylint: disable=no-member + return cls.__name__.lower() # pylint: disable=no-member id = _sa.Column(_sa.Integer, primary_key=True) diff --git a/caramel/scripts/generate_ca.py b/caramel/scripts/generate_ca.py index ab49a7b..bf4d158 100644 --- a/caramel/scripts/generate_ca.py +++ b/caramel/scripts/generate_ca.py @@ -79,7 +79,7 @@ def later_check(subject): casubject = casubject[:-2] subject = subject[:-2] - for (ca, sub) in zip(casubject, subject): + for ca, sub in zip(casubject, subject): if ca != sub: raise ValueError("Subject needs to match CA cert:" "{}".format(casubject)) diff --git a/caramel/views.py b/caramel/views.py index 14ae54c..4670b05 100644 --- a/caramel/views.py +++ b/caramel/views.py @@ -28,7 +28,7 @@ # 2 kbyte should be enough for up to 4 kbit keys. # XXX: This should probably be handled outside of app (i.e. by the # server), or at least be configurable. -_MAXLEN = 2 * 2 ** 10 +_MAXLEN = 2 * 2**10 def raise_for_length(req, limit=_MAXLEN): @@ -38,7 +38,7 @@ def raise_for_length(req, limit=_MAXLEN): if length is None: raise HTTPLengthRequired if length > limit: - raise HTTPRequestEntityTooLarge("Max size: {0} kB".format(limit / 2 ** 10)) + raise HTTPRequestEntityTooLarge("Max size: {0} kB".format(limit / 2**10)) def raise_for_subject(components, required_prefix):