Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

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/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,4 @@
except ImportError:
import pkgutil

__path__ = pkgutil.extend_path(__path__, __name__)
__path__ = pkgutil.extend_path(__path__, __name__) # type: ignore
2 changes: 1 addition & 1 deletion google/cloud/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,4 @@
except ImportError:
import pkgutil

__path__ = pkgutil.extend_path(__path__, __name__)
__path__ = pkgutil.extend_path(__path__, __name__) # type: ignore
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ async def export_entities(
request: Union[datastore_admin.ExportEntitiesRequest, dict] = None,
*,
project_id: str = None,
labels: Sequence[datastore_admin.ExportEntitiesRequest.LabelsEntry] = None,
labels: Dict[str, str] = None,
entity_filter: datastore_admin.EntityFilter = None,
output_url_prefix: str = None,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
Expand Down Expand Up @@ -260,7 +260,7 @@ async def export_entities(
This corresponds to the ``project_id`` field
on the ``request`` instance; if ``request`` is provided, this
should not be set.
labels (:class:`Sequence[google.cloud.datastore_admin_v1.types.ExportEntitiesRequest.LabelsEntry]`):
labels (:class:`Dict[str, str]`):
Client-assigned labels.
This corresponds to the ``labels`` field
on the ``request`` instance; if ``request`` is provided, this
Expand Down Expand Up @@ -368,7 +368,7 @@ async def import_entities(
request: Union[datastore_admin.ImportEntitiesRequest, dict] = None,
*,
project_id: str = None,
labels: Sequence[datastore_admin.ImportEntitiesRequest.LabelsEntry] = None,
labels: Dict[str, str] = None,
input_url: str = None,
entity_filter: datastore_admin.EntityFilter = None,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
Expand All @@ -394,7 +394,7 @@ async def import_entities(
This corresponds to the ``project_id`` field
on the ``request`` instance; if ``request`` is provided, this
should not be set.
labels (:class:`Sequence[google.cloud.datastore_admin_v1.types.ImportEntitiesRequest.LabelsEntry]`):
labels (:class:`Dict[str, str]`):
Client-assigned labels.
This corresponds to the ``labels`` field
on the ``request`` instance; if ``request`` is provided, this
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -406,7 +406,7 @@ def export_entities(
request: Union[datastore_admin.ExportEntitiesRequest, dict] = None,
*,
project_id: str = None,
labels: Sequence[datastore_admin.ExportEntitiesRequest.LabelsEntry] = None,
labels: Dict[str, str] = None,
entity_filter: datastore_admin.EntityFilter = None,
output_url_prefix: str = None,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
Expand Down Expand Up @@ -435,7 +435,7 @@ def export_entities(
This corresponds to the ``project_id`` field
on the ``request`` instance; if ``request`` is provided, this
should not be set.
labels (Sequence[google.cloud.datastore_admin_v1.types.ExportEntitiesRequest.LabelsEntry]):
labels (Dict[str, str]):
Client-assigned labels.
This corresponds to the ``labels`` field
on the ``request`` instance; if ``request`` is provided, this
Expand Down Expand Up @@ -542,7 +542,7 @@ def import_entities(
request: Union[datastore_admin.ImportEntitiesRequest, dict] = None,
*,
project_id: str = None,
labels: Sequence[datastore_admin.ImportEntitiesRequest.LabelsEntry] = None,
labels: Dict[str, str] = None,
input_url: str = None,
entity_filter: datastore_admin.EntityFilter = None,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
Expand All @@ -568,7 +568,7 @@ def import_entities(
This corresponds to the ``project_id`` field
on the ``request`` instance; if ``request`` is provided, this
should not be set.
labels (Sequence[google.cloud.datastore_admin_v1.types.ImportEntitiesRequest.LabelsEntry]):
labels (Dict[str, str]):
Client-assigned labels.
This corresponds to the ``labels`` field
on the ``request`` instance; if ``request`` is provided, this
Expand Down
6 changes: 3 additions & 3 deletions google/cloud/datastore_admin_v1/types/datastore_admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ class CommonMetadata(proto.Message):
operation_type (google.cloud.datastore_admin_v1.types.OperationType):
The type of the operation. Can be used as a
filter in ListOperationsRequest.
labels (Sequence[google.cloud.datastore_admin_v1.types.CommonMetadata.LabelsEntry]):
labels (Dict[str, str]):
The client-assigned labels which were
provided when the operation was created. May
also include additional labels.
Expand Down Expand Up @@ -113,7 +113,7 @@ class ExportEntitiesRequest(proto.Message):
project_id (str):
Required. Project ID against which to make
the request.
labels (Sequence[google.cloud.datastore_admin_v1.types.ExportEntitiesRequest.LabelsEntry]):
labels (Dict[str, str]):
Client-assigned labels.
entity_filter (google.cloud.datastore_admin_v1.types.EntityFilter):
Description of what data from the project is
Expand Down Expand Up @@ -157,7 +157,7 @@ class ImportEntitiesRequest(proto.Message):
project_id (str):
Required. Project ID against which to make
the request.
labels (Sequence[google.cloud.datastore_admin_v1.types.ImportEntitiesRequest.LabelsEntry]):
labels (Dict[str, str]):
Client-assigned labels.
input_url (str):
Required. The full resource URL of the external storage
Expand Down
5 changes: 2 additions & 3 deletions noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,9 +77,8 @@ def blacken(session):
def mypy(session):
"""Verify type hints are mypy compatible."""
session.install("-e", ".")
session.install("mypy")
# TODO: also verify types on tests, all of google package
session.run("mypy", "-p", "google.cloud.datastore", "--no-incremental")
session.install("mypy", "types-setuptools", "types-mock", "types-requests")
session.run("mypy", "google/", "tests/")


@nox.session(python=DEFAULT_PYTHON_VERSION)
Expand Down
21 changes: 17 additions & 4 deletions owlbot.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@

common = gcp.CommonTemplates()


# This is a customized version of the s.get_staging_dirs() function from synthtool to
# cater for copying 2 different folders from googleapis-gen
# which are datastore and datastore/admin
Expand Down Expand Up @@ -60,6 +61,7 @@ def get_staging_dirs(
else:
return []


# This library ships clients for two different APIs,
# Datastore and Datastore Admin
datastore_default_version = "v1"
Expand Down Expand Up @@ -197,6 +199,17 @@ def docfx(session):
""",
)

# Work around: https://github.com/googleapis/gapic-generator-python/issues/689
s.replace(
[
"google/**/datastore_admin/async_client.py",
"google/**/datastore_admin/client.py",
"google/**/types/datastore_admin.py",
],
r"Sequence\[.*\.LabelsEntry\]",
r"Dict[str, str]",
)

# Add documentation about creating indexes and populating data for system
# tests.
assert 1 == s.replace(
Expand Down Expand Up @@ -240,7 +253,8 @@ def docfx(session):
)

# add type checker nox session
s.replace("noxfile.py",
s.replace(
"noxfile.py",
"""nox.options.sessions = \[
"unit",
"system",""",
Expand All @@ -262,9 +276,8 @@ def lint_setup_py\(session\):
def mypy(session):
"""Verify type hints are mypy compatible."""
session.install("-e", ".")
session.install("mypy")
# TODO: also verify types on tests, all of google package
session.run("mypy", "-p", "google.cloud.datastore", "--no-incremental")
session.install("mypy", "types-setuptools", "types-mock", "types-requests")
session.run("mypy", "google/", "tests/")


@nox.session(python=DEFAULT_PYTHON_VERSION)
Expand Down
5 changes: 4 additions & 1 deletion tests/unit/test_batch.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@
# See the License for the specific language governing permissions and
# limitations under the License.

from typing import Dict
from typing import Any

import mock
import pytest

Expand Down Expand Up @@ -498,7 +501,7 @@ def test__parse_commit_response():
class _Entity(dict):
key = None
exclude_from_indexes = ()
_meanings = {}
_meanings: Dict[str, Any] = {}


class _Key(object):
Expand Down
5 changes: 4 additions & 1 deletion tests/unit/test_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@
# See the License for the specific language governing permissions and
# limitations under the License.

from typing import Dict
from typing import Any

import mock
import pytest

Expand Down Expand Up @@ -1522,7 +1525,7 @@ def __exit__(self, *args):
class _Entity(dict):
key = None
exclude_from_indexes = ()
_meanings = {}
_meanings: Dict[str, Any] = {}


class _Key(object):
Expand Down