Skip to content
Closed
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:b8058df4c45e9a6e07f6b4d65b458d0d059241dd34c814f151c8bf6b89211209
image: us-central1-docker.pkg.dev/cloud-sdk-librarian-prod/images-prod/python-librarian-generator@sha256:a38add811f7f139d6a385b22d283ad09ef305b8cf50382ef62f0ce690787f021
libraries:
- id: google-cloud-firestore
version: 2.23.0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,6 @@
except AttributeError: # pragma: NO COVER
OptionalRetry = Union[retries.AsyncRetry, object, None] # type: ignore

from google.api_core import operation as gac_operation # type: ignore
from google.api_core import operation_async # type: ignore
from google.cloud.firestore_admin_v1.services.firestore_admin import pagers
from google.cloud.firestore_admin_v1.types import backup
from google.cloud.firestore_admin_v1.types import database
Expand All @@ -62,10 +60,12 @@
from google.cloud.firestore_admin_v1.types import user_creds as gfa_user_creds
from google.cloud.location import locations_pb2 # type: ignore
from google.longrunning import operations_pb2 # type: ignore
from google.protobuf import duration_pb2 # type: ignore
from google.protobuf import empty_pb2 # type: ignore
from google.protobuf import field_mask_pb2 # type: ignore
from google.protobuf import timestamp_pb2 # type: ignore
import google.api_core.operation as gac_operation # type: ignore
import google.api_core.operation_async as operation_async # type: ignore
import google.protobuf.duration_pb2 as duration_pb2 # type: ignore
import google.protobuf.empty_pb2 as empty_pb2 # type: ignore
import google.protobuf.field_mask_pb2 as field_mask_pb2 # type: ignore
import google.protobuf.timestamp_pb2 as timestamp_pb2 # type: ignore
from .transports.base import FirestoreAdminTransport, DEFAULT_CLIENT_INFO
from .transports.grpc_asyncio import FirestoreAdminGrpcAsyncIOTransport
from .client import FirestoreAdminClient
Expand Down Expand Up @@ -183,7 +183,10 @@ def from_service_account_info(cls, info: dict, *args, **kwargs):
Returns:
FirestoreAdminAsyncClient: The constructed client.
"""
return FirestoreAdminClient.from_service_account_info.__func__(FirestoreAdminAsyncClient, info, *args, **kwargs) # type: ignore
sa_info_func = (
FirestoreAdminClient.from_service_account_info.__func__ # type: ignore
)
return sa_info_func(FirestoreAdminAsyncClient, info, *args, **kwargs)

@classmethod
def from_service_account_file(cls, filename: str, *args, **kwargs):
Expand All @@ -199,7 +202,10 @@ def from_service_account_file(cls, filename: str, *args, **kwargs):
Returns:
FirestoreAdminAsyncClient: The constructed client.
"""
return FirestoreAdminClient.from_service_account_file.__func__(FirestoreAdminAsyncClient, filename, *args, **kwargs) # type: ignore
sa_file_func = (
FirestoreAdminClient.from_service_account_file.__func__ # type: ignore
)
return sa_file_func(FirestoreAdminAsyncClient, 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,8 +61,6 @@

_LOGGER = std_logging.getLogger(__name__)

from google.api_core import operation as gac_operation # type: ignore
from google.api_core import operation_async # type: ignore
from google.cloud.firestore_admin_v1.services.firestore_admin import pagers
from google.cloud.firestore_admin_v1.types import backup
from google.cloud.firestore_admin_v1.types import database
Expand All @@ -78,10 +76,12 @@
from google.cloud.firestore_admin_v1.types import user_creds as gfa_user_creds
from google.cloud.location import locations_pb2 # type: ignore
from google.longrunning import operations_pb2 # type: ignore
from google.protobuf import duration_pb2 # type: ignore
from google.protobuf import empty_pb2 # type: ignore
from google.protobuf import field_mask_pb2 # type: ignore
from google.protobuf import timestamp_pb2 # type: ignore
import google.api_core.operation as gac_operation # type: ignore
import google.api_core.operation_async as operation_async # type: ignore
import google.protobuf.duration_pb2 as duration_pb2 # type: ignore
import google.protobuf.empty_pb2 as empty_pb2 # type: ignore
import google.protobuf.field_mask_pb2 as field_mask_pb2 # type: ignore
import google.protobuf.timestamp_pb2 as timestamp_pb2 # type: ignore
from .transports.base import FirestoreAdminTransport, DEFAULT_CLIENT_INFO
from .transports.grpc import FirestoreAdminGrpcTransport
from .transports.grpc_asyncio import FirestoreAdminGrpcAsyncIOTransport
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
from google.cloud.firestore_admin_v1.types import user_creds as gfa_user_creds
from google.cloud.location import locations_pb2 # type: ignore
from google.longrunning import operations_pb2 # type: ignore
from google.protobuf import empty_pb2 # type: ignore
import google.protobuf.empty_pb2 as empty_pb2 # type: ignore

DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo(
gapic_version=package_version.__version__
Expand Down Expand Up @@ -97,8 +97,6 @@ def __init__(
be used for service account credentials.
"""

scopes_kwargs = {"scopes": scopes, "default_scopes": self.AUTH_SCOPES}

# Save the scopes.
self._scopes = scopes
if not hasattr(self, "_ignore_credentials"):
Expand All @@ -113,11 +111,16 @@ def __init__(

if credentials_file is not None:
credentials, _ = google.auth.load_credentials_from_file(
credentials_file, **scopes_kwargs, quota_project_id=quota_project_id
credentials_file,
scopes=scopes,
quota_project_id=quota_project_id,
default_scopes=self.AUTH_SCOPES,
)
elif credentials is None and not self._ignore_credentials:
credentials, _ = google.auth.default(
**scopes_kwargs, quota_project_id=quota_project_id
scopes=scopes,
quota_project_id=quota_project_id,
default_scopes=self.AUTH_SCOPES,
)
# Don't apply audience if the credentials file passed from user.
if hasattr(credentials, "with_gdch_audience"):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
from google.cloud.firestore_admin_v1.types import user_creds as gfa_user_creds
from google.cloud.location import locations_pb2 # type: ignore
from google.longrunning import operations_pb2 # type: ignore
from google.protobuf import empty_pb2 # type: ignore
import google.protobuf.empty_pb2 as empty_pb2 # type: ignore
from .base import FirestoreAdminTransport, DEFAULT_CLIENT_INFO

try:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
from google.cloud.firestore_admin_v1.types import user_creds as gfa_user_creds
from google.cloud.location import locations_pb2 # type: ignore
from google.longrunning import operations_pb2 # type: ignore
from google.protobuf import empty_pb2 # type: ignore
import google.protobuf.empty_pb2 as empty_pb2 # type: ignore
from .base import FirestoreAdminTransport, DEFAULT_CLIENT_INFO
from .grpc import FirestoreAdminGrpcTransport

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
from google.cloud.firestore_admin_v1.types import schedule
from google.cloud.firestore_admin_v1.types import user_creds
from google.cloud.firestore_admin_v1.types import user_creds as gfa_user_creds
from google.protobuf import empty_pb2 # type: ignore
import google.protobuf.empty_pb2 as empty_pb2 # type: ignore
from google.longrunning import operations_pb2 # type: ignore


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

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: clause is generally discouraged as it catches all exceptions, including system-exiting ones like SystemExit or KeyboardInterrupt. It's better to catch a more specific exception, like Exception, to avoid unintentionally suppressing important errors. This applies to all similar try...except: blocks in this file.

Suggested change
except:
except Exception:

request_payload = None
http_request = {
Expand Down Expand Up @@ -2257,7 +2257,7 @@ def __call__(
)
method = transcoded_request["method"]
try:
request_payload = json_format.MessageToJson(request)
request_payload = type(request).to_json(request)
except:
request_payload = None
http_request = {
Expand Down Expand Up @@ -2569,7 +2569,7 @@ def __call__(
)
method = transcoded_request["method"]
try:
request_payload = json_format.MessageToJson(request)
request_payload = type(request).to_json(request)
except:
request_payload = None
http_request = {
Expand Down Expand Up @@ -2721,7 +2721,7 @@ def __call__(
)
method = transcoded_request["method"]
try:
request_payload = json_format.MessageToJson(request)
request_payload = type(request).to_json(request)
except:
request_payload = None
http_request = {
Expand Down Expand Up @@ -3014,7 +3014,7 @@ def __call__(
)
method = transcoded_request["method"]
try:
request_payload = json_format.MessageToJson(request)
request_payload = type(request).to_json(request)
except:
request_payload = None
http_request = {
Expand Down Expand Up @@ -3124,7 +3124,7 @@ def __call__(
)
method = transcoded_request["method"]
try:
request_payload = json_format.MessageToJson(request)
request_payload = type(request).to_json(request)
except:
request_payload = None
http_request = {
Expand Down Expand Up @@ -3238,7 +3238,7 @@ def __call__(
)
method = transcoded_request["method"]
try:
request_payload = json_format.MessageToJson(request)
request_payload = type(request).to_json(request)
except:
request_payload = None
http_request = {
Expand Down Expand Up @@ -3377,7 +3377,7 @@ def __call__(
)
method = transcoded_request["method"]
try:
request_payload = json_format.MessageToJson(request)
request_payload = type(request).to_json(request)
except:
request_payload = None
http_request = {
Expand Down Expand Up @@ -3486,7 +3486,7 @@ def __call__(
)
method = transcoded_request["method"]
try:
request_payload = json_format.MessageToJson(request)
request_payload = type(request).to_json(request)
except:
request_payload = None
http_request = {
Expand Down Expand Up @@ -3913,7 +3913,7 @@ def __call__(
)
method = transcoded_request["method"]
try:
request_payload = json_format.MessageToJson(request)
request_payload = type(request).to_json(request)
except:
request_payload = None
http_request = {
Expand Down Expand Up @@ -4970,7 +4970,7 @@ def __call__(
)
method = transcoded_request["method"]
try:
request_payload = json_format.MessageToJson(request)
request_payload = type(request).to_json(request)
except:
request_payload = None
http_request = {
Expand Down Expand Up @@ -6175,7 +6175,7 @@ def __call__(
)
method = transcoded_request["method"]
try:
request_payload = json_format.MessageToJson(request)
request_payload = type(request).to_json(request)
except:
request_payload = None
http_request = {
Expand Down Expand Up @@ -6487,7 +6487,7 @@ def __call__(
)
method = transcoded_request["method"]
try:
request_payload = json_format.MessageToJson(request)
request_payload = type(request).to_json(request)
except:
request_payload = None
http_request = {
Expand Down Expand Up @@ -6639,7 +6639,7 @@ def __call__(
)
method = transcoded_request["method"]
try:
request_payload = json_format.MessageToJson(request)
request_payload = type(request).to_json(request)
except:
request_payload = None
http_request = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
from google.cloud.firestore_admin_v1.types import schedule
from google.cloud.firestore_admin_v1.types import user_creds
from google.cloud.firestore_admin_v1.types import user_creds as gfa_user_creds
from google.protobuf import empty_pb2 # type: ignore
import google.protobuf.empty_pb2 as empty_pb2 # type: ignore
from google.longrunning import operations_pb2 # type: ignore


Expand Down
2 changes: 1 addition & 1 deletion google/cloud/firestore_admin_v1/types/backup.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

import proto # type: ignore

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


__protobuf__ = proto.module(
Expand Down
4 changes: 2 additions & 2 deletions google/cloud/firestore_admin_v1/types/database.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 timestamp_pb2 # type: ignore
import google.protobuf.duration_pb2 as duration_pb2 # type: ignore
import google.protobuf.timestamp_pb2 as timestamp_pb2 # type: ignore


__protobuf__ = proto.module(
Expand Down
4 changes: 2 additions & 2 deletions google/cloud/firestore_admin_v1/types/firestore_admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@
from google.cloud.firestore_admin_v1.types import schedule
from google.cloud.firestore_admin_v1.types import snapshot
from google.cloud.firestore_admin_v1.types import user_creds as gfa_user_creds
from google.protobuf import field_mask_pb2 # type: ignore
from google.protobuf import timestamp_pb2 # type: ignore
import google.protobuf.field_mask_pb2 as field_mask_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/firestore_admin_v1/types/operation.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

from google.cloud.firestore_admin_v1.types import index as gfa_index
from google.cloud.firestore_admin_v1.types import snapshot
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/firestore_admin_v1/types/schedule.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 duration_pb2 # type: ignore
from google.protobuf import timestamp_pb2 # type: ignore
from google.type import dayofweek_pb2 # type: ignore
import google.protobuf.duration_pb2 as duration_pb2 # type: ignore
import google.protobuf.timestamp_pb2 as timestamp_pb2 # type: ignore
import google.type.dayofweek_pb2 as dayofweek_pb2 # type: ignore


__protobuf__ = proto.module(
Expand Down
2 changes: 1 addition & 1 deletion google/cloud/firestore_admin_v1/types/snapshot.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

import proto # type: ignore

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/firestore_admin_v1/types/user_creds.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

import proto # type: ignore

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/firestore_bundle/types/bundle.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@

import proto # type: ignore

from google.cloud.firestore_v1.types import document as document_pb2 # type: ignore
from google.cloud.firestore_v1.types import query as query_pb2 # type: ignore
from google.protobuf import timestamp_pb2 # type: ignore
import google.firestore.v1.document_pb2 as document_pb2 # type: ignore
import google.firestore.v1.query_pb2 as query_pb2 # type: ignore
import google.protobuf.timestamp_pb2 as timestamp_pb2 # type: ignore


__protobuf__ = proto.module(
Expand Down
14 changes: 10 additions & 4 deletions google/cloud/firestore_v1/services/firestore/async_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,8 @@
from google.cloud.firestore_v1.types import write as gf_write
from google.cloud.location import locations_pb2 # type: ignore
from google.longrunning import operations_pb2 # type: ignore
from google.protobuf import timestamp_pb2 # type: ignore
from google.rpc import status_pb2 # type: ignore
import google.protobuf.timestamp_pb2 as timestamp_pb2 # type: ignore
import google.rpc.status_pb2 as status_pb2 # type: ignore
from .transports.base import FirestoreTransport, DEFAULT_CLIENT_INFO
from .transports.grpc_asyncio import FirestoreGrpcAsyncIOTransport
from .client import FirestoreClient
Expand Down Expand Up @@ -129,7 +129,10 @@ def from_service_account_info(cls, info: dict, *args, **kwargs):
Returns:
FirestoreAsyncClient: The constructed client.
"""
return FirestoreClient.from_service_account_info.__func__(FirestoreAsyncClient, info, *args, **kwargs) # type: ignore
sa_info_func = (
FirestoreClient.from_service_account_info.__func__ # type: ignore
)
return sa_info_func(FirestoreAsyncClient, info, *args, **kwargs)

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

from_service_account_json = from_service_account_file

Expand Down
Loading
Loading