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:b8058df4c45e9a6e07f6b4d65b458d0d059241dd34c814f151c8bf6b89211209
image: us-central1-docker.pkg.dev/cloud-sdk-librarian-prod/images-prod/python-librarian-generator@sha256:667c9c407ace8caf2deba85187536df8a091e7b05c78eea63eb01255fe17a8f3
libraries:
- id: google-cloud-spanner
version: 3.63.0
Expand Down
38 changes: 35 additions & 3 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
#
##
# google-cloud-spanner documentation build configuration file
#
# This file is execfile()d with the current directory set to its
Expand All @@ -25,9 +24,12 @@
# All configuration values have a default; values that are commented out
# serve to show the default.

import sys
import logging
import os
import shlex
import sys
import logging
from typing import Any
Comment on lines +27 to +32
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

The logging module is imported twice. Please remove the duplicate import. It's also good practice to keep imports sorted alphabetically.

Suggested change
import logging
import os
import shlex
import sys
import logging
from typing import Any
import logging
import os
import shlex
import sys
from typing import Any


# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
Expand Down Expand Up @@ -383,3 +385,33 @@
napoleon_use_ivar = False
napoleon_use_param = True
napoleon_use_rtype = True

# Setup for sphinx behaviors such as warning filters.
class UnexpectedUnindentFilter(logging.Filter):
"""Filter out warnings about unexpected unindentation following bullet lists."""

def filter(self, record: logging.LogRecord) -> bool:
"""Filter the log record.

Args:
record (logging.LogRecord): The log record.

Returns:
bool: False to suppress the warning, True to allow it.
"""
msg = record.getMessage()
if "Bullet list ends without a blank line" in msg:
return False
return True


def setup(app: Any) -> None:
"""Setup the Sphinx application.

Args:
app (Any): The Sphinx application.
"""
# Sphinx's logger is hierarchical. Adding a filter to the
# root 'sphinx' logger will catch warnings from all sub-loggers.
logger = logging.getLogger('sphinx')
logger.addFilter(UnexpectedUnindentFilter())
Original file line number Diff line number Diff line change
Expand Up @@ -45,15 +45,16 @@
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.iam.v1 import iam_policy_pb2 # type: ignore
from google.iam.v1 import policy_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.iam.v1.iam_policy_pb2 as iam_policy_pb2 # type: ignore
import google.iam.v1.policy_pb2 as policy_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.longrunning.operations_pb2 as operations_pb2 # type: ignore
Comment on lines 52 to +53
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

The google.longrunning.operations_pb2 module is imported twice. Please remove the redundant import.

Suggested change
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.longrunning.operations_pb2 as operations_pb2 # type: ignore
import google.longrunning.operations_pb2 as operations_pb2 # 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 google.cloud.spanner_admin_database_v1.services.database_admin import pagers
from google.cloud.spanner_admin_database_v1.types import common, spanner_database_admin
Expand Down Expand Up @@ -160,7 +161,10 @@ def from_service_account_info(cls, info: dict, *args, **kwargs):
Returns:
DatabaseAdminAsyncClient: The constructed client.
"""
return DatabaseAdminClient.from_service_account_info.__func__(DatabaseAdminAsyncClient, info, *args, **kwargs) # type: ignore
sa_info_func = (
DatabaseAdminClient.from_service_account_info.__func__ # type: ignore
)
return sa_info_func(DatabaseAdminAsyncClient, info, *args, **kwargs)

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

from_service_account_json = from_service_account_file

Expand Down Expand Up @@ -226,7 +233,7 @@ def transport(self) -> DatabaseAdminTransport:
return self._client.transport

@property
def api_endpoint(self):
def api_endpoint(self) -> str:
"""Return the API endpoint used by the client instance.

