Skip to content

Commit

Permalink
Fix Ruff TRY300: Consider moving this statement to an else block
Browse files Browse the repository at this point in the history
  • Loading branch information
ogenstad committed Jun 30, 2024
1 parent 320b229 commit af59114
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 3 deletions.
3 changes: 1 addition & 2 deletions nornir/core/inventory.py
Original file line number Diff line number Diff line change
Expand Up @@ -339,8 +339,7 @@ def __getitem__(self, item: str) -> Any:
except KeyError:
for g in self.extended_groups():
try:
r = g.data[item]
return r
return g.data[item]
except KeyError:
continue

Expand Down
1 change: 0 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,6 @@ ignore = [
"TRY002", # Create your own exception
"TRY003", # Avoid specifying long messages outside the exception class
"TRY004", # Prefer `TypeError` exception for invalid type
"TRY300", # Consider moving this statement to an `else` block
"TRY400", # Use `logging.exception` instead of `logging.error`
"UP004", # Class inherits from `object`
"UP009", # UTF-8 encoding declaration is unnecessary
Expand Down

0 comments on commit af59114

Please sign in to comment.