Skip to content

Commit

Permalink
[pre-commit.ci] pre-commit autoupdate (#2115)
Browse files Browse the repository at this point in the history
<!--pre-commit.ci start-->
updates:
- [github.com/psf/black: 23.12.1 →
24.1.1](psf/black@23.12.1...24.1.1)
- [github.com/astral-sh/ruff-pre-commit: v0.1.14 →
v0.2.0](astral-sh/ruff-pre-commit@v0.1.14...v0.2.0)
<!--pre-commit.ci end-->

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
  • Loading branch information
pre-commit-ci[bot] authored Feb 6, 2024
1 parent 399685d commit e4222cb
Show file tree
Hide file tree
Showing 28 changed files with 52 additions and 20 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:
exclude: ^python-sdk/mk/|^python-sdk/docs/Makefile|^python-sdk/Makefile$|^python-sdk/tests/benchmark/Makefile$

- repo: https://github.com/psf/black
rev: 23.12.1
rev: 24.1.1
hooks:
- id: black
args: ["--config", "./python-sdk/pyproject.toml"]
Expand All @@ -68,7 +68,7 @@ repos:
additional_dependencies: [black>=22.10.0]

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: 'v0.1.14'
rev: 'v0.2.0'
hooks:
- id: ruff
args:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""This script fetches the latest runtime image tag from the provided Quay.io repository URL."""

from __future__ import annotations

import sys
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,11 @@ def parse_providers_release_testing_gh_issue(issue_url: str) -> list[str]:
h2_titles = first_comment.find_all("h2")
package_urls = [_parse_pypi_url_from_h2_title(h2_title) for h2_title in h2_titles]
pinned_packages = [
_parse_pinned_package_from_pypi_url(url)
if "apache-airflow-providers-cncf-kubernetes" not in url
else _parse_pinned_pacakge_from_cncf(url)
(
_parse_pinned_package_from_pypi_url(url)
if "apache-airflow-providers-cncf-kubernetes" not in url
else _parse_pinned_pacakge_from_cncf(url)
)
for url in package_urls
]
return pinned_packages
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
n copy of ``summarize_campaign`` task will be created dynamically
using dynamic task mapping
"""

import os
from datetime import datetime

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
- You can either specify a service account key file and set `GOOGLE_APPLICATION_CREDENTIALS`
with the file path to the service account.
"""

import os

import pandas as pd
Expand Down
1 change: 1 addition & 0 deletions python-sdk/example_dags/example_load_file.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
For sharing a file/folder
please refer https://www.labnol.org/google-api-service-account-220404#4-share-a-drive-folder
"""

import os
import pathlib
from datetime import datetime
Expand Down
1 change: 1 addition & 0 deletions python-sdk/src/astro/databases/aws/redshift.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""AWS Redshift table implementation."""

from __future__ import annotations

from typing import Any
Expand Down
1 change: 1 addition & 0 deletions python-sdk/src/astro/databases/google/bigquery.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Google BigQuery table implementation."""

from __future__ import annotations

import time
Expand Down
1 change: 1 addition & 0 deletions python-sdk/src/astro/databases/postgres.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Postgres database implementation."""

from __future__ import annotations

import io
Expand Down
1 change: 1 addition & 0 deletions python-sdk/src/astro/databases/snowflake.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Snowflake database implementation."""

from __future__ import annotations

import logging
Expand Down
6 changes: 3 additions & 3 deletions python-sdk/src/astro/files/locations/amazon/s3.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,9 @@ def databricks_auth_settings(self) -> dict:
"fs.s3a.secret.key": credentials.secret_key,
}
if credentials.token:
cred_dict[
"fs.s3a.aws.credentials.provider"
] = "org.apache.hadoop.fs.s3a.TemporaryAWSCredentialsProvider"
cred_dict["fs.s3a.aws.credentials.provider"] = (
"org.apache.hadoop.fs.s3a.TemporaryAWSCredentialsProvider"
)
cred_dict["fs.s3a.session.token"] = credentials.token
return cred_dict

