from xml.etree.ElementTree import Element
translation_element: Element
translations = {
attr: text
for item in translation_element.findall("{*}Translation") # `Element.findall() -> list[Element]`
if (attr := item.get("AttributeName")) is not None # unwrap since `Element.get() -> str | None`
and (text := item.get("Text")) is not None
}
I would expect attr not to be treated as static key here since it should (depending on the xml source) be different for every iteration of the comprehension.
Hi 👋!
I have a piece of code raising
from
ruff check .
since the update from ruff 0.1.11 to 0.1.13.This is the piece of code in question: https://github.com/XKNX/xknxproject/blob/73088e13bfcd11f4dc03963bf2c8ef4776972e68/xknxproject/loader/knx_master_loader.py#L70-L75 A short version of it:
I would expect
attr
not to be treated as static key here since it should (depending on the xml source) be different for every iteration of the comprehension.Here is my ruff section from pyproject.toml: