Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion google/cloud/spanner_v1/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

import pkg_resources

__version__ = pkg_resources.get_distribution("google-cloud-spanner").version
__version__: str = pkg_resources.get_distribution("google-cloud-spanner").version
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This annotation shouldn't be needed, since you have installed types-setuptools in the nox session.


from .services.spanner import SpannerClient
from .types.commit_response import CommitResponse
Expand Down
3 changes: 2 additions & 1 deletion google/cloud/spanner_v1/instance.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
import google.api_core.operation
from google.api_core.exceptions import InvalidArgument
import re
import typing

from google.protobuf.empty_pb2 import Empty
from google.protobuf.field_mask_pb2 import FieldMask
Expand All @@ -41,7 +42,7 @@
DEFAULT_NODE_COUNT = 1
PROCESSING_UNITS_PER_NODE = 1000

_OPERATION_METADATA_MESSAGES = (
_OPERATION_METADATA_MESSAGES: typing.Tuple = (
backup.Backup,
backup.CreateBackupMetadata,
spanner_database_admin.CreateDatabaseMetadata,
Expand Down
2 changes: 1 addition & 1 deletion google/cloud/spanner_v1/snapshot.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ class _SnapshotBase(_SessionWrapper):
"""

_multi_use = False
_read_only = True
_read_only: bool = True
_transaction_id = None
_read_request_count = 0
_execute_sql_count = 0
Expand Down
15 changes: 15 additions & 0 deletions noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -264,3 +264,18 @@ def docfx(session):
os.path.join("docs", ""),
os.path.join("docs", "_build", "html", ""),
)


@nox.session(python=DEFAULT_PYTHON_VERSION)
def mypy(session):
"""Verify type hints are mypy compatible."""
session.install("-e", ".")
session.install("mypy", "types-setuptools")
session.run("mypy", "--install-types", "--non-interactive")
session.run(
"mypy",
"-p",
"google.cloud.spanner_v1",
"--no-incremental",
"--ignore-missing-imports",
)