From aaa4b5866deee9a316ec26a13e7970a5e1d236f9 Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Wed, 23 Mar 2022 11:34:20 -0600 Subject: [PATCH 01/19] chore(python): configure release-please on previous major versions (#88) Source-Link: https://github.com/googleapis/synthtool/commit/c1dd87e9287f8de99930d3046dd555c4d03384c6 Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-python:latest@sha256:2d13c2172a5d6129c861edaa48b60ead15aeaf58aa75e02d870c4cbdfa63aaba Co-authored-by: Owl Bot --- .github/.OwlBot.lock.yaml | 2 +- .github/release-please.yml | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/.github/.OwlBot.lock.yaml b/.github/.OwlBot.lock.yaml index 44c78f7..8807627 100644 --- a/.github/.OwlBot.lock.yaml +++ b/.github/.OwlBot.lock.yaml @@ -13,4 +13,4 @@ # limitations under the License. docker: image: gcr.io/cloud-devrel-public-resources/owlbot-python:latest - digest: sha256:4e1991042fe54b991db9ca17c8fb386e61b22fe4d1472a568bf0fcac85dcf5d3 + digest: sha256:2d13c2172a5d6129c861edaa48b60ead15aeaf58aa75e02d870c4cbdfa63aaba diff --git a/.github/release-please.yml b/.github/release-please.yml index 466597e..6def37a 100644 --- a/.github/release-please.yml +++ b/.github/release-please.yml @@ -1,2 +1,8 @@ releaseType: python handleGHRelease: true +# NOTE: this section is generated by synthtool.languages.python +# See https://github.com/googleapis/synthtool/blob/master/synthtool/languages/python.py +branches: +- branch: v0 + handleGHRelease: true + releaseType: python From 163e0b522124e903d5d895f333c555c395ddd77c Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Mon, 28 Mar 2022 23:56:10 +0000 Subject: [PATCH 02/19] chore(python): use black==22.3.0 (#89) Source-Link: https://github.com/googleapis/synthtool/commit/6fab84af09f2cf89a031fd8671d1def6b2931b11 Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-python:latest@sha256:7cffbc10910c3ab1b852c05114a08d374c195a81cdec1d4a67a1d129331d0bfe --- .github/.OwlBot.lock.yaml | 2 +- docs/conf.py | 13 +- .../cloud_shell_service/async_client.py | 42 ++- .../services/cloud_shell_service/client.py | 86 ++++-- .../cloud_shell_service/transports/base.py | 25 +- .../cloud_shell_service/transports/grpc.py | 3 +- google/cloud/shell_v1/types/cloudshell.py | 130 +++++++-- noxfile.py | 9 +- .../shell_v1/test_cloud_shell_service.py | 263 +++++++++++++----- 9 files changed, 443 insertions(+), 130 deletions(-) diff --git a/.github/.OwlBot.lock.yaml b/.github/.OwlBot.lock.yaml index 8807627..87dd006 100644 --- a/.github/.OwlBot.lock.yaml +++ b/.github/.OwlBot.lock.yaml @@ -13,4 +13,4 @@ # limitations under the License. docker: image: gcr.io/cloud-devrel-public-resources/owlbot-python:latest - digest: sha256:2d13c2172a5d6129c861edaa48b60ead15aeaf58aa75e02d870c4cbdfa63aaba + digest: sha256:7cffbc10910c3ab1b852c05114a08d374c195a81cdec1d4a67a1d129331d0bfe diff --git a/docs/conf.py b/docs/conf.py index 4858738..16854da 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -314,7 +314,13 @@ # One entry per manual page. List of tuples # (source start file, name, description, authors, manual section). man_pages = [ - (root_doc, "google-cloud-shell", "google-cloud-shell Documentation", [author], 1,) + ( + root_doc, + "google-cloud-shell", + "google-cloud-shell Documentation", + [author], + 1, + ) ] # If true, show URL addresses after external links. @@ -355,7 +361,10 @@ intersphinx_mapping = { "python": ("https://python.readthedocs.org/en/latest/", None), "google-auth": ("https://googleapis.dev/python/google-auth/latest/", None), - "google.api_core": ("https://googleapis.dev/python/google-api-core/latest/", None,), + "google.api_core": ( + "https://googleapis.dev/python/google-api-core/latest/", + None, + ), "grpc": ("https://grpc.github.io/grpc/python/", None), "proto-plus": ("https://proto-plus-python.readthedocs.io/en/latest/", None), "protobuf": ("https://googleapis.dev/python/protobuf/latest/", None), diff --git a/google/cloud/shell_v1/services/cloud_shell_service/async_client.py b/google/cloud/shell_v1/services/cloud_shell_service/async_client.py index 3fddf3b..d126e4b 100644 --- a/google/cloud/shell_v1/services/cloud_shell_service/async_client.py +++ b/google/cloud/shell_v1/services/cloud_shell_service/async_client.py @@ -301,7 +301,8 @@ def sample_get_environment(): maximum=60.0, multiplier=1.3, predicate=retries.if_exception_type( - core_exceptions.ServiceUnavailable, core_exceptions.Unknown, + core_exceptions.ServiceUnavailable, + core_exceptions.Unknown, ), deadline=60.0, ), @@ -316,7 +317,12 @@ def sample_get_environment(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -398,7 +404,12 @@ def sample_start_environment(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Wrap the response in an operation future. response = operation_async.from_gapic( @@ -484,7 +495,12 @@ def sample_authorize_environment(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Wrap the response in an operation future. response = operation_async.from_gapic( @@ -571,7 +587,12 @@ def sample_add_public_key(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Wrap the response in an operation future. response = operation_async.from_gapic( @@ -658,7 +679,12 @@ def sample_remove_public_key(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Wrap the response in an operation future. response = operation_async.from_gapic( @@ -680,7 +706,9 @@ async def __aexit__(self, exc_type, exc, tb): try: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution("google-cloud-shell",).version, + gapic_version=pkg_resources.get_distribution( + "google-cloud-shell", + ).version, ) except pkg_resources.DistributionNotFound: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() diff --git a/google/cloud/shell_v1/services/cloud_shell_service/client.py b/google/cloud/shell_v1/services/cloud_shell_service/client.py index 0d28657..85fb173 100644 --- a/google/cloud/shell_v1/services/cloud_shell_service/client.py +++ b/google/cloud/shell_v1/services/cloud_shell_service/client.py @@ -57,7 +57,8 @@ class CloudShellServiceClientMeta(type): _transport_registry["grpc_asyncio"] = CloudShellServiceGrpcAsyncIOTransport def get_transport_class( - cls, label: str = None, + cls, + label: str = None, ) -> Type[CloudShellServiceTransport]: """Returns an appropriate transport class. @@ -171,10 +172,14 @@ def transport(self) -> CloudShellServiceTransport: return self._transport @staticmethod - def environment_path(user: str, environment: str,) -> str: + def environment_path( + user: str, + environment: str, + ) -> str: """Returns a fully-qualified environment string.""" return "users/{user}/environments/{environment}".format( - user=user, environment=environment, + user=user, + environment=environment, ) @staticmethod @@ -184,7 +189,9 @@ def parse_environment_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_billing_account_path(billing_account: str,) -> str: + def common_billing_account_path( + billing_account: str, + ) -> str: """Returns a fully-qualified billing_account string.""" return "billingAccounts/{billing_account}".format( billing_account=billing_account, @@ -197,9 +204,13 @@ def parse_common_billing_account_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_folder_path(folder: str,) -> str: + def common_folder_path( + folder: str, + ) -> str: """Returns a fully-qualified folder string.""" - return "folders/{folder}".format(folder=folder,) + return "folders/{folder}".format( + folder=folder, + ) @staticmethod def parse_common_folder_path(path: str) -> Dict[str, str]: @@ -208,9 +219,13 @@ def parse_common_folder_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_organization_path(organization: str,) -> str: + def common_organization_path( + organization: str, + ) -> str: """Returns a fully-qualified organization string.""" - return "organizations/{organization}".format(organization=organization,) + return "organizations/{organization}".format( + organization=organization, + ) @staticmethod def parse_common_organization_path(path: str) -> Dict[str, str]: @@ -219,9 +234,13 @@ def parse_common_organization_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_project_path(project: str,) -> str: + def common_project_path( + project: str, + ) -> str: """Returns a fully-qualified project string.""" - return "projects/{project}".format(project=project,) + return "projects/{project}".format( + project=project, + ) @staticmethod def parse_common_project_path(path: str) -> Dict[str, str]: @@ -230,10 +249,14 @@ def parse_common_project_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_location_path(project: str, location: str,) -> str: + def common_location_path( + project: str, + location: str, + ) -> str: """Returns a fully-qualified location string.""" return "projects/{project}/locations/{location}".format( - project=project, location=location, + project=project, + location=location, ) @staticmethod @@ -501,7 +524,12 @@ def sample_get_environment(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -584,7 +612,12 @@ def sample_start_environment(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Wrap the response in an operation future. response = operation.from_gapic( @@ -671,7 +704,12 @@ def sample_authorize_environment(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Wrap the response in an operation future. response = operation.from_gapic( @@ -759,7 +797,12 @@ def sample_add_public_key(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Wrap the response in an operation future. response = operation.from_gapic( @@ -847,7 +890,12 @@ def sample_remove_public_key(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Wrap the response in an operation future. response = operation.from_gapic( @@ -876,7 +924,9 @@ def __exit__(self, type, value, traceback): try: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution("google-cloud-shell",).version, + gapic_version=pkg_resources.get_distribution( + "google-cloud-shell", + ).version, ) except pkg_resources.DistributionNotFound: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() diff --git a/google/cloud/shell_v1/services/cloud_shell_service/transports/base.py b/google/cloud/shell_v1/services/cloud_shell_service/transports/base.py index 9952e10..b474bcf 100644 --- a/google/cloud/shell_v1/services/cloud_shell_service/transports/base.py +++ b/google/cloud/shell_v1/services/cloud_shell_service/transports/base.py @@ -31,7 +31,9 @@ try: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution("google-cloud-shell",).version, + gapic_version=pkg_resources.get_distribution( + "google-cloud-shell", + ).version, ) except pkg_resources.DistributionNotFound: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() @@ -127,7 +129,8 @@ def _prep_wrapped_messages(self, client_info): maximum=60.0, multiplier=1.3, predicate=retries.if_exception_type( - core_exceptions.ServiceUnavailable, core_exceptions.Unknown, + core_exceptions.ServiceUnavailable, + core_exceptions.Unknown, ), deadline=60.0, ), @@ -135,7 +138,9 @@ def _prep_wrapped_messages(self, client_info): client_info=client_info, ), self.start_environment: gapic_v1.method.wrap_method( - self.start_environment, default_timeout=60.0, client_info=client_info, + self.start_environment, + default_timeout=60.0, + client_info=client_info, ), self.authorize_environment: gapic_v1.method.wrap_method( self.authorize_environment, @@ -143,19 +148,23 @@ def _prep_wrapped_messages(self, client_info): client_info=client_info, ), self.add_public_key: gapic_v1.method.wrap_method( - self.add_public_key, default_timeout=60.0, client_info=client_info, + self.add_public_key, + default_timeout=60.0, + client_info=client_info, ), self.remove_public_key: gapic_v1.method.wrap_method( - self.remove_public_key, default_timeout=60.0, client_info=client_info, + self.remove_public_key, + default_timeout=60.0, + client_info=client_info, ), } def close(self): """Closes resources associated with the transport. - .. warning:: - Only call this method if the transport is NOT shared - with other clients - this may cause errors in other clients! + .. warning:: + Only call this method if the transport is NOT shared + with other clients - this may cause errors in other clients! """ raise NotImplementedError() diff --git a/google/cloud/shell_v1/services/cloud_shell_service/transports/grpc.py b/google/cloud/shell_v1/services/cloud_shell_service/transports/grpc.py index 5a09b82..9ba1ea6 100644 --- a/google/cloud/shell_v1/services/cloud_shell_service/transports/grpc.py +++ b/google/cloud/shell_v1/services/cloud_shell_service/transports/grpc.py @@ -234,8 +234,7 @@ def create_channel( @property def grpc_channel(self) -> grpc.Channel: - """Return the channel designed to connect to this service. - """ + """Return the channel designed to connect to this service.""" return self._grpc_channel @property diff --git a/google/cloud/shell_v1/types/cloudshell.py b/google/cloud/shell_v1/types/cloudshell.py index 8e6662b..1cbe91f 100644 --- a/google/cloud/shell_v1/types/cloudshell.py +++ b/google/cloud/shell_v1/types/cloudshell.py @@ -101,15 +101,43 @@ class State(proto.Enum): RUNNING = 3 DELETING = 4 - name = proto.Field(proto.STRING, number=1,) - id = proto.Field(proto.STRING, number=2,) - docker_image = proto.Field(proto.STRING, number=3,) - state = proto.Field(proto.ENUM, number=4, enum=State,) - web_host = proto.Field(proto.STRING, number=12,) - ssh_username = proto.Field(proto.STRING, number=5,) - ssh_host = proto.Field(proto.STRING, number=6,) - ssh_port = proto.Field(proto.INT32, number=7,) - public_keys = proto.RepeatedField(proto.STRING, number=8,) + name = proto.Field( + proto.STRING, + number=1, + ) + id = proto.Field( + proto.STRING, + number=2, + ) + docker_image = proto.Field( + proto.STRING, + number=3, + ) + state = proto.Field( + proto.ENUM, + number=4, + enum=State, + ) + web_host = proto.Field( + proto.STRING, + number=12, + ) + ssh_username = proto.Field( + proto.STRING, + number=5, + ) + ssh_host = proto.Field( + proto.STRING, + number=6, + ) + ssh_port = proto.Field( + proto.INT32, + number=7, + ) + public_keys = proto.RepeatedField( + proto.STRING, + number=8, + ) class GetEnvironmentRequest(proto.Message): @@ -123,7 +151,10 @@ class GetEnvironmentRequest(proto.Message): ``users/someone@example.com/environments/default``. """ - name = proto.Field(proto.STRING, number=1,) + name = proto.Field( + proto.STRING, + number=1, + ) class CreateEnvironmentMetadata(proto.Message): @@ -162,9 +193,18 @@ class StartEnvironmentRequest(proto.Message): environment before it is started. """ - name = proto.Field(proto.STRING, number=1,) - access_token = proto.Field(proto.STRING, number=2,) - public_keys = proto.RepeatedField(proto.STRING, number=3,) + name = proto.Field( + proto.STRING, + number=1, + ) + access_token = proto.Field( + proto.STRING, + number=2, + ) + public_keys = proto.RepeatedField( + proto.STRING, + number=3, + ) class AuthorizeEnvironmentRequest(proto.Message): @@ -188,10 +228,23 @@ class AuthorizeEnvironmentRequest(proto.Message): received the request. """ - name = proto.Field(proto.STRING, number=1,) - access_token = proto.Field(proto.STRING, number=2,) - id_token = proto.Field(proto.STRING, number=4,) - expire_time = proto.Field(proto.MESSAGE, number=3, message=timestamp_pb2.Timestamp,) + name = proto.Field( + proto.STRING, + number=1, + ) + access_token = proto.Field( + proto.STRING, + number=2, + ) + id_token = proto.Field( + proto.STRING, + number=4, + ) + expire_time = proto.Field( + proto.MESSAGE, + number=3, + message=timestamp_pb2.Timestamp, + ) class AuthorizeEnvironmentResponse(proto.Message): @@ -231,7 +284,11 @@ class State(proto.Enum): AWAITING_COMPUTE_RESOURCES = 4 FINISHED = 3 - state = proto.Field(proto.ENUM, number=1, enum=State,) + state = proto.Field( + proto.ENUM, + number=1, + enum=State, + ) class StartEnvironmentResponse(proto.Message): @@ -244,7 +301,11 @@ class StartEnvironmentResponse(proto.Message): Environment that was started. """ - environment = proto.Field(proto.MESSAGE, number=1, message="Environment",) + environment = proto.Field( + proto.MESSAGE, + number=1, + message="Environment", + ) class AddPublicKeyRequest(proto.Message): @@ -265,8 +326,14 @@ class AddPublicKeyRequest(proto.Message): encoded with Base64. """ - environment = proto.Field(proto.STRING, number=1,) - key = proto.Field(proto.STRING, number=2,) + environment = proto.Field( + proto.STRING, + number=1, + ) + key = proto.Field( + proto.STRING, + number=2, + ) class AddPublicKeyResponse(proto.Message): @@ -278,7 +345,10 @@ class AddPublicKeyResponse(proto.Message): Key that was added to the environment. """ - key = proto.Field(proto.STRING, number=1,) + key = proto.Field( + proto.STRING, + number=1, + ) class AddPublicKeyMetadata(proto.Message): @@ -301,8 +371,14 @@ class RemovePublicKeyRequest(proto.Message): environment. """ - environment = proto.Field(proto.STRING, number=1,) - key = proto.Field(proto.STRING, number=2,) + environment = proto.Field( + proto.STRING, + number=1, + ) + key = proto.Field( + proto.STRING, + number=2, + ) class RemovePublicKeyResponse(proto.Message): @@ -337,7 +413,11 @@ class CloudShellErrorCode(proto.Enum): TOS_VIOLATION = 4 QUOTA_EXCEEDED = 5 - code = proto.Field(proto.ENUM, number=1, enum=CloudShellErrorCode,) + code = proto.Field( + proto.ENUM, + number=1, + enum=CloudShellErrorCode, + ) __all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/noxfile.py b/noxfile.py index 2a2001c..3addb4e 100644 --- a/noxfile.py +++ b/noxfile.py @@ -24,7 +24,7 @@ import nox -BLACK_VERSION = "black==19.10b0" +BLACK_VERSION = "black==22.3.0" BLACK_PATHS = ["docs", "google", "tests", "noxfile.py", "setup.py"] DEFAULT_PYTHON_VERSION = "3.8" @@ -57,7 +57,9 @@ def lint(session): """ session.install("flake8", BLACK_VERSION) session.run( - "black", "--check", *BLACK_PATHS, + "black", + "--check", + *BLACK_PATHS, ) session.run("flake8", "google", "tests") @@ -67,7 +69,8 @@ def blacken(session): """Run black. Format code to uniform standard.""" session.install(BLACK_VERSION) session.run( - "black", *BLACK_PATHS, + "black", + *BLACK_PATHS, ) diff --git a/tests/unit/gapic/shell_v1/test_cloud_shell_service.py b/tests/unit/gapic/shell_v1/test_cloud_shell_service.py index d7f5537..992f939 100644 --- a/tests/unit/gapic/shell_v1/test_cloud_shell_service.py +++ b/tests/unit/gapic/shell_v1/test_cloud_shell_service.py @@ -93,7 +93,11 @@ def test__get_default_mtls_endpoint(): @pytest.mark.parametrize( - "client_class", [CloudShellServiceClient, CloudShellServiceAsyncClient,] + "client_class", + [ + CloudShellServiceClient, + CloudShellServiceAsyncClient, + ], ) def test_cloud_shell_service_client_from_service_account_info(client_class): creds = ga_credentials.AnonymousCredentials() @@ -135,7 +139,11 @@ def test_cloud_shell_service_client_service_account_always_use_jwt( @pytest.mark.parametrize( - "client_class", [CloudShellServiceClient, CloudShellServiceAsyncClient,] + "client_class", + [ + CloudShellServiceClient, + CloudShellServiceAsyncClient, + ], ) def test_cloud_shell_service_client_from_service_account_file(client_class): creds = ga_credentials.AnonymousCredentials() @@ -509,7 +517,9 @@ def test_cloud_shell_service_client_client_options_scopes( client_class, transport_class, transport_name ): # Check the case scopes are provided. - options = client_options.ClientOptions(scopes=["1", "2"],) + options = client_options.ClientOptions( + scopes=["1", "2"], + ) with mock.patch.object(transport_class, "__init__") as patched: patched.return_value = None client = client_class(client_options=options, transport=transport_name) @@ -649,10 +659,17 @@ def test_cloud_shell_service_client_create_channel_credentials_file( ) -@pytest.mark.parametrize("request_type", [cloudshell.GetEnvironmentRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + cloudshell.GetEnvironmentRequest, + dict, + ], +) def test_get_environment(request_type, transport: str = "grpc"): client = CloudShellServiceClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -697,7 +714,8 @@ def test_get_environment_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = CloudShellServiceClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -713,7 +731,8 @@ async def test_get_environment_async( transport: str = "grpc_asyncio", request_type=cloudshell.GetEnvironmentRequest ): client = CloudShellServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -762,7 +781,9 @@ async def test_get_environment_async_from_dict(): def test_get_environment_field_headers(): - client = CloudShellServiceClient(credentials=ga_credentials.AnonymousCredentials(),) + client = CloudShellServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. @@ -782,7 +803,10 @@ def test_get_environment_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name/value", + ) in kw["metadata"] @pytest.mark.asyncio @@ -811,11 +835,16 @@ async def test_get_environment_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name/value", + ) in kw["metadata"] def test_get_environment_flattened(): - client = CloudShellServiceClient(credentials=ga_credentials.AnonymousCredentials(),) + client = CloudShellServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_environment), "__call__") as call: @@ -823,7 +852,9 @@ def test_get_environment_flattened(): call.return_value = cloudshell.Environment() # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.get_environment(name="name_value",) + client.get_environment( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -835,13 +866,16 @@ def test_get_environment_flattened(): def test_get_environment_flattened_error(): - client = CloudShellServiceClient(credentials=ga_credentials.AnonymousCredentials(),) + client = CloudShellServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): client.get_environment( - cloudshell.GetEnvironmentRequest(), name="name_value", + cloudshell.GetEnvironmentRequest(), + name="name_value", ) @@ -861,7 +895,9 @@ async def test_get_environment_flattened_async(): ) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.get_environment(name="name_value",) + response = await client.get_environment( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -882,14 +918,22 @@ async def test_get_environment_flattened_error_async(): # fields is an error. with pytest.raises(ValueError): await client.get_environment( - cloudshell.GetEnvironmentRequest(), name="name_value", + cloudshell.GetEnvironmentRequest(), + name="name_value", ) -@pytest.mark.parametrize("request_type", [cloudshell.StartEnvironmentRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + cloudshell.StartEnvironmentRequest, + dict, + ], +) def test_start_environment(request_type, transport: str = "grpc"): client = CloudShellServiceClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -917,7 +961,8 @@ def test_start_environment_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = CloudShellServiceClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -935,7 +980,8 @@ async def test_start_environment_async( transport: str = "grpc_asyncio", request_type=cloudshell.StartEnvironmentRequest ): client = CloudShellServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -967,7 +1013,9 @@ async def test_start_environment_async_from_dict(): def test_start_environment_field_headers(): - client = CloudShellServiceClient(credentials=ga_credentials.AnonymousCredentials(),) + client = CloudShellServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. @@ -989,7 +1037,10 @@ def test_start_environment_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name/value", + ) in kw["metadata"] @pytest.mark.asyncio @@ -1020,15 +1071,23 @@ async def test_start_environment_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name/value", + ) in kw["metadata"] @pytest.mark.parametrize( - "request_type", [cloudshell.AuthorizeEnvironmentRequest, dict,] + "request_type", + [ + cloudshell.AuthorizeEnvironmentRequest, + dict, + ], ) def test_authorize_environment(request_type, transport: str = "grpc"): client = CloudShellServiceClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1056,7 +1115,8 @@ def test_authorize_environment_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = CloudShellServiceClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1074,7 +1134,8 @@ async def test_authorize_environment_async( transport: str = "grpc_asyncio", request_type=cloudshell.AuthorizeEnvironmentRequest ): client = CloudShellServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1106,7 +1167,9 @@ async def test_authorize_environment_async_from_dict(): def test_authorize_environment_field_headers(): - client = CloudShellServiceClient(credentials=ga_credentials.AnonymousCredentials(),) + client = CloudShellServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. @@ -1128,7 +1191,10 @@ def test_authorize_environment_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name/value", + ) in kw["metadata"] @pytest.mark.asyncio @@ -1159,13 +1225,23 @@ async def test_authorize_environment_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name/value", + ) in kw["metadata"] -@pytest.mark.parametrize("request_type", [cloudshell.AddPublicKeyRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + cloudshell.AddPublicKeyRequest, + dict, + ], +) def test_add_public_key(request_type, transport: str = "grpc"): client = CloudShellServiceClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1191,7 +1267,8 @@ def test_add_public_key_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = CloudShellServiceClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1207,7 +1284,8 @@ async def test_add_public_key_async( transport: str = "grpc_asyncio", request_type=cloudshell.AddPublicKeyRequest ): client = CloudShellServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1237,7 +1315,9 @@ async def test_add_public_key_async_from_dict(): def test_add_public_key_field_headers(): - client = CloudShellServiceClient(credentials=ga_credentials.AnonymousCredentials(),) + client = CloudShellServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. @@ -1257,7 +1337,10 @@ def test_add_public_key_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "environment=environment/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "environment=environment/value", + ) in kw["metadata"] @pytest.mark.asyncio @@ -1286,13 +1369,23 @@ async def test_add_public_key_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "environment=environment/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "environment=environment/value", + ) in kw["metadata"] -@pytest.mark.parametrize("request_type", [cloudshell.RemovePublicKeyRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + cloudshell.RemovePublicKeyRequest, + dict, + ], +) def test_remove_public_key(request_type, transport: str = "grpc"): client = CloudShellServiceClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1320,7 +1413,8 @@ def test_remove_public_key_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = CloudShellServiceClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1338,7 +1432,8 @@ async def test_remove_public_key_async( transport: str = "grpc_asyncio", request_type=cloudshell.RemovePublicKeyRequest ): client = CloudShellServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1370,7 +1465,9 @@ async def test_remove_public_key_async_from_dict(): def test_remove_public_key_field_headers(): - client = CloudShellServiceClient(credentials=ga_credentials.AnonymousCredentials(),) + client = CloudShellServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. @@ -1392,7 +1489,10 @@ def test_remove_public_key_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "environment=environment/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "environment=environment/value", + ) in kw["metadata"] @pytest.mark.asyncio @@ -1423,7 +1523,10 @@ async def test_remove_public_key_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "environment=environment/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "environment=environment/value", + ) in kw["metadata"] def test_credentials_transport_error(): @@ -1433,7 +1536,8 @@ def test_credentials_transport_error(): ) with pytest.raises(ValueError): client = CloudShellServiceClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # It is an error to provide a credentials file and a transport instance. @@ -1453,7 +1557,10 @@ def test_credentials_transport_error(): options = client_options.ClientOptions() options.api_key = "api_key" with pytest.raises(ValueError): - client = CloudShellServiceClient(client_options=options, transport=transport,) + client = CloudShellServiceClient( + client_options=options, + transport=transport, + ) # It is an error to provide an api_key and a credential. options = mock.Mock() @@ -1469,7 +1576,8 @@ def test_credentials_transport_error(): ) with pytest.raises(ValueError): client = CloudShellServiceClient( - client_options={"scopes": ["1", "2"]}, transport=transport, + client_options={"scopes": ["1", "2"]}, + transport=transport, ) @@ -1514,8 +1622,13 @@ def test_transport_adc(transport_class): def test_transport_grpc_default(): # A client should use the gRPC transport by default. - client = CloudShellServiceClient(credentials=ga_credentials.AnonymousCredentials(),) - assert isinstance(client.transport, transports.CloudShellServiceGrpcTransport,) + client = CloudShellServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + assert isinstance( + client.transport, + transports.CloudShellServiceGrpcTransport, + ) def test_cloud_shell_service_base_transport_error(): @@ -1569,7 +1682,8 @@ def test_cloud_shell_service_base_transport_with_credentials_file(): Transport.return_value = None load_creds.return_value = (ga_credentials.AnonymousCredentials(), None) transport = transports.CloudShellServiceTransport( - credentials_file="credentials.json", quota_project_id="octopus", + credentials_file="credentials.json", + quota_project_id="octopus", ) load_creds.assert_called_once_with( "credentials.json", @@ -1729,7 +1843,8 @@ def test_cloud_shell_service_grpc_transport_channel(): # Check that channel is used if provided. transport = transports.CloudShellServiceGrpcTransport( - host="squid.clam.whelk", channel=channel, + host="squid.clam.whelk", + channel=channel, ) assert transport.grpc_channel == channel assert transport._host == "squid.clam.whelk:443" @@ -1741,7 +1856,8 @@ def test_cloud_shell_service_grpc_asyncio_transport_channel(): # Check that channel is used if provided. transport = transports.CloudShellServiceGrpcAsyncIOTransport( - host="squid.clam.whelk", channel=channel, + host="squid.clam.whelk", + channel=channel, ) assert transport.grpc_channel == channel assert transport._host == "squid.clam.whelk:443" @@ -1850,12 +1966,16 @@ def test_cloud_shell_service_transport_channel_mtls_with_adc(transport_class): def test_cloud_shell_service_grpc_lro_client(): client = CloudShellServiceClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) transport = client.transport # Ensure that we have a api-core operations client. - assert isinstance(transport.operations_client, operations_v1.OperationsClient,) + assert isinstance( + transport.operations_client, + operations_v1.OperationsClient, + ) # Ensure that subsequent calls to the property send the exact same object. assert transport.operations_client is transport.operations_client @@ -1863,12 +1983,16 @@ def test_cloud_shell_service_grpc_lro_client(): def test_cloud_shell_service_grpc_lro_async_client(): client = CloudShellServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc_asyncio", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc_asyncio", ) transport = client.transport # Ensure that we have a api-core operations client. - assert isinstance(transport.operations_client, operations_v1.OperationsAsyncClient,) + assert isinstance( + transport.operations_client, + operations_v1.OperationsAsyncClient, + ) # Ensure that subsequent calls to the property send the exact same object. assert transport.operations_client is transport.operations_client @@ -1878,7 +2002,8 @@ def test_environment_path(): user = "squid" environment = "clam" expected = "users/{user}/environments/{environment}".format( - user=user, environment=environment, + user=user, + environment=environment, ) actual = CloudShellServiceClient.environment_path(user, environment) assert expected == actual @@ -1918,7 +2043,9 @@ def test_parse_common_billing_account_path(): def test_common_folder_path(): folder = "cuttlefish" - expected = "folders/{folder}".format(folder=folder,) + expected = "folders/{folder}".format( + folder=folder, + ) actual = CloudShellServiceClient.common_folder_path(folder) assert expected == actual @@ -1936,7 +2063,9 @@ def test_parse_common_folder_path(): def test_common_organization_path(): organization = "winkle" - expected = "organizations/{organization}".format(organization=organization,) + expected = "organizations/{organization}".format( + organization=organization, + ) actual = CloudShellServiceClient.common_organization_path(organization) assert expected == actual @@ -1954,7 +2083,9 @@ def test_parse_common_organization_path(): def test_common_project_path(): project = "scallop" - expected = "projects/{project}".format(project=project,) + expected = "projects/{project}".format( + project=project, + ) actual = CloudShellServiceClient.common_project_path(project) assert expected == actual @@ -1974,7 +2105,8 @@ def test_common_location_path(): project = "squid" location = "clam" expected = "projects/{project}/locations/{location}".format( - project=project, location=location, + project=project, + location=location, ) actual = CloudShellServiceClient.common_location_path(project, location) assert expected == actual @@ -1999,7 +2131,8 @@ def test_client_with_default_client_info(): transports.CloudShellServiceTransport, "_prep_wrapped_messages" ) as prep: client = CloudShellServiceClient( - credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, + credentials=ga_credentials.AnonymousCredentials(), + client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -2008,7 +2141,8 @@ def test_client_with_default_client_info(): ) as prep: transport_class = CloudShellServiceClient.get_transport_class() transport = transport_class( - credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, + credentials=ga_credentials.AnonymousCredentials(), + client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -2016,7 +2150,8 @@ def test_client_with_default_client_info(): @pytest.mark.asyncio async def test_transport_close_async(): client = CloudShellServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc_asyncio", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc_asyncio", ) with mock.patch.object( type(getattr(client.transport, "grpc_channel")), "close" From 92ba0890ab68334e32965fc1e8635fe3b920382d Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Wed, 30 Mar 2022 17:04:12 +0000 Subject: [PATCH 03/19] chore(python): add E231 to .flake8 ignore list (#90) Source-Link: https://github.com/googleapis/synthtool/commit/7ff4aad2ec5af0380e8bd6da1fa06eaadf24ec81 Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-python:latest@sha256:462782b0b492346b2d9099aaff52206dd30bc8e031ea97082e6facecc2373244 --- .flake8 | 2 +- .github/.OwlBot.lock.yaml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.flake8 b/.flake8 index 29227d4..2e43874 100644 --- a/.flake8 +++ b/.flake8 @@ -16,7 +16,7 @@ # Generated by synthtool. DO NOT EDIT! [flake8] -ignore = E203, E266, E501, W503 +ignore = E203, E231, E266, E501, W503 exclude = # Exclude generated code. **/proto/** diff --git a/.github/.OwlBot.lock.yaml b/.github/.OwlBot.lock.yaml index 87dd006..9e0a935 100644 --- a/.github/.OwlBot.lock.yaml +++ b/.github/.OwlBot.lock.yaml @@ -13,4 +13,4 @@ # limitations under the License. docker: image: gcr.io/cloud-devrel-public-resources/owlbot-python:latest - digest: sha256:7cffbc10910c3ab1b852c05114a08d374c195a81cdec1d4a67a1d129331d0bfe + digest: sha256:462782b0b492346b2d9099aaff52206dd30bc8e031ea97082e6facecc2373244 From 1fa4abe2c0f664a4d953814af82a28110b051a29 Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Fri, 1 Apr 2022 00:32:19 +0000 Subject: [PATCH 04/19] chore(python): update .pre-commit-config.yaml to use black==22.3.0 (#91) Source-Link: https://github.com/googleapis/synthtool/commit/7804ade3daae0d66649bee8df6c55484c6580b8d Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-python:latest@sha256:eede5672562a32821444a8e803fb984a6f61f2237ea3de229d2de24453f4ae7d --- .github/.OwlBot.lock.yaml | 3 ++- .pre-commit-config.yaml | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/.OwlBot.lock.yaml b/.github/.OwlBot.lock.yaml index 9e0a935..22cc254 100644 --- a/.github/.OwlBot.lock.yaml +++ b/.github/.OwlBot.lock.yaml @@ -13,4 +13,5 @@ # limitations under the License. docker: image: gcr.io/cloud-devrel-public-resources/owlbot-python:latest - digest: sha256:462782b0b492346b2d9099aaff52206dd30bc8e031ea97082e6facecc2373244 + digest: sha256:eede5672562a32821444a8e803fb984a6f61f2237ea3de229d2de24453f4ae7d +# created: 2022-03-30T23:44:26.560599165Z diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 62eb5a7..46d2371 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -22,7 +22,7 @@ repos: - id: end-of-file-fixer - id: check-yaml - repo: https://github.com/psf/black - rev: 19.10b0 + rev: 22.3.0 hooks: - id: black - repo: https://gitlab.com/pycqa/flake8 From ef7b02a1f95e52dbe82ad8d9a3f567b3853403ce Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Fri, 1 Apr 2022 02:14:31 +0000 Subject: [PATCH 05/19] chore(python): Enable size-label bot (#92) Source-Link: https://github.com/googleapis/synthtool/commit/06e82790dd719a165ad32b8a06f8f6ec3e3cae0f Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-python:latest@sha256:b3500c053313dc34e07b1632ba9e4e589f4f77036a7cf39e1fe8906811ae0fce --- .github/.OwlBot.lock.yaml | 4 ++-- .github/auto-label.yaml | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) create mode 100644 .github/auto-label.yaml diff --git a/.github/.OwlBot.lock.yaml b/.github/.OwlBot.lock.yaml index 22cc254..58a0b15 100644 --- a/.github/.OwlBot.lock.yaml +++ b/.github/.OwlBot.lock.yaml @@ -13,5 +13,5 @@ # limitations under the License. docker: image: gcr.io/cloud-devrel-public-resources/owlbot-python:latest - digest: sha256:eede5672562a32821444a8e803fb984a6f61f2237ea3de229d2de24453f4ae7d -# created: 2022-03-30T23:44:26.560599165Z + digest: sha256:b3500c053313dc34e07b1632ba9e4e589f4f77036a7cf39e1fe8906811ae0fce +# created: 2022-04-01T01:42:03.609279246Z diff --git a/.github/auto-label.yaml b/.github/auto-label.yaml new file mode 100644 index 0000000..09c8d73 --- /dev/null +++ b/.github/auto-label.yaml @@ -0,0 +1,2 @@ +requestsize: + enabled: true From a50aa06f34e9a1f4cce55f9e2c3e5e36c3a9efb1 Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Fri, 1 Apr 2022 19:48:31 +0000 Subject: [PATCH 06/19] chore(python): refactor unit / system test dependency install (#93) Source-Link: https://github.com/googleapis/synthtool/commit/993985f0fc4b37152e588f0549bcbdaf34666023 Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-python:latest@sha256:1894490910e891a385484514b22eb5133578897eb5b3c380e6d8ad475c6647cd --- .github/.OwlBot.lock.yaml | 4 +- noxfile.py | 105 ++++++++++++++++++++++++++++++-------- 2 files changed, 87 insertions(+), 22 deletions(-) diff --git a/.github/.OwlBot.lock.yaml b/.github/.OwlBot.lock.yaml index 58a0b15..fa57622 100644 --- a/.github/.OwlBot.lock.yaml +++ b/.github/.OwlBot.lock.yaml @@ -13,5 +13,5 @@ # limitations under the License. docker: image: gcr.io/cloud-devrel-public-resources/owlbot-python:latest - digest: sha256:b3500c053313dc34e07b1632ba9e4e589f4f77036a7cf39e1fe8906811ae0fce -# created: 2022-04-01T01:42:03.609279246Z + digest: sha256:1894490910e891a385484514b22eb5133578897eb5b3c380e6d8ad475c6647cd +# created: 2022-04-01T15:48:07.524222836Z diff --git a/noxfile.py b/noxfile.py index 3addb4e..6ee5e8a 100644 --- a/noxfile.py +++ b/noxfile.py @@ -20,16 +20,40 @@ import os import pathlib import shutil +import warnings import nox - BLACK_VERSION = "black==22.3.0" BLACK_PATHS = ["docs", "google", "tests", "noxfile.py", "setup.py"] DEFAULT_PYTHON_VERSION = "3.8" -SYSTEM_TEST_PYTHON_VERSIONS = ["3.8"] + UNIT_TEST_PYTHON_VERSIONS = ["3.6", "3.7", "3.8", "3.9", "3.10"] +UNIT_TEST_STANDARD_DEPENDENCIES = [ + "mock", + "asyncmock", + "pytest", + "pytest-cov", + "pytest-asyncio", +] +UNIT_TEST_EXTERNAL_DEPENDENCIES = [] +UNIT_TEST_LOCAL_DEPENDENCIES = [] +UNIT_TEST_DEPENDENCIES = [] +UNIT_TEST_EXTRAS = [] +UNIT_TEST_EXTRAS_BY_PYTHON = {} + +SYSTEM_TEST_PYTHON_VERSIONS = ["3.8"] +SYSTEM_TEST_STANDARD_DEPENDENCIES = [ + "mock", + "pytest", + "google-cloud-testutils", +] +SYSTEM_TEST_EXTERNAL_DEPENDENCIES = [] +SYSTEM_TEST_LOCAL_DEPENDENCIES = [] +SYSTEM_TEST_DEPENDENCIES = [] +SYSTEM_TEST_EXTRAS = [] +SYSTEM_TEST_EXTRAS_BY_PYTHON = {} CURRENT_DIRECTORY = pathlib.Path(__file__).parent.absolute() @@ -81,23 +105,41 @@ def lint_setup_py(session): session.run("python", "setup.py", "check", "--restructuredtext", "--strict") +def install_unittest_dependencies(session, *constraints): + standard_deps = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_DEPENDENCIES + session.install(*standard_deps, *constraints) + + if UNIT_TEST_EXTERNAL_DEPENDENCIES: + warnings.warn( + "'unit_test_external_dependencies' is deprecated. Instead, please " + "use 'unit_test_dependencies' or 'unit_test_local_dependencies'.", + DeprecationWarning, + ) + session.install(*UNIT_TEST_EXTERNAL_DEPENDENCIES, *constraints) + + if UNIT_TEST_LOCAL_DEPENDENCIES: + session.install(*UNIT_TEST_LOCAL_DEPENDENCIES, *constraints) + + if UNIT_TEST_EXTRAS_BY_PYTHON: + extras = UNIT_TEST_EXTRAS_BY_PYTHON.get(session.python, []) + elif UNIT_TEST_EXTRAS: + extras = UNIT_TEST_EXTRAS + else: + extras = [] + + if extras: + session.install("-e", f".[{','.join(extras)}]", *constraints) + else: + session.install("-e", ".", *constraints) + + def default(session): # Install all test dependencies, then install this package in-place. constraints_path = str( CURRENT_DIRECTORY / "testing" / f"constraints-{session.python}.txt" ) - session.install( - "mock", - "asyncmock", - "pytest", - "pytest-cov", - "pytest-asyncio", - "-c", - constraints_path, - ) - - session.install("-e", ".", "-c", constraints_path) + install_unittest_dependencies(session, "-c", constraints_path) # Run py.test against the unit tests. session.run( @@ -121,6 +163,35 @@ def unit(session): default(session) +def install_systemtest_dependencies(session, *constraints): + + # Use pre-release gRPC for system tests. + session.install("--pre", "grpcio") + + session.install(*SYSTEM_TEST_STANDARD_DEPENDENCIES, *constraints) + + if SYSTEM_TEST_EXTERNAL_DEPENDENCIES: + session.install(*SYSTEM_TEST_EXTERNAL_DEPENDENCIES, *constraints) + + if SYSTEM_TEST_LOCAL_DEPENDENCIES: + session.install("-e", *SYSTEM_TEST_LOCAL_DEPENDENCIES, *constraints) + + if SYSTEM_TEST_DEPENDENCIES: + session.install("-e", *SYSTEM_TEST_DEPENDENCIES, *constraints) + + if SYSTEM_TEST_EXTRAS_BY_PYTHON: + extras = SYSTEM_TEST_EXTRAS_BY_PYTHON.get(session.python, []) + elif SYSTEM_TEST_EXTRAS: + extras = SYSTEM_TEST_EXTRAS + else: + extras = [] + + if extras: + session.install("-e", f".[{','.join(extras)}]", *constraints) + else: + session.install("-e", ".", *constraints) + + @nox.session(python=SYSTEM_TEST_PYTHON_VERSIONS) def system(session): """Run the system test suite.""" @@ -143,13 +214,7 @@ def system(session): if not system_test_exists and not system_test_folder_exists: session.skip("System tests were not found") - # Use pre-release gRPC for system tests. - session.install("--pre", "grpcio") - - # Install all test dependencies, then install this package into the - # virtualenv's dist-packages. - session.install("mock", "pytest", "google-cloud-testutils", "-c", constraints_path) - session.install("-e", ".", "-c", constraints_path) + install_systemtest_dependencies(session, "-c", constraints_path) # Run py.test against the system tests. if system_test_exists: From 13ed512562646fc0ce9672e12857bd6cc52fcf69 Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Wed, 6 Apr 2022 06:54:15 -0400 Subject: [PATCH 07/19] chore(python): add license header to auto-label.yaml (#94) Source-Link: https://github.com/googleapis/synthtool/commit/eb78c980b52c7c6746d2edb77d9cf7aaa99a2aab Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-python:latest@sha256:8a5d3f6a2e43ed8293f34e06a2f56931d1e88a2694c3bb11b15df4eb256ad163 Co-authored-by: Owl Bot --- .github/.OwlBot.lock.yaml | 4 ++-- .github/auto-label.yaml | 13 +++++++++++++ 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/.github/.OwlBot.lock.yaml b/.github/.OwlBot.lock.yaml index fa57622..bc893c9 100644 --- a/.github/.OwlBot.lock.yaml +++ b/.github/.OwlBot.lock.yaml @@ -13,5 +13,5 @@ # limitations under the License. docker: image: gcr.io/cloud-devrel-public-resources/owlbot-python:latest - digest: sha256:1894490910e891a385484514b22eb5133578897eb5b3c380e6d8ad475c6647cd -# created: 2022-04-01T15:48:07.524222836Z + digest: sha256:8a5d3f6a2e43ed8293f34e06a2f56931d1e88a2694c3bb11b15df4eb256ad163 +# created: 2022-04-06T10:30:21.687684602Z diff --git a/.github/auto-label.yaml b/.github/auto-label.yaml index 09c8d73..41bff0b 100644 --- a/.github/auto-label.yaml +++ b/.github/auto-label.yaml @@ -1,2 +1,15 @@ +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# 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. requestsize: enabled: true From 7bdb4bba668c918de87a66cc4b186e03bcdc9049 Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Mon, 11 Apr 2022 19:55:35 -0400 Subject: [PATCH 08/19] chore: Use gapic-generator-python 0.65.0 (#97) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * chore: Use gapic-generator-python 0.65.0 PiperOrigin-RevId: 440970084 Source-Link: https://github.com/googleapis/googleapis/commit/5e0a3d57254ab9857ccac77fc6ffade7b69a2dc7 Source-Link: https://github.com/googleapis/googleapis-gen/commit/b0c628a3fade768f225d76992791ea1ba2a881be Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiYjBjNjI4YTNmYWRlNzY4ZjIyNWQ3Njk5Mjc5MWVhMWJhMmE4ODFiZSJ9 * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md Co-authored-by: Owl Bot --- .../cloud_shell_service/async_client.py | 10 +-- .../services/cloud_shell_service/client.py | 7 +- .../cloud_shell_service/transports/base.py | 8 +- .../cloud_shell_service/transports/grpc.py | 4 + .../shell_v1/test_cloud_shell_service.py | 79 +++++++++++++++---- 5 files changed, 75 insertions(+), 33 deletions(-) diff --git a/google/cloud/shell_v1/services/cloud_shell_service/async_client.py b/google/cloud/shell_v1/services/cloud_shell_service/async_client.py index d126e4b..61232e4 100644 --- a/google/cloud/shell_v1/services/cloud_shell_service/async_client.py +++ b/google/cloud/shell_v1/services/cloud_shell_service/async_client.py @@ -16,7 +16,7 @@ from collections import OrderedDict import functools import re -from typing import Dict, Optional, Sequence, Tuple, Type, Union +from typing import Dict, Mapping, Optional, Sequence, Tuple, Type, Union import pkg_resources from google.api_core.client_options import ClientOptions @@ -225,7 +225,6 @@ async def get_environment( r"""Gets an environment. Returns NOT_FOUND if the environment does not exist. - .. code-block:: python from google.cloud import shell_v1 @@ -301,8 +300,7 @@ def sample_get_environment(): maximum=60.0, multiplier=1.3, predicate=retries.if_exception_type( - core_exceptions.ServiceUnavailable, - core_exceptions.Unknown, + core_exceptions.GoogleAPICallError, ), deadline=60.0, ), @@ -344,7 +342,6 @@ async def start_environment( connections, the operation will contain a StartEnvironmentResponse in its response field. - .. code-block:: python from google.cloud import shell_v1 @@ -436,7 +433,6 @@ async def authorize_environment( line tools without requiring the user to manually authenticate. - .. code-block:: python from google.cloud import shell_v1 @@ -526,7 +522,6 @@ async def add_public_key( SSH. If a key with the same content already exists, this will error with ALREADY_EXISTS. - .. code-block:: python from google.cloud import shell_v1 @@ -618,7 +613,6 @@ async def remove_public_key( corresponding private key. If a key with the same content is not present, this will error with NOT_FOUND. - .. code-block:: python from google.cloud import shell_v1 diff --git a/google/cloud/shell_v1/services/cloud_shell_service/client.py b/google/cloud/shell_v1/services/cloud_shell_service/client.py index 85fb173..4cfa0af 100644 --- a/google/cloud/shell_v1/services/cloud_shell_service/client.py +++ b/google/cloud/shell_v1/services/cloud_shell_service/client.py @@ -16,7 +16,7 @@ from collections import OrderedDict import os import re -from typing import Dict, Optional, Sequence, Tuple, Type, Union +from typing import Dict, Mapping, Optional, Sequence, Tuple, Type, Union import pkg_resources from google.api_core import client_options as client_options_lib @@ -442,7 +442,6 @@ def get_environment( r"""Gets an environment. Returns NOT_FOUND if the environment does not exist. - .. code-block:: python from google.cloud import shell_v1 @@ -551,7 +550,6 @@ def start_environment( connections, the operation will contain a StartEnvironmentResponse in its response field. - .. code-block:: python from google.cloud import shell_v1 @@ -644,7 +642,6 @@ def authorize_environment( line tools without requiring the user to manually authenticate. - .. code-block:: python from google.cloud import shell_v1 @@ -735,7 +732,6 @@ def add_public_key( SSH. If a key with the same content already exists, this will error with ALREADY_EXISTS. - .. code-block:: python from google.cloud import shell_v1 @@ -828,7 +824,6 @@ def remove_public_key( corresponding private key. If a key with the same content is not present, this will error with NOT_FOUND. - .. code-block:: python from google.cloud import shell_v1 diff --git a/google/cloud/shell_v1/services/cloud_shell_service/transports/base.py b/google/cloud/shell_v1/services/cloud_shell_service/transports/base.py index b474bcf..ce70e62 100644 --- a/google/cloud/shell_v1/services/cloud_shell_service/transports/base.py +++ b/google/cloud/shell_v1/services/cloud_shell_service/transports/base.py @@ -82,6 +82,7 @@ def __init__( always_use_jwt_access (Optional[bool]): Whether self signed JWT should be used for service account credentials. """ + # Save the hostname. Default to port 443 (HTTPS) if none is specified. if ":" not in host: host += ":443" @@ -129,8 +130,7 @@ def _prep_wrapped_messages(self, client_info): maximum=60.0, multiplier=1.3, predicate=retries.if_exception_type( - core_exceptions.ServiceUnavailable, - core_exceptions.Unknown, + core_exceptions.GoogleAPICallError, ), deadline=60.0, ), @@ -218,5 +218,9 @@ def remove_public_key( ]: raise NotImplementedError() + @property + def kind(self) -> str: + raise NotImplementedError() + __all__ = ("CloudShellServiceTransport",) diff --git a/google/cloud/shell_v1/services/cloud_shell_service/transports/grpc.py b/google/cloud/shell_v1/services/cloud_shell_service/transports/grpc.py index 9ba1ea6..f8cc39f 100644 --- a/google/cloud/shell_v1/services/cloud_shell_service/transports/grpc.py +++ b/google/cloud/shell_v1/services/cloud_shell_service/transports/grpc.py @@ -402,5 +402,9 @@ def remove_public_key( def close(self): self.grpc_channel.close() + @property + def kind(self) -> str: + return "grpc" + __all__ = ("CloudShellServiceGrpcTransport",) diff --git a/tests/unit/gapic/shell_v1/test_cloud_shell_service.py b/tests/unit/gapic/shell_v1/test_cloud_shell_service.py index 992f939..88f2cb6 100644 --- a/tests/unit/gapic/shell_v1/test_cloud_shell_service.py +++ b/tests/unit/gapic/shell_v1/test_cloud_shell_service.py @@ -93,24 +93,26 @@ def test__get_default_mtls_endpoint(): @pytest.mark.parametrize( - "client_class", + "client_class,transport_name", [ - CloudShellServiceClient, - CloudShellServiceAsyncClient, + (CloudShellServiceClient, "grpc"), + (CloudShellServiceAsyncClient, "grpc_asyncio"), ], ) -def test_cloud_shell_service_client_from_service_account_info(client_class): +def test_cloud_shell_service_client_from_service_account_info( + client_class, transport_name +): creds = ga_credentials.AnonymousCredentials() with mock.patch.object( service_account.Credentials, "from_service_account_info" ) as factory: factory.return_value = creds info = {"valid": True} - client = client_class.from_service_account_info(info) + client = client_class.from_service_account_info(info, transport=transport_name) assert client.transport._credentials == creds assert isinstance(client, client_class) - assert client.transport._host == "cloudshell.googleapis.com:443" + assert client.transport._host == ("cloudshell.googleapis.com:443") @pytest.mark.parametrize( @@ -139,27 +141,33 @@ def test_cloud_shell_service_client_service_account_always_use_jwt( @pytest.mark.parametrize( - "client_class", + "client_class,transport_name", [ - CloudShellServiceClient, - CloudShellServiceAsyncClient, + (CloudShellServiceClient, "grpc"), + (CloudShellServiceAsyncClient, "grpc_asyncio"), ], ) -def test_cloud_shell_service_client_from_service_account_file(client_class): +def test_cloud_shell_service_client_from_service_account_file( + client_class, transport_name +): creds = ga_credentials.AnonymousCredentials() with mock.patch.object( service_account.Credentials, "from_service_account_file" ) as factory: factory.return_value = creds - client = client_class.from_service_account_file("dummy/file/path.json") + client = client_class.from_service_account_file( + "dummy/file/path.json", transport=transport_name + ) assert client.transport._credentials == creds assert isinstance(client, client_class) - client = client_class.from_service_account_json("dummy/file/path.json") + client = client_class.from_service_account_json( + "dummy/file/path.json", transport=transport_name + ) assert client.transport._credentials == creds assert isinstance(client, client_class) - assert client.transport._host == "cloudshell.googleapis.com:443" + assert client.transport._host == ("cloudshell.googleapis.com:443") def test_cloud_shell_service_client_get_transport_class(): @@ -1620,6 +1628,19 @@ def test_transport_adc(transport_class): adc.assert_called_once() +@pytest.mark.parametrize( + "transport_name", + [ + "grpc", + ], +) +def test_transport_kind(transport_name): + transport = CloudShellServiceClient.get_transport_class(transport_name)( + credentials=ga_credentials.AnonymousCredentials(), + ) + assert transport.kind == transport_name + + def test_transport_grpc_default(): # A client should use the gRPC transport by default. client = CloudShellServiceClient( @@ -1671,6 +1692,14 @@ def test_cloud_shell_service_base_transport(): with pytest.raises(NotImplementedError): transport.operations_client + # Catch all for all remaining methods and properties + remainder = [ + "kind", + ] + for r in remainder: + with pytest.raises(NotImplementedError): + getattr(transport, r)() + def test_cloud_shell_service_base_transport_with_credentials_file(): # Instantiate the base transport with a credentials file @@ -1818,24 +1847,40 @@ def test_cloud_shell_service_grpc_transport_client_cert_source_for_mtls( ) -def test_cloud_shell_service_host_no_port(): +@pytest.mark.parametrize( + "transport_name", + [ + "grpc", + "grpc_asyncio", + ], +) +def test_cloud_shell_service_host_no_port(transport_name): client = CloudShellServiceClient( credentials=ga_credentials.AnonymousCredentials(), client_options=client_options.ClientOptions( api_endpoint="cloudshell.googleapis.com" ), + transport=transport_name, ) - assert client.transport._host == "cloudshell.googleapis.com:443" + assert client.transport._host == ("cloudshell.googleapis.com:443") -def test_cloud_shell_service_host_with_port(): +@pytest.mark.parametrize( + "transport_name", + [ + "grpc", + "grpc_asyncio", + ], +) +def test_cloud_shell_service_host_with_port(transport_name): client = CloudShellServiceClient( credentials=ga_credentials.AnonymousCredentials(), client_options=client_options.ClientOptions( api_endpoint="cloudshell.googleapis.com:8000" ), + transport=transport_name, ) - assert client.transport._host == "cloudshell.googleapis.com:8000" + assert client.transport._host == ("cloudshell.googleapis.com:8000") def test_cloud_shell_service_grpc_transport_channel(): From 30aedc95d86ea942737a1a42a68a2ad007264b29 Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Thu, 14 Apr 2022 07:24:00 -0400 Subject: [PATCH 09/19] chore: use gapic-generator-python 0.65.1 (#98) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * chore: use gapic-generator-python 0.65.1 PiperOrigin-RevId: 441524537 Source-Link: https://github.com/googleapis/googleapis/commit/2a273915b3f70fe86c9d2a75470a0b83e48d0abf Source-Link: https://github.com/googleapis/googleapis-gen/commit/ab6756a48c89b5bcb9fb73443cb8e55d574f4643 Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiYWI2NzU2YTQ4Yzg5YjViY2I5ZmI3MzQ0M2NiOGU1NWQ1NzRmNDY0MyJ9 * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md Co-authored-by: Owl Bot --- .../cloud_shell_service/async_client.py | 3 +- .../cloud_shell_service/transports/base.py | 3 +- .../snippet_metadata_shell_v1.json | 378 +++++++++++++++++- 3 files changed, 362 insertions(+), 22 deletions(-) diff --git a/google/cloud/shell_v1/services/cloud_shell_service/async_client.py b/google/cloud/shell_v1/services/cloud_shell_service/async_client.py index 61232e4..8838bbb 100644 --- a/google/cloud/shell_v1/services/cloud_shell_service/async_client.py +++ b/google/cloud/shell_v1/services/cloud_shell_service/async_client.py @@ -300,7 +300,8 @@ def sample_get_environment(): maximum=60.0, multiplier=1.3, predicate=retries.if_exception_type( - core_exceptions.GoogleAPICallError, + core_exceptions.ServiceUnavailable, + core_exceptions.Unknown, ), deadline=60.0, ), diff --git a/google/cloud/shell_v1/services/cloud_shell_service/transports/base.py b/google/cloud/shell_v1/services/cloud_shell_service/transports/base.py index ce70e62..7a200a9 100644 --- a/google/cloud/shell_v1/services/cloud_shell_service/transports/base.py +++ b/google/cloud/shell_v1/services/cloud_shell_service/transports/base.py @@ -130,7 +130,8 @@ def _prep_wrapped_messages(self, client_info): maximum=60.0, multiplier=1.3, predicate=retries.if_exception_type( - core_exceptions.GoogleAPICallError, + core_exceptions.ServiceUnavailable, + core_exceptions.Unknown, ), deadline=60.0, ), diff --git a/samples/generated_samples/snippet_metadata_shell_v1.json b/samples/generated_samples/snippet_metadata_shell_v1.json index c62e83b..66ec515 100644 --- a/samples/generated_samples/snippet_metadata_shell_v1.json +++ b/samples/generated_samples/snippet_metadata_shell_v1.json @@ -1,16 +1,57 @@ { + "clientLibrary": { + "apis": [ + { + "id": "google.cloud.shell.v1", + "version": "v1" + } + ], + "language": "PYTHON", + "name": "google-cloud-shell" + }, "snippets": [ { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.shell_v1.CloudShellServiceAsyncClient", + "shortName": "CloudShellServiceAsyncClient" + }, + "fullName": "google.cloud.shell_v1.CloudShellServiceAsyncClient.add_public_key", "method": { + "fullName": "google.cloud.shell.v1.CloudShellService.AddPublicKey", "service": { + "fullName": "google.cloud.shell.v1.CloudShellService", "shortName": "CloudShellService" }, "shortName": "AddPublicKey" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.shell_v1.types.AddPublicKeyRequest" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.api_core.operation_async.AsyncOperation", + "shortName": "add_public_key" }, + "description": "Sample for AddPublicKey", "file": "cloudshell_v1_generated_cloud_shell_service_add_public_key_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "cloudshell_v1_generated_CloudShellService_AddPublicKey_async", "segments": [ { @@ -43,18 +84,50 @@ "start": 45, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "cloudshell_v1_generated_cloud_shell_service_add_public_key_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.shell_v1.CloudShellServiceClient", + "shortName": "CloudShellServiceClient" + }, + "fullName": "google.cloud.shell_v1.CloudShellServiceClient.add_public_key", "method": { + "fullName": "google.cloud.shell.v1.CloudShellService.AddPublicKey", "service": { + "fullName": "google.cloud.shell.v1.CloudShellService", "shortName": "CloudShellService" }, "shortName": "AddPublicKey" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.shell_v1.types.AddPublicKeyRequest" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.api_core.operation.Operation", + "shortName": "add_public_key" }, + "description": "Sample for AddPublicKey", "file": "cloudshell_v1_generated_cloud_shell_service_add_public_key_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "cloudshell_v1_generated_CloudShellService_AddPublicKey_sync", "segments": [ { @@ -87,19 +160,51 @@ "start": 45, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "cloudshell_v1_generated_cloud_shell_service_add_public_key_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.shell_v1.CloudShellServiceAsyncClient", + "shortName": "CloudShellServiceAsyncClient" + }, + "fullName": "google.cloud.shell_v1.CloudShellServiceAsyncClient.authorize_environment", "method": { + "fullName": "google.cloud.shell.v1.CloudShellService.AuthorizeEnvironment", "service": { + "fullName": "google.cloud.shell.v1.CloudShellService", "shortName": "CloudShellService" }, "shortName": "AuthorizeEnvironment" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.shell_v1.types.AuthorizeEnvironmentRequest" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.api_core.operation_async.AsyncOperation", + "shortName": "authorize_environment" }, + "description": "Sample for AuthorizeEnvironment", "file": "cloudshell_v1_generated_cloud_shell_service_authorize_environment_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "cloudshell_v1_generated_CloudShellService_AuthorizeEnvironment_async", "segments": [ { @@ -132,18 +237,50 @@ "start": 45, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "cloudshell_v1_generated_cloud_shell_service_authorize_environment_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.shell_v1.CloudShellServiceClient", + "shortName": "CloudShellServiceClient" + }, + "fullName": "google.cloud.shell_v1.CloudShellServiceClient.authorize_environment", "method": { + "fullName": "google.cloud.shell.v1.CloudShellService.AuthorizeEnvironment", "service": { + "fullName": "google.cloud.shell.v1.CloudShellService", "shortName": "CloudShellService" }, "shortName": "AuthorizeEnvironment" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.shell_v1.types.AuthorizeEnvironmentRequest" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.api_core.operation.Operation", + "shortName": "authorize_environment" }, + "description": "Sample for AuthorizeEnvironment", "file": "cloudshell_v1_generated_cloud_shell_service_authorize_environment_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "cloudshell_v1_generated_CloudShellService_AuthorizeEnvironment_sync", "segments": [ { @@ -176,19 +313,55 @@ "start": 45, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "cloudshell_v1_generated_cloud_shell_service_authorize_environment_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.shell_v1.CloudShellServiceAsyncClient", + "shortName": "CloudShellServiceAsyncClient" + }, + "fullName": "google.cloud.shell_v1.CloudShellServiceAsyncClient.get_environment", "method": { + "fullName": "google.cloud.shell.v1.CloudShellService.GetEnvironment", "service": { + "fullName": "google.cloud.shell.v1.CloudShellService", "shortName": "CloudShellService" }, "shortName": "GetEnvironment" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.shell_v1.types.GetEnvironmentRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.shell_v1.types.Environment", + "shortName": "get_environment" }, + "description": "Sample for GetEnvironment", "file": "cloudshell_v1_generated_cloud_shell_service_get_environment_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "cloudshell_v1_generated_CloudShellService_GetEnvironment_async", "segments": [ { @@ -221,18 +394,54 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "cloudshell_v1_generated_cloud_shell_service_get_environment_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.shell_v1.CloudShellServiceClient", + "shortName": "CloudShellServiceClient" + }, + "fullName": "google.cloud.shell_v1.CloudShellServiceClient.get_environment", "method": { + "fullName": "google.cloud.shell.v1.CloudShellService.GetEnvironment", "service": { + "fullName": "google.cloud.shell.v1.CloudShellService", "shortName": "CloudShellService" }, "shortName": "GetEnvironment" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.shell_v1.types.GetEnvironmentRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.shell_v1.types.Environment", + "shortName": "get_environment" }, + "description": "Sample for GetEnvironment", "file": "cloudshell_v1_generated_cloud_shell_service_get_environment_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "cloudshell_v1_generated_CloudShellService_GetEnvironment_sync", "segments": [ { @@ -265,19 +474,51 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "cloudshell_v1_generated_cloud_shell_service_get_environment_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.shell_v1.CloudShellServiceAsyncClient", + "shortName": "CloudShellServiceAsyncClient" + }, + "fullName": "google.cloud.shell_v1.CloudShellServiceAsyncClient.remove_public_key", "method": { + "fullName": "google.cloud.shell.v1.CloudShellService.RemovePublicKey", "service": { + "fullName": "google.cloud.shell.v1.CloudShellService", "shortName": "CloudShellService" }, "shortName": "RemovePublicKey" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.shell_v1.types.RemovePublicKeyRequest" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.api_core.operation_async.AsyncOperation", + "shortName": "remove_public_key" }, + "description": "Sample for RemovePublicKey", "file": "cloudshell_v1_generated_cloud_shell_service_remove_public_key_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "cloudshell_v1_generated_CloudShellService_RemovePublicKey_async", "segments": [ { @@ -310,18 +551,50 @@ "start": 45, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "cloudshell_v1_generated_cloud_shell_service_remove_public_key_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.shell_v1.CloudShellServiceClient", + "shortName": "CloudShellServiceClient" + }, + "fullName": "google.cloud.shell_v1.CloudShellServiceClient.remove_public_key", "method": { + "fullName": "google.cloud.shell.v1.CloudShellService.RemovePublicKey", "service": { + "fullName": "google.cloud.shell.v1.CloudShellService", "shortName": "CloudShellService" }, "shortName": "RemovePublicKey" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.shell_v1.types.RemovePublicKeyRequest" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.api_core.operation.Operation", + "shortName": "remove_public_key" }, + "description": "Sample for RemovePublicKey", "file": "cloudshell_v1_generated_cloud_shell_service_remove_public_key_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "cloudshell_v1_generated_CloudShellService_RemovePublicKey_sync", "segments": [ { @@ -354,19 +627,51 @@ "start": 45, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "cloudshell_v1_generated_cloud_shell_service_remove_public_key_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.shell_v1.CloudShellServiceAsyncClient", + "shortName": "CloudShellServiceAsyncClient" + }, + "fullName": "google.cloud.shell_v1.CloudShellServiceAsyncClient.start_environment", "method": { + "fullName": "google.cloud.shell.v1.CloudShellService.StartEnvironment", "service": { + "fullName": "google.cloud.shell.v1.CloudShellService", "shortName": "CloudShellService" }, "shortName": "StartEnvironment" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.shell_v1.types.StartEnvironmentRequest" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.api_core.operation_async.AsyncOperation", + "shortName": "start_environment" }, + "description": "Sample for StartEnvironment", "file": "cloudshell_v1_generated_cloud_shell_service_start_environment_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "cloudshell_v1_generated_CloudShellService_StartEnvironment_async", "segments": [ { @@ -399,18 +704,50 @@ "start": 45, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "cloudshell_v1_generated_cloud_shell_service_start_environment_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.shell_v1.CloudShellServiceClient", + "shortName": "CloudShellServiceClient" + }, + "fullName": "google.cloud.shell_v1.CloudShellServiceClient.start_environment", "method": { + "fullName": "google.cloud.shell.v1.CloudShellService.StartEnvironment", "service": { + "fullName": "google.cloud.shell.v1.CloudShellService", "shortName": "CloudShellService" }, "shortName": "StartEnvironment" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.shell_v1.types.StartEnvironmentRequest" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.api_core.operation.Operation", + "shortName": "start_environment" }, + "description": "Sample for StartEnvironment", "file": "cloudshell_v1_generated_cloud_shell_service_start_environment_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "cloudshell_v1_generated_CloudShellService_StartEnvironment_sync", "segments": [ { @@ -443,7 +780,8 @@ "start": 45, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "cloudshell_v1_generated_cloud_shell_service_start_environment_sync.py" } ] } From 7d3a0c624b28fcd88ba3d6d3dd0e8cebeea1d70f Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Wed, 20 Apr 2022 21:29:05 -0400 Subject: [PATCH 10/19] chore(python): add nox session to sort python imports (#99) Source-Link: https://github.com/googleapis/synthtool/commit/1b71c10e20de7ed3f97f692f99a0e3399b67049f Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-python:latest@sha256:00c9d764fd1cd56265f12a5ef4b99a0c9e87cf261018099141e2ca5158890416 Co-authored-by: Owl Bot --- .github/.OwlBot.lock.yaml | 4 +- docs/conf.py | 2 +- google/cloud/shell/__init__.py | 41 +++++++++--------- google/cloud/shell_v1/__init__.py | 43 ++++++++++--------- .../services/cloud_shell_service/__init__.py | 2 +- .../cloud_shell_service/async_client.py | 10 +++-- .../services/cloud_shell_service/client.py | 8 ++-- .../transports/__init__.py | 1 - .../cloud_shell_service/transports/base.py | 9 ++-- .../cloud_shell_service/transports/grpc.py | 12 +++--- .../transports/grpc_asyncio.py | 12 +++--- google/cloud/shell_v1/types/cloudshell.py | 4 +- noxfile.py | 28 ++++++++++-- setup.py | 1 - .../shell_v1/test_cloud_shell_service.py | 43 ++++++++++--------- 15 files changed, 121 insertions(+), 99 deletions(-) diff --git a/.github/.OwlBot.lock.yaml b/.github/.OwlBot.lock.yaml index bc893c9..7c454ab 100644 --- a/.github/.OwlBot.lock.yaml +++ b/.github/.OwlBot.lock.yaml @@ -13,5 +13,5 @@ # limitations under the License. docker: image: gcr.io/cloud-devrel-public-resources/owlbot-python:latest - digest: sha256:8a5d3f6a2e43ed8293f34e06a2f56931d1e88a2694c3bb11b15df4eb256ad163 -# created: 2022-04-06T10:30:21.687684602Z + digest: sha256:00c9d764fd1cd56265f12a5ef4b99a0c9e87cf261018099141e2ca5158890416 +# created: 2022-04-20T23:42:53.970438194Z diff --git a/docs/conf.py b/docs/conf.py index 16854da..0fb429b 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -24,9 +24,9 @@ # All configuration values have a default; values that are commented out # serve to show the default. -import sys import os import shlex +import sys # 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 diff --git a/google/cloud/shell/__init__.py b/google/cloud/shell/__init__.py index 0e583cc..bf56bf2 100644 --- a/google/cloud/shell/__init__.py +++ b/google/cloud/shell/__init__.py @@ -14,31 +14,32 @@ # limitations under the License. # +from google.cloud.shell_v1.services.cloud_shell_service.async_client import ( + CloudShellServiceAsyncClient, +) from google.cloud.shell_v1.services.cloud_shell_service.client import ( CloudShellServiceClient, ) -from google.cloud.shell_v1.services.cloud_shell_service.async_client import ( - CloudShellServiceAsyncClient, +from google.cloud.shell_v1.types.cloudshell import ( + AddPublicKeyMetadata, + AddPublicKeyRequest, + AddPublicKeyResponse, + AuthorizeEnvironmentMetadata, + AuthorizeEnvironmentRequest, + AuthorizeEnvironmentResponse, + CloudShellErrorDetails, + CreateEnvironmentMetadata, + DeleteEnvironmentMetadata, + Environment, + GetEnvironmentRequest, + RemovePublicKeyMetadata, + RemovePublicKeyRequest, + RemovePublicKeyResponse, + StartEnvironmentMetadata, + StartEnvironmentRequest, + StartEnvironmentResponse, ) -from google.cloud.shell_v1.types.cloudshell import AddPublicKeyMetadata -from google.cloud.shell_v1.types.cloudshell import AddPublicKeyRequest -from google.cloud.shell_v1.types.cloudshell import AddPublicKeyResponse -from google.cloud.shell_v1.types.cloudshell import AuthorizeEnvironmentMetadata -from google.cloud.shell_v1.types.cloudshell import AuthorizeEnvironmentRequest -from google.cloud.shell_v1.types.cloudshell import AuthorizeEnvironmentResponse -from google.cloud.shell_v1.types.cloudshell import CloudShellErrorDetails -from google.cloud.shell_v1.types.cloudshell import CreateEnvironmentMetadata -from google.cloud.shell_v1.types.cloudshell import DeleteEnvironmentMetadata -from google.cloud.shell_v1.types.cloudshell import Environment -from google.cloud.shell_v1.types.cloudshell import GetEnvironmentRequest -from google.cloud.shell_v1.types.cloudshell import RemovePublicKeyMetadata -from google.cloud.shell_v1.types.cloudshell import RemovePublicKeyRequest -from google.cloud.shell_v1.types.cloudshell import RemovePublicKeyResponse -from google.cloud.shell_v1.types.cloudshell import StartEnvironmentMetadata -from google.cloud.shell_v1.types.cloudshell import StartEnvironmentRequest -from google.cloud.shell_v1.types.cloudshell import StartEnvironmentResponse - __all__ = ( "CloudShellServiceClient", "CloudShellServiceAsyncClient", diff --git a/google/cloud/shell_v1/__init__.py b/google/cloud/shell_v1/__init__.py index 90405ad..45ae75b 100644 --- a/google/cloud/shell_v1/__init__.py +++ b/google/cloud/shell_v1/__init__.py @@ -14,26 +14,29 @@ # limitations under the License. # -from .services.cloud_shell_service import CloudShellServiceClient -from .services.cloud_shell_service import CloudShellServiceAsyncClient - -from .types.cloudshell import AddPublicKeyMetadata -from .types.cloudshell import AddPublicKeyRequest -from .types.cloudshell import AddPublicKeyResponse -from .types.cloudshell import AuthorizeEnvironmentMetadata -from .types.cloudshell import AuthorizeEnvironmentRequest -from .types.cloudshell import AuthorizeEnvironmentResponse -from .types.cloudshell import CloudShellErrorDetails -from .types.cloudshell import CreateEnvironmentMetadata -from .types.cloudshell import DeleteEnvironmentMetadata -from .types.cloudshell import Environment -from .types.cloudshell import GetEnvironmentRequest -from .types.cloudshell import RemovePublicKeyMetadata -from .types.cloudshell import RemovePublicKeyRequest -from .types.cloudshell import RemovePublicKeyResponse -from .types.cloudshell import StartEnvironmentMetadata -from .types.cloudshell import StartEnvironmentRequest -from .types.cloudshell import StartEnvironmentResponse +from .services.cloud_shell_service import ( + CloudShellServiceAsyncClient, + CloudShellServiceClient, +) +from .types.cloudshell import ( + AddPublicKeyMetadata, + AddPublicKeyRequest, + AddPublicKeyResponse, + AuthorizeEnvironmentMetadata, + AuthorizeEnvironmentRequest, + AuthorizeEnvironmentResponse, + CloudShellErrorDetails, + CreateEnvironmentMetadata, + DeleteEnvironmentMetadata, + Environment, + GetEnvironmentRequest, + RemovePublicKeyMetadata, + RemovePublicKeyRequest, + RemovePublicKeyResponse, + StartEnvironmentMetadata, + StartEnvironmentRequest, + StartEnvironmentResponse, +) __all__ = ( "CloudShellServiceAsyncClient", diff --git a/google/cloud/shell_v1/services/cloud_shell_service/__init__.py b/google/cloud/shell_v1/services/cloud_shell_service/__init__.py index d08cd0a..86938fd 100644 --- a/google/cloud/shell_v1/services/cloud_shell_service/__init__.py +++ b/google/cloud/shell_v1/services/cloud_shell_service/__init__.py @@ -13,8 +13,8 @@ # See the License for the specific language governing permissions and # limitations under the License. # -from .client import CloudShellServiceClient from .async_client import CloudShellServiceAsyncClient +from .client import CloudShellServiceClient __all__ = ( "CloudShellServiceClient", diff --git a/google/cloud/shell_v1/services/cloud_shell_service/async_client.py b/google/cloud/shell_v1/services/cloud_shell_service/async_client.py index 8838bbb..c6b278d 100644 --- a/google/cloud/shell_v1/services/cloud_shell_service/async_client.py +++ b/google/cloud/shell_v1/services/cloud_shell_service/async_client.py @@ -17,14 +17,14 @@ import functools import re from typing import Dict, Mapping, Optional, Sequence, Tuple, Type, Union -import pkg_resources -from google.api_core.client_options import ClientOptions from google.api_core import exceptions as core_exceptions from google.api_core import gapic_v1 from google.api_core import retry as retries +from google.api_core.client_options import ClientOptions from google.auth import credentials as ga_credentials # type: ignore from google.oauth2 import service_account # type: ignore +import pkg_resources try: OptionalRetry = Union[retries.Retry, gapic_v1.method._MethodDefault] @@ -33,10 +33,12 @@ from google.api_core import operation # type: ignore from google.api_core import operation_async # type: ignore + from google.cloud.shell_v1.types import cloudshell -from .transports.base import CloudShellServiceTransport, DEFAULT_CLIENT_INFO -from .transports.grpc_asyncio import CloudShellServiceGrpcAsyncIOTransport + from .client import CloudShellServiceClient +from .transports.base import DEFAULT_CLIENT_INFO, CloudShellServiceTransport +from .transports.grpc_asyncio import CloudShellServiceGrpcAsyncIOTransport class CloudShellServiceAsyncClient: diff --git a/google/cloud/shell_v1/services/cloud_shell_service/client.py b/google/cloud/shell_v1/services/cloud_shell_service/client.py index 4cfa0af..8527f94 100644 --- a/google/cloud/shell_v1/services/cloud_shell_service/client.py +++ b/google/cloud/shell_v1/services/cloud_shell_service/client.py @@ -17,17 +17,17 @@ import os import re from typing import Dict, Mapping, Optional, Sequence, Tuple, Type, Union -import pkg_resources from google.api_core import client_options as client_options_lib from google.api_core import exceptions as core_exceptions from google.api_core import gapic_v1 from google.api_core import retry as retries from google.auth import credentials as ga_credentials # type: ignore +from google.auth.exceptions import MutualTLSChannelError # type: ignore from google.auth.transport import mtls # type: ignore from google.auth.transport.grpc import SslCredentials # type: ignore -from google.auth.exceptions import MutualTLSChannelError # type: ignore from google.oauth2 import service_account # type: ignore +import pkg_resources try: OptionalRetry = Union[retries.Retry, gapic_v1.method._MethodDefault] @@ -36,8 +36,10 @@ from google.api_core import operation # type: ignore from google.api_core import operation_async # type: ignore + from google.cloud.shell_v1.types import cloudshell -from .transports.base import CloudShellServiceTransport, DEFAULT_CLIENT_INFO + +from .transports.base import DEFAULT_CLIENT_INFO, CloudShellServiceTransport from .transports.grpc import CloudShellServiceGrpcTransport from .transports.grpc_asyncio import CloudShellServiceGrpcAsyncIOTransport diff --git a/google/cloud/shell_v1/services/cloud_shell_service/transports/__init__.py b/google/cloud/shell_v1/services/cloud_shell_service/transports/__init__.py index 2c11e4b..9a8b985 100644 --- a/google/cloud/shell_v1/services/cloud_shell_service/transports/__init__.py +++ b/google/cloud/shell_v1/services/cloud_shell_service/transports/__init__.py @@ -20,7 +20,6 @@ from .grpc import CloudShellServiceGrpcTransport from .grpc_asyncio import CloudShellServiceGrpcAsyncIOTransport - # Compile a registry of transports. _transport_registry = OrderedDict() # type: Dict[str, Type[CloudShellServiceTransport]] _transport_registry["grpc"] = CloudShellServiceGrpcTransport diff --git a/google/cloud/shell_v1/services/cloud_shell_service/transports/base.py b/google/cloud/shell_v1/services/cloud_shell_service/transports/base.py index 7a200a9..87c858b 100644 --- a/google/cloud/shell_v1/services/cloud_shell_service/transports/base.py +++ b/google/cloud/shell_v1/services/cloud_shell_service/transports/base.py @@ -15,19 +15,18 @@ # import abc from typing import Awaitable, Callable, Dict, Optional, Sequence, Union -import pkg_resources -import google.auth # type: ignore import google.api_core from google.api_core import exceptions as core_exceptions -from google.api_core import gapic_v1 +from google.api_core import gapic_v1, operations_v1 from google.api_core import retry as retries -from google.api_core import operations_v1 +import google.auth # type: ignore from google.auth import credentials as ga_credentials # type: ignore +from google.longrunning import operations_pb2 # type: ignore from google.oauth2 import service_account # type: ignore +import pkg_resources from google.cloud.shell_v1.types import cloudshell -from google.longrunning import operations_pb2 # type: ignore try: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( diff --git a/google/cloud/shell_v1/services/cloud_shell_service/transports/grpc.py b/google/cloud/shell_v1/services/cloud_shell_service/transports/grpc.py index f8cc39f..f0a9da3 100644 --- a/google/cloud/shell_v1/services/cloud_shell_service/transports/grpc.py +++ b/google/cloud/shell_v1/services/cloud_shell_service/transports/grpc.py @@ -13,21 +13,19 @@ # See the License for the specific language governing permissions and # limitations under the License. # -import warnings from typing import Callable, Dict, Optional, Sequence, Tuple, Union +import warnings -from google.api_core import grpc_helpers -from google.api_core import operations_v1 -from google.api_core import gapic_v1 +from google.api_core import gapic_v1, grpc_helpers, operations_v1 import google.auth # type: ignore from google.auth import credentials as ga_credentials # type: ignore from google.auth.transport.grpc import SslCredentials # type: ignore - +from google.longrunning import operations_pb2 # type: ignore import grpc # type: ignore from google.cloud.shell_v1.types import cloudshell -from google.longrunning import operations_pb2 # type: ignore -from .base import CloudShellServiceTransport, DEFAULT_CLIENT_INFO + +from .base import DEFAULT_CLIENT_INFO, CloudShellServiceTransport class CloudShellServiceGrpcTransport(CloudShellServiceTransport): diff --git a/google/cloud/shell_v1/services/cloud_shell_service/transports/grpc_asyncio.py b/google/cloud/shell_v1/services/cloud_shell_service/transports/grpc_asyncio.py index e7b3279..b9a8d43 100644 --- a/google/cloud/shell_v1/services/cloud_shell_service/transports/grpc_asyncio.py +++ b/google/cloud/shell_v1/services/cloud_shell_service/transports/grpc_asyncio.py @@ -13,21 +13,19 @@ # See the License for the specific language governing permissions and # limitations under the License. # -import warnings from typing import Awaitable, Callable, Dict, Optional, Sequence, Tuple, Union +import warnings -from google.api_core import gapic_v1 -from google.api_core import grpc_helpers_async -from google.api_core import operations_v1 +from google.api_core import gapic_v1, grpc_helpers_async, operations_v1 from google.auth import credentials as ga_credentials # type: ignore from google.auth.transport.grpc import SslCredentials # type: ignore - +from google.longrunning import operations_pb2 # type: ignore import grpc # type: ignore from grpc.experimental import aio # type: ignore from google.cloud.shell_v1.types import cloudshell -from google.longrunning import operations_pb2 # type: ignore -from .base import CloudShellServiceTransport, DEFAULT_CLIENT_INFO + +from .base import DEFAULT_CLIENT_INFO, CloudShellServiceTransport from .grpc import CloudShellServiceGrpcTransport diff --git a/google/cloud/shell_v1/types/cloudshell.py b/google/cloud/shell_v1/types/cloudshell.py index 1cbe91f..e2bfa0a 100644 --- a/google/cloud/shell_v1/types/cloudshell.py +++ b/google/cloud/shell_v1/types/cloudshell.py @@ -13,10 +13,8 @@ # See the License for the specific language governing permissions and # limitations under the License. # -import proto # type: ignore - from google.protobuf import timestamp_pb2 # type: ignore - +import proto # type: ignore __protobuf__ = proto.module( package="google.cloud.shell.v1", diff --git a/noxfile.py b/noxfile.py index 6ee5e8a..7c1742d 100644 --- a/noxfile.py +++ b/noxfile.py @@ -17,6 +17,7 @@ # Generated by synthtool. DO NOT EDIT! from __future__ import absolute_import + import os import pathlib import shutil @@ -25,7 +26,8 @@ import nox BLACK_VERSION = "black==22.3.0" -BLACK_PATHS = ["docs", "google", "tests", "noxfile.py", "setup.py"] +ISORT_VERSION = "isort==5.10.1" +LINT_PATHS = ["docs", "google", "tests", "noxfile.py", "setup.py"] DEFAULT_PYTHON_VERSION = "3.8" @@ -83,7 +85,7 @@ def lint(session): session.run( "black", "--check", - *BLACK_PATHS, + *LINT_PATHS, ) session.run("flake8", "google", "tests") @@ -94,7 +96,27 @@ def blacken(session): session.install(BLACK_VERSION) session.run( "black", - *BLACK_PATHS, + *LINT_PATHS, + ) + + +@nox.session(python=DEFAULT_PYTHON_VERSION) +def format(session): + """ + Run isort to sort imports. Then run black + to format code to uniform standard. + """ + session.install(BLACK_VERSION, ISORT_VERSION) + # Use the --fss option to sort imports using strict alphabetical order. + # See https://pycqa.github.io/isort/docs/configuration/options.html#force-sort-within-sections + session.run( + "isort", + "--fss", + *LINT_PATHS, + ) + session.run( + "black", + *LINT_PATHS, ) diff --git a/setup.py b/setup.py index 048ed98..eedfdf3 100644 --- a/setup.py +++ b/setup.py @@ -19,7 +19,6 @@ import setuptools - name = "google-cloud-shell" description = "Cloud Shell API client library" version = "1.3.2" diff --git a/tests/unit/gapic/shell_v1/test_cloud_shell_service.py b/tests/unit/gapic/shell_v1/test_cloud_shell_service.py index 88f2cb6..e0ad7c2 100644 --- a/tests/unit/gapic/shell_v1/test_cloud_shell_service.py +++ b/tests/unit/gapic/shell_v1/test_cloud_shell_service.py @@ -13,38 +13,39 @@ # See the License for the specific language governing permissions and # limitations under the License. # -import os -import mock - -import grpc -from grpc.experimental import aio import math -import pytest -from proto.marshal.rules.dates import DurationRule, TimestampRule - +import os +from google.api_core import ( + future, + gapic_v1, + grpc_helpers, + grpc_helpers_async, + operation, + operations_v1, + path_template, +) from google.api_core import client_options from google.api_core import exceptions as core_exceptions -from google.api_core import future -from google.api_core import gapic_v1 -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 +import google.auth from google.auth import credentials as ga_credentials from google.auth.exceptions import MutualTLSChannelError +from google.longrunning import operations_pb2 +from google.oauth2 import service_account +from google.protobuf import timestamp_pb2 # type: ignore +import grpc +from grpc.experimental import aio +import mock +from proto.marshal.rules.dates import DurationRule, TimestampRule +import pytest + from google.cloud.shell_v1.services.cloud_shell_service import ( CloudShellServiceAsyncClient, + CloudShellServiceClient, + transports, ) -from google.cloud.shell_v1.services.cloud_shell_service import CloudShellServiceClient -from google.cloud.shell_v1.services.cloud_shell_service import transports from google.cloud.shell_v1.types import cloudshell -from google.longrunning import operations_pb2 -from google.oauth2 import service_account -from google.protobuf import timestamp_pb2 # type: ignore -import google.auth def client_cert_source_callback(): From 55a1448221e3b5ef185615282219a31d0f85c9c1 Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Thu, 21 Apr 2022 12:16:31 -0400 Subject: [PATCH 11/19] chore(python): use ubuntu 22.04 in docs image (#101) Source-Link: https://github.com/googleapis/synthtool/commit/f15cc72fb401b4861cedebb10af74afe428fb1f8 Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-python:latest@sha256:bc5eed3804aec2f05fad42aacf973821d9500c174015341f721a984a0825b6fd Co-authored-by: Owl Bot --- .github/.OwlBot.lock.yaml | 4 ++-- .kokoro/docker/docs/Dockerfile | 20 ++++++++++++++++++-- 2 files changed, 20 insertions(+), 4 deletions(-) diff --git a/.github/.OwlBot.lock.yaml b/.github/.OwlBot.lock.yaml index 7c454ab..64f82d6 100644 --- a/.github/.OwlBot.lock.yaml +++ b/.github/.OwlBot.lock.yaml @@ -13,5 +13,5 @@ # limitations under the License. docker: image: gcr.io/cloud-devrel-public-resources/owlbot-python:latest - digest: sha256:00c9d764fd1cd56265f12a5ef4b99a0c9e87cf261018099141e2ca5158890416 -# created: 2022-04-20T23:42:53.970438194Z + digest: sha256:bc5eed3804aec2f05fad42aacf973821d9500c174015341f721a984a0825b6fd +# created: 2022-04-21T15:43:16.246106921Z diff --git a/.kokoro/docker/docs/Dockerfile b/.kokoro/docker/docs/Dockerfile index 4e1b1fb..238b87b 100644 --- a/.kokoro/docker/docs/Dockerfile +++ b/.kokoro/docker/docs/Dockerfile @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -from ubuntu:20.04 +from ubuntu:22.04 ENV DEBIAN_FRONTEND noninteractive @@ -60,8 +60,24 @@ RUN apt-get update \ && rm -rf /var/lib/apt/lists/* \ && rm -f /var/cache/apt/archives/*.deb +###################### Install python 3.8.11 + +# Download python 3.8.11 +RUN wget https://www.python.org/ftp/python/3.8.11/Python-3.8.11.tgz + +# Extract files +RUN tar -xvf Python-3.8.11.tgz + +# Install python 3.8.11 +RUN ./Python-3.8.11/configure --enable-optimizations +RUN make altinstall + +###################### Install pip RUN wget -O /tmp/get-pip.py 'https://bootstrap.pypa.io/get-pip.py' \ - && python3.8 /tmp/get-pip.py \ + && python3 /tmp/get-pip.py \ && rm /tmp/get-pip.py +# Test pip +RUN python3 -m pip + CMD ["python3.8"] From d1bf6ad9a353fb2817449f325cdda54d88b30683 Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Thu, 28 Apr 2022 07:45:08 -0400 Subject: [PATCH 12/19] chore: use gapic-generator-python 0.65.2 (#102) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * chore: use gapic-generator-python 0.65.2 PiperOrigin-RevId: 444333013 Source-Link: https://github.com/googleapis/googleapis/commit/f91b6cf82e929280f6562f6110957c654bd9e2e6 Source-Link: https://github.com/googleapis/googleapis-gen/commit/16eb36095c294e712c74a1bf23550817b42174e5 Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiMTZlYjM2MDk1YzI5NGU3MTJjNzRhMWJmMjM1NTA4MTdiNDIxNzRlNSJ9 * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md Co-authored-by: Owl Bot --- .../cloud_shell_service/async_client.py | 30 +++++++------- .../shell_v1/test_cloud_shell_service.py | 40 +++++++++---------- 2 files changed, 35 insertions(+), 35 deletions(-) diff --git a/google/cloud/shell_v1/services/cloud_shell_service/async_client.py b/google/cloud/shell_v1/services/cloud_shell_service/async_client.py index c6b278d..7629943 100644 --- a/google/cloud/shell_v1/services/cloud_shell_service/async_client.py +++ b/google/cloud/shell_v1/services/cloud_shell_service/async_client.py @@ -231,9 +231,9 @@ async def get_environment( from google.cloud import shell_v1 - def sample_get_environment(): + async def sample_get_environment(): # Create a client - client = shell_v1.CloudShellServiceClient() + client = shell_v1.CloudShellServiceAsyncClient() # Initialize request argument(s) request = shell_v1.GetEnvironmentRequest( @@ -241,7 +241,7 @@ def sample_get_environment(): ) # Make the request - response = client.get_environment(request=request) + response = await client.get_environment(request=request) # Handle the response print(response) @@ -349,9 +349,9 @@ async def start_environment( from google.cloud import shell_v1 - def sample_start_environment(): + async def sample_start_environment(): # Create a client - client = shell_v1.CloudShellServiceClient() + client = shell_v1.CloudShellServiceAsyncClient() # Initialize request argument(s) request = shell_v1.StartEnvironmentRequest( @@ -362,7 +362,7 @@ def sample_start_environment(): print("Waiting for operation to complete...") - response = operation.result() + response = await operation.result() # Handle the response print(response) @@ -440,9 +440,9 @@ async def authorize_environment( from google.cloud import shell_v1 - def sample_authorize_environment(): + async def sample_authorize_environment(): # Create a client - client = shell_v1.CloudShellServiceClient() + client = shell_v1.CloudShellServiceAsyncClient() # Initialize request argument(s) request = shell_v1.AuthorizeEnvironmentRequest( @@ -453,7 +453,7 @@ def sample_authorize_environment(): print("Waiting for operation to complete...") - response = operation.result() + response = await operation.result() # Handle the response print(response) @@ -529,9 +529,9 @@ async def add_public_key( from google.cloud import shell_v1 - def sample_add_public_key(): + async def sample_add_public_key(): # Create a client - client = shell_v1.CloudShellServiceClient() + client = shell_v1.CloudShellServiceAsyncClient() # Initialize request argument(s) request = shell_v1.AddPublicKeyRequest( @@ -542,7 +542,7 @@ def sample_add_public_key(): print("Waiting for operation to complete...") - response = operation.result() + response = await operation.result() # Handle the response print(response) @@ -620,9 +620,9 @@ async def remove_public_key( from google.cloud import shell_v1 - def sample_remove_public_key(): + async def sample_remove_public_key(): # Create a client - client = shell_v1.CloudShellServiceClient() + client = shell_v1.CloudShellServiceAsyncClient() # Initialize request argument(s) request = shell_v1.RemovePublicKeyRequest( @@ -633,7 +633,7 @@ def sample_remove_public_key(): print("Waiting for operation to complete...") - response = operation.result() + response = await operation.result() # Handle the response print(response) diff --git a/tests/unit/gapic/shell_v1/test_cloud_shell_service.py b/tests/unit/gapic/shell_v1/test_cloud_shell_service.py index e0ad7c2..6341376 100644 --- a/tests/unit/gapic/shell_v1/test_cloud_shell_service.py +++ b/tests/unit/gapic/shell_v1/test_cloud_shell_service.py @@ -798,7 +798,7 @@ def test_get_environment_field_headers(): # a field header. Set these to a non-empty value. request = cloudshell.GetEnvironmentRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_environment), "__call__") as call: @@ -814,7 +814,7 @@ def test_get_environment_field_headers(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "name=name/value", + "name=name_value", ) in kw["metadata"] @@ -828,7 +828,7 @@ async def test_get_environment_field_headers_async(): # a field header. Set these to a non-empty value. request = cloudshell.GetEnvironmentRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_environment), "__call__") as call: @@ -846,7 +846,7 @@ async def test_get_environment_field_headers_async(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "name=name/value", + "name=name_value", ) in kw["metadata"] @@ -1030,7 +1030,7 @@ def test_start_environment_field_headers(): # a field header. Set these to a non-empty value. request = cloudshell.StartEnvironmentRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1048,7 +1048,7 @@ def test_start_environment_field_headers(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "name=name/value", + "name=name_value", ) in kw["metadata"] @@ -1062,7 +1062,7 @@ async def test_start_environment_field_headers_async(): # a field header. Set these to a non-empty value. request = cloudshell.StartEnvironmentRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1082,7 +1082,7 @@ async def test_start_environment_field_headers_async(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "name=name/value", + "name=name_value", ) in kw["metadata"] @@ -1184,7 +1184,7 @@ def test_authorize_environment_field_headers(): # a field header. Set these to a non-empty value. request = cloudshell.AuthorizeEnvironmentRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1202,7 +1202,7 @@ def test_authorize_environment_field_headers(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "name=name/value", + "name=name_value", ) in kw["metadata"] @@ -1216,7 +1216,7 @@ async def test_authorize_environment_field_headers_async(): # a field header. Set these to a non-empty value. request = cloudshell.AuthorizeEnvironmentRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1236,7 +1236,7 @@ async def test_authorize_environment_field_headers_async(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "name=name/value", + "name=name_value", ) in kw["metadata"] @@ -1332,7 +1332,7 @@ def test_add_public_key_field_headers(): # a field header. Set these to a non-empty value. request = cloudshell.AddPublicKeyRequest() - request.environment = "environment/value" + request.environment = "environment_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.add_public_key), "__call__") as call: @@ -1348,7 +1348,7 @@ def test_add_public_key_field_headers(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "environment=environment/value", + "environment=environment_value", ) in kw["metadata"] @@ -1362,7 +1362,7 @@ async def test_add_public_key_field_headers_async(): # a field header. Set these to a non-empty value. request = cloudshell.AddPublicKeyRequest() - request.environment = "environment/value" + request.environment = "environment_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.add_public_key), "__call__") as call: @@ -1380,7 +1380,7 @@ async def test_add_public_key_field_headers_async(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "environment=environment/value", + "environment=environment_value", ) in kw["metadata"] @@ -1482,7 +1482,7 @@ def test_remove_public_key_field_headers(): # a field header. Set these to a non-empty value. request = cloudshell.RemovePublicKeyRequest() - request.environment = "environment/value" + request.environment = "environment_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1500,7 +1500,7 @@ def test_remove_public_key_field_headers(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "environment=environment/value", + "environment=environment_value", ) in kw["metadata"] @@ -1514,7 +1514,7 @@ async def test_remove_public_key_field_headers_async(): # a field header. Set these to a non-empty value. request = cloudshell.RemovePublicKeyRequest() - request.environment = "environment/value" + request.environment = "environment_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1534,7 +1534,7 @@ async def test_remove_public_key_field_headers_async(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "environment=environment/value", + "environment=environment_value", ) in kw["metadata"] From ad4fb4295d7c905612a4efc88c0eabcb4e3fcf76 Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Thu, 5 May 2022 12:09:36 -0400 Subject: [PATCH 13/19] chore: [autoapprove] update readme_gen.py to include autoescape True (#103) Source-Link: https://github.com/googleapis/synthtool/commit/6b4d5a6407d740beb4158b302194a62a4108a8a6 Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-python:latest@sha256:f792ee1320e03eda2d13a5281a2989f7ed8a9e50b73ef6da97fac7e1e850b149 Co-authored-by: Owl Bot --- .github/.OwlBot.lock.yaml | 4 ++-- scripts/readme-gen/readme_gen.py | 5 ++++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/.github/.OwlBot.lock.yaml b/.github/.OwlBot.lock.yaml index 64f82d6..b631901 100644 --- a/.github/.OwlBot.lock.yaml +++ b/.github/.OwlBot.lock.yaml @@ -13,5 +13,5 @@ # limitations under the License. docker: image: gcr.io/cloud-devrel-public-resources/owlbot-python:latest - digest: sha256:bc5eed3804aec2f05fad42aacf973821d9500c174015341f721a984a0825b6fd -# created: 2022-04-21T15:43:16.246106921Z + digest: sha256:f792ee1320e03eda2d13a5281a2989f7ed8a9e50b73ef6da97fac7e1e850b149 +# created: 2022-05-05T15:17:27.599381182Z diff --git a/scripts/readme-gen/readme_gen.py b/scripts/readme-gen/readme_gen.py index d309d6e..91b5967 100644 --- a/scripts/readme-gen/readme_gen.py +++ b/scripts/readme-gen/readme_gen.py @@ -28,7 +28,10 @@ jinja_env = jinja2.Environment( trim_blocks=True, loader=jinja2.FileSystemLoader( - os.path.abspath(os.path.join(os.path.dirname(__file__), 'templates')))) + os.path.abspath(os.path.join(os.path.dirname(__file__), "templates")) + ), + autoescape=True, +) README_TMPL = jinja_env.get_template('README.tmpl.rst') From 7ff89545652ea089ca8c5bc475b8a84d30f5058c Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Thu, 5 May 2022 23:30:14 +0000 Subject: [PATCH 14/19] chore(python): auto approve template changes (#104) Source-Link: https://github.com/googleapis/synthtool/commit/453a5d9c9a55d1969240a37d36cec626d20a9024 Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-python:latest@sha256:81ed5ecdfc7cac5b699ba4537376f3563f6f04122c4ec9e735d3b3dc1d43dd32 --- .github/.OwlBot.lock.yaml | 4 ++-- .github/auto-approve.yml | 3 +++ 2 files changed, 5 insertions(+), 2 deletions(-) create mode 100644 .github/auto-approve.yml diff --git a/.github/.OwlBot.lock.yaml b/.github/.OwlBot.lock.yaml index b631901..757c9dc 100644 --- a/.github/.OwlBot.lock.yaml +++ b/.github/.OwlBot.lock.yaml @@ -13,5 +13,5 @@ # limitations under the License. docker: image: gcr.io/cloud-devrel-public-resources/owlbot-python:latest - digest: sha256:f792ee1320e03eda2d13a5281a2989f7ed8a9e50b73ef6da97fac7e1e850b149 -# created: 2022-05-05T15:17:27.599381182Z + digest: sha256:81ed5ecdfc7cac5b699ba4537376f3563f6f04122c4ec9e735d3b3dc1d43dd32 +# created: 2022-05-05T22:08:23.383410683Z diff --git a/.github/auto-approve.yml b/.github/auto-approve.yml new file mode 100644 index 0000000..311ebbb --- /dev/null +++ b/.github/auto-approve.yml @@ -0,0 +1,3 @@ +# https://github.com/googleapis/repo-automation-bots/tree/main/packages/auto-approve +processes: + - "OwlBotTemplateChanges" From 35c8bd66b63e4de943b40d2b7fb5767a5beeab22 Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Mon, 30 May 2022 17:48:22 +0000 Subject: [PATCH 15/19] chore: use gapic-generator-python 1.0.0 (#105) - [ ] Regenerate this pull request now. PiperOrigin-RevId: 451250442 Source-Link: https://github.com/googleapis/googleapis/commit/cca5e8181f6442b134e8d4d206fbe9e0e74684ba Source-Link: https://github.com/googleapis/googleapis-gen/commit/0b219da161a8bdcc3c6f7b2efcd82105182a30ca Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiMGIyMTlkYTE2MWE4YmRjYzNjNmY3YjJlZmNkODIxMDUxODJhMzBjYSJ9 --- tests/unit/gapic/shell_v1/test_cloud_shell_service.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/tests/unit/gapic/shell_v1/test_cloud_shell_service.py b/tests/unit/gapic/shell_v1/test_cloud_shell_service.py index 6341376..f182559 100644 --- a/tests/unit/gapic/shell_v1/test_cloud_shell_service.py +++ b/tests/unit/gapic/shell_v1/test_cloud_shell_service.py @@ -13,9 +13,17 @@ # See the License for the specific language governing permissions and # limitations under the License. # -import math import os +# try/except added for compatibility with python < 3.8 +try: + from unittest import mock + from unittest.mock import AsyncMock +except ImportError: + import mock + +import math + from google.api_core import ( future, gapic_v1, @@ -36,7 +44,6 @@ from google.protobuf import timestamp_pb2 # type: ignore import grpc from grpc.experimental import aio -import mock from proto.marshal.rules.dates import DurationRule, TimestampRule import pytest From 5ac2e3b0bbf79f4910a3e00f077554f78bf9accf Mon Sep 17 00:00:00 2001 From: Anthonios Partheniou Date: Wed, 1 Jun 2022 22:37:18 -0400 Subject: [PATCH 16/19] fix(deps): require protobuf <4.0.0dev (#106) --- setup.py | 3 ++- testing/constraints-3.6.txt | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/setup.py b/setup.py index eedfdf3..246bcd9 100644 --- a/setup.py +++ b/setup.py @@ -29,7 +29,8 @@ # Until this issue is closed # https://github.com/googleapis/google-cloud-python/issues/10566 "google-api-core[grpc] >= 1.31.5, <3.0.0dev,!=2.0.*,!=2.1.*,!=2.2.*,!=2.3.0", - "proto-plus >= 1.15.0", + "proto-plus >= 1.15.0, <2.0.0dev", + "protobuf >= 3.19.0, <4.0.0dev", ] package_root = os.path.abspath(os.path.dirname(__file__)) diff --git a/testing/constraints-3.6.txt b/testing/constraints-3.6.txt index b666ca6..ec8ca20 100644 --- a/testing/constraints-3.6.txt +++ b/testing/constraints-3.6.txt @@ -7,3 +7,4 @@ # Then this file should have foo==1.14.0 google-api-core==1.31.5 proto-plus==1.15.0 +protobuf==3.19.0 From 4d16fd5738b545fac4cb7b4ae47a59b618a73333 Mon Sep 17 00:00:00 2001 From: Dan Lee <71398022+dandhlee@users.noreply.github.com> Date: Thu, 2 Jun 2022 20:32:17 -0400 Subject: [PATCH 17/19] docs: fix changelog header to consistent size (#107) Co-authored-by: Anthonios Partheniou --- CHANGELOG.md | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 15b320a..13311d8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,13 +1,13 @@ # Changelog -### [1.3.2](https://github.com/googleapis/python-shell/compare/v1.3.1...v1.3.2) (2022-03-05) +## [1.3.2](https://github.com/googleapis/python-shell/compare/v1.3.1...v1.3.2) (2022-03-05) ### Bug Fixes * **deps:** require google-api-core>=1.31.5, >=2.3.2 ([#85](https://github.com/googleapis/python-shell/issues/85)) ([b3271c5](https://github.com/googleapis/python-shell/commit/b3271c5f07fc1326a614ab8fb365cc9b7c46c897)) -### [1.3.1](https://github.com/googleapis/python-shell/compare/v1.3.0...v1.3.1) (2022-02-11) +## [1.3.1](https://github.com/googleapis/python-shell/compare/v1.3.0...v1.3.1) (2022-02-11) ### Bug Fixes @@ -21,14 +21,14 @@ * add api key support ([#70](https://github.com/googleapis/python-shell/issues/70)) ([3e91fb8](https://github.com/googleapis/python-shell/commit/3e91fb8bacf28a19e167a357829ffcbb9e0e02c9)) -### [1.2.2](https://www.github.com/googleapis/python-shell/compare/v1.2.1...v1.2.2) (2022-01-07) +## [1.2.2](https://www.github.com/googleapis/python-shell/compare/v1.2.1...v1.2.2) (2022-01-07) ### Bug Fixes * provide appropriate mock values for message body fields ([24cf144](https://www.github.com/googleapis/python-shell/commit/24cf144d17b64dc71a5182d1ccbc44444bd68450)) -### [1.2.1](https://www.github.com/googleapis/python-shell/compare/v1.2.0...v1.2.1) (2021-11-01) +## [1.2.1](https://www.github.com/googleapis/python-shell/compare/v1.2.0...v1.2.1) (2021-11-01) ### Bug Fixes @@ -55,7 +55,7 @@ * add context manager support in client ([#41](https://www.github.com/googleapis/python-shell/issues/41)) ([33eb545](https://www.github.com/googleapis/python-shell/commit/33eb545715c52bb3e8e04cba07ee84466ace672e)) -### [1.0.1](https://www.github.com/googleapis/python-shell/compare/v1.0.0...v1.0.1) (2021-09-24) +## [1.0.1](https://www.github.com/googleapis/python-shell/compare/v1.0.0...v1.0.1) (2021-09-24) ### Bug Fixes @@ -69,7 +69,7 @@ * bump release level to production/stable ([#25](https://www.github.com/googleapis/python-shell/issues/25)) ([9a1a44e](https://www.github.com/googleapis/python-shell/commit/9a1a44e65f4c9adc16bce134046752e10d04ce4b)) -### [0.2.2](https://www.github.com/googleapis/python-shell/compare/v0.2.1...v0.2.2) (2021-07-30) +## [0.2.2](https://www.github.com/googleapis/python-shell/compare/v0.2.1...v0.2.2) (2021-07-30) ### Features @@ -86,7 +86,7 @@ * release as 0.2.2 ([#22](https://www.github.com/googleapis/python-shell/issues/22)) ([d3b208a](https://www.github.com/googleapis/python-shell/commit/d3b208aa33932c1008c5627d61bcd8dcf67aa85a)) -### [0.2.1](https://www.github.com/googleapis/python-shell/compare/v0.2.0...v0.2.1) (2021-07-21) +## [0.2.1](https://www.github.com/googleapis/python-shell/compare/v0.2.0...v0.2.1) (2021-07-21) ### Bug Fixes From e26b5c846cdb85362f7a8bbea037c9f5415e354a Mon Sep 17 00:00:00 2001 From: Anthonios Partheniou Date: Fri, 3 Jun 2022 12:51:42 -0400 Subject: [PATCH 18/19] chore: test minimum dependencies in python 3.7 (#110) --- testing/constraints-3.7.txt | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/testing/constraints-3.7.txt b/testing/constraints-3.7.txt index e69de29..ec8ca20 100644 --- a/testing/constraints-3.7.txt +++ b/testing/constraints-3.7.txt @@ -0,0 +1,10 @@ +# This constraints file is used to check that lower bounds +# are correct in setup.py +# List *all* library dependencies and extras in this file. +# Pin the version to the lower bound. +# +# e.g., if setup.py has "foo >= 1.14.0, < 2.0.0dev", +# Then this file should have foo==1.14.0 +google-api-core==1.31.5 +proto-plus==1.15.0 +protobuf==3.19.0 From 522dee526a211411b0f6fe8bf3aef1e731e83061 Mon Sep 17 00:00:00 2001 From: "release-please[bot]" <55107282+release-please[bot]@users.noreply.github.com> Date: Mon, 6 Jun 2022 17:44:28 -0400 Subject: [PATCH 19/19] chore(main): release 1.3.3 (#108) Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com> Co-authored-by: Anthonios Partheniou --- CHANGELOG.md | 12 ++++++++++++ setup.py | 2 +- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 13311d8..cc372f6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,17 @@ # Changelog +## [1.3.3](https://github.com/googleapis/python-shell/compare/v1.3.2...v1.3.3) (2022-06-03) + + +### Bug Fixes + +* **deps:** require protobuf <4.0.0dev ([#106](https://github.com/googleapis/python-shell/issues/106)) ([5ac2e3b](https://github.com/googleapis/python-shell/commit/5ac2e3b0bbf79f4910a3e00f077554f78bf9accf)) + + +### Documentation + +* fix changelog header to consistent size ([#107](https://github.com/googleapis/python-shell/issues/107)) ([4d16fd5](https://github.com/googleapis/python-shell/commit/4d16fd5738b545fac4cb7b4ae47a59b618a73333)) + ## [1.3.2](https://github.com/googleapis/python-shell/compare/v1.3.1...v1.3.2) (2022-03-05) diff --git a/setup.py b/setup.py index 246bcd9..d4bd1a2 100644 --- a/setup.py +++ b/setup.py @@ -21,7 +21,7 @@ name = "google-cloud-shell" description = "Cloud Shell API client library" -version = "1.3.2" +version = "1.3.3" release_status = "Development Status :: 5 - Production/Stable" url = "https://github.com/googleapis/python-shell" dependencies = [