Skip to content

Commit e65d470

Browse files
steffnayabdelmegahedgoogle
authored andcommitted
fix: upgrade black (googleapis#1177)
* fix: upgrade black * upgrade black
1 parent 025a904 commit e65d470

File tree

70 files changed

+1186
-410
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

70 files changed

+1186
-410
lines changed

docs/conf.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -362,7 +362,10 @@
362362
intersphinx_mapping = {
363363
"python": ("https://python.readthedocs.org/en/latest/", None),
364364
"google-auth": ("https://googleapis.dev/python/google-auth/latest/", None),
365-
"google.api_core": ("https://googleapis.dev/python/google-api-core/latest/", None,),
365+
"google.api_core": (
366+
"https://googleapis.dev/python/google-api-core/latest/",
367+
None,
368+
),
366369
"grpc": ("https://grpc.github.io/grpc/python/", None),
367370
"proto-plus": ("https://proto-plus-python.readthedocs.io/en/latest/", None),
368371
"protobuf": ("https://googleapis.dev/python/protobuf/latest/", None),

google/cloud/bigquery/_pandas_helpers.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -585,7 +585,10 @@ def dataframe_to_parquet(
585585
bq_schema = schema._to_schema_fields(bq_schema)
586586
arrow_table = dataframe_to_arrow(dataframe, bq_schema)
587587
pyarrow.parquet.write_table(
588-
arrow_table, filepath, compression=parquet_compression, **kwargs,
588+
arrow_table,
589+
filepath,
590+
compression=parquet_compression,
591+
**kwargs,
589592
)
590593

591594

google/cloud/bigquery/_tqdm_helpers.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,9 @@ def wait_for_query(
9595
progress_bar.total = len(query_job.query_plan)
9696
progress_bar.set_description(
9797
"Query executing stage {} and status {} : {:0.2f}s".format(
98-
current_stage.name, current_stage.status, time.time() - start_time,
98+
current_stage.name,
99+
current_stage.status,
100+
time.time() - start_time,
99101
),
100102
)
101103
try:

google/cloud/bigquery/client.py

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1894,9 +1894,7 @@ def _get_query_results(
18941894

18951895
def job_from_resource(
18961896
self, resource: dict
1897-
) -> Union[
1898-
job.CopyJob, job.ExtractJob, job.LoadJob, job.QueryJob, job.UnknownJob,
1899-
]:
1897+
) -> Union[job.CopyJob, job.ExtractJob, job.LoadJob, job.QueryJob, job.UnknownJob]:
19001898
"""Detect correct job type from resource and instantiate.
19011899
19021900
Args:
@@ -1978,8 +1976,8 @@ def create_job(
19781976
timeout=timeout,
19791977
)
19801978
elif "extract" in job_config:
1981-
extract_job_config = google.cloud.bigquery.job.ExtractJobConfig.from_api_repr(
1982-
job_config
1979+
extract_job_config = (
1980+
google.cloud.bigquery.job.ExtractJobConfig.from_api_repr(job_config)
19831981
)
19841982
source = _get_sub_prop(job_config, ["extract", "sourceTable"])
19851983
if source:
@@ -2152,7 +2150,8 @@ def cancel_job(
21522150
job_instance = self.job_from_resource(resource["job"]) # never an UnknownJob
21532151

21542152
return typing.cast(
2155-
Union[job.LoadJob, job.CopyJob, job.ExtractJob, job.QueryJob], job_instance,
2153+
Union[job.LoadJob, job.CopyJob, job.ExtractJob, job.QueryJob],
2154+
job_instance,
21562155
)
21572156

21582157
def list_jobs(

google/cloud/bigquery/dataset.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ def __repr__(self):
191191
)
192192

193193
def _key(self):
194-
""" A tuple key that uniquely describes this field.
194+
"""A tuple key that uniquely describes this field.
195195
Used to compute this instance's hashcode and evaluate equality.
196196
Returns:
197197
Tuple: The contents of this :class:`~google.cloud.bigquery.dataset.AccessEntry`.

google/cloud/bigquery/dbapi/_helpers.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -486,8 +486,7 @@ def raise_on_closed(
486486
"""Make public instance methods raise an error if the instance is closed."""
487487

488488
def _raise_on_closed(method):
489-
"""Make a non-static method raise an error if its containing instance is closed.
490-
"""
489+
"""Make a non-static method raise an error if its containing instance is closed."""
491490

492491
def with_closed_check(self, *args, **kwargs):
493492
if getattr(self, closed_attr_name):
@@ -498,8 +497,7 @@ def with_closed_check(self, *args, **kwargs):
498497
return with_closed_check
499498

500499
def decorate_public_methods(klass):
501-
"""Apply ``_raise_on_closed()`` decorator to public instance methods.
502-
"""
500+
"""Apply ``_raise_on_closed()`` decorator to public instance methods."""
503501
for name in dir(klass):
504502
if name.startswith("_") and name != "__iter__":
505503
continue

google/cloud/bigquery/external_config.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -289,8 +289,7 @@ def from_api_repr(cls, resource: dict) -> "BigtableColumnFamily":
289289

290290

291291
class BigtableOptions(object):
292-
"""Options that describe how to treat Bigtable tables as BigQuery tables.
293-
"""
292+
"""Options that describe how to treat Bigtable tables as BigQuery tables."""
294293

295294
_SOURCE_FORMAT = "BIGTABLE"
296295
_RESOURCE_NAME = "bigtableOptions"
@@ -557,7 +556,11 @@ def from_api_repr(cls, resource: dict) -> "GoogleSheetsOptions":
557556
)
558557

559558
OptionsType = Union[
560-
AvroOptions, BigtableOptions, CSVOptions, GoogleSheetsOptions, ParquetOptions,
559+
AvroOptions,
560+
BigtableOptions,
561+
CSVOptions,
562+
GoogleSheetsOptions,
563+
ParquetOptions,
561564
]
562565

563566

google/cloud/bigquery/job/query.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -324,7 +324,8 @@ def connection_properties(self) -> List[ConnectionProperty]:
324324
@connection_properties.setter
325325
def connection_properties(self, value: Iterable[ConnectionProperty]):
326326
self._set_sub_prop(
327-
"connectionProperties", [prop.to_api_repr() for prop in value],
327+
"connectionProperties",
328+
[prop.to_api_repr() for prop in value],
328329
)
329330

330331
@property

google/cloud/bigquery/magics/magics.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -586,7 +586,9 @@ def _cell_magic(line, query):
586586
bqstorage_client_options.api_endpoint = args.bqstorage_api_endpoint
587587

588588
bqstorage_client = _make_bqstorage_client(
589-
client, use_bqstorage_api, bqstorage_client_options,
589+
client,
590+
use_bqstorage_api,
591+
bqstorage_client_options,
590592
)
591593

592594
close_transports = functools.partial(_close_transports, client, bqstorage_client)
@@ -637,7 +639,8 @@ def _cell_magic(line, query):
637639
return
638640

639641
result = rows.to_dataframe(
640-
bqstorage_client=bqstorage_client, create_bqstorage_client=False,
642+
bqstorage_client=bqstorage_client,
643+
create_bqstorage_client=False,
641644
)
642645
if args.destination_var:
643646
IPython.get_ipython().push({args.destination_var: result})

google/cloud/bigquery/opentelemetry_tracing.py

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -37,28 +37,28 @@
3737
@contextmanager
3838
def create_span(name, attributes=None, client=None, job_ref=None):
3939
"""Creates a ContextManager for a Span to be exported to the configured exporter.
40-
If no configuration exists yields None.
41-
42-
Args:
43-
name (str): Name that will be set for the span being created
44-
attributes (Optional[dict]):
45-
Additional attributes that pertain to
46-
the specific API call (i.e. not a default attribute)
47-
client (Optional[google.cloud.bigquery.client.Client]):
48-
Pass in a Client object to extract any attributes that may be
49-
relevant to it and add them to the created spans.
50-
job_ref (Optional[google.cloud.bigquery.job._AsyncJob])
51-
Pass in a _AsyncJob object to extract any attributes that may be
52-
relevant to it and add them to the created spans.
53-
54-
Yields:
55-
opentelemetry.trace.Span: Yields the newly created Span.
56-
57-
Raises:
58-
google.api_core.exceptions.GoogleAPICallError:
59-
Raised if a span could not be yielded or issue with call to
60-
OpenTelemetry.
61-
"""
40+
If no configuration exists yields None.
41+
42+
Args:
43+
name (str): Name that will be set for the span being created
44+
attributes (Optional[dict]):
45+
Additional attributes that pertain to
46+
the specific API call (i.e. not a default attribute)
47+
client (Optional[google.cloud.bigquery.client.Client]):
48+
Pass in a Client object to extract any attributes that may be
49+
relevant to it and add them to the created spans.
50+
job_ref (Optional[google.cloud.bigquery.job._AsyncJob])
51+
Pass in a _AsyncJob object to extract any attributes that may be
52+
relevant to it and add them to the created spans.
53+
54+
Yields:
55+
opentelemetry.trace.Span: Yields the newly created Span.
56+
57+
Raises:
58+
google.api_core.exceptions.GoogleAPICallError:
59+
Raised if a span could not be yielded or issue with call to
60+
OpenTelemetry.
61+
"""
6262
global _warned_telemetry
6363
final_attributes = _get_final_span_attributes(attributes, client, job_ref)
6464
if not HAS_OPENTELEMETRY:

0 commit comments

Comments
 (0)