Skip to content

Commit

Permalink
Rename name -> hostname to avoid redefining argument with the local name
Browse files Browse the repository at this point in the history
Fixes Ruff: PLR1704
  • Loading branch information
ogenstad committed Jul 1, 2024
1 parent a304100 commit be0483f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
8 changes: 4 additions & 4 deletions nornir/core/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,12 +121,12 @@ def run(

run_on = []
if on_good:
for name, host in self.inventory.hosts.items():
if name not in self.data.failed_hosts:
for hostname, host in self.inventory.hosts.items():
if hostname not in self.data.failed_hosts:
run_on.append(host)
if on_failed:
for name, host in self.inventory.hosts.items():
if name in self.data.failed_hosts:
for hostname, host in self.inventory.hosts.items():
if hostname in self.data.failed_hosts:
run_on.append(host)

num_hosts = len(run_on)
Expand Down
1 change: 0 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,6 @@ ignore = [
"PIE800", # Unnecessary spread `**`
"PLC0205", # Class `__slots__` should be a non-string iterable
"PLC2801", # Unnecessary dunder call to `__getattribute__`. Access attribute directly or use getattr built-in function
"PLR1704", # Redefining argument with the local name
"PLR6201", # Use a `set` literal when testing for membership
"PLR6301", # Method `run` could be a function, class method, or static method
"PLW1514", # `open` in text mode without explicit `encoding` argument
Expand Down

0 comments on commit be0483f

Please sign in to comment.