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 .librarian/state.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
image: us-central1-docker.pkg.dev/cloud-sdk-librarian-prod/images-prod/python-librarian-generator@sha256:51d42b9060365aa10d21e64a370b82bf1e07ed7f1e46062dcb3ad10632b0acc8
image: us-central1-docker.pkg.dev/cloud-sdk-librarian-prod/images-prod/python-librarian-generator@sha256:a38add811f7f139d6a385b22d283ad09ef305b8cf50382ef62f0ce690787f021
libraries:
- id: google-cloud-datastore
version: 2.23.0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,13 @@
except AttributeError: # pragma: NO COVER
OptionalRetry = Union[retries.AsyncRetry, object, None] # type: ignore

from google.api_core import operation # type: ignore
from google.api_core import operation_async # type: ignore
from google.cloud.datastore_admin_v1.services.datastore_admin import pagers
from google.cloud.datastore_admin_v1.types import datastore_admin
from google.cloud.datastore_admin_v1.types import index
from google.longrunning import operations_pb2 # type: ignore
from google.protobuf import empty_pb2 # type: ignore
import google.api_core.operation as operation # type: ignore
import google.api_core.operation_async as operation_async # type: ignore
import google.protobuf.empty_pb2 as empty_pb2 # type: ignore
from .transports.base import DatastoreAdminTransport, DEFAULT_CLIENT_INFO
from .transports.grpc_asyncio import DatastoreAdminGrpcAsyncIOTransport
from .client import DatastoreAdminClient
Expand Down Expand Up @@ -170,7 +170,10 @@ def from_service_account_info(cls, info: dict, *args, **kwargs):
Returns:
DatastoreAdminAsyncClient: The constructed client.
"""
return DatastoreAdminClient.from_service_account_info.__func__(DatastoreAdminAsyncClient, info, *args, **kwargs) # type: ignore
sa_info_func = (
DatastoreAdminClient.from_service_account_info.__func__ # type: ignore
)
return sa_info_func(DatastoreAdminAsyncClient, info, *args, **kwargs)

@classmethod
def from_service_account_file(cls, filename: str, *args, **kwargs):
Expand All @@ -186,7 +189,10 @@ def from_service_account_file(cls, filename: str, *args, **kwargs):
Returns:
DatastoreAdminAsyncClient: The constructed client.
"""
return DatastoreAdminClient.from_service_account_file.__func__(DatastoreAdminAsyncClient, filename, *args, **kwargs) # type: ignore
sa_file_func = (
DatastoreAdminClient.from_service_account_file.__func__ # type: ignore
)
return sa_file_func(DatastoreAdminAsyncClient, filename, *args, **kwargs)

from_service_account_json = from_service_account_file

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,13 +61,13 @@

_LOGGER = std_logging.getLogger(__name__)

from google.api_core import operation # type: ignore
from google.api_core import operation_async # type: ignore
from google.cloud.datastore_admin_v1.services.datastore_admin import pagers
from google.cloud.datastore_admin_v1.types import datastore_admin
from google.cloud.datastore_admin_v1.types import index
from google.longrunning import operations_pb2 # type: ignore
from google.protobuf import empty_pb2 # type: ignore
import google.api_core.operation as operation # type: ignore
import google.api_core.operation_async as operation_async # type: ignore
import google.protobuf.empty_pb2 as empty_pb2 # type: ignore
from .transports.base import DatastoreAdminTransport, DEFAULT_CLIENT_INFO
from .transports.grpc import DatastoreAdminGrpcTransport
from .transports.grpc_asyncio import DatastoreAdminGrpcAsyncIOTransport
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -796,7 +796,7 @@ def __call__(
)
method = transcoded_request["method"]
try:
request_payload = json_format.MessageToJson(request)
request_payload = type(request).to_json(request)

Choose a reason for hiding this comment

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

medium

Using a bare except: on line 800 is discouraged as it catches all exceptions, including system-exiting ones like KeyboardInterrupt and SystemExit. This can hide bugs and make debugging difficult. It's better to catch a more specific exception, like except Exception:, or even more specific exceptions that to_json might raise.

