Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Ruff TRY300: Consider moving this statement to an else block #946

Merged
merged 1 commit into from
Jul 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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