diff --git a/nornir/core/inventory.py b/nornir/core/inventory.py index fcff2c76..3a90313d 100644 --- a/nornir/core/inventory.py +++ b/nornir/core/inventory.py @@ -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 diff --git a/pyproject.toml b/pyproject.toml index 5ef74ddf..ec8d0384 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -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