Skip to content

Commit dfe1886

Browse files
authored
chore: upgrade mypy (#1705)
1 parent e8da978 commit dfe1886

31 files changed

+46
-46
lines changed

google/cloud/bigquery/client.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2182,12 +2182,12 @@ def list_jobs(
21822182
parent_job: Optional[Union[QueryJob, str]] = None,
21832183
max_results: Optional[int] = None,
21842184
page_token: Optional[str] = None,
2185-
all_users: bool = None,
2185+
all_users: Optional[bool] = None,
21862186
state_filter: Optional[str] = None,
21872187
retry: retries.Retry = DEFAULT_RETRY,
21882188
timeout: TimeoutType = DEFAULT_TIMEOUT,
2189-
min_creation_time: datetime.datetime = None,
2190-
max_creation_time: datetime.datetime = None,
2189+
min_creation_time: Optional[datetime.datetime] = None,
2190+
max_creation_time: Optional[datetime.datetime] = None,
21912191
page_size: Optional[int] = None,
21922192
) -> page_iterator.Iterator:
21932193
"""List jobs for the project associated with this client.
@@ -3407,7 +3407,7 @@ def insert_rows(
34073407
self,
34083408
table: Union[Table, TableReference, str],
34093409
rows: Union[Iterable[Tuple], Iterable[Mapping[str, Any]]],
3410-
selected_fields: Sequence[SchemaField] = None,
3410+
selected_fields: Optional[Sequence[SchemaField]] = None,
34113411
**kwargs,
34123412
) -> Sequence[Dict[str, Any]]:
34133413
"""Insert rows into a table via the streaming API.
@@ -3483,7 +3483,7 @@ def insert_rows_from_dataframe(
34833483
self,
34843484
table: Union[Table, TableReference, str],
34853485
dataframe,
3486-
selected_fields: Sequence[SchemaField] = None,
3486+
selected_fields: Optional[Sequence[SchemaField]] = None,
34873487
chunk_size: int = 500,
34883488
**kwargs: Dict,
34893489
) -> Sequence[Sequence[dict]]:
@@ -3546,8 +3546,8 @@ def insert_rows_json(
35463546
row_ids: Union[
35473547
Iterable[Optional[str]], AutoRowIDs, None
35483548
] = AutoRowIDs.GENERATE_UUID,
3549-
skip_invalid_rows: bool = None,
3550-
ignore_unknown_values: bool = None,
3549+
skip_invalid_rows: Optional[bool] = None,
3550+
ignore_unknown_values: Optional[bool] = None,
35513551
template_suffix: Optional[str] = None,
35523552
retry: retries.Retry = DEFAULT_RETRY,
35533553
timeout: TimeoutType = DEFAULT_TIMEOUT,
@@ -3738,7 +3738,7 @@ def list_partitions(
37383738
def list_rows(
37393739
self,
37403740
table: Union[Table, TableListItem, TableReference, str],
3741-
selected_fields: Sequence[SchemaField] = None,
3741+
selected_fields: Optional[Sequence[SchemaField]] = None,
37423742
max_results: Optional[int] = None,
37433743
page_token: Optional[str] = None,
37443744
start_index: Optional[int] = None,
@@ -3851,7 +3851,7 @@ def _list_rows_from_query_results(
38513851
project: str,
38523852
schema: SchemaField,
38533853
total_rows: Optional[int] = None,
3854-
destination: Union[Table, TableReference, TableListItem, str] = None,
3854+
destination: Optional[Union[Table, TableReference, TableListItem, str]] = None,
38553855
max_results: Optional[int] = None,
38563856
start_index: Optional[int] = None,
38573857
page_size: Optional[int] = None,

google/cloud/bigquery/job/query.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1693,7 +1693,7 @@ def to_arrow(
16931693
def to_dataframe(
16941694
self,
16951695
bqstorage_client: Optional["bigquery_storage.BigQueryReadClient"] = None,
1696-
dtypes: Dict[str, Any] = None,
1696+
dtypes: Optional[Dict[str, Any]] = None,
16971697
progress_bar_type: Optional[str] = None,
16981698
create_bqstorage_client: bool = True,
16991699
max_results: Optional[int] = None,
@@ -1879,7 +1879,7 @@ def to_dataframe(
18791879
def to_geodataframe(
18801880
self,
18811881
bqstorage_client: Optional["bigquery_storage.BigQueryReadClient"] = None,
1882-
dtypes: Dict[str, Any] = None,
1882+
dtypes: Optional[Dict[str, Any]] = None,
18831883
progress_bar_type: Optional[str] = None,
18841884
create_bqstorage_client: bool = True,
18851885
max_results: Optional[int] = None,

google/cloud/bigquery/table.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1853,7 +1853,7 @@ def to_arrow(
18531853
def to_dataframe_iterable(
18541854
self,
18551855
bqstorage_client: Optional["bigquery_storage.BigQueryReadClient"] = None,
1856-
dtypes: Dict[str, Any] = None,
1856+
dtypes: Optional[Dict[str, Any]] = None,
18571857
max_queue_size: int = _pandas_helpers._MAX_QUEUE_SIZE_DEFAULT, # type: ignore
18581858
) -> "pandas.DataFrame":
18591859
"""Create an iterable of pandas DataFrames, to process the table as a stream.
@@ -1929,7 +1929,7 @@ def to_dataframe_iterable(
19291929
def to_dataframe(
19301930
self,
19311931
bqstorage_client: Optional["bigquery_storage.BigQueryReadClient"] = None,
1932-
dtypes: Dict[str, Any] = None,
1932+
dtypes: Optional[Dict[str, Any]] = None,
19331933
progress_bar_type: Optional[str] = None,
19341934
create_bqstorage_client: bool = True,
19351935
geography_as_object: bool = False,
@@ -2227,7 +2227,7 @@ def __can_cast_timestamp_ns(column):
22272227
def to_geodataframe(
22282228
self,
22292229
bqstorage_client: Optional["bigquery_storage.BigQueryReadClient"] = None,
2230-
dtypes: Dict[str, Any] = None,
2230+
dtypes: Optional[Dict[str, Any]] = None,
22312231
progress_bar_type: Optional[str] = None,
22322232
create_bqstorage_client: bool = True,
22332233
geography_column: Optional[str] = None,

noxfile.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
import nox
2323

2424

25-
MYPY_VERSION = "mypy==0.910"
25+
MYPY_VERSION = "mypy==1.6.1"
2626
PYTYPE_VERSION = "pytype==2021.4.9"
2727
BLACK_VERSION = "black==23.7.0"
2828
BLACK_PATHS = (
@@ -137,7 +137,7 @@ def mypy(session):
137137
"types-requests",
138138
"types-setuptools",
139139
)
140-
session.run("mypy", "google/cloud")
140+
session.run("mypy", "google/cloud", "--show-traceback")
141141

142142

143143
@nox.session(python=DEFAULT_PYTHON_VERSION)

samples/snippets/authenticate_service_account_test.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717

1818
import google.auth
1919

20-
import authenticate_service_account
20+
import authenticate_service_account # type: ignore
2121

2222
if typing.TYPE_CHECKING:
2323
import pytest

samples/snippets/authorized_view_tutorial_test.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
from google.cloud import bigquery
1919
import pytest
2020

21-
import authorized_view_tutorial
21+
import authorized_view_tutorial # type: ignore
2222

2323

2424
@pytest.fixture(scope="module")

samples/snippets/create_partitioned_table_test.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515
import typing
1616

17-
import create_partitioned_table
17+
import create_partitioned_table # type: ignore
1818

1919
if typing.TYPE_CHECKING:
2020
import pytest

samples/snippets/create_table_cmek_test.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515
import typing
1616

17-
import create_table_cmek
17+
import create_table_cmek # type: ignore
1818

1919
if typing.TYPE_CHECKING:
2020
import pytest

samples/snippets/create_table_external_data_configuration_test.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515
import typing
1616

17-
import create_table_external_data_configuration
17+
import create_table_external_data_configuration # type: ignore
1818

1919
if typing.TYPE_CHECKING:
2020
import pytest

samples/snippets/create_table_external_hive_partitioned_test.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515
import typing
1616

17-
import create_table_external_hive_partitioned
17+
import create_table_external_hive_partitioned # type: ignore
1818

1919
if typing.TYPE_CHECKING:
2020
import pytest

0 commit comments

Comments
 (0)