Skip to content

Commit

Permalink
chore: upgrade mypy (#1705)
Browse files Browse the repository at this point in the history
  • Loading branch information
Linchin authored Oct 27, 2023
1 parent e8da978 commit dfe1886
Show file tree
Hide file tree
Showing 31 changed files with 46 additions and 46 deletions.
18 changes: 9 additions & 9 deletions google/cloud/bigquery/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -2182,12 +2182,12 @@ def list_jobs(
parent_job: Optional[Union[QueryJob, str]] = None,
max_results: Optional[int] = None,
page_token: Optional[str] = None,
all_users: bool = None,
all_users: Optional[bool] = None,
state_filter: Optional[str] = None,
retry: retries.Retry = DEFAULT_RETRY,
timeout: TimeoutType = DEFAULT_TIMEOUT,
min_creation_time: datetime.datetime = None,
max_creation_time: datetime.datetime = None,
min_creation_time: Optional[datetime.datetime] = None,
max_creation_time: Optional[datetime.datetime] = None,
page_size: Optional[int] = None,
) -> page_iterator.Iterator:
"""List jobs for the project associated with this client.
Expand Down Expand Up @@ -3407,7 +3407,7 @@ def insert_rows(
self,
table: Union[Table, TableReference, str],
rows: Union[Iterable[Tuple], Iterable[Mapping[str, Any]]],
selected_fields: Sequence[SchemaField] = None,
selected_fields: Optional[Sequence[SchemaField]] = None,
**kwargs,
) -> Sequence[Dict[str, Any]]:
"""Insert rows into a table via the streaming API.
Expand Down Expand Up @@ -3483,7 +3483,7 @@ def insert_rows_from_dataframe(
self,
table: Union[Table, TableReference, str],
dataframe,
selected_fields: Sequence[SchemaField] = None,
selected_fields: Optional[Sequence[SchemaField]] = None,
chunk_size: int = 500,
**kwargs: Dict,
) -> Sequence[Sequence[dict]]:
Expand Down Expand Up @@ -3546,8 +3546,8 @@ def insert_rows_json(
row_ids: Union[
Iterable[Optional[str]], AutoRowIDs, None
] = AutoRowIDs.GENERATE_UUID,
skip_invalid_rows: bool = None,
ignore_unknown_values: bool = None,
skip_invalid_rows: Optional[bool] = None,
ignore_unknown_values: Optional[bool] = None,
template_suffix: Optional[str] = None,
retry: retries.Retry = DEFAULT_RETRY,
timeout: TimeoutType = DEFAULT_TIMEOUT,
Expand Down Expand Up @@ -3738,7 +3738,7 @@ def list_partitions(
def list_rows(
self,
table: Union[Table, TableListItem, TableReference, str],
selected_fields: Sequence[SchemaField] = None,
selected_fields: Optional[Sequence[SchemaField]] = None,
max_results: Optional[int] = None,
page_token: Optional[str] = None,
start_index: Optional[int] = None,
Expand Down Expand Up @@ -3851,7 +3851,7 @@ def _list_rows_from_query_results(
project: str,
schema: SchemaField,
total_rows: Optional[int] = None,
destination: Union[Table, TableReference, TableListItem, str] = None,
destination: Optional[Union[Table, TableReference, TableListItem, str]] = None,
max_results: Optional[int] = None,
start_index: Optional[int] = None,
page_size: Optional[int] = None,
Expand Down
4 changes: 2 additions & 2 deletions google/cloud/bigquery/job/query.py
Original file line number Diff line number Diff line change
Expand Up @@ -1693,7 +1693,7 @@ def to_arrow(
def to_dataframe(
self,
bqstorage_client: Optional["bigquery_storage.BigQueryReadClient"] = None,
dtypes: Dict[str, Any] = None,
dtypes: Optional[Dict[str, Any]] = None,
progress_bar_type: Optional[str] = None,
create_bqstorage_client: bool = True,
max_results: Optional[int] = None,
Expand Down Expand Up @@ -1879,7 +1879,7 @@ def to_dataframe(
def to_geodataframe(
self,
bqstorage_client: Optional["bigquery_storage.BigQueryReadClient"] = None,
dtypes: Dict[str, Any] = None,
dtypes: Optional[Dict[str, Any]] = None,
progress_bar_type: Optional[str] = None,
create_bqstorage_client: bool = True,
max_results: Optional[int] = None,
Expand Down
6 changes: 3 additions & 3 deletions google/cloud/bigquery/table.py
Original file line number Diff line number Diff line change
Expand Up @@ -1853,7 +1853,7 @@ def to_arrow(
def to_dataframe_iterable(
self,
bqstorage_client: Optional["bigquery_storage.BigQueryReadClient"] = None,
dtypes: Dict[str, Any] = None,
dtypes: Optional[Dict[str, Any]] = None,
max_queue_size: int = _pandas_helpers._MAX_QUEUE_SIZE_DEFAULT, # type: ignore
) -> "pandas.DataFrame":
"""Create an iterable of pandas DataFrames, to process the table as a stream.
Expand Down Expand Up @@ -1929,7 +1929,7 @@ def to_dataframe_iterable(
def to_dataframe(
self,
bqstorage_client: Optional["bigquery_storage.BigQueryReadClient"] = None,
dtypes: Dict[str, Any] = None,
dtypes: Optional[Dict[str, Any]] = None,
progress_bar_type: Optional[str] = None,
create_bqstorage_client: bool = True,
geography_as_object: bool = False,
Expand Down Expand Up @@ -2227,7 +2227,7 @@ def __can_cast_timestamp_ns(column):
def to_geodataframe(
self,
bqstorage_client: Optional["bigquery_storage.BigQueryReadClient"] = None,
dtypes: Dict[str, Any] = None,
dtypes: Optional[Dict[str, Any]] = None,
progress_bar_type: Optional[str] = None,
create_bqstorage_client: bool = True,
geography_column: Optional[str] = None,
Expand Down
4 changes: 2 additions & 2 deletions noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
import nox


MYPY_VERSION = "mypy==0.910"
MYPY_VERSION = "mypy==1.6.1"
PYTYPE_VERSION = "pytype==2021.4.9"
BLACK_VERSION = "black==23.7.0"
BLACK_PATHS = (
Expand Down Expand Up @@ -137,7 +137,7 @@ def mypy(session):
"types-requests",
"types-setuptools",
)
session.run("mypy", "google/cloud")
session.run("mypy", "google/cloud", "--show-traceback")


@nox.session(python=DEFAULT_PYTHON_VERSION)
Expand Down
2 changes: 1 addition & 1 deletion samples/snippets/authenticate_service_account_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

import google.auth

import authenticate_service_account
import authenticate_service_account # type: ignore

if typing.TYPE_CHECKING:
import pytest
Expand Down
2 changes: 1 addition & 1 deletion samples/snippets/authorized_view_tutorial_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
from google.cloud import bigquery
import pytest

import authorized_view_tutorial
import authorized_view_tutorial # type: ignore


@pytest.fixture(scope="module")
Expand Down
2 changes: 1 addition & 1 deletion samples/snippets/create_partitioned_table_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

import typing

import create_partitioned_table
import create_partitioned_table # type: ignore

if typing.TYPE_CHECKING:
import pytest
Expand Down
2 changes: 1 addition & 1 deletion samples/snippets/create_table_cmek_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

import typing

import create_table_cmek
import create_table_cmek # type: ignore

if typing.TYPE_CHECKING:
import pytest
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

import typing

import create_table_external_data_configuration
import create_table_external_data_configuration # type: ignore

if typing.TYPE_CHECKING:
import pytest
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

import typing

import create_table_external_hive_partitioned
import create_table_external_hive_partitioned # type: ignore

if typing.TYPE_CHECKING:
import pytest
Expand Down
2 changes: 1 addition & 1 deletion samples/snippets/create_table_schema_from_json_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

import typing

import create_table_schema_from_json
import create_table_schema_from_json # type: ignore

if typing.TYPE_CHECKING:
import pytest
Expand Down
2 changes: 1 addition & 1 deletion samples/snippets/create_table_snapshot_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

import typing

import create_table_snapshot
import create_table_snapshot # type: ignore

if typing.TYPE_CHECKING:
import pytest
Expand Down
4 changes: 2 additions & 2 deletions samples/snippets/dataset_access_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@

import typing

import revoke_dataset_access
import update_dataset_access
import revoke_dataset_access # type: ignore
import update_dataset_access # type: ignore

if typing.TYPE_CHECKING:
from google.cloud import bigquery
Expand Down
2 changes: 1 addition & 1 deletion samples/snippets/delete_job_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

from google.cloud import bigquery

import delete_job
import delete_job # type: ignore

if typing.TYPE_CHECKING:
import pytest
Expand Down
2 changes: 1 addition & 1 deletion samples/snippets/delete_label_table_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

import typing

import delete_label_table
import delete_label_table # type: ignore

if typing.TYPE_CHECKING:
import pytest
Expand Down
2 changes: 1 addition & 1 deletion samples/snippets/get_table_labels_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

from google.cloud import bigquery

import get_table_labels
import get_table_labels # type: ignore

if typing.TYPE_CHECKING:
import pytest
Expand Down
2 changes: 1 addition & 1 deletion samples/snippets/get_table_make_schema_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

import typing

import get_table_make_schema
import get_table_make_schema # type: ignore

if typing.TYPE_CHECKING:
import pathlib
Expand Down
2 changes: 1 addition & 1 deletion samples/snippets/label_table_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

import typing

import label_table
import label_table # type: ignore

if typing.TYPE_CHECKING:
import pytest
Expand Down
2 changes: 1 addition & 1 deletion samples/snippets/load_table_schema_from_json_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

import typing

import load_table_schema_from_json
import load_table_schema_from_json # type: ignore

if typing.TYPE_CHECKING:
import pytest
Expand Down
2 changes: 1 addition & 1 deletion samples/snippets/load_table_uri_firestore_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

import typing

import load_table_uri_firestore
import load_table_uri_firestore # type: ignore

if typing.TYPE_CHECKING:
import pytest
Expand Down
4 changes: 2 additions & 2 deletions samples/snippets/manage_job_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
from google.cloud import bigquery
import pytest

import manage_job_cancel
import manage_job_get
import manage_job_cancel # type: ignore
import manage_job_get # type: ignore


def test_manage_job(capsys: pytest.CaptureFixture[str]) -> None:
Expand Down
2 changes: 1 addition & 1 deletion samples/snippets/materialized_view_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
from google.cloud import bigquery
import pytest

import materialized_view
import materialized_view # type: ignore


def temp_suffix() -> str:
Expand Down
2 changes: 1 addition & 1 deletion samples/snippets/natality_tutorial_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
from google.cloud import bigquery
import pytest

import natality_tutorial
import natality_tutorial # type: ignore


@pytest.fixture(scope="module")
Expand Down
2 changes: 1 addition & 1 deletion samples/snippets/nested_repeated_schema_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

import typing

import nested_repeated_schema
import nested_repeated_schema # type: ignore

if typing.TYPE_CHECKING:
import pytest
Expand Down
2 changes: 1 addition & 1 deletion samples/snippets/quickstart_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
from google.cloud import bigquery
import pytest

import quickstart
import quickstart # type: ignore

# Must match the dataset listed in quickstart.py (there's no easy way to
# extract this).
Expand Down
2 changes: 1 addition & 1 deletion samples/snippets/relax_column_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

from google.cloud import bigquery

import relax_column
import relax_column # type: ignore

if typing.TYPE_CHECKING:
import pytest
Expand Down
2 changes: 1 addition & 1 deletion samples/snippets/simple_app_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

import typing

import simple_app
import simple_app # type: ignore

if typing.TYPE_CHECKING:
import pytest
Expand Down
4 changes: 2 additions & 2 deletions samples/snippets/test_update_with_dml.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
from google.cloud import bigquery
import pytest

from conftest import prefixer
import update_with_dml
from conftest import prefixer # type: ignore
import update_with_dml # type: ignore


@pytest.fixture
Expand Down
2 changes: 1 addition & 1 deletion samples/snippets/update_table_expiration_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
import datetime
import typing

import update_table_expiration
import update_table_expiration # type: ignore

if typing.TYPE_CHECKING:
import pathlib
Expand Down
2 changes: 1 addition & 1 deletion samples/snippets/user_credentials_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
import mock
import pytest

from user_credentials import main
from user_credentials import main # type: ignore

PROJECT = os.environ["GOOGLE_CLOUD_PROJECT"]

Expand Down
2 changes: 1 addition & 1 deletion samples/snippets/view_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
from google.cloud import bigquery
import pytest

import view
import view # type: ignore


def temp_suffix() -> str:
Expand Down

0 comments on commit dfe1886

Please sign in to comment.