Skip to content

Commit

Permalink
black24
Browse files Browse the repository at this point in the history
  • Loading branch information
maxfischer2781 committed Feb 2, 2024
1 parent ff1d810 commit c3a9f36
Show file tree
Hide file tree
Showing 8 changed files with 26 additions and 18 deletions.
1 change: 1 addition & 0 deletions src/cobald/__about__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
8 changes: 4 additions & 4 deletions src/cobald/controller/stepwise.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
"""
Expand Down
8 changes: 5 additions & 3 deletions src/cobald/daemon/core/logger.py
Original file line number Diff line number Diff line change
Expand Up @@ -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],
)
1 change: 1 addition & 0 deletions src/cobald/daemon/core/main.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
Daemon core specific to cobald
"""

import asyncio
import sys
import logging
Expand Down
8 changes: 5 additions & 3 deletions src/cobald/daemon/debug.py
Original file line number Diff line number Diff line change
Expand Up @@ -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())
),
)


Expand Down
1 change: 1 addition & 0 deletions src/cobald/daemon/plugins.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
Tools and helpers to declare plugins
"""

from typing import Iterable, FrozenSet, TypeVar, NamedTuple


Expand Down
1 change: 1 addition & 0 deletions src/cobald/interfaces/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
}
"""

from ._composite import CompositePool
from ._controller import Controller
from ._pool import Pool
Expand Down
16 changes: 8 additions & 8 deletions src/cobald/interfaces/_partial.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down Expand Up @@ -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):
Expand Down Expand Up @@ -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__(
Expand All @@ -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):
Expand Down

0 comments on commit c3a9f36

Please sign in to comment.