Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Inspection maintenance #135

Merged
merged 7 commits into from
Feb 14, 2024
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .flake8
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[flake8]
statistics = True
max-line-length = 80
ignore = E501, B008, B011, W503, B905
select = C,E,F,W,B,B9
ignore = E203, E501, E704, B008, B011, B905, W503
exclude = docs,.svn,CVS,.bzr,.hg,.git,__pycache__,.tox,.eggs,*.egg
5 changes: 3 additions & 2 deletions cobald_tests/decorator/test_logger.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import threading
import logging
import io
import warnings

import pytest

Expand Down Expand Up @@ -57,9 +58,9 @@ def test_name(self):
def test_verification(self):
pool = FullMockPool()
# no warnings by default
with pytest.warns(None) as recorded_warnings:
with warnings.catch_warnings():
warnings.simplefilter("error")
Logger(target=pool, name="test logger")
assert not recorded_warnings

pool = FullMockPool()
with pytest.warns(FutureWarning):
Expand Down
3 changes: 2 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
python_requires=">=3.8",
install_requires=[
"pyyaml",
"trio>=0.4.0",
"trio",
"entrypoints",
"toposort",
],
Expand All @@ -68,6 +68,7 @@
"flake8",
"flake8-bugbear",
"black; implementation_name=='cpython'",
"pytest>=8.0",
"pytest-cov",
]
+ TESTS_REQUIRE,
Expand Down
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 @@
self._thresholds: Set[float] = set()

@overload # noqa: F811
def add(self, rule: ControlRule, *, supply: float) -> ControlRule:
...
def add(self, rule: ControlRule, *, supply: float) -> ControlRule: ...
Dismissed Show dismissed Hide dismissed

@overload # noqa: F811
def add(self, rule: None, *, supply: float) -> Callable[[ControlRule], ControlRule]:
...
def add(
self, rule: None, *, supply: float
) -> Callable[[ControlRule], ControlRule]: ...
Dismissed Show dismissed Hide dismissed

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 @@
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 @@
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": ...
Dismissed Show dismissed Hide dismissed

@overload # noqa: F811
def __rshift__(self, other: "Union[Partial, PartialBind]") -> "PartialBind[C_co]":
...
def __rshift__(
self, other: "Union[Partial, PartialBind]"
) -> "PartialBind[C_co]": ...
Dismissed Show dismissed Hide dismissed

def __rshift__(self, other): # noqa: F811
if isinstance(other, PartialBind):
Expand Down Expand Up @@ -107,6 +108,7 @@
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 @@
self.targets = targets

@overload # noqa: F811
def __rshift__(self, other: Partial[Owner]) -> "PartialBind[C_co]":
...
def __rshift__(self, other: Partial[Owner]) -> "PartialBind[C_co]": ...
Dismissed Show dismissed Hide dismissed

@overload # noqa: F811
def __rshift__(self, other: "Pool") -> "C_co":
...
def __rshift__(self, other: "Pool") -> "C_co": ...
Dismissed Show dismissed Hide dismissed

def __rshift__(self, other: "Union[Pool, Partial[Owner]]"): # noqa: F811
if isinstance(other, _pool.Pool):
Expand Down
Loading