Rewrite as dict comprehension

This commit is contained in:
Hugo van Kemenade 2024-01-15 13:34:25 +02:00
parent 69ada9994a
commit 96eb24b768

View File

@ -227,11 +227,7 @@ def imagemath_convert(self: _Operand, mode: str) -> _Operand:
@cache @cache
def _get_ops() -> dict[str, Any]: def _get_ops() -> dict[str, Any]:
ops = {} return {k[10:]: v for k, v in globals().items() if k[:10] == "imagemath_"}
for k, v in list(globals().items()):
if k[:10] == "imagemath_":
ops[k[10:]] = v
return ops
def eval(expression: str, _dict: dict[str, Any] = {}, **kw: Any) -> Any: def eval(expression: str, _dict: dict[str, Any] = {}, **kw: Any) -> Any: