diff --git a/mypy/semanal_main.py b/mypy/semanal_main.py index 92a1c24b7b4c..2e0d901d5864 100644 --- a/mypy/semanal_main.py +++ b/mypy/semanal_main.py @@ -181,7 +181,7 @@ def process_top_levels(graph: Graph, scc: list[str], patches: Patches) -> None: # Reverse order of the scc so the first modules in the original list will be # be processed first. This helps with performance. - scc = list(reversed(scc)) + scc = list(reversed(scc)) # noqa: FURB187 intentional copy # Initialize ASTs and symbol tables. for id in scc: diff --git a/mypyc/analysis/dataflow.py b/mypyc/analysis/dataflow.py index 26b58e224634..0657261e7a8f 100644 --- a/mypyc/analysis/dataflow.py +++ b/mypyc/analysis/dataflow.py @@ -542,7 +542,7 @@ def run_analysis( # Set up initial state for worklist algorithm. worklist = list(blocks) if not backward: - worklist = worklist[::-1] # Reverse for a small performance improvement + worklist.reverse() # Reverse for a small performance improvement workset = set(worklist) before: dict[BasicBlock, set[T]] = {} after: dict[BasicBlock, set[T]] = {} diff --git a/pyproject.toml b/pyproject.toml index d264ac3749a9..ddc28f458d50 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -148,6 +148,7 @@ select = [ "SIM201", "SIM202", "SIM222", "SIM223", # flake8-simplify "FURB168", # Prefer is operator over isinstance for None checks "FURB169", # Do not use is comparison with type(None). Use None + "FURB187", # avoid list reverse copy "FURB188", # use str.remove(pre|suf)fix "ISC001", # implicitly concatenated string "RET501", "RET502", # better return None handling