except:
request_payload = None
http_request = {
Expand Down Expand Up @@ -943,7 +943,7 @@ def __call__(
)
method = transcoded_request["method"]
try:
request_payload = json_format.MessageToJson(request)
request_payload = type(request).to_json(request)

Choose a reason for hiding this comment

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

medium

Using a bare except: on line 947 is discouraged as it catches all exceptions, including system-exiting ones like KeyboardInterrupt and SystemExit. This can hide bugs and make debugging difficult. It's better to catch a more specific exception, like except Exception:, or even more specific exceptions that to_json might raise.

except:
request_payload = None
http_request = {
Expand Down Expand Up @@ -1094,7 +1094,7 @@ def __call__(
)
method = transcoded_request["method"]
try:
request_payload = json_format.MessageToJson(request)
request_payload = type(request).to_json(request)

Choose a reason for hiding this comment

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

medium

Using a bare except: on line 1098 is discouraged as it catches all exceptions, including system-exiting ones like KeyboardInterrupt and SystemExit. This can hide bugs and make debugging difficult. It's better to catch a more specific exception, like except Exception:, or even more specific exceptions that to_json might raise.

except:
request_payload = None
http_request = {
Expand Down Expand Up @@ -1395,7 +1395,7 @@ def __call__(
)
method = transcoded_request["method"]
try:
request_payload = json_format.MessageToJson(request)
request_payload = type(request).to_json(request)

Choose a reason for hiding this comment

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

medium

Using a bare except: on line 1399 is discouraged as it catches all exceptions, including system-exiting ones like KeyboardInterrupt and SystemExit. This can hide bugs and make debugging difficult. It's better to catch a more specific exception, like except Exception:, or even more specific exceptions that to_json might raise.

except:
request_payload = None
http_request = {
Expand Down
2 changes: 1 addition & 1 deletion google/cloud/datastore_admin_v1/types/datastore_admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

from google.cloud.datastore_admin_v1.types import index as gda_index
from google.cloud.datastore_admin_v1.types import migration
from google.protobuf import timestamp_pb2 # type: ignore
import google.protobuf.timestamp_pb2 as timestamp_pb2 # type: ignore


__protobuf__ = proto.module(
Expand Down
12 changes: 9 additions & 3 deletions google/cloud/datastore_v1/services/datastore/async_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
from google.cloud.datastore_v1.types import query
from google.cloud.datastore_v1.types import query_profile
from google.longrunning import operations_pb2 # type: ignore
from google.protobuf import timestamp_pb2 # type: ignore
import google.protobuf.timestamp_pb2 as timestamp_pb2 # type: ignore
from .transports.base import DatastoreTransport, DEFAULT_CLIENT_INFO
from .transports.grpc_asyncio import DatastoreGrpcAsyncIOTransport
from .client import DatastoreClient
Expand Down Expand Up @@ -117,7 +117,10 @@ def from_service_account_info(cls, info: dict, *args, **kwargs):
Returns:
DatastoreAsyncClient: The constructed client.
"""
return DatastoreClient.from_service_account_info.__func__(DatastoreAsyncClient, info, *args, **kwargs) # type: ignore
sa_info_func = (
DatastoreClient.from_service_account_info.__func__ # type: ignore
)
return sa_info_func(DatastoreAsyncClient, info, *args, **kwargs)

@classmethod
def from_service_account_file(cls, filename: str, *args, **kwargs):
Expand All @@ -133,7 +136,10 @@ def from_service_account_file(cls, filename: str, *args, **kwargs):
Returns:
DatastoreAsyncClient: The constructed client.
"""
return DatastoreClient.from_service_account_file.__func__(DatastoreAsyncClient, filename, *args, **kwargs) # type: ignore
sa_file_func = (
DatastoreClient.from_service_account_file.__func__ # type: ignore
)
return sa_file_func(DatastoreAsyncClient, filename, *args, **kwargs)

from_service_account_json = from_service_account_file

Expand Down
2 changes: 1 addition & 1 deletion google/cloud/datastore_v1/services/datastore/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@
from google.cloud.datastore_v1.types import query
from google.cloud.datastore_v1.types import query_profile
from google.longrunning import operations_pb2 # type: ignore
from google.protobuf import timestamp_pb2 # type: ignore
import google.protobuf.timestamp_pb2 as timestamp_pb2 # type: ignore
from .transports.base import DatastoreTransport, DEFAULT_CLIENT_INFO
from .transports.grpc import DatastoreGrpcTransport
from .transports.grpc_asyncio import DatastoreGrpcAsyncIOTransport
Expand Down
2 changes: 1 addition & 1 deletion google/cloud/datastore_v1/types/aggregation_result.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

from google.cloud.datastore_v1.types import entity
from google.cloud.datastore_v1.types import query
from google.protobuf import timestamp_pb2 # type: ignore
import google.protobuf.timestamp_pb2 as timestamp_pb2 # type: ignore


__protobuf__ = proto.module(
Expand Down
2 changes: 1 addition & 1 deletion google/cloud/datastore_v1/types/datastore.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
from google.cloud.datastore_v1.types import entity
from google.cloud.datastore_v1.types import query as gd_query
from google.cloud.datastore_v1.types import query_profile
from google.protobuf import timestamp_pb2 # type: ignore
import google.protobuf.timestamp_pb2 as timestamp_pb2 # type: ignore


__protobuf__ = proto.module(
Expand Down
6 changes: 3 additions & 3 deletions google/cloud/datastore_v1/types/entity.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@

import proto # type: ignore

from google.protobuf import struct_pb2 # type: ignore
from google.protobuf import timestamp_pb2 # type: ignore
from google.type import latlng_pb2 # type: ignore
import google.protobuf.struct_pb2 as struct_pb2 # type: ignore
import google.protobuf.timestamp_pb2 as timestamp_pb2 # type: ignore
import google.type.latlng_pb2 as latlng_pb2 # type: ignore


__protobuf__ = proto.module(
Expand Down
4 changes: 2 additions & 2 deletions google/cloud/datastore_v1/types/query.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@
import proto # type: ignore

from google.cloud.datastore_v1.types import entity as gd_entity
from google.protobuf import timestamp_pb2 # type: ignore
from google.protobuf import wrappers_pb2 # type: ignore
import google.protobuf.timestamp_pb2 as timestamp_pb2 # type: ignore
import google.protobuf.wrappers_pb2 as wrappers_pb2 # type: ignore


__protobuf__ = proto.module(
Expand Down
4 changes: 2 additions & 2 deletions google/cloud/datastore_v1/types/query_profile.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@

import proto # type: ignore

from google.protobuf import duration_pb2 # type: ignore
from google.protobuf import struct_pb2 # type: ignore
import google.protobuf.duration_pb2 as duration_pb2 # type: ignore
import google.protobuf.struct_pb2 as struct_pb2 # type: ignore


__protobuf__ = proto.module(
Expand Down
2 changes: 1 addition & 1 deletion noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -368,7 +368,7 @@ def docs(session):
)


@nox.session(python="3.9")
@nox.session(python="3.10")
def doctests(session):
# Install all test dependencies, then install this package into the
# virtualenv's dist-packages.
Expand Down
5 changes: 3 additions & 2 deletions tests/unit/gapic/datastore_admin_v1/test_datastore_admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
import json
import math
import pytest
from collections.abc import Sequence, Mapping
from google.api_core import api_core_version
from proto.marshal.rules.dates import DurationRule, TimestampRule
from proto.marshal.rules import wrappers
Expand All @@ -51,7 +52,6 @@
from google.api_core import grpc_helpers
from google.api_core import grpc_helpers_async
from google.api_core import operation
from google.api_core import operation_async # type: ignore
from google.api_core import operations_v1
from google.api_core import path_template
from google.api_core import retry as retries
Expand All @@ -69,8 +69,9 @@
from google.cloud.datastore_admin_v1.types import index
from google.longrunning import operations_pb2 # type: ignore
from google.oauth2 import service_account
from google.protobuf import empty_pb2 # type: ignore
import google.api_core.operation_async as operation_async # type: ignore
import google.auth
import google.protobuf.empty_pb2 as empty_pb2 # type: ignore


CRED_INFO_JSON = {
Expand Down
9 changes: 5 additions & 4 deletions tests/unit/gapic/datastore_v1/test_datastore.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
import json
import math
import pytest
from collections.abc import Sequence, Mapping
from google.api_core import api_core_version
from proto.marshal.rules.dates import DurationRule, TimestampRule
from proto.marshal.rules import wrappers
Expand Down Expand Up @@ -63,11 +64,11 @@
from google.cloud.datastore_v1.types import query_profile
from google.longrunning import operations_pb2 # type: ignore
from google.oauth2 import service_account
from google.protobuf import struct_pb2 # type: ignore
from google.protobuf import timestamp_pb2 # type: ignore
from google.protobuf import wrappers_pb2 # type: ignore
from google.type import latlng_pb2 # type: ignore
import google.auth
import google.protobuf.struct_pb2 as struct_pb2 # type: ignore
import google.protobuf.timestamp_pb2 as timestamp_pb2 # type: ignore
import google.protobuf.wrappers_pb2 as wrappers_pb2 # type: ignore
import google.type.latlng_pb2 as latlng_pb2 # type: ignore


CRED_INFO_JSON = {
Expand Down
Loading