Skip to content

Commit

Permalink
Fix Ruff PYI036 - Type annotations for context manager exit (#954)
Browse files Browse the repository at this point in the history
The first argument in `__exit__` should be annotated with `object` or `type[BaseException] | None
  • Loading branch information
ogenstad authored Jul 1, 2024
1 parent 7cf6463 commit 03b576a
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
4 changes: 2 additions & 2 deletions nornir/core/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@ def __enter__(self) -> "Nornir":

def __exit__(
self,
exc_type: Type[BaseException],
exc_val: BaseException,
exc_type: Optional[Type[BaseException]] = None,
exc_val: Optional[BaseException] = None,
exc_tb: Optional[types.TracebackType] = None,
) -> None:
self.close_connections(on_good=True, on_failed=True)
Expand Down
1 change: 0 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,6 @@ ignore = [
"PTH100", # `os.path.abspath()` should be replaced by `Path.resolve()`
"PTH120", # `os.path.dirname()` should be replaced by `Path.parent`
"PTH123", # `open()` should be replaced by `Path.open()`
"PYI036", # The first argument in `__exit__` should be annotated with `object` or `type[BaseException] | None`
"RET504", # Unnecessary assignment before `return` statement
"RSE102", # Unnecessary parentheses on raised exception
"RUF001", # String contains ambiguous `–` (EN DASH). Did you mean `-` (HYPHEN-MINUS)?
Expand Down

0 comments on commit 03b576a

Please sign in to comment.