Skip to content

Commit

Permalink
[pre-commit.ci] pre-commit autoupdate (#1381)
Browse files Browse the repository at this point in the history
* [pre-commit.ci] pre-commit autoupdate

updates:
- [github.com/astral-sh/ruff-pre-commit: v0.1.6 → v0.1.7](astral-sh/ruff-pre-commit@v0.1.6...v0.1.7)
- [github.com/PyCQA/bandit: 1.7.5 → 1.7.6](PyCQA/bandit@1.7.5...1.7.6)

* Fix mypy

* Fix mypy

* Fix mypy

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Pankaj <[email protected]>
  • Loading branch information
pre-commit-ci[bot] and pankajastro authored Dec 12, 2023
1 parent f47365d commit cf7db12
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 6 deletions.
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ repos:
additional_dependencies: [black==22.3.0]

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: 'v0.1.6'
rev: 'v0.1.7'
hooks:
- id: ruff
args: ["--config", "./pyproject.toml"]
Expand Down Expand Up @@ -90,7 +90,7 @@ repos:
additional_dependencies: ['toml']

- repo: https://github.com/PyCQA/bandit
rev: 1.7.5
rev: 1.7.6
hooks:
- id: bandit
# Excluding Example DAGs temporarily until they can be fixed
Expand Down
12 changes: 8 additions & 4 deletions astronomer/providers/google/cloud/hooks/dataproc.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,20 @@

from airflow.providers.google.common.consts import CLIENT_INFO
from airflow.providers.google.common.hooks.base_google import GoogleBaseHook
from google.api_core import gapic_v1
from google.api_core import gapic_v1, retry_async as retries
from google.api_core.client_options import ClientOptions
from google.api_core.retry import Retry
from google.cloud.dataproc_v1 import (
ClusterControllerAsyncClient,
Job,
JobControllerAsyncClient,
)
from google.cloud.dataproc_v1.types import clusters

try:
OptionalRetry = Union[retries.AsyncRetry, gapic_v1.method._MethodDefault]
except AttributeError: # pragma: no cover
OptionalRetry = Union[retries.AsyncRetry, object] # type: ignore[misc]

JobType = Union[Job, Any]


Expand Down Expand Up @@ -68,7 +72,7 @@ async def get_cluster(
region: str,
cluster_name: str,
project_id: str,
retry: Union[Retry, gapic_v1.method._MethodDefault] = gapic_v1.method.DEFAULT,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
metadata: Sequence[Tuple[str, str]] = (),
) -> clusters.Cluster:
"""
Expand Down Expand Up @@ -98,7 +102,7 @@ async def get_job(
timeout: float = 5,
region: Optional[str] = None,
location: Optional[str] = None,
retry: Union[Retry, gapic_v1.method._MethodDefault] = gapic_v1.method.DEFAULT,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
metadata: Sequence[Tuple[str, str]] = (),
) -> JobType:
"""
Expand Down
4 changes: 4 additions & 0 deletions astronomer/providers/snowflake/hooks/snowflake_sql_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,8 @@ def execute_query(
try:
response.raise_for_status()
except requests.exceptions.HTTPError as e: # pragma: no cover
if e.response is None:
raise e
raise AirflowException(
f"Response: {e.response.content!r}, " f"Status Code: {e.response.status_code}"
) # pragma: no cover
Expand Down Expand Up @@ -203,6 +205,8 @@ def check_query_output(self, query_ids: list[str]) -> None:
response.raise_for_status()
self.log.info(response.json())
except requests.exceptions.HTTPError as e:
if e.response is None: # pragma: no cover
raise e
raise AirflowException(
f"Response: {e.response.content!r}, Status Code: {e.response.status_code}"
)
Expand Down

0 comments on commit cf7db12

Please sign in to comment.