Skip to content

Commit

Permalink
Fix ruff rule PLW2901 "redefine loop name" (#216)
Browse files Browse the repository at this point in the history
Closes #157
  • Loading branch information
milanmlft authored Jan 11, 2024
1 parent 22aa62c commit d344654
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions pixl_ehr/src/pixl_ehr/_queries.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,17 +41,17 @@ def _replace_placeholders_and_populate_values(self, context: dict) -> None:
continue

for key, value in context.items():
line = line.replace("${{ " + str(key) + " }}", str(value)) # noqa: PLW2901
new_line = line.replace("${{ " + str(key) + " }}", str(value))

n = line.count(f":{key}")
n = new_line.count(f":{key}")
self.values += n * [value]
line = line.replace(f":{key}", "%s") # noqa: PLW2901
new_line = new_line.replace(f":{key}", "%s")

if ":" in line.replace("::", "") or "${{" in line:
if ":" in new_line.replace("::", "") or "${{" in new_line:
msg = (
"Had an insufficient context to replace "
f"line {i} in {self._filepath}\n"
f"{line}"
f"new_line {i} in {self._filepath}\n"
f"{new_line}"
)
raise RuntimeError(msg)
self._lines[i] = line
self._lines[i] = new_line

0 comments on commit d344654

Please sign in to comment.