Skip to content

Commit

Permalink
chore(deps): update minor updates (master) (#251)
Browse files Browse the repository at this point in the history
* chore(deps): update minor updates

* ruff: SIM910

* ruff: disable RUF017

* T3FiltertingStockSelector: avoid quadratic list summation

* fixup! ruff: SIM910

* tests: remove deprecated app shortcut

* fixup! tests: remove deprecated app shortcut

---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Jakob van Santen <jvansanten@gmail.com>
  • Loading branch information
renovate[bot] and jvansanten committed Mar 1, 2024
1 parent daeaf38 commit fb1ac3e
Show file tree
Hide file tree
Showing 9 changed files with 43 additions and 40 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,6 @@ jobs:
mongo: true
lint: true
# renovate: datasource=conda depName=conda-forge/python
python-version: "3.12.1"
python-version: "3.12.2"
# renovate: datasource=pypi depName=ruff
ruff-version: "0.1.15"
ruff-version: "0.3.0"
2 changes: 1 addition & 1 deletion ampel/cli/T2Command.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ def run(self, args: dict[str, Any], unknown_args: Sequence[str], sub_op: None |
if sub_op == 'show':

m = t2_utils.match_t2s(**args)
limit = args.get('limit', None)
limit = args.get('limit')
if args.get('dry_run'):
count = col.count_documents(m)
if limit:
Expand Down
2 changes: 1 addition & 1 deletion ampel/log/LightLogRecord.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,4 +48,4 @@ def getMessage(self):
return self.msg

def __getattr__(self, k):
return self.__dict__[k] if k in self.__dict__ else None
return self.__dict__.get(k, None)
2 changes: 1 addition & 1 deletion ampel/log/LogsDumper.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ def log_entries(self, log_entries: Sequence[dict], logger: AmpelLogger) -> None:
for el in log_entries:

record = LightLogRecord(name=0, levelno=el['f'], msg=el.get('m'))
record.extra = el['e'] if 'e' in el else {}
record.extra = el.get('e') or {}
record.extra['run'] = el['r']

if 'c' in el:
Expand Down
14 changes: 7 additions & 7 deletions ampel/ops/AmpelExceptionPublisher.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,13 @@ def t3_fields(self, doc: dict[str, Any]) -> list[dict[str, Any]]:
fields = []
if "job" in doc:
fields.append(
{"title": "Job", "value": doc.get("job", None), "short": True}
{"title": "Job", "value": doc.get("job"), "short": True}
)
if "task" in doc:
fields.append(
{"title": "Task", "value": doc.get("task", None), "short": True}
{"title": "Task", "value": doc.get("task"), "short": True}
)
fields.append({"title": "Run", "value": doc.get("run", None), "short": True})
fields.append({"title": "Run", "value": doc.get("run"), "short": True})
return fields

def format_attachment(self, doc: dict[str, Any]) -> dict[str, Any]:
Expand All @@ -58,18 +58,18 @@ def format_attachment(self, doc: dict[str, Any]) -> dict[str, Any]:
if doc["tier"] == 0:
for field in "section", "stock":
fields.append( # noqa: PERF401
{"title": field, "value": doc.get(field, None), "short": True}
{"title": field, "value": doc.get(field), "short": True}
)
if "alert" in doc:
fields.append(
{"title": "alert", "value": doc["alert"], "short": True}
)
elif doc["tier"] == 2:
fields.append(
{"title": "unit", "value": doc.get("unit", None), "short": True}
{"title": "unit", "value": doc.get("unit"), "short": True}
)
t2Doc = doc.get("t2Doc", None)
if hasattr(t2Doc, "binary"):
t2Doc = doc.get("t2Doc")
if t2Doc and hasattr(t2Doc, "binary"):
fields.append(
{"title": "t2Doc", "value": t2Doc.binary.hex(), "short": True}
)
Expand Down
4 changes: 3 additions & 1 deletion ampel/t3/supply/select/T3FilteringStockSelector.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
# Last Modified Date: 02.08.2020
# Last Modified By : Jakob van Santen <jakob.van.santen@desy.de>

import functools
import operator
from collections.abc import Generator
from itertools import islice
from typing import Any
Expand Down Expand Up @@ -197,5 +199,5 @@ def _all_units(filters: T2FilterModel | AllOf[T2FilterModel] | AnyOf[T2FilterMod
return list(set(f.unit for f in filters.all_of))
if isinstance(filters, AnyOf):
# NB: AnyOf may contain AllOf
return list(set(sum((_all_units(f) for f in filters.any_of), [])))
return list(set(functools.reduce(operator.iadd, (_all_units(f) for f in filters.any_of), [])))
raise TypeError()
4 changes: 2 additions & 2 deletions ampel/test/test_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
import pytest
import pytest_asyncio
import yaml
from httpx import AsyncClient
from httpx import ASGITransport, AsyncClient
from prometheus_client.parser import text_fd_to_metric_families

from ampel.core.AmpelContext import AmpelContext
Expand All @@ -37,7 +37,7 @@ async def test_client(dev_context, monkeypatch):
):
monkeypatch.setattr(f"ampel.run.server.task_manager.{attr}", {})

async with AsyncClient(app=server.app, base_url="http://test") as client:
async with AsyncClient(transport=ASGITransport(app=server.app), base_url="http://test") as client:
yield client


Expand Down
44 changes: 22 additions & 22 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 4 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -62,12 +62,12 @@ slack-sdk = {version = "^3.18.1", optional = true}
pytest = "^8.0.2"
pytest-cov = "^4.1.0"
mypy = "^1.8.0"
pytest-asyncio = "^0.23.4"
pytest-asyncio = "^0.23.5"
pytest-mock = "^3.12.0"
mongomock = "^4.1.2"
# mongomock uses pkg_resources
setuptools = {version = "*", python = ">=3.12"}
httpx = "^0.26.0"
httpx = "^0.27.0"
types-setuptools = "^65.1.0"
types-PyYAML = "^6.0.12"

Expand All @@ -78,7 +78,7 @@ slack = ["slack_sdk"]
[tool.poetry.group.dev.dependencies]
types-requests = "^2.28.11.15"
types-psutil = "^5.9.5.20240106"
ruff = "^0.1.13"
ruff = "^0.3.0"

[tool.isort]
profile = "black"
Expand Down Expand Up @@ -158,6 +158,7 @@ ignore = [
"PLR09", # too many (arguments|branches)
"PLR2004", # Magic value used in comparison
"RUF012", # mutable class properties (are harmless everywhere BaseModel is used)
"RUF018", # assignment expressions in asserts are fine
]

[tool.ruff.lint.per-file-ignores]
Expand Down

0 comments on commit fb1ac3e

Please sign in to comment.