From 96eb24b768d9ae1fa894c8ce0b6dc71ddd2ce940 Mon Sep 17 00:00:00 2001 From: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com> Date: Mon, 15 Jan 2024 13:34:25 +0200 Subject: [PATCH] Rewrite as dict comprehension --- src/PIL/ImageMath.py | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/src/PIL/ImageMath.py b/src/PIL/ImageMath.py index 4bfafedc3..39a86cb11 100644 --- a/src/PIL/ImageMath.py +++ b/src/PIL/ImageMath.py @@ -227,11 +227,7 @@ def imagemath_convert(self: _Operand, mode: str) -> _Operand: @cache def _get_ops() -> dict[str, Any]: - ops = {} - for k, v in list(globals().items()): - if k[:10] == "imagemath_": - ops[k[10:]] = v - return ops + return {k[10:]: v for k, v in globals().items() if k[:10] == "imagemath_"} def eval(expression: str, _dict: dict[str, Any] = {}, **kw: Any) -> Any: