Skip to content

Commit 6163efc

Browse files
chalmerloweparthea
authored andcommitted
chore: update linting with ruff
1 parent cb2edca commit 6163efc

File tree

130 files changed

+2502
-2092
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

130 files changed

+2502
-2092
lines changed

packages/google-cloud-spanner/google/cloud/aio/_cross_sync/_decorators.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
Contains a set of AstDecorator classes, which define the behavior of CrossSync decorators.
1616
Each AstDecorator class is used through @CrossSync.<decorator_name>
1717
"""
18+
1819
from __future__ import annotations
1920

2021
from typing import TYPE_CHECKING, Iterable

packages/google-cloud-spanner/google/cloud/spanner_admin_database_v1/services/database_admin/async_client.py

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,10 @@
1313
# See the License for the specific language governing permissions and
1414
# limitations under the License.
1515
#
16-
from collections import OrderedDict
1716
import logging as std_logging
1817
import re
18+
import uuid
19+
from collections import OrderedDict
1920
from typing import (
2021
Callable,
2122
Dict,
@@ -28,15 +29,14 @@
2829
Type,
2930
Union,
3031
)
31-
import uuid
3232

33+
import google.protobuf
3334
from google.api_core import exceptions as core_exceptions
3435
from google.api_core import gapic_v1
3536
from google.api_core import retry_async as retries
3637
from google.api_core.client_options import ClientOptions
3738
from google.auth import credentials as ga_credentials # type: ignore
3839
from google.oauth2 import service_account # type: ignore
39-
import google.protobuf
4040

4141
from google.cloud.spanner_admin_database_v1 import gapic_version as package_version
4242

@@ -49,21 +49,24 @@
4949
import google.api_core.operation_async as operation_async # type: ignore
5050
import google.iam.v1.iam_policy_pb2 as iam_policy_pb2 # type: ignore
5151
import google.iam.v1.policy_pb2 as policy_pb2 # type: ignore
52-
from google.longrunning import operations_pb2 # type: ignore
5352
import google.longrunning.operations_pb2 as operations_pb2 # type: ignore
5453
import google.protobuf.duration_pb2 as duration_pb2 # type: ignore
5554
import google.protobuf.empty_pb2 as empty_pb2 # type: ignore
5655
import google.protobuf.field_mask_pb2 as field_mask_pb2 # type: ignore
5756
import google.protobuf.timestamp_pb2 as timestamp_pb2 # type: ignore
57+
from google.longrunning import operations_pb2 # type: ignore
5858

5959
from google.cloud.spanner_admin_database_v1.services.database_admin import pagers
60-
from google.cloud.spanner_admin_database_v1.types import common, spanner_database_admin
6160
from google.cloud.spanner_admin_database_v1.types import (
62-
backup_schedule as gsad_backup_schedule,
61+
backup,
62+
backup_schedule,
63+
common,
64+
spanner_database_admin,
6365
)
64-
from google.cloud.spanner_admin_database_v1.types import backup
6566
from google.cloud.spanner_admin_database_v1.types import backup as gsad_backup
66-
from google.cloud.spanner_admin_database_v1.types import backup_schedule
67+
from google.cloud.spanner_admin_database_v1.types import (
68+
backup_schedule as gsad_backup_schedule,
69+
)
6770

6871
from .client import DatabaseAdminClient
6972
from .transports.base import DEFAULT_CLIENT_INFO, DatabaseAdminTransport

packages/google-cloud-spanner/google/cloud/spanner_admin_database_v1/services/database_admin/client.py

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,14 @@
1313
# See the License for the specific language governing permissions and
1414
# limitations under the License.
1515
#
16-
from collections import OrderedDict
17-
from http import HTTPStatus
1816
import json
1917
import logging as std_logging
2018
import os
2119
import re
20+
import uuid
21+
import warnings
22+
from collections import OrderedDict
23+
from http import HTTPStatus
2224
from typing import (
2325
Callable,
2426
Dict,
@@ -32,9 +34,8 @@
3234
Union,
3335
cast,
3436
)
35-
import uuid
36-
import warnings
3737

38+
import google.protobuf
3839
from google.api_core import client_options as client_options_lib
3940
from google.api_core import exceptions as core_exceptions
4041
from google.api_core import gapic_v1
@@ -44,7 +45,6 @@
4445
from google.auth.transport import mtls # type: ignore
4546
from google.auth.transport.grpc import SslCredentials # type: ignore
4647
from google.oauth2 import service_account # type: ignore
47-
import google.protobuf
4848

4949
from google.cloud.spanner_admin_database_v1 import gapic_version as package_version
5050

@@ -66,21 +66,24 @@
6666
import google.api_core.operation_async as operation_async # type: ignore
6767
import google.iam.v1.iam_policy_pb2 as iam_policy_pb2 # type: ignore
6868
import google.iam.v1.policy_pb2 as policy_pb2 # type: ignore
69-
from google.longrunning import operations_pb2 # type: ignore
7069
import google.longrunning.operations_pb2 as operations_pb2 # type: ignore
7170
import google.protobuf.duration_pb2 as duration_pb2 # type: ignore
7271
import google.protobuf.empty_pb2 as empty_pb2 # type: ignore
7372
import google.protobuf.field_mask_pb2 as field_mask_pb2 # type: ignore
7473
import google.protobuf.timestamp_pb2 as timestamp_pb2 # type: ignore
74+
from google.longrunning import operations_pb2 # type: ignore
7575

7676
from google.cloud.spanner_admin_database_v1.services.database_admin import pagers
77-
from google.cloud.spanner_admin_database_v1.types import common, spanner_database_admin
7877
from google.cloud.spanner_admin_database_v1.types import (
79-
backup_schedule as gsad_backup_schedule,
78+
backup,
79+
backup_schedule,
80+
common,
81+
spanner_database_admin,
8082
)
81-
from google.cloud.spanner_admin_database_v1.types import backup
8283
from google.cloud.spanner_admin_database_v1.types import backup as gsad_backup
83-
from google.cloud.spanner_admin_database_v1.types import backup_schedule
84+
from google.cloud.spanner_admin_database_v1.types import (
85+
backup_schedule as gsad_backup_schedule,
86+
)
8487

8588
from .transports.base import DEFAULT_CLIENT_INFO, DatabaseAdminTransport
8689
from .transports.grpc import DatabaseAdminGrpcTransport
@@ -846,8 +849,7 @@ def __init__(
846849
)
847850
if self._client_options.scopes:
848851
raise ValueError(
849-
"When providing a transport instance, provide its scopes "
850-
"directly."
852+
"When providing a transport instance, provide its scopes directly."
851853
)
852854
self._transport = cast(DatabaseAdminTransport, transport)
853855
self._api_endpoint = self._transport.host

packages/google-cloud-spanner/google/cloud/spanner_admin_database_v1/services/database_admin/pagers.py

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ def __init__(
7373
*,
7474
retry: OptionalRetry = gapic_v1.method.DEFAULT,
7575
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
76-
metadata: Sequence[Tuple[str, Union[str, bytes]]] = ()
76+
metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
7777
):
7878
"""Instantiate the pager.
7979
@@ -149,7 +149,7 @@ def __init__(
149149
*,
150150
retry: OptionalAsyncRetry = gapic_v1.method.DEFAULT,
151151
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
152-
metadata: Sequence[Tuple[str, Union[str, bytes]]] = ()
152+
metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
153153
):
154154
"""Instantiates the pager.
155155
@@ -231,7 +231,7 @@ def __init__(
231231
*,
232232
retry: OptionalRetry = gapic_v1.method.DEFAULT,
233233
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
234-
metadata: Sequence[Tuple[str, Union[str, bytes]]] = ()
234+
metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
235235
):
236236
"""Instantiate the pager.
237237
@@ -307,7 +307,7 @@ def __init__(
307307
*,
308308
retry: OptionalAsyncRetry = gapic_v1.method.DEFAULT,
309309
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
310-
metadata: Sequence[Tuple[str, Union[str, bytes]]] = ()
310+
metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
311311
):
312312
"""Instantiates the pager.
313313
@@ -387,7 +387,7 @@ def __init__(
387387
*,
388388
retry: OptionalRetry = gapic_v1.method.DEFAULT,
389389
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
390-
metadata: Sequence[Tuple[str, Union[str, bytes]]] = ()
390+
metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
391391
):
392392
"""Instantiate the pager.
393393
@@ -465,7 +465,7 @@ def __init__(
465465
*,
466466
retry: OptionalAsyncRetry = gapic_v1.method.DEFAULT,
467467
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
468-
metadata: Sequence[Tuple[str, Union[str, bytes]]] = ()
468+
metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
469469
):
470470
"""Instantiates the pager.
471471
@@ -547,7 +547,7 @@ def __init__(
547547
*,
548548
retry: OptionalRetry = gapic_v1.method.DEFAULT,
549549
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
550-
metadata: Sequence[Tuple[str, Union[str, bytes]]] = ()
550+
metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
551551
):
552552
"""Instantiate the pager.
553553
@@ -623,7 +623,7 @@ def __init__(
623623
*,
624624
retry: OptionalAsyncRetry = gapic_v1.method.DEFAULT,
625625
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
626-
metadata: Sequence[Tuple[str, Union[str, bytes]]] = ()
626+
metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
627627
):
628628
"""Instantiates the pager.
629629
@@ -703,7 +703,7 @@ def __init__(
703703
*,
704704
retry: OptionalRetry = gapic_v1.method.DEFAULT,
705705
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
706-
metadata: Sequence[Tuple[str, Union[str, bytes]]] = ()
706+
metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
707707
):
708708
"""Instantiate the pager.
709709
@@ -781,7 +781,7 @@ def __init__(
781781
*,
782782
retry: OptionalAsyncRetry = gapic_v1.method.DEFAULT,
783783
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
784-
metadata: Sequence[Tuple[str, Union[str, bytes]]] = ()
784+
metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
785785
):
786786
"""Instantiates the pager.
787787
@@ -863,7 +863,7 @@ def __init__(
863863
*,
864864
retry: OptionalRetry = gapic_v1.method.DEFAULT,
865865
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
866-
metadata: Sequence[Tuple[str, Union[str, bytes]]] = ()
866+
metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
867867
):
868868
"""Instantiate the pager.
869869
@@ -939,7 +939,7 @@ def __init__(
939939
*,
940940
retry: OptionalAsyncRetry = gapic_v1.method.DEFAULT,
941941
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
942-
metadata: Sequence[Tuple[str, Union[str, bytes]]] = ()
942+
metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
943943
):
944944
"""Instantiates the pager.
945945

packages/google-cloud-spanner/google/cloud/spanner_admin_database_v1/services/database_admin/transports/base.py

Lines changed: 19 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -17,26 +17,28 @@
1717
from typing import Awaitable, Callable, Dict, Optional, Sequence, Union
1818

1919
import google.api_core
20+
import google.auth # type: ignore
21+
import google.iam.v1.iam_policy_pb2 as iam_policy_pb2 # type: ignore
22+
import google.iam.v1.policy_pb2 as policy_pb2 # type: ignore
23+
import google.protobuf
24+
import google.protobuf.empty_pb2 as empty_pb2 # type: ignore
2025
from google.api_core import exceptions as core_exceptions
2126
from google.api_core import gapic_v1, operations_v1
2227
from google.api_core import retry as retries
23-
import google.auth # type: ignore
2428
from google.auth import credentials as ga_credentials # type: ignore
25-
import google.iam.v1.iam_policy_pb2 as iam_policy_pb2 # type: ignore
26-
import google.iam.v1.policy_pb2 as policy_pb2 # type: ignore
2729
from google.longrunning import operations_pb2 # type: ignore
2830
from google.oauth2 import service_account # type: ignore
29-
import google.protobuf
30-
import google.protobuf.empty_pb2 as empty_pb2 # type: ignore
3131

3232
from google.cloud.spanner_admin_database_v1 import gapic_version as package_version
3333
from google.cloud.spanner_admin_database_v1.types import (
34-
backup_schedule as gsad_backup_schedule,
34+
backup,
35+
backup_schedule,
36+
spanner_database_admin,
3537
)
36-
from google.cloud.spanner_admin_database_v1.types import backup
3738
from google.cloud.spanner_admin_database_v1.types import backup as gsad_backup
38-
from google.cloud.spanner_admin_database_v1.types import backup_schedule
39-
from google.cloud.spanner_admin_database_v1.types import spanner_database_admin
39+
from google.cloud.spanner_admin_database_v1.types import (
40+
backup_schedule as gsad_backup_schedule,
41+
)
4042

4143
DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo(
4244
gapic_version=package_version.__version__
@@ -828,13 +830,19 @@ def get_operation(
828830
@property
829831
def cancel_operation(
830832
self,
831-
) -> Callable[[operations_pb2.CancelOperationRequest], None,]:
833+
) -> Callable[
834+
[operations_pb2.CancelOperationRequest],
835+
None,
836+
]:
832837
raise NotImplementedError()
833838

834839
@property
835840
def delete_operation(
836841
self,
837-
) -> Callable[[operations_pb2.DeleteOperationRequest], None,]:
842+
) -> Callable[
843+
[operations_pb2.DeleteOperationRequest],
844+
None,
845+
]:
838846
raise NotImplementedError()
839847

840848
@property

packages/google-cloud-spanner/google/cloud/spanner_admin_database_v1/services/database_admin/transports/grpc.py

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -16,29 +16,31 @@
1616
import json
1717
import logging as std_logging
1818
import pickle
19-
from typing import Callable, Dict, Optional, Sequence, Tuple, Union
2019
import warnings
20+
from typing import Callable, Dict, Optional, Sequence, Tuple, Union
2121

22-
from google.api_core import gapic_v1, grpc_helpers, operations_v1
2322
import google.auth # type: ignore
24-
from google.auth import credentials as ga_credentials # type: ignore
25-
from google.auth.transport.grpc import SslCredentials # type: ignore
2623
import google.iam.v1.iam_policy_pb2 as iam_policy_pb2 # type: ignore
2724
import google.iam.v1.policy_pb2 as policy_pb2 # type: ignore
28-
from google.longrunning import operations_pb2 # type: ignore
2925
import google.protobuf.empty_pb2 as empty_pb2 # type: ignore
30-
from google.protobuf.json_format import MessageToJson
3126
import google.protobuf.message
3227
import grpc # type: ignore
3328
import proto # type: ignore
29+
from google.api_core import gapic_v1, grpc_helpers, operations_v1
30+
from google.auth import credentials as ga_credentials # type: ignore
31+
from google.auth.transport.grpc import SslCredentials # type: ignore
32+
from google.longrunning import operations_pb2 # type: ignore
33+
from google.protobuf.json_format import MessageToJson
3434

3535
from google.cloud.spanner_admin_database_v1.types import (
36-
backup_schedule as gsad_backup_schedule,
36+
backup,
37+
backup_schedule,
38+
spanner_database_admin,
3739
)
38-
from google.cloud.spanner_admin_database_v1.types import backup
3940
from google.cloud.spanner_admin_database_v1.types import backup as gsad_backup
40-
from google.cloud.spanner_admin_database_v1.types import backup_schedule
41-
from google.cloud.spanner_admin_database_v1.types import spanner_database_admin
41+
from google.cloud.spanner_admin_database_v1.types import (
42+
backup_schedule as gsad_backup_schedule,
43+
)
4244

4345
from .base import DEFAULT_CLIENT_INFO, DatabaseAdminTransport
4446

@@ -1251,12 +1253,12 @@ def internal_update_graph_operation(
12511253
# gRPC handles serialization and deserialization, so we just need
12521254
# to pass in the functions for each.
12531255
if "internal_update_graph_operation" not in self._stubs:
1254-
self._stubs[
1255-
"internal_update_graph_operation"
1256-
] = self._logged_channel.unary_unary(
1257-
"/google.spanner.admin.database.v1.DatabaseAdmin/InternalUpdateGraphOperation",
1258-
request_serializer=spanner_database_admin.InternalUpdateGraphOperationRequest.serialize,
1259-
response_deserializer=spanner_database_admin.InternalUpdateGraphOperationResponse.deserialize,
1256+
self._stubs["internal_update_graph_operation"] = (
1257+
self._logged_channel.unary_unary(
1258+
"/google.spanner.admin.database.v1.DatabaseAdmin/InternalUpdateGraphOperation",
1259+
request_serializer=spanner_database_admin.InternalUpdateGraphOperationRequest.serialize,
1260+
response_deserializer=spanner_database_admin.InternalUpdateGraphOperationResponse.deserialize,
1261+
)
12601262
)
12611263
return self._stubs["internal_update_graph_operation"]
12621264

0 commit comments

Comments
 (0)