From 53d9293bc42da31d3a3b45c73e23de1ac9b43591 Mon Sep 17 00:00:00 2001 From: Alexandru Fikl <alexfikl@gmail.com> Date: Wed, 3 Jul 2024 19:34:01 +0300 Subject: [PATCH] pyproject: add and fix ruff UP issues --- pyproject.toml | 5 +++++ pytools/graph.py | 2 +- pytools/persistent_dict.py | 2 +- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index deb407e..80e34ff 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -77,6 +77,7 @@ extend-select = [ "N", # pep8-naming "NPY", # numpy "Q", # flake8-quotes + "UP", # pyupgrade "W", # pycodestyle ] extend-ignore = [ @@ -84,6 +85,10 @@ extend-ignore = [ "E221", # multiple spaces before operator "E226", # missing whitespace around arithmetic operator "E402", # module-level import not at top of file + "UP006", # updated annotations due to __future__ import + "UP007", # updated annotations due to __future__ import + "UP031", # use f-strings instead of % + "UP032", # use f-strings instead of .format ] [tool.ruff.lint.flake8-quotes] diff --git a/pytools/graph.py b/pytools/graph.py index 09db7aa..2725bd4 100644 --- a/pytools/graph.py +++ b/pytools/graph.py @@ -267,7 +267,7 @@ class HeapEntry: self.node = node self.key = key - def __lt__(self, other: "HeapEntry") -> bool: + def __lt__(self, other: HeapEntry) -> bool: return self.key < other.key diff --git a/pytools/persistent_dict.py b/pytools/persistent_dict.py index 5d1baf9..c35476c 100644 --- a/pytools/persistent_dict.py +++ b/pytools/persistent_dict.py @@ -254,7 +254,7 @@ class KeyBuilder: @staticmethod def update_for_type(key_hash: Hash, key: type) -> None: key_hash.update( - f"{key.__module__}.{key.__qualname__}.{key.__name__}".encode("utf-8")) + f"{key.__module__}.{key.__qualname__}.{key.__name__}".encode()) update_for_ABCMeta = update_for_type # noqa: N815 -- GitLab