Skip to content

Commit 21c54d2

Browse files
author
V
committed
Implements most black upgrade format fixes
1 parent f227e41 commit 21c54d2

File tree

13 files changed

+48
-33
lines changed

13 files changed

+48
-33
lines changed

airflow/dags/airtable_loader_v2/generate_gtfs_download_configs.py

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -49,18 +49,22 @@ def gtfs_datasets_to_extract_configs(
4949
name=record.name,
5050
url=record.pipeline_url,
5151
feed_type=record.data,
52-
auth_query_params={
53-
record.authorization_url_parameter_name: record.url_secret_key_name
54-
}
55-
if record.authorization_url_parameter_name
56-
and record.url_secret_key_name
57-
else {},
58-
auth_headers={
59-
record.authorization_header_parameter_name: record.header_secret_key_name
60-
}
61-
if record.authorization_header_parameter_name
62-
and record.header_secret_key_name
63-
else {},
52+
auth_query_params=(
53+
{
54+
record.authorization_url_parameter_name: record.url_secret_key_name
55+
}
56+
if record.authorization_url_parameter_name
57+
and record.url_secret_key_name
58+
else {}
59+
),
60+
auth_headers=(
61+
{
62+
record.authorization_header_parameter_name: record.header_secret_key_name
63+
}
64+
if record.authorization_header_parameter_name
65+
and record.header_secret_key_name
66+
else {}
67+
),
6468
),
6569
)
6670
except ValidationError as e:

airflow/dags/dags.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,11 @@ def log_failure_to_slack(context):
5555
wait_for_defaults={"retries": 24, "check_existence": True, "timeout": 10 * 60},
5656
latest_only=False,
5757
user_defined_macros={
58-
"image_tag": lambda: "development"
59-
if os.environ["AIRFLOW_ENV"] == "development"
60-
else "latest",
58+
"image_tag": lambda: (
59+
"development"
60+
if os.environ["AIRFLOW_ENV"] == "development"
61+
else "latest"
62+
),
6163
"env_var": os.environ.get,
6264
},
6365
default_args={

airflow/plugins/operators/external_table.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
However, it's cumbersome to convert the http api style schema fields to SQL, so
88
we provide a fallback for these old-style tasks.
99
"""
10+
1011
from google.api_core.exceptions import NotFound
1112
from google.cloud import bigquery
1213
from utils import CALITP_BQ_LOCATION, CALITP_PROJECT_NAME

airflow/plugins/scripts/gtfs_rt_parser.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
"""
22
Parses binary RT feeds and writes them back to GCS as gzipped newline-delimited JSON
33
"""
4+
45
import base64
56
import copy
67
import datetime
@@ -414,9 +415,9 @@ def where_base64url(self, base64_url: Optional[str]):
414415
def get_aggregates(
415416
self,
416417
) -> List[RTHourlyAggregation]:
417-
aggregates: Dict[
418-
Tuple[pendulum.DateTime, str], List[GTFSRTFeedExtract]
419-
] = defaultdict(list)
418+
aggregates: Dict[Tuple[pendulum.DateTime, str], List[GTFSRTFeedExtract]] = (
419+
defaultdict(list)
420+
)
420421

421422
for file in self.files:
422423
if self.base64_url is None or file.base64_url == self.base64_url:
@@ -892,9 +893,9 @@ def parse_and_validate(
892893

893894
def make_dict_bq_safe(d: Dict[str, Any]) -> Dict[str, Any]:
894895
return {
895-
make_name_bq_safe(key): make_dict_bq_safe(value)
896-
if isinstance(value, dict)
897-
else value
896+
make_name_bq_safe(key): (
897+
make_dict_bq_safe(value) if isinstance(value, dict) else value
898+
)
898899
for key, value in d.items()
899900
}
900901

packages/calitp-data-analysis/calitp_data_analysis/geography_utils.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
Utility functions for geospatial data.
33
Some functions for dealing with census tract or other geographic unit dfs.
44
"""
5+
56
from typing import Literal, Union, cast
67

78
import dask.dataframe as dd

packages/calitp-data-analysis/calitp_data_analysis/styleguide.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
https://github.com/CityOfLosAngeles/los-angeles-citywide-data-style
2525
2626
"""
27+
2728
import altair as alt # type: ignore
2829
from calitp_data_analysis import calitp_color_palette as cp
2930

packages/calitp-data-analysis/calitp_data_analysis/utils.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
"""
22
General utility functions.
33
"""
4+
45
import base64
56
import os
67
import shutil

packages/calitp-data-infra/calitp_data_infra/storage.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -643,9 +643,9 @@ def build_request(self, auth_dict: Mapping[str, str]) -> Request:
643643
headers = {k: auth_dict[v] for k, v in self.auth_headers.items()}
644644

645645
# some web servers require user agents or they will throw a 4XX error
646-
headers[
647-
"User-Agent"
648-
] = "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:55.0) Gecko/20100101 Firefox/55.0"
646+
headers["User-Agent"] = (
647+
"Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:55.0) Gecko/20100101 Firefox/55.0"
648+
)
649649

650650
# inspired by: https://stackoverflow.com/questions/18869074/create-url-without-request-execution
651651
return Request(

warehouse/scripts/dbt_artifacts/__init__.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
"""
22
Built off the starting point of https://guitton.co/posts/dbt-artifacts
33
"""
4+
45
import abc
56
import os
67
from enum import Enum
@@ -64,9 +65,9 @@ def num_bytes(self) -> Optional[int]:
6465
CatalogTable.num_bytes = property(num_bytes) # type: ignore[attr-defined]
6566

6667
DependsOn.resolved_nodes = property( # type: ignore[attr-defined]
67-
lambda self: [NodeModelMixin._instances[node] for node in self.nodes]
68-
if self.nodes
69-
else []
68+
lambda self: (
69+
[NodeModelMixin._instances[node] for node in self.nodes] if self.nodes else []
70+
)
7071
)
7172
ColumnInfo.publish = property(lambda self: self.meta.get("publish.include", False)) # type: ignore[attr-defined]
7273

warehouse/scripts/dbt_artifacts/manifest.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,9 @@ class ManifestMetadata(BaseModel):
2424
class Config:
2525
extra = Extra.allow
2626

27-
dbt_schema_version: Optional[
28-
str
29-
] = "https://schemas.getdbt.com/dbt/manifest/v9.json"
27+
dbt_schema_version: Optional[str] = (
28+
"https://schemas.getdbt.com/dbt/manifest/v9.json"
29+
)
3030
dbt_version: Optional[str] = "1.6.0a1"
3131
generated_at: Optional[datetime] = "2023-04-21T11:09:06.496436Z"
3232
invocation_id: Optional[str] = "c4b245be-8edb-4ad7-ba54-9337ce594f5d"

0 commit comments

Comments
 (0)