Returns:
Expand Down Expand Up @@ -1327,7 +1334,7 @@ async def set_iam_policy(
# client as shown in:
# https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import spanner_admin_database_v1
from google.iam.v1 import iam_policy_pb2 # type: ignore
import google.iam.v1.iam_policy_pb2 as iam_policy_pb2 # type: ignore

async def sample_set_iam_policy():
# Create a client
Expand Down Expand Up @@ -1474,7 +1481,7 @@ async def get_iam_policy(
# client as shown in:
# https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import spanner_admin_database_v1
from google.iam.v1 import iam_policy_pb2 # type: ignore
import google.iam.v1.iam_policy_pb2 as iam_policy_pb2 # type: ignore

async def sample_get_iam_policy():
# Create a client
Expand Down Expand Up @@ -1622,7 +1629,7 @@ async def test_iam_permissions(
# client as shown in:
# https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import spanner_admin_database_v1
from google.iam.v1 import iam_policy_pb2 # type: ignore
import google.iam.v1.iam_policy_pb2 as iam_policy_pb2 # type: ignore

async def sample_test_iam_permissions():
# Create a client
Expand Down Expand Up @@ -3980,7 +3987,7 @@ async def sample_internal_update_graph_operation():

async def list_operations(
self,
request: Optional[operations_pb2.ListOperationsRequest] = None,
request: Optional[Union[operations_pb2.ListOperationsRequest, dict]] = None,
*,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
Expand All @@ -4006,8 +4013,12 @@ async def list_operations(
# Create or coerce a protobuf request object.
# The request isn't a proto-plus wrapped type,
# so it must be constructed via keyword expansion.
if isinstance(request, dict):
request = operations_pb2.ListOperationsRequest(**request)
if request is None:
request_pb = operations_pb2.ListOperationsRequest()
elif isinstance(request, dict):
request_pb = operations_pb2.ListOperationsRequest(**request)
else:
request_pb = request

# Wrap the RPC method; this adds retry and timeout information,
# and friendly error handling.
Expand All @@ -4016,15 +4027,15 @@ async def list_operations(
# Certain fields should be provided within the metadata header;
# add these here.
metadata = tuple(metadata) + (
gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)),
gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)),
)

# Validate the universe domain.
self._client._validate_universe_domain()

# Send the request.
response = await rpc(
request,
request_pb,
retry=retry,
timeout=timeout,
metadata=metadata,
Expand All @@ -4035,7 +4046,7 @@ async def list_operations(

async def get_operation(
self,
request: Optional[operations_pb2.GetOperationRequest] = None,
request: Optional[Union[operations_pb2.GetOperationRequest, dict]] = None,
*,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
Expand All @@ -4061,8 +4072,12 @@ async def get_operation(
# Create or coerce a protobuf request object.
# The request isn't a proto-plus wrapped type,
# so it must be constructed via keyword expansion.
if isinstance(request, dict):
request = operations_pb2.GetOperationRequest(**request)
if request is None:
request_pb = operations_pb2.GetOperationRequest()
elif isinstance(request, dict):
request_pb = operations_pb2.GetOperationRequest(**request)
else:
request_pb = request

# Wrap the RPC method; this adds retry and timeout information,
# and friendly error handling.
Expand All @@ -4071,15 +4086,15 @@ async def get_operation(
# Certain fields should be provided within the metadata header;
# add these here.
metadata = tuple(metadata) + (
gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)),
gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)),
)

# Validate the universe domain.
self._client._validate_universe_domain()

# Send the request.
response = await rpc(
request,
request_pb,
retry=retry,
timeout=timeout,
metadata=metadata,
Expand All @@ -4090,7 +4105,7 @@ async def get_operation(

async def delete_operation(
self,
request: Optional[operations_pb2.DeleteOperationRequest] = None,
request: Optional[Union[operations_pb2.DeleteOperationRequest, dict]] = None,
*,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
Expand Down Expand Up @@ -4120,8 +4135,12 @@ async def delete_operation(
# Create or coerce a protobuf request object.
# The request isn't a proto-plus wrapped type,
# so it must be constructed via keyword expansion.
if isinstance(request, dict):
request = operations_pb2.DeleteOperationRequest(**request)
if request is None:
request_pb = operations_pb2.DeleteOperationRequest()
elif isinstance(request, dict):
request_pb = operations_pb2.DeleteOperationRequest(**request)
else:
request_pb = request

# Wrap the RPC method; this adds retry and timeout information,
# and friendly error handling.
Expand All @@ -4130,23 +4149,23 @@ async def delete_operation(
# Certain fields should be provided within the metadata header;
# add these here.
metadata = tuple(metadata) + (
gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)),
gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)),
)

# Validate the universe domain.
self._client._validate_universe_domain()

# Send the request.
await rpc(
request,
request_pb,
retry=retry,
timeout=timeout,
metadata=metadata,
)

async def cancel_operation(
self,
request: Optional[operations_pb2.CancelOperationRequest] = None,
request: Optional[Union[operations_pb2.CancelOperationRequest, dict]] = None,
*,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
Expand Down Expand Up @@ -4175,8 +4194,12 @@ async def cancel_operation(
# Create or coerce a protobuf request object.
# The request isn't a proto-plus wrapped type,
# so it must be constructed via keyword expansion.
if isinstance(request, dict):
request = operations_pb2.CancelOperationRequest(**request)
if request is None:
request_pb = operations_pb2.CancelOperationRequest()
elif isinstance(request, dict):
request_pb = operations_pb2.CancelOperationRequest(**request)
else:
request_pb = request

# Wrap the RPC method; this adds retry and timeout information,
# and friendly error handling.
Expand All @@ -4185,15 +4208,15 @@ async def cancel_operation(
# Certain fields should be provided within the metadata header;
# add these here.
metadata = tuple(metadata) + (
gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)),
gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)),
)

# Validate the universe domain.
self._client._validate_universe_domain()

# Send the request.
await rpc(
request,
request_pb,
retry=retry,
timeout=timeout,
metadata=metadata,
Expand Down
Loading
Loading