From c3a9f367652c4547d2b30c1c3578c2c99642513f Mon Sep 17 00:00:00 2001 From: Max Fischer Date: Fri, 2 Feb 2024 16:39:14 +0100 Subject: [PATCH] black24 --- src/cobald/__about__.py | 1 + src/cobald/controller/stepwise.py | 8 ++++---- src/cobald/daemon/core/logger.py | 8 +++++--- src/cobald/daemon/core/main.py | 1 + src/cobald/daemon/debug.py | 8 +++++--- src/cobald/daemon/plugins.py | 1 + src/cobald/interfaces/__init__.py | 1 + src/cobald/interfaces/_partial.py | 16 ++++++++-------- 8 files changed, 26 insertions(+), 18 deletions(-) diff --git a/src/cobald/__about__.py b/src/cobald/__about__.py index 9544ea41..040846c4 100644 --- a/src/cobald/__about__.py +++ b/src/cobald/__about__.py @@ -10,6 +10,7 @@ This is a **draft** for a feedback based balancing system for providing opportunistic resources. """ + __title__ = "cobald" __summary__ = "COBalD - the Opportunistic Balancing Daemon" __url__ = "https://github.com/MatterMiners/cobald" diff --git a/src/cobald/controller/stepwise.py b/src/cobald/controller/stepwise.py index ccc0a83a..4982ebe7 100644 --- a/src/cobald/controller/stepwise.py +++ b/src/cobald/controller/stepwise.py @@ -134,12 +134,12 @@ def __init__(self, base: ControlRule): self._thresholds: Set[float] = set() @overload # noqa: F811 - def add(self, rule: ControlRule, *, supply: float) -> ControlRule: - ... + def add(self, rule: ControlRule, *, supply: float) -> ControlRule: ... @overload # noqa: F811 - def add(self, rule: None, *, supply: float) -> Callable[[ControlRule], ControlRule]: - ... + def add( + self, rule: None, *, supply: float + ) -> Callable[[ControlRule], ControlRule]: ... def add(self, rule: ControlRule = None, *, supply: float): # noqa: F811 """ diff --git a/src/cobald/daemon/core/logger.py b/src/cobald/daemon/core/logger.py index c7100529..89b8c974 100644 --- a/src/cobald/daemon/core/logger.py +++ b/src/cobald/daemon/core/logger.py @@ -25,9 +25,11 @@ def initialise_logging(level: str, target: str, short_format: bool): handler = create_handler(target=target) logging.basicConfig( level=log_level, - format="%(asctime)-15s (%(process)d) %(message)s" - if not short_format - else "%(message)s", + format=( + "%(asctime)-15s (%(process)d) %(message)s" + if not short_format + else "%(message)s" + ), datefmt="%Y-%m-%d %H:%M:%S", handlers=[handler], ) diff --git a/src/cobald/daemon/core/main.py b/src/cobald/daemon/core/main.py index ba38355f..1e9fa5ad 100644 --- a/src/cobald/daemon/core/main.py +++ b/src/cobald/daemon/core/main.py @@ -1,6 +1,7 @@ """ Daemon core specific to cobald """ + import asyncio import sys import logging diff --git a/src/cobald/daemon/debug.py b/src/cobald/daemon/debug.py index 7eb0254f..558eba8f 100644 --- a/src/cobald/daemon/debug.py +++ b/src/cobald/daemon/debug.py @@ -20,9 +20,11 @@ def pretty_partial(obj: partial) -> str: return "partial(%s%s%s)" % ( pretty_ref(obj.func), "" if not obj.args else ", ".join(repr(arg) for arg in obj.args), - "" - if not obj.keywords - else ", ".join("%r = %r" % (k, v) for k, v in obj.keywords.items()), + ( + "" + if not obj.keywords + else ", ".join("%r = %r" % (k, v) for k, v in obj.keywords.items()) + ), ) diff --git a/src/cobald/daemon/plugins.py b/src/cobald/daemon/plugins.py index 653ee9e0..8adceacb 100644 --- a/src/cobald/daemon/plugins.py +++ b/src/cobald/daemon/plugins.py @@ -1,6 +1,7 @@ """ Tools and helpers to declare plugins """ + from typing import Iterable, FrozenSet, TypeVar, NamedTuple diff --git a/src/cobald/interfaces/__init__.py b/src/cobald/interfaces/__init__.py index 3b1818f9..09c4d942 100644 --- a/src/cobald/interfaces/__init__.py +++ b/src/cobald/interfaces/__init__.py @@ -23,6 +23,7 @@ } """ + from ._composite import CompositePool from ._controller import Controller from ._pool import Pool diff --git a/src/cobald/interfaces/_partial.py b/src/cobald/interfaces/_partial.py index 47c27349..4d83f225 100644 --- a/src/cobald/interfaces/_partial.py +++ b/src/cobald/interfaces/_partial.py @@ -39,6 +39,7 @@ class Partial(Generic[C_co]): creates a temporary :py:class:`~.PartialBind`. Only binding to a :py:class:`~.Pool` as the last element creates a concrete binding. """ + __slots__ = ("ctor", "args", "kwargs", "leaf") def __init__(self, ctor: Type[C_co], *args, __leaf__, **kwargs): @@ -74,12 +75,12 @@ def __construct__(self, *args, **kwargs): return self.ctor(*args, *self.args, **kwargs, **self.kwargs) @overload # noqa: F811 - def __rshift__(self, other: "Union[Owner, Pool, PartialBind[Pool]]") -> "C_co": - ... + def __rshift__(self, other: "Union[Owner, Pool, PartialBind[Pool]]") -> "C_co": ... @overload # noqa: F811 - def __rshift__(self, other: "Union[Partial, PartialBind]") -> "PartialBind[C_co]": - ... + def __rshift__( + self, other: "Union[Partial, PartialBind]" + ) -> "PartialBind[C_co]": ... def __rshift__(self, other): # noqa: F811 if isinstance(other, PartialBind): @@ -107,6 +108,7 @@ class PartialBind(Generic[C_co]): This helper is used to invert the operator precedence of ``>>``, allowing the last pair to be bound first. """ + __slots__ = ("parent", "targets") def __init__( @@ -118,12 +120,10 @@ def __init__( self.targets = targets @overload # noqa: F811 - def __rshift__(self, other: Partial[Owner]) -> "PartialBind[C_co]": - ... + def __rshift__(self, other: Partial[Owner]) -> "PartialBind[C_co]": ... @overload # noqa: F811 - def __rshift__(self, other: "Pool") -> "C_co": - ... + def __rshift__(self, other: "Pool") -> "C_co": ... def __rshift__(self, other: "Union[Pool, Partial[Owner]]"): # noqa: F811 if isinstance(other, _pool.Pool):