Skip to content

Commit

Permalink
Fix D105 checks for SSH provider (#38013)
Browse files Browse the repository at this point in the history
Co-authored-by: mehdi.alizade <mehdi.alizade@cafebazaar.ir>
  • Loading branch information
alizademhdi and mehdi.alizade committed Mar 11, 2024
1 parent 5cafdce commit 6ac50c9
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 2 additions & 0 deletions airflow/providers/ssh/hooks/ssh.py
Original file line number Diff line number Diff line change
Expand Up @@ -375,9 +375,11 @@ def log_before_sleep(retry_state):
category=AirflowProviderDeprecationWarning,
)
def __enter__(self) -> SSHHook:
"""Return an instance of SSHHook when the `with` statement is used."""
return self

def __exit__(self, exc_type, exc_val, exc_tb) -> None:
"""Clear ssh client after exiting the `with` statement block."""
if self.client is not None:
self.client.close()
self.client = None
Expand Down
1 change: 0 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -1470,7 +1470,6 @@ combine-as-imports = true
"airflow/providers/microsoft/psrp/hooks/psrp.py" = ["D105"]
"airflow/providers/samba/hooks/samba.py" = ["D105"]
"airflow/providers/smtp/hooks/smtp.py" = ["D105"]
"airflow/providers/ssh/hooks/ssh.py" = ["D105"]
"airflow/providers/tableau/hooks/tableau.py" = ["D105"]

[tool.ruff.lint.flake8-tidy-imports]
Expand Down

0 comments on commit 6ac50c9

Please sign in to comment.