Skip to content
This repository was archived by the owner on Mar 13, 2026. It is now read-only.

Commit a848d69

Browse files
committed
chore: more lint
1 parent 686193e commit a848d69

3 files changed

Lines changed: 12 additions & 9 deletions

File tree

pandas_gbq/core/resource_references.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
import dataclasses
66
import re
7+
from typing import Union
78

89

910
_TABLE_REFEREENCE_PATTERN = re.compile(
@@ -37,7 +38,7 @@ class BigQueryTableId:
3738
table_id: str
3839

3940

40-
def parse_table_id(table_id: str) -> BigLakeTableId | BigQueryTableId:
41+
def parse_table_id(table_id: str) -> Union[BigLakeTableId, BigQueryTableId]:
4142
"""Turn a string into a BigLakeTableId or BigQueryTableId.
4243
4344
Raises:

pandas_gbq/core/sample.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
from __future__ import annotations
66

77
import typing
8-
from typing import Optional, Sequence
8+
from typing import Optional, Sequence, Union
99

1010
import google.cloud.bigquery
1111
import google.cloud.bigquery.table
@@ -130,7 +130,7 @@ def _download_results_in_parallel(
130130
rows: google.cloud.bigquery.table.RowIterator,
131131
*,
132132
bqclient: google.cloud.bigquery.Client,
133-
progress_bar_type: Optional[str] = None,
133+
progress_bar_type: Union[str, None] = None,
134134
use_bqstorage_api: bool = True,
135135
):
136136
table_reference = getattr(rows, "_table", None)
@@ -162,7 +162,7 @@ def _sample_with_tablesample(
162162
bqclient: google.cloud.bigquery.Client,
163163
proportion: float,
164164
target_row_count: int,
165-
progress_bar_type: Optional[str] = None,
165+
progress_bar_type: Union[str, None] = None,
166166
use_bqstorage_api: bool = True,
167167
) -> Optional[pandas.DataFrame]:
168168
sample_percent = min(100, max(1, int(proportion * 100)))
@@ -187,7 +187,7 @@ def _sample_with_limit(
187187
*,
188188
bqclient: google.cloud.bigquery.Client,
189189
target_row_count: int,
190-
progress_bar_type: Optional[str] = None,
190+
progress_bar_type: Union[str, None] = None,
191191
use_bqstorage_api: bool = True,
192192
) -> Optional[pandas.DataFrame]:
193193
query = f"""
@@ -210,7 +210,7 @@ def _sample_biglake_table(
210210
reference: pandas_gbq.core.resource_references.BigLakeTableId,
211211
bqclient: google.cloud.bigquery.Client,
212212
target_bytes: int,
213-
progress_bar_type: str | None,
213+
progress_bar_type: Union[str, None],
214214
use_bqstorage_api: bool,
215215
) -> Optional[pandas.DataFrame]:
216216
metadata = pandas_gbq.core.biglake.get_table_metadata(
@@ -247,7 +247,7 @@ def _sample_bq_table(
247247
reference: pandas_gbq.core.resource_references.BigQueryTableId,
248248
bqclient: google.cloud.bigquery.Client,
249249
target_bytes: int,
250-
progress_bar_type: str | None,
250+
progress_bar_type: Union[str, None],
251251
use_bqstorage_api: bool,
252252
) -> Optional[pandas.DataFrame]:
253253
table = bqclient.get_table(
@@ -319,7 +319,7 @@ def sample(
319319
target_mb: Optional[int] = None,
320320
credentials: Optional[google.oauth2.credentials.Credentials] = None,
321321
billing_project_id: Optional[str] = None,
322-
progress_bar_type: Optional[str] = None,
322+
progress_bar_type: Union[str, None] = None,
323323
use_bqstorage_api: bool = True,
324324
) -> Optional[pandas.DataFrame]:
325325
"""Sample a BigQuery table, attempting to limit the amount of data read.

pandas_gbq/gbq.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -419,7 +419,9 @@ def to_gbq(
419419
destination_table : str
420420
Name of table to be written, in the form ``dataset.tablename`` or
421421
``project.dataset.tablename``.
422-
clustering_columns : pandas.Index | Iterable[Hashable], optional
422+
clustering_columns: typing.Union[
423+
pandas.core.indexes.base.Index, typing.Iterable[typing.Hashable]
424+
] = (),
423425
Specifies the columns for clustering in the BigQuery table.
424426
time_partitioning_column : str, optional
425427
Specifies the column for time-based partitioning in the BigQuery table.

0 commit comments

Comments
 (0)