From a77fac51e8b0bfa43b648b1784b723425b86e396 Mon Sep 17 00:00:00 2001 From: James McKinney <26463+jpmckinney@users.noreply.github.com> Date: Sat, 28 Sep 2024 16:33:50 -0400 Subject: [PATCH] chore: Avoid unnecessary assignment before for-loop --- ocdsindex/__main__.py | 3 +-- pyproject.toml | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/ocdsindex/__main__.py b/ocdsindex/__main__.py index aea973f..d3d44e6 100644 --- a/ocdsindex/__main__.py +++ b/ocdsindex/__main__.py @@ -123,8 +123,7 @@ def copy(host, source, destination): for index_result in es.cat.indices(format="json"): index = index_result["index"] - result = es.search(index=index, size=10000, query={"term": {"base_url": source}}) - for hit in result["hits"]["hits"]: + for hit in es.search(index=index, size=10000, query={"term": {"base_url": source}})["hits"]["hits"]: document = hit["_source"] for field in ("url", "base_url"): document[field] = document[field].replace(source, destination) diff --git a/pyproject.toml b/pyproject.toml index fbd457e..1790a40 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -48,7 +48,7 @@ target-version = "py39" select = ["ALL"] ignore = [ "ANN", "C901", "COM812", "D203", "D212", "D415", "EM", "ISC001", "PERF203", "PLR091", "Q000", - "D1", + "D1", "D205", "PLR2004", # magic "PTH", ]