Expand Down
8 changes: 5 additions & 3 deletions python-sdk/src/astro/sql/operators/dataframe.py
Original file line number Diff line number Diff line change
Expand Up @@ -247,9 +247,11 @@ def get_openlineage_facets_on_complete(self, task_instance): # skipcq: PYL-W061
fields=[
SchemaField(
name=self.schema if self.schema else self.output_table.metadata.schema,
type=self.database
if self.database
else self.output_table.metadata.database,
type=(
self.database
if self.database
else self.output_table.metadata.database
),
)
]
),
Expand Down
8 changes: 5 additions & 3 deletions python-sdk/src/astro/sql/operators/export_to_file.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,9 +120,11 @@ def get_openlineage_facets_on_complete(self, task_instance): # skipcq: PYL-W061
),
"dataSource": DataSourceDatasetFacet(name=self.output_file.path, uri=output_uri),
"outputStatistics": OutputStatisticsOutputDatasetFacet(
rowCount=self.input_data.row_count
if isinstance(self.input_data, BaseTable)
else len(self.input_data),
rowCount=(
self.input_data.row_count
if isinstance(self.input_data, BaseTable)
else len(self.input_data)
),
size=self.output_file.size,
),
},
Expand Down
8 changes: 5 additions & 3 deletions python-sdk/src/astro/utils/table.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,11 @@ def _find_first_table_from_op_kwargs(
:return: first valid table found in op_kwargs.
"""
kwargs = [
op_kwargs[kwarg.name].resolve(context)
if isinstance(op_kwargs[kwarg.name], XComArg)
else op_kwargs[kwarg.name]
(
op_kwargs[kwarg.name].resolve(context)
if isinstance(op_kwargs[kwarg.name], XComArg)
else op_kwargs[kwarg.name]
)
for kwarg in inspect.signature(python_callable).parameters.values()
]
tables = [kwarg for kwarg in kwargs if isinstance(kwarg, BaseTable)]
Expand Down
9 changes: 6 additions & 3 deletions python-sdk/tests/benchmark/dags/benchmark_gcs_to_big_query.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
This DAG is to benchmark GCSToBigQueryOperator for various dataset
"""

import os
from datetime import datetime, timedelta

Expand Down Expand Up @@ -83,9 +84,11 @@
task_id="load_five_gb",
bucket="astro-sdk",
source_objects=[
f"benchmark/trimmed/pypi/pypi-downloads-2021-03-28-0000000000{str(i)}.ndjson"
if i >= 10
else f"benchmark/trimmed/pypi/pypi-downloads-2021-03-28-00000000000{str(i)}.ndjson"
(
f"benchmark/trimmed/pypi/pypi-downloads-2021-03-28-0000000000{str(i)}.ndjson"
if i >= 10
else f"benchmark/trimmed/pypi/pypi-downloads-2021-03-28-00000000000{str(i)}.ndjson"
)
for i in range(20)
],
destination_project_dataset_table=f"{DATASET_NAME}.{TABLE_NAME}",
Expand Down
1 change: 1 addition & 0 deletions python-sdk/tests/benchmark/synthetic_csv_generator.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
Function to generate csv files of various sizes
"""

import csv
import random

Expand Down
1 change: 1 addition & 0 deletions python-sdk/tests/benchmark/synthetic_ndjson_generator.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
Function to generate ndjson files of various sizes
"""

import ndjson
from faker import Faker

Expand Down
1 change: 1 addition & 0 deletions python-sdk/tests/benchmark/synthetic_parquet_generator.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
Function to generate PARQUET files of various sizes
"""

import pandas as pd
from faker import Faker

Expand Down
1 change: 1 addition & 0 deletions python-sdk/tests/databases/test_redshift.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Tests specific to the Sqlite Database implementation."""

from unittest import mock

from airflow.models import Connection
Expand Down
1 change: 1 addition & 0 deletions python-sdk/tests/databases/test_snowflake.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Tests specific to the Snowflake Database implementation."""

import pathlib
from unittest import mock
from unittest.mock import MagicMock, PropertyMock, patch
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Astronomer migration DAG to transform metadata from source deployment to target Astro Cloud deployment."""

from datetime import datetime

from airflow import DAG
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Tests all Database implementations."""

import pathlib
from unittest import mock

Expand Down
1 change: 1 addition & 0 deletions python-sdk/tests_integration/databases/test_bigquery.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Tests specific to the Sqlite Database implementation."""

import os
import pathlib
from unittest import mock
Expand Down
1 change: 1 addition & 0 deletions python-sdk/tests_integration/databases/test_mssql.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Tests specific to the SqlServer Database implementation."""

import pathlib
import re
from urllib.parse import urlparse
Expand Down
1 change: 1 addition & 0 deletions python-sdk/tests_integration/databases/test_mysql.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Tests specific to the MySql Database implementation."""

import pathlib

import pandas as pd
Expand Down
1 change: 1 addition & 0 deletions python-sdk/tests_integration/databases/test_postgres.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Tests specific to the Sqlite Database implementation."""

import os
import pathlib
from urllib.parse import urlparse
Expand Down
1 change: 1 addition & 0 deletions python-sdk/tests_integration/databases/test_redshift.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Tests specific to the Sqlite Database implementation."""

import os
import pathlib
import re
Expand Down
1 change: 1 addition & 0 deletions python-sdk/tests_integration/databases/test_snowflake.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Tests specific to the Snowflake Database implementation."""

import os
import pathlib
from unittest import mock
Expand Down

0 comments on commit e4222cb

Please sign in to comment.