diff --git a/CHANGELOG.md b/CHANGELOG.md index 0a64c7a7..4ef49750 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,13 @@ [1]: https://pypi.org/project/google-cloud-build/#history +### [2.0.1](https://github.com/googleapis/python-cloudbuild/compare/v2.0.0...v2.0.1) (2022-04-04) + + +### Bug Fixes + +* **deps:** require google-api-core >= 1.31.5, >= 2.3.2 on v2 release ([#244](https://github.com/googleapis/python-cloudbuild/issues/244)) ([dd65eed](https://github.com/googleapis/python-cloudbuild/commit/dd65eedb062837a345f9e62eb85da1592921d3e9)) + ## [2.0.0](https://www.github.com/googleapis/python-cloudbuild/compare/v1.1.0...v2.0.0) (2020-07-23) diff --git a/docs/conf.py b/docs/conf.py index 2d0ebebb..99e23e6d 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -62,9 +62,9 @@ master_doc = "index" # General information about the project. -project = u"google-cloud-build" -copyright = u"2019, Google" -author = u"Google APIs" +project = "google-cloud-build" +copyright = "2019, Google" +author = "Google APIs" # The version info for the project you're documenting, acts as replacement for # |version| and |release|, also used in various other places throughout the @@ -258,7 +258,7 @@ ( master_doc, "google-cloud-build.tex", - u"google-cloud-build Documentation", + "google-cloud-build Documentation", author, "manual", ) @@ -293,7 +293,7 @@ ( master_doc, "google-cloud-build", - u"google-cloud-build Documentation", + "google-cloud-build Documentation", [author], 1, ) @@ -312,7 +312,7 @@ ( master_doc, "google-cloud-build", - u"google-cloud-build Documentation", + "google-cloud-build Documentation", author, "google-cloud-build", "google-cloud-build Library", @@ -337,7 +337,10 @@ intersphinx_mapping = { "python": ("http://python.readthedocs.org/en/latest/", None), "google-auth": ("https://google-auth.readthedocs.io/en/stable", 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.io/grpc/python/", None), } diff --git a/google/cloud/devtools/cloudbuild_v1/services/cloud_build/async_client.py b/google/cloud/devtools/cloudbuild_v1/services/cloud_build/async_client.py index 96421e96..33104d7c 100644 --- a/google/cloud/devtools/cloudbuild_v1/services/cloud_build/async_client.py +++ b/google/cloud/devtools/cloudbuild_v1/services/cloud_build/async_client.py @@ -101,7 +101,9 @@ def __init__( """ self._client = CloudBuildClient( - credentials=credentials, transport=transport, client_options=client_options, + credentials=credentials, + transport=transport, + client_options=client_options, ) async def create_build( @@ -198,7 +200,12 @@ async def create_build( ) # 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( @@ -301,7 +308,8 @@ async def get_build( maximum=60.0, multiplier=1.3, predicate=retries.if_exception_type( - exceptions.ServiceUnavailable, exceptions.DeadlineExceeded, + exceptions.ServiceUnavailable, + exceptions.DeadlineExceeded, ), ), default_timeout=600.0, @@ -309,7 +317,12 @@ async def get_build( ) # 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 @@ -385,7 +398,8 @@ async def list_builds( maximum=60.0, multiplier=1.3, predicate=retries.if_exception_type( - exceptions.ServiceUnavailable, exceptions.DeadlineExceeded, + exceptions.ServiceUnavailable, + exceptions.DeadlineExceeded, ), ), default_timeout=600.0, @@ -393,12 +407,20 @@ async def list_builds( ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # This method is paged; wrap the response in a pager, which provides # an `__aiter__` convenience method. response = pagers.ListBuildsAsyncPager( - method=rpc, request=request, response=response, metadata=metadata, + method=rpc, + request=request, + response=response, + metadata=metadata, ) # Done; return the response. @@ -490,7 +512,12 @@ async def cancel_build( ) # 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 @@ -615,7 +642,12 @@ async def retry_build( ) # 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( @@ -699,7 +731,12 @@ async def create_build_trigger( ) # 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 @@ -776,7 +813,8 @@ async def get_build_trigger( maximum=60.0, multiplier=1.3, predicate=retries.if_exception_type( - exceptions.ServiceUnavailable, exceptions.DeadlineExceeded, + exceptions.ServiceUnavailable, + exceptions.DeadlineExceeded, ), ), default_timeout=600.0, @@ -784,7 +822,12 @@ async def get_build_trigger( ) # 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 @@ -853,7 +896,8 @@ async def list_build_triggers( maximum=60.0, multiplier=1.3, predicate=retries.if_exception_type( - exceptions.ServiceUnavailable, exceptions.DeadlineExceeded, + exceptions.ServiceUnavailable, + exceptions.DeadlineExceeded, ), ), default_timeout=600.0, @@ -861,12 +905,20 @@ async def list_build_triggers( ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # This method is paged; wrap the response in a pager, which provides # an `__aiter__` convenience method. response = pagers.ListBuildTriggersAsyncPager( - method=rpc, request=request, response=response, metadata=metadata, + method=rpc, + request=request, + response=response, + metadata=metadata, ) # Done; return the response. @@ -935,7 +987,8 @@ async def delete_build_trigger( maximum=60.0, multiplier=1.3, predicate=retries.if_exception_type( - exceptions.ServiceUnavailable, exceptions.DeadlineExceeded, + exceptions.ServiceUnavailable, + exceptions.DeadlineExceeded, ), ), default_timeout=600.0, @@ -944,7 +997,10 @@ async def delete_build_trigger( # Send the request. await rpc( - request, retry=retry, timeout=timeout, metadata=metadata, + request, + retry=retry, + timeout=timeout, + metadata=metadata, ) async def update_build_trigger( @@ -1026,7 +1082,12 @@ async def update_build_trigger( ) # 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 @@ -1131,7 +1192,12 @@ async def run_build_trigger( ) # 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( @@ -1197,7 +1263,12 @@ async def create_worker_pool( ) # 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 @@ -1254,7 +1325,8 @@ async def get_worker_pool( maximum=60.0, multiplier=1.3, predicate=retries.if_exception_type( - exceptions.ServiceUnavailable, exceptions.DeadlineExceeded, + exceptions.ServiceUnavailable, + exceptions.DeadlineExceeded, ), ), default_timeout=600.0, @@ -1262,7 +1334,12 @@ async def get_worker_pool( ) # 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 @@ -1303,7 +1380,10 @@ async def delete_worker_pool( # Send the request. await rpc( - request, retry=retry, timeout=timeout, metadata=metadata, + request, + retry=retry, + timeout=timeout, + metadata=metadata, ) async def update_worker_pool( @@ -1357,7 +1437,12 @@ async def update_worker_pool( ) # 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 @@ -1401,7 +1486,8 @@ async def list_worker_pools( maximum=60.0, multiplier=1.3, predicate=retries.if_exception_type( - exceptions.ServiceUnavailable, exceptions.DeadlineExceeded, + exceptions.ServiceUnavailable, + exceptions.DeadlineExceeded, ), ), default_timeout=600.0, @@ -1409,7 +1495,12 @@ async def list_worker_pools( ) # 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 diff --git a/google/cloud/devtools/cloudbuild_v1/services/cloud_build/client.py b/google/cloud/devtools/cloudbuild_v1/services/cloud_build/client.py index a89cd044..c3676143 100644 --- a/google/cloud/devtools/cloudbuild_v1/services/cloud_build/client.py +++ b/google/cloud/devtools/cloudbuild_v1/services/cloud_build/client.py @@ -54,7 +54,10 @@ class CloudBuildClientMeta(type): _transport_registry["grpc"] = CloudBuildGrpcTransport _transport_registry["grpc_asyncio"] = CloudBuildGrpcAsyncIOTransport - def get_transport_class(cls, label: str = None,) -> Type[CloudBuildTransport]: + def get_transport_class( + cls, + label: str = None, + ) -> Type[CloudBuildTransport]: """Return an appropriate transport class. Args: @@ -321,7 +324,12 @@ def create_build( ) # 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( @@ -424,7 +432,8 @@ def get_build( maximum=60.0, multiplier=1.3, predicate=retries.if_exception_type( - exceptions.ServiceUnavailable, exceptions.DeadlineExceeded, + exceptions.ServiceUnavailable, + exceptions.DeadlineExceeded, ), ), default_timeout=600.0, @@ -432,7 +441,12 @@ def get_build( ) # 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 @@ -508,7 +522,8 @@ def list_builds( maximum=60.0, multiplier=1.3, predicate=retries.if_exception_type( - exceptions.ServiceUnavailable, exceptions.DeadlineExceeded, + exceptions.ServiceUnavailable, + exceptions.DeadlineExceeded, ), ), default_timeout=600.0, @@ -516,12 +531,20 @@ def list_builds( ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # This method is paged; wrap the response in a pager, which provides # an `__iter__` convenience method. response = pagers.ListBuildsPager( - method=rpc, request=request, response=response, metadata=metadata, + method=rpc, + request=request, + response=response, + metadata=metadata, ) # Done; return the response. @@ -613,7 +636,12 @@ def cancel_build( ) # 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 @@ -738,7 +766,12 @@ def retry_build( ) # 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( @@ -822,7 +855,12 @@ def create_build_trigger( ) # 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 @@ -899,7 +937,8 @@ def get_build_trigger( maximum=60.0, multiplier=1.3, predicate=retries.if_exception_type( - exceptions.ServiceUnavailable, exceptions.DeadlineExceeded, + exceptions.ServiceUnavailable, + exceptions.DeadlineExceeded, ), ), default_timeout=600.0, @@ -907,7 +946,12 @@ def get_build_trigger( ) # 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 @@ -976,7 +1020,8 @@ def list_build_triggers( maximum=60.0, multiplier=1.3, predicate=retries.if_exception_type( - exceptions.ServiceUnavailable, exceptions.DeadlineExceeded, + exceptions.ServiceUnavailable, + exceptions.DeadlineExceeded, ), ), default_timeout=600.0, @@ -984,12 +1029,20 @@ def list_build_triggers( ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # This method is paged; wrap the response in a pager, which provides # an `__iter__` convenience method. response = pagers.ListBuildTriggersPager( - method=rpc, request=request, response=response, metadata=metadata, + method=rpc, + request=request, + response=response, + metadata=metadata, ) # Done; return the response. @@ -1058,7 +1111,8 @@ def delete_build_trigger( maximum=60.0, multiplier=1.3, predicate=retries.if_exception_type( - exceptions.ServiceUnavailable, exceptions.DeadlineExceeded, + exceptions.ServiceUnavailable, + exceptions.DeadlineExceeded, ), ), default_timeout=600.0, @@ -1067,7 +1121,10 @@ def delete_build_trigger( # Send the request. rpc( - request, retry=retry, timeout=timeout, metadata=metadata, + request, + retry=retry, + timeout=timeout, + metadata=metadata, ) def update_build_trigger( @@ -1149,7 +1206,12 @@ def update_build_trigger( ) # 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 @@ -1254,7 +1316,12 @@ def run_build_trigger( ) # 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( @@ -1320,7 +1387,12 @@ def create_worker_pool( ) # 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 @@ -1377,7 +1449,8 @@ def get_worker_pool( maximum=60.0, multiplier=1.3, predicate=retries.if_exception_type( - exceptions.ServiceUnavailable, exceptions.DeadlineExceeded, + exceptions.ServiceUnavailable, + exceptions.DeadlineExceeded, ), ), default_timeout=600.0, @@ -1385,7 +1458,12 @@ def get_worker_pool( ) # 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 @@ -1426,7 +1504,10 @@ def delete_worker_pool( # Send the request. rpc( - request, retry=retry, timeout=timeout, metadata=metadata, + request, + retry=retry, + timeout=timeout, + metadata=metadata, ) def update_worker_pool( @@ -1480,7 +1561,12 @@ def update_worker_pool( ) # 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 @@ -1524,7 +1610,8 @@ def list_worker_pools( maximum=60.0, multiplier=1.3, predicate=retries.if_exception_type( - exceptions.ServiceUnavailable, exceptions.DeadlineExceeded, + exceptions.ServiceUnavailable, + exceptions.DeadlineExceeded, ), ), default_timeout=600.0, @@ -1532,7 +1619,12 @@ def list_worker_pools( ) # 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 diff --git a/google/cloud/devtools/cloudbuild_v1/services/cloud_build/transports/grpc.py b/google/cloud/devtools/cloudbuild_v1/services/cloud_build/transports/grpc.py index a3570363..025ff910 100644 --- a/google/cloud/devtools/cloudbuild_v1/services/cloud_build/transports/grpc.py +++ b/google/cloud/devtools/cloudbuild_v1/services/cloud_build/transports/grpc.py @@ -196,7 +196,8 @@ def grpc_channel(self) -> grpc.Channel: # have one. if not hasattr(self, "_grpc_channel"): self._grpc_channel = self.create_channel( - self._host, credentials=self._credentials, + self._host, + credentials=self._credentials, ) # Return the channel from cache. diff --git a/google/cloud/devtools/cloudbuild_v1/services/cloud_build/transports/grpc_asyncio.py b/google/cloud/devtools/cloudbuild_v1/services/cloud_build/transports/grpc_asyncio.py index 432dfb85..56f74902 100644 --- a/google/cloud/devtools/cloudbuild_v1/services/cloud_build/transports/grpc_asyncio.py +++ b/google/cloud/devtools/cloudbuild_v1/services/cloud_build/transports/grpc_asyncio.py @@ -191,7 +191,8 @@ def grpc_channel(self) -> aio.Channel: # have one. if not hasattr(self, "_grpc_channel"): self._grpc_channel = self.create_channel( - self._host, credentials=self._credentials, + self._host, + credentials=self._credentials, ) # Return the channel from cache. diff --git a/google/cloud/devtools/cloudbuild_v1/types/cloudbuild.py b/google/cloud/devtools/cloudbuild_v1/types/cloudbuild.py index 371c86c4..1997427f 100644 --- a/google/cloud/devtools/cloudbuild_v1/types/cloudbuild.py +++ b/google/cloud/devtools/cloudbuild_v1/types/cloudbuild.py @@ -104,7 +104,11 @@ class RunBuildTriggerRequest(proto.Message): trigger_id = proto.Field(proto.STRING, number=2) - source = proto.Field(proto.MESSAGE, number=3, message="RepoSource",) + source = proto.Field( + proto.MESSAGE, + number=3, + message="RepoSource", + ) class StorageSource(proto.Message): @@ -202,11 +206,17 @@ class Source(proto.Message): """ storage_source = proto.Field( - proto.MESSAGE, number=2, oneof="source", message=StorageSource, + proto.MESSAGE, + number=2, + oneof="source", + message=StorageSource, ) repo_source = proto.Field( - proto.MESSAGE, number=3, oneof="source", message=RepoSource, + proto.MESSAGE, + number=3, + oneof="source", + message=RepoSource, ) @@ -228,7 +238,11 @@ class BuiltImage(proto.Message): digest = proto.Field(proto.STRING, number=3) - push_timing = proto.Field(proto.MESSAGE, number=4, message="TimeSpan",) + push_timing = proto.Field( + proto.MESSAGE, + number=4, + message="TimeSpan", + ) class BuildStep(proto.Message): @@ -343,15 +357,35 @@ class BuildStep(proto.Message): secret_env = proto.RepeatedField(proto.STRING, number=8) - volumes = proto.RepeatedField(proto.MESSAGE, number=9, message="Volume",) + volumes = proto.RepeatedField( + proto.MESSAGE, + number=9, + message="Volume", + ) - timing = proto.Field(proto.MESSAGE, number=10, message="TimeSpan",) + timing = proto.Field( + proto.MESSAGE, + number=10, + message="TimeSpan", + ) - pull_timing = proto.Field(proto.MESSAGE, number=13, message="TimeSpan",) + pull_timing = proto.Field( + proto.MESSAGE, + number=13, + message="TimeSpan", + ) - timeout = proto.Field(proto.MESSAGE, number=11, message=duration.Duration,) + timeout = proto.Field( + proto.MESSAGE, + number=11, + message=duration.Duration, + ) - status = proto.Field(proto.ENUM, number=12, enum="Build.Status",) + status = proto.Field( + proto.ENUM, + number=12, + enum="Build.Status", + ) class Volume(proto.Message): @@ -407,7 +441,11 @@ class Results(proto.Message): Time to push all non-container artifacts. """ - images = proto.RepeatedField(proto.MESSAGE, number=2, message=BuiltImage,) + images = proto.RepeatedField( + proto.MESSAGE, + number=2, + message=BuiltImage, + ) build_step_images = proto.RepeatedField(proto.STRING, number=3) @@ -417,7 +455,11 @@ class Results(proto.Message): build_step_outputs = proto.RepeatedField(proto.BYTES, number=6) - artifact_timing = proto.Field(proto.MESSAGE, number=7, message="TimeSpan",) + artifact_timing = proto.Field( + proto.MESSAGE, + number=7, + message="TimeSpan", + ) class ArtifactResult(proto.Message): @@ -435,7 +477,11 @@ class ArtifactResult(proto.Message): location = proto.Field(proto.STRING, number=1) - file_hash = proto.RepeatedField(proto.MESSAGE, number=2, message="FileHashes",) + file_hash = proto.RepeatedField( + proto.MESSAGE, + number=2, + message="FileHashes", + ) class Build(proto.Message): @@ -568,39 +614,85 @@ class Status(proto.Enum): project_id = proto.Field(proto.STRING, number=16) - status = proto.Field(proto.ENUM, number=2, enum=Status,) + status = proto.Field( + proto.ENUM, + number=2, + enum=Status, + ) status_detail = proto.Field(proto.STRING, number=24) - source = proto.Field(proto.MESSAGE, number=3, message=Source,) + source = proto.Field( + proto.MESSAGE, + number=3, + message=Source, + ) - steps = proto.RepeatedField(proto.MESSAGE, number=11, message=BuildStep,) + steps = proto.RepeatedField( + proto.MESSAGE, + number=11, + message=BuildStep, + ) - results = proto.Field(proto.MESSAGE, number=10, message=Results,) + results = proto.Field( + proto.MESSAGE, + number=10, + message=Results, + ) - create_time = proto.Field(proto.MESSAGE, number=6, message=timestamp.Timestamp,) + create_time = proto.Field( + proto.MESSAGE, + number=6, + message=timestamp.Timestamp, + ) - start_time = proto.Field(proto.MESSAGE, number=7, message=timestamp.Timestamp,) + start_time = proto.Field( + proto.MESSAGE, + number=7, + message=timestamp.Timestamp, + ) - finish_time = proto.Field(proto.MESSAGE, number=8, message=timestamp.Timestamp,) + finish_time = proto.Field( + proto.MESSAGE, + number=8, + message=timestamp.Timestamp, + ) - timeout = proto.Field(proto.MESSAGE, number=12, message=duration.Duration,) + timeout = proto.Field( + proto.MESSAGE, + number=12, + message=duration.Duration, + ) images = proto.RepeatedField(proto.STRING, number=13) - queue_ttl = proto.Field(proto.MESSAGE, number=40, message=duration.Duration,) + queue_ttl = proto.Field( + proto.MESSAGE, + number=40, + message=duration.Duration, + ) - artifacts = proto.Field(proto.MESSAGE, number=37, message="Artifacts",) + artifacts = proto.Field( + proto.MESSAGE, + number=37, + message="Artifacts", + ) logs_bucket = proto.Field(proto.STRING, number=19) source_provenance = proto.Field( - proto.MESSAGE, number=21, message="SourceProvenance", + proto.MESSAGE, + number=21, + message="SourceProvenance", ) build_trigger_id = proto.Field(proto.STRING, number=22) - options = proto.Field(proto.MESSAGE, number=23, message="BuildOptions",) + options = proto.Field( + proto.MESSAGE, + number=23, + message="BuildOptions", + ) log_url = proto.Field(proto.STRING, number=25) @@ -608,9 +700,18 @@ class Status(proto.Enum): tags = proto.RepeatedField(proto.STRING, number=31) - secrets = proto.RepeatedField(proto.MESSAGE, number=32, message="Secret",) + secrets = proto.RepeatedField( + proto.MESSAGE, + number=32, + message="Secret", + ) - timing = proto.MapField(proto.STRING, proto.MESSAGE, number=33, message="TimeSpan",) + timing = proto.MapField( + proto.STRING, + proto.MESSAGE, + number=33, + message="TimeSpan", + ) class Artifacts(proto.Message): @@ -670,11 +771,19 @@ class ArtifactObjects(proto.Message): paths = proto.RepeatedField(proto.STRING, number=2) - timing = proto.Field(proto.MESSAGE, number=3, message="TimeSpan",) + timing = proto.Field( + proto.MESSAGE, + number=3, + message="TimeSpan", + ) images = proto.RepeatedField(proto.STRING, number=1) - objects = proto.Field(proto.MESSAGE, number=2, message=ArtifactObjects,) + objects = proto.Field( + proto.MESSAGE, + number=2, + message=ArtifactObjects, + ) class TimeSpan(proto.Message): @@ -687,9 +796,17 @@ class TimeSpan(proto.Message): End of time span. """ - start_time = proto.Field(proto.MESSAGE, number=1, message=timestamp.Timestamp,) + start_time = proto.Field( + proto.MESSAGE, + number=1, + message=timestamp.Timestamp, + ) - end_time = proto.Field(proto.MESSAGE, number=2, message=timestamp.Timestamp,) + end_time = proto.Field( + proto.MESSAGE, + number=2, + message=timestamp.Timestamp, + ) class BuildOperationMetadata(proto.Message): @@ -700,7 +817,11 @@ class BuildOperationMetadata(proto.Message): The build that the operation is tracking. """ - build = proto.Field(proto.MESSAGE, number=1, message=Build,) + build = proto.Field( + proto.MESSAGE, + number=1, + message=Build, + ) class SourceProvenance(proto.Message): @@ -730,13 +851,22 @@ class SourceProvenance(proto.Message): """ resolved_storage_source = proto.Field( - proto.MESSAGE, number=3, message=StorageSource, + proto.MESSAGE, + number=3, + message=StorageSource, ) - resolved_repo_source = proto.Field(proto.MESSAGE, number=6, message=RepoSource,) + resolved_repo_source = proto.Field( + proto.MESSAGE, + number=6, + message=RepoSource, + ) file_hashes = proto.MapField( - proto.STRING, proto.MESSAGE, number=4, message="FileHashes", + proto.STRING, + proto.MESSAGE, + number=4, + message="FileHashes", ) @@ -750,7 +880,11 @@ class FileHashes(proto.Message): Collection of file hashes. """ - file_hash = proto.RepeatedField(proto.MESSAGE, number=1, message="Hash",) + file_hash = proto.RepeatedField( + proto.MESSAGE, + number=1, + message="Hash", + ) class Hash(proto.Message): @@ -769,7 +903,11 @@ class HashType(proto.Enum): SHA256 = 1 MD5 = 2 - type = proto.Field(proto.ENUM, number=1, enum=HashType,) + type = proto.Field( + proto.ENUM, + number=1, + enum=HashType, + ) value = proto.Field(proto.BYTES, number=2) @@ -810,7 +948,11 @@ class CreateBuildRequest(proto.Message): project_id = proto.Field(proto.STRING, number=1) - build = proto.Field(proto.MESSAGE, number=2, message=Build,) + build = proto.Field( + proto.MESSAGE, + number=2, + message=Build, + ) class GetBuildRequest(proto.Message): @@ -866,7 +1008,11 @@ class ListBuildsResponse(proto.Message): def raw_page(self): return self - builds = proto.RepeatedField(proto.MESSAGE, number=1, message=Build,) + builds = proto.RepeatedField( + proto.MESSAGE, + number=1, + message=Build, + ) next_page_token = proto.Field(proto.STRING, number=2) @@ -967,15 +1113,32 @@ class BuildTrigger(proto.Message): tags = proto.RepeatedField(proto.STRING, number=19) - trigger_template = proto.Field(proto.MESSAGE, number=7, message=RepoSource,) + trigger_template = proto.Field( + proto.MESSAGE, + number=7, + message=RepoSource, + ) - github = proto.Field(proto.MESSAGE, number=13, message="GitHubEventsConfig",) + github = proto.Field( + proto.MESSAGE, + number=13, + message="GitHubEventsConfig", + ) - build = proto.Field(proto.MESSAGE, number=4, oneof="build_template", message=Build,) + build = proto.Field( + proto.MESSAGE, + number=4, + oneof="build_template", + message=Build, + ) filename = proto.Field(proto.STRING, number=8, oneof="build_template") - create_time = proto.Field(proto.MESSAGE, number=5, message=timestamp.Timestamp,) + create_time = proto.Field( + proto.MESSAGE, + number=5, + message=timestamp.Timestamp, + ) disabled = proto.Field(proto.BOOL, number=9) @@ -1019,10 +1182,18 @@ class GitHubEventsConfig(proto.Message): name = proto.Field(proto.STRING, number=7) pull_request = proto.Field( - proto.MESSAGE, number=4, oneof="event", message="PullRequestFilter", + proto.MESSAGE, + number=4, + oneof="event", + message="PullRequestFilter", ) - push = proto.Field(proto.MESSAGE, number=5, oneof="event", message="PushFilter",) + push = proto.Field( + proto.MESSAGE, + number=5, + oneof="event", + message="PushFilter", + ) class PullRequestFilter(proto.Message): @@ -1050,7 +1221,11 @@ class CommentControl(proto.Enum): branch = proto.Field(proto.STRING, number=2, oneof="git_ref") - comment_control = proto.Field(proto.ENUM, number=5, enum=CommentControl,) + comment_control = proto.Field( + proto.ENUM, + number=5, + enum=CommentControl, + ) invert_regex = proto.Field(proto.BOOL, number=6) @@ -1095,7 +1270,11 @@ class CreateBuildTriggerRequest(proto.Message): project_id = proto.Field(proto.STRING, number=1) - trigger = proto.Field(proto.MESSAGE, number=2, message=BuildTrigger,) + trigger = proto.Field( + proto.MESSAGE, + number=2, + message=BuildTrigger, + ) class GetBuildTriggerRequest(proto.Message): @@ -1151,7 +1330,11 @@ class ListBuildTriggersResponse(proto.Message): def raw_page(self): return self - triggers = proto.RepeatedField(proto.MESSAGE, number=1, message=BuildTrigger,) + triggers = proto.RepeatedField( + proto.MESSAGE, + number=1, + message=BuildTrigger, + ) next_page_token = proto.Field(proto.STRING, number=2) @@ -1189,7 +1372,11 @@ class UpdateBuildTriggerRequest(proto.Message): trigger_id = proto.Field(proto.STRING, number=2) - trigger = proto.Field(proto.MESSAGE, number=3, message=BuildTrigger,) + trigger = proto.Field( + proto.MESSAGE, + number=3, + message=BuildTrigger, + ) class BuildOptions(proto.Message): @@ -1290,28 +1477,54 @@ class LoggingMode(proto.Enum): GCS_ONLY = 2 source_provenance_hash = proto.RepeatedField( - proto.ENUM, number=1, enum=Hash.HashType, + proto.ENUM, + number=1, + enum=Hash.HashType, ) - requested_verify_option = proto.Field(proto.ENUM, number=2, enum=VerifyOption,) + requested_verify_option = proto.Field( + proto.ENUM, + number=2, + enum=VerifyOption, + ) - machine_type = proto.Field(proto.ENUM, number=3, enum=MachineType,) + machine_type = proto.Field( + proto.ENUM, + number=3, + enum=MachineType, + ) disk_size_gb = proto.Field(proto.INT64, number=6) - substitution_option = proto.Field(proto.ENUM, number=4, enum=SubstitutionOption,) + substitution_option = proto.Field( + proto.ENUM, + number=4, + enum=SubstitutionOption, + ) - log_streaming_option = proto.Field(proto.ENUM, number=5, enum=LogStreamingOption,) + log_streaming_option = proto.Field( + proto.ENUM, + number=5, + enum=LogStreamingOption, + ) worker_pool = proto.Field(proto.STRING, number=7) - logging = proto.Field(proto.ENUM, number=11, enum=LoggingMode,) + logging = proto.Field( + proto.ENUM, + number=11, + enum=LoggingMode, + ) env = proto.RepeatedField(proto.STRING, number=12) secret_env = proto.RepeatedField(proto.STRING, number=13) - volumes = proto.RepeatedField(proto.MESSAGE, number=14, message=Volume,) + volumes = proto.RepeatedField( + proto.MESSAGE, + number=14, + message=Volume, + ) class WorkerPool(proto.Message): @@ -1383,17 +1596,41 @@ class Status(proto.Enum): worker_count = proto.Field(proto.INT64, number=4) - worker_config = proto.Field(proto.MESSAGE, number=16, message="WorkerConfig",) + worker_config = proto.Field( + proto.MESSAGE, + number=16, + message="WorkerConfig", + ) - regions = proto.RepeatedField(proto.ENUM, number=9, enum=Region,) + regions = proto.RepeatedField( + proto.ENUM, + number=9, + enum=Region, + ) - create_time = proto.Field(proto.MESSAGE, number=11, message=timestamp.Timestamp,) + create_time = proto.Field( + proto.MESSAGE, + number=11, + message=timestamp.Timestamp, + ) - update_time = proto.Field(proto.MESSAGE, number=17, message=timestamp.Timestamp,) + update_time = proto.Field( + proto.MESSAGE, + number=17, + message=timestamp.Timestamp, + ) - delete_time = proto.Field(proto.MESSAGE, number=12, message=timestamp.Timestamp,) + delete_time = proto.Field( + proto.MESSAGE, + number=12, + message=timestamp.Timestamp, + ) - status = proto.Field(proto.ENUM, number=13, enum=Status,) + status = proto.Field( + proto.ENUM, + number=13, + enum=Status, + ) class WorkerConfig(proto.Message): @@ -1434,7 +1671,11 @@ class WorkerConfig(proto.Message): disk_size_gb = proto.Field(proto.INT64, number=2) - network = proto.Field(proto.MESSAGE, number=3, message="Network",) + network = proto.Field( + proto.MESSAGE, + number=3, + message="Network", + ) tag = proto.Field(proto.STRING, number=4) @@ -1477,7 +1718,11 @@ class CreateWorkerPoolRequest(proto.Message): parent = proto.Field(proto.STRING, number=1) - worker_pool = proto.Field(proto.MESSAGE, number=2, message=WorkerPool,) + worker_pool = proto.Field( + proto.MESSAGE, + number=2, + message=WorkerPool, + ) class GetWorkerPoolRequest(proto.Message): @@ -1520,7 +1765,11 @@ class UpdateWorkerPoolRequest(proto.Message): name = proto.Field(proto.STRING, number=2) - worker_pool = proto.Field(proto.MESSAGE, number=3, message=WorkerPool,) + worker_pool = proto.Field( + proto.MESSAGE, + number=3, + message=WorkerPool, + ) class ListWorkerPoolsRequest(proto.Message): @@ -1542,7 +1791,11 @@ class ListWorkerPoolsResponse(proto.Message): ``WorkerPools`` for the project. """ - worker_pools = proto.RepeatedField(proto.MESSAGE, number=1, message=WorkerPool,) + worker_pools = proto.RepeatedField( + proto.MESSAGE, + number=1, + message=WorkerPool, + ) __all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/noxfile.py b/noxfile.py index da184cbd..8a0a73db 100644 --- a/noxfile.py +++ b/noxfile.py @@ -23,7 +23,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" @@ -40,12 +40,14 @@ def lint(session): """ session.install("flake8", BLACK_VERSION) session.run( - "black", "--check", *BLACK_PATHS, + "black", + "--check", + *BLACK_PATHS, ) session.run("flake8", "google", "tests") -@nox.session(python="3.6") +@nox.session(python=DEFAULT_PYTHON_VERSION) def blacken(session): """Run black. @@ -57,7 +59,8 @@ def blacken(session): """ session.install(BLACK_VERSION) session.run( - "black", *BLACK_PATHS, + "black", + *BLACK_PATHS, ) @@ -118,7 +121,9 @@ def system(session): # Install all test dependencies, then install this package into the # virtualenv's dist-packages. session.install( - "mock", "pytest", "google-cloud-testutils", + "mock", + "pytest", + "google-cloud-testutils", ) session.install("-e", ".") @@ -147,7 +152,7 @@ def docs(session): """Build the docs for this library.""" session.install("-e", ".") - session.install("sphinx<3.0.0", "alabaster", "recommonmark") + session.install("sphinx<3.0.0", "alabaster", "recommonmark", "Jinja2<3.1") shutil.rmtree(os.path.join("docs", "_build"), ignore_errors=True) session.run( diff --git a/setup.py b/setup.py index 7612f587..fe3e463e 100644 --- a/setup.py +++ b/setup.py @@ -21,7 +21,7 @@ name = "google-cloud-build" description = "Google Cloud Build API client library" -version = "2.0.0" +version = "2.0.1" # Should be one of: # 'Development Status :: 3 - Alpha' # 'Development Status :: 4 - Beta' diff --git a/tests/unit/gapic/cloudbuild_v1/test_cloud_build.py b/tests/unit/gapic/cloudbuild_v1/test_cloud_build.py index fff9e16f..fb1abfb2 100644 --- a/tests/unit/gapic/cloudbuild_v1/test_cloud_build.py +++ b/tests/unit/gapic/cloudbuild_v1/test_cloud_build.py @@ -251,7 +251,9 @@ def test_cloud_build_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) @@ -312,7 +314,8 @@ def test_cloud_build_client_client_options_from_dict(): def test_create_build(transport: str = "grpc"): client = CloudBuildClient( - credentials=credentials.AnonymousCredentials(), transport=transport, + credentials=credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -339,7 +342,8 @@ def test_create_build(transport: str = "grpc"): @pytest.mark.asyncio async def test_create_build_async(transport: str = "grpc_asyncio"): client = CloudBuildAsyncClient( - credentials=credentials.AnonymousCredentials(), transport=transport, + credentials=credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -368,7 +372,9 @@ async def test_create_build_async(transport: str = "grpc_asyncio"): def test_create_build_flattened(): - client = CloudBuildClient(credentials=credentials.AnonymousCredentials(),) + client = CloudBuildClient( + credentials=credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client._transport.create_build), "__call__") as call: @@ -378,7 +384,8 @@ def test_create_build_flattened(): # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. client.create_build( - project_id="project_id_value", build=cloudbuild.Build(id="id_value"), + project_id="project_id_value", + build=cloudbuild.Build(id="id_value"), ) # Establish that the underlying call was made with the expected @@ -392,7 +399,9 @@ def test_create_build_flattened(): def test_create_build_flattened_error(): - client = CloudBuildClient(credentials=credentials.AnonymousCredentials(),) + client = CloudBuildClient( + credentials=credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. @@ -406,7 +415,9 @@ def test_create_build_flattened_error(): @pytest.mark.asyncio async def test_create_build_flattened_async(): - client = CloudBuildAsyncClient(credentials=credentials.AnonymousCredentials(),) + client = CloudBuildAsyncClient( + credentials=credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -421,7 +432,8 @@ async def test_create_build_flattened_async(): # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. response = await client.create_build( - project_id="project_id_value", build=cloudbuild.Build(id="id_value"), + project_id="project_id_value", + build=cloudbuild.Build(id="id_value"), ) # Establish that the underlying call was made with the expected @@ -436,7 +448,9 @@ async def test_create_build_flattened_async(): @pytest.mark.asyncio async def test_create_build_flattened_error_async(): - client = CloudBuildAsyncClient(credentials=credentials.AnonymousCredentials(),) + client = CloudBuildAsyncClient( + credentials=credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. @@ -450,7 +464,8 @@ async def test_create_build_flattened_error_async(): def test_get_build(transport: str = "grpc"): client = CloudBuildClient( - credentials=credentials.AnonymousCredentials(), transport=transport, + credentials=credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -505,7 +520,8 @@ def test_get_build(transport: str = "grpc"): @pytest.mark.asyncio async def test_get_build_async(transport: str = "grpc_asyncio"): client = CloudBuildAsyncClient( - credentials=credentials.AnonymousCredentials(), transport=transport, + credentials=credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -562,7 +578,9 @@ async def test_get_build_async(transport: str = "grpc_asyncio"): def test_get_build_flattened(): - client = CloudBuildClient(credentials=credentials.AnonymousCredentials(),) + client = CloudBuildClient( + credentials=credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client._transport.get_build), "__call__") as call: @@ -572,7 +590,8 @@ def test_get_build_flattened(): # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. client.get_build( - project_id="project_id_value", id="id_value", + project_id="project_id_value", + id="id_value", ) # Establish that the underlying call was made with the expected @@ -586,19 +605,25 @@ def test_get_build_flattened(): def test_get_build_flattened_error(): - client = CloudBuildClient(credentials=credentials.AnonymousCredentials(),) + client = CloudBuildClient( + credentials=credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): client.get_build( - cloudbuild.GetBuildRequest(), project_id="project_id_value", id="id_value", + cloudbuild.GetBuildRequest(), + project_id="project_id_value", + id="id_value", ) @pytest.mark.asyncio async def test_get_build_flattened_async(): - client = CloudBuildAsyncClient(credentials=credentials.AnonymousCredentials(),) + client = CloudBuildAsyncClient( + credentials=credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -610,7 +635,10 @@ async def test_get_build_flattened_async(): call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cloudbuild.Build()) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.get_build(project_id="project_id_value", id="id_value",) + response = await client.get_build( + project_id="project_id_value", + id="id_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -624,19 +652,24 @@ async def test_get_build_flattened_async(): @pytest.mark.asyncio async def test_get_build_flattened_error_async(): - client = CloudBuildAsyncClient(credentials=credentials.AnonymousCredentials(),) + client = CloudBuildAsyncClient( + credentials=credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): await client.get_build( - cloudbuild.GetBuildRequest(), project_id="project_id_value", id="id_value", + cloudbuild.GetBuildRequest(), + project_id="project_id_value", + id="id_value", ) def test_list_builds(transport: str = "grpc"): client = CloudBuildClient( - credentials=credentials.AnonymousCredentials(), transport=transport, + credentials=credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -667,7 +700,8 @@ def test_list_builds(transport: str = "grpc"): @pytest.mark.asyncio async def test_list_builds_async(transport: str = "grpc_asyncio"): client = CloudBuildAsyncClient( - credentials=credentials.AnonymousCredentials(), transport=transport, + credentials=credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -680,7 +714,9 @@ async def test_list_builds_async(transport: str = "grpc_asyncio"): ) as call: # Designate an appropriate return value for the call. call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - cloudbuild.ListBuildsResponse(next_page_token="next_page_token_value",) + cloudbuild.ListBuildsResponse( + next_page_token="next_page_token_value", + ) ) response = await client.list_builds(request) @@ -698,7 +734,9 @@ async def test_list_builds_async(transport: str = "grpc_asyncio"): def test_list_builds_flattened(): - client = CloudBuildClient(credentials=credentials.AnonymousCredentials(),) + client = CloudBuildClient( + credentials=credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client._transport.list_builds), "__call__") as call: @@ -708,7 +746,8 @@ def test_list_builds_flattened(): # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. client.list_builds( - project_id="project_id_value", filter="filter_value", + project_id="project_id_value", + filter="filter_value", ) # Establish that the underlying call was made with the expected @@ -722,7 +761,9 @@ def test_list_builds_flattened(): def test_list_builds_flattened_error(): - client = CloudBuildClient(credentials=credentials.AnonymousCredentials(),) + client = CloudBuildClient( + credentials=credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. @@ -736,7 +777,9 @@ def test_list_builds_flattened_error(): @pytest.mark.asyncio async def test_list_builds_flattened_async(): - client = CloudBuildAsyncClient(credentials=credentials.AnonymousCredentials(),) + client = CloudBuildAsyncClient( + credentials=credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -751,7 +794,8 @@ async def test_list_builds_flattened_async(): # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. response = await client.list_builds( - project_id="project_id_value", filter="filter_value", + project_id="project_id_value", + filter="filter_value", ) # Establish that the underlying call was made with the expected @@ -766,7 +810,9 @@ async def test_list_builds_flattened_async(): @pytest.mark.asyncio async def test_list_builds_flattened_error_async(): - client = CloudBuildAsyncClient(credentials=credentials.AnonymousCredentials(),) + client = CloudBuildAsyncClient( + credentials=credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. @@ -779,22 +825,37 @@ async def test_list_builds_flattened_error_async(): def test_list_builds_pager(): - client = CloudBuildClient(credentials=credentials.AnonymousCredentials,) + client = CloudBuildClient( + credentials=credentials.AnonymousCredentials, + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client._transport.list_builds), "__call__") as call: # Set the response to a series of pages. call.side_effect = ( cloudbuild.ListBuildsResponse( - builds=[cloudbuild.Build(), cloudbuild.Build(), cloudbuild.Build(),], + builds=[ + cloudbuild.Build(), + cloudbuild.Build(), + cloudbuild.Build(), + ], next_page_token="abc", ), - cloudbuild.ListBuildsResponse(builds=[], next_page_token="def",), cloudbuild.ListBuildsResponse( - builds=[cloudbuild.Build(),], next_page_token="ghi", + builds=[], + next_page_token="def", ), cloudbuild.ListBuildsResponse( - builds=[cloudbuild.Build(), cloudbuild.Build(),], + builds=[ + cloudbuild.Build(), + ], + next_page_token="ghi", + ), + cloudbuild.ListBuildsResponse( + builds=[ + cloudbuild.Build(), + cloudbuild.Build(), + ], ), RuntimeError, ) @@ -810,22 +871,37 @@ def test_list_builds_pager(): def test_list_builds_pages(): - client = CloudBuildClient(credentials=credentials.AnonymousCredentials,) + client = CloudBuildClient( + credentials=credentials.AnonymousCredentials, + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client._transport.list_builds), "__call__") as call: # Set the response to a series of pages. call.side_effect = ( cloudbuild.ListBuildsResponse( - builds=[cloudbuild.Build(), cloudbuild.Build(), cloudbuild.Build(),], + builds=[ + cloudbuild.Build(), + cloudbuild.Build(), + cloudbuild.Build(), + ], next_page_token="abc", ), - cloudbuild.ListBuildsResponse(builds=[], next_page_token="def",), cloudbuild.ListBuildsResponse( - builds=[cloudbuild.Build(),], next_page_token="ghi", + builds=[], + next_page_token="def", ), cloudbuild.ListBuildsResponse( - builds=[cloudbuild.Build(), cloudbuild.Build(),], + builds=[ + cloudbuild.Build(), + ], + next_page_token="ghi", + ), + cloudbuild.ListBuildsResponse( + builds=[ + cloudbuild.Build(), + cloudbuild.Build(), + ], ), RuntimeError, ) @@ -836,7 +912,9 @@ def test_list_builds_pages(): @pytest.mark.asyncio async def test_list_builds_async_pager(): - client = CloudBuildAsyncClient(credentials=credentials.AnonymousCredentials,) + client = CloudBuildAsyncClient( + credentials=credentials.AnonymousCredentials, + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -847,19 +925,34 @@ async def test_list_builds_async_pager(): # Set the response to a series of pages. call.side_effect = ( cloudbuild.ListBuildsResponse( - builds=[cloudbuild.Build(), cloudbuild.Build(), cloudbuild.Build(),], + builds=[ + cloudbuild.Build(), + cloudbuild.Build(), + cloudbuild.Build(), + ], next_page_token="abc", ), - cloudbuild.ListBuildsResponse(builds=[], next_page_token="def",), cloudbuild.ListBuildsResponse( - builds=[cloudbuild.Build(),], next_page_token="ghi", + builds=[], + next_page_token="def", ), cloudbuild.ListBuildsResponse( - builds=[cloudbuild.Build(), cloudbuild.Build(),], + builds=[ + cloudbuild.Build(), + ], + next_page_token="ghi", + ), + cloudbuild.ListBuildsResponse( + builds=[ + cloudbuild.Build(), + cloudbuild.Build(), + ], ), RuntimeError, ) - async_pager = await client.list_builds(request={},) + async_pager = await client.list_builds( + request={}, + ) assert async_pager.next_page_token == "abc" responses = [] async for response in async_pager: @@ -871,7 +964,9 @@ async def test_list_builds_async_pager(): @pytest.mark.asyncio async def test_list_builds_async_pages(): - client = CloudBuildAsyncClient(credentials=credentials.AnonymousCredentials,) + client = CloudBuildAsyncClient( + credentials=credentials.AnonymousCredentials, + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -882,15 +977,28 @@ async def test_list_builds_async_pages(): # Set the response to a series of pages. call.side_effect = ( cloudbuild.ListBuildsResponse( - builds=[cloudbuild.Build(), cloudbuild.Build(), cloudbuild.Build(),], + builds=[ + cloudbuild.Build(), + cloudbuild.Build(), + cloudbuild.Build(), + ], next_page_token="abc", ), - cloudbuild.ListBuildsResponse(builds=[], next_page_token="def",), cloudbuild.ListBuildsResponse( - builds=[cloudbuild.Build(),], next_page_token="ghi", + builds=[], + next_page_token="def", ), cloudbuild.ListBuildsResponse( - builds=[cloudbuild.Build(), cloudbuild.Build(),], + builds=[ + cloudbuild.Build(), + ], + next_page_token="ghi", + ), + cloudbuild.ListBuildsResponse( + builds=[ + cloudbuild.Build(), + cloudbuild.Build(), + ], ), RuntimeError, ) @@ -903,7 +1011,8 @@ async def test_list_builds_async_pages(): def test_cancel_build(transport: str = "grpc"): client = CloudBuildClient( - credentials=credentials.AnonymousCredentials(), transport=transport, + credentials=credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -958,7 +1067,8 @@ def test_cancel_build(transport: str = "grpc"): @pytest.mark.asyncio async def test_cancel_build_async(transport: str = "grpc_asyncio"): client = CloudBuildAsyncClient( - credentials=credentials.AnonymousCredentials(), transport=transport, + credentials=credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1015,7 +1125,9 @@ async def test_cancel_build_async(transport: str = "grpc_asyncio"): def test_cancel_build_flattened(): - client = CloudBuildClient(credentials=credentials.AnonymousCredentials(),) + client = CloudBuildClient( + credentials=credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client._transport.cancel_build), "__call__") as call: @@ -1025,7 +1137,8 @@ def test_cancel_build_flattened(): # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. client.cancel_build( - project_id="project_id_value", id="id_value", + project_id="project_id_value", + id="id_value", ) # Establish that the underlying call was made with the expected @@ -1039,7 +1152,9 @@ def test_cancel_build_flattened(): def test_cancel_build_flattened_error(): - client = CloudBuildClient(credentials=credentials.AnonymousCredentials(),) + client = CloudBuildClient( + credentials=credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. @@ -1053,7 +1168,9 @@ def test_cancel_build_flattened_error(): @pytest.mark.asyncio async def test_cancel_build_flattened_async(): - client = CloudBuildAsyncClient(credentials=credentials.AnonymousCredentials(),) + client = CloudBuildAsyncClient( + credentials=credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1066,7 +1183,8 @@ async def test_cancel_build_flattened_async(): # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. response = await client.cancel_build( - project_id="project_id_value", id="id_value", + project_id="project_id_value", + id="id_value", ) # Establish that the underlying call was made with the expected @@ -1081,7 +1199,9 @@ async def test_cancel_build_flattened_async(): @pytest.mark.asyncio async def test_cancel_build_flattened_error_async(): - client = CloudBuildAsyncClient(credentials=credentials.AnonymousCredentials(),) + client = CloudBuildAsyncClient( + credentials=credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. @@ -1095,7 +1215,8 @@ async def test_cancel_build_flattened_error_async(): def test_retry_build(transport: str = "grpc"): client = CloudBuildClient( - credentials=credentials.AnonymousCredentials(), transport=transport, + credentials=credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1122,7 +1243,8 @@ def test_retry_build(transport: str = "grpc"): @pytest.mark.asyncio async def test_retry_build_async(transport: str = "grpc_asyncio"): client = CloudBuildAsyncClient( - credentials=credentials.AnonymousCredentials(), transport=transport, + credentials=credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1151,7 +1273,9 @@ async def test_retry_build_async(transport: str = "grpc_asyncio"): def test_retry_build_flattened(): - client = CloudBuildClient(credentials=credentials.AnonymousCredentials(),) + client = CloudBuildClient( + credentials=credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client._transport.retry_build), "__call__") as call: @@ -1161,7 +1285,8 @@ def test_retry_build_flattened(): # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. client.retry_build( - project_id="project_id_value", id="id_value", + project_id="project_id_value", + id="id_value", ) # Establish that the underlying call was made with the expected @@ -1175,7 +1300,9 @@ def test_retry_build_flattened(): def test_retry_build_flattened_error(): - client = CloudBuildClient(credentials=credentials.AnonymousCredentials(),) + client = CloudBuildClient( + credentials=credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. @@ -1189,7 +1316,9 @@ def test_retry_build_flattened_error(): @pytest.mark.asyncio async def test_retry_build_flattened_async(): - client = CloudBuildAsyncClient(credentials=credentials.AnonymousCredentials(),) + client = CloudBuildAsyncClient( + credentials=credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1204,7 +1333,8 @@ async def test_retry_build_flattened_async(): # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. response = await client.retry_build( - project_id="project_id_value", id="id_value", + project_id="project_id_value", + id="id_value", ) # Establish that the underlying call was made with the expected @@ -1219,7 +1349,9 @@ async def test_retry_build_flattened_async(): @pytest.mark.asyncio async def test_retry_build_flattened_error_async(): - client = CloudBuildAsyncClient(credentials=credentials.AnonymousCredentials(),) + client = CloudBuildAsyncClient( + credentials=credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. @@ -1233,7 +1365,8 @@ async def test_retry_build_flattened_error_async(): def test_create_build_trigger(transport: str = "grpc"): client = CloudBuildClient( - credentials=credentials.AnonymousCredentials(), transport=transport, + credentials=credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1285,7 +1418,8 @@ def test_create_build_trigger(transport: str = "grpc"): @pytest.mark.asyncio async def test_create_build_trigger_async(transport: str = "grpc_asyncio"): client = CloudBuildAsyncClient( - credentials=credentials.AnonymousCredentials(), transport=transport, + credentials=credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1336,7 +1470,9 @@ async def test_create_build_trigger_async(transport: str = "grpc_asyncio"): def test_create_build_trigger_flattened(): - client = CloudBuildClient(credentials=credentials.AnonymousCredentials(),) + client = CloudBuildClient( + credentials=credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1363,7 +1499,9 @@ def test_create_build_trigger_flattened(): def test_create_build_trigger_flattened_error(): - client = CloudBuildClient(credentials=credentials.AnonymousCredentials(),) + client = CloudBuildClient( + credentials=credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. @@ -1377,7 +1515,9 @@ def test_create_build_trigger_flattened_error(): @pytest.mark.asyncio async def test_create_build_trigger_flattened_async(): - client = CloudBuildAsyncClient(credentials=credentials.AnonymousCredentials(),) + client = CloudBuildAsyncClient( + credentials=credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1408,7 +1548,9 @@ async def test_create_build_trigger_flattened_async(): @pytest.mark.asyncio async def test_create_build_trigger_flattened_error_async(): - client = CloudBuildAsyncClient(credentials=credentials.AnonymousCredentials(),) + client = CloudBuildAsyncClient( + credentials=credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. @@ -1422,7 +1564,8 @@ async def test_create_build_trigger_flattened_error_async(): def test_get_build_trigger(transport: str = "grpc"): client = CloudBuildClient( - credentials=credentials.AnonymousCredentials(), transport=transport, + credentials=credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1474,7 +1617,8 @@ def test_get_build_trigger(transport: str = "grpc"): @pytest.mark.asyncio async def test_get_build_trigger_async(transport: str = "grpc_asyncio"): client = CloudBuildAsyncClient( - credentials=credentials.AnonymousCredentials(), transport=transport, + credentials=credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1525,7 +1669,9 @@ async def test_get_build_trigger_async(transport: str = "grpc_asyncio"): def test_get_build_trigger_flattened(): - client = CloudBuildClient(credentials=credentials.AnonymousCredentials(),) + client = CloudBuildClient( + credentials=credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1537,7 +1683,8 @@ def test_get_build_trigger_flattened(): # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. client.get_build_trigger( - project_id="project_id_value", trigger_id="trigger_id_value", + project_id="project_id_value", + trigger_id="trigger_id_value", ) # Establish that the underlying call was made with the expected @@ -1551,7 +1698,9 @@ def test_get_build_trigger_flattened(): def test_get_build_trigger_flattened_error(): - client = CloudBuildClient(credentials=credentials.AnonymousCredentials(),) + client = CloudBuildClient( + credentials=credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. @@ -1565,7 +1714,9 @@ def test_get_build_trigger_flattened_error(): @pytest.mark.asyncio async def test_get_build_trigger_flattened_async(): - client = CloudBuildAsyncClient(credentials=credentials.AnonymousCredentials(),) + client = CloudBuildAsyncClient( + credentials=credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1580,7 +1731,8 @@ async def test_get_build_trigger_flattened_async(): # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. response = await client.get_build_trigger( - project_id="project_id_value", trigger_id="trigger_id_value", + project_id="project_id_value", + trigger_id="trigger_id_value", ) # Establish that the underlying call was made with the expected @@ -1595,7 +1747,9 @@ async def test_get_build_trigger_flattened_async(): @pytest.mark.asyncio async def test_get_build_trigger_flattened_error_async(): - client = CloudBuildAsyncClient(credentials=credentials.AnonymousCredentials(),) + client = CloudBuildAsyncClient( + credentials=credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. @@ -1609,7 +1763,8 @@ async def test_get_build_trigger_flattened_error_async(): def test_list_build_triggers(transport: str = "grpc"): client = CloudBuildClient( - credentials=credentials.AnonymousCredentials(), transport=transport, + credentials=credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1642,7 +1797,8 @@ def test_list_build_triggers(transport: str = "grpc"): @pytest.mark.asyncio async def test_list_build_triggers_async(transport: str = "grpc_asyncio"): client = CloudBuildAsyncClient( - credentials=credentials.AnonymousCredentials(), transport=transport, + credentials=credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1675,7 +1831,9 @@ async def test_list_build_triggers_async(transport: str = "grpc_asyncio"): def test_list_build_triggers_flattened(): - client = CloudBuildClient(credentials=credentials.AnonymousCredentials(),) + client = CloudBuildClient( + credentials=credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1686,7 +1844,9 @@ def test_list_build_triggers_flattened(): # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.list_build_triggers(project_id="project_id_value",) + client.list_build_triggers( + project_id="project_id_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -1697,19 +1857,24 @@ def test_list_build_triggers_flattened(): def test_list_build_triggers_flattened_error(): - client = CloudBuildClient(credentials=credentials.AnonymousCredentials(),) + client = CloudBuildClient( + credentials=credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): client.list_build_triggers( - cloudbuild.ListBuildTriggersRequest(), project_id="project_id_value", + cloudbuild.ListBuildTriggersRequest(), + project_id="project_id_value", ) @pytest.mark.asyncio async def test_list_build_triggers_flattened_async(): - client = CloudBuildAsyncClient(credentials=credentials.AnonymousCredentials(),) + client = CloudBuildAsyncClient( + credentials=credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1723,7 +1888,9 @@ async def test_list_build_triggers_flattened_async(): ) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.list_build_triggers(project_id="project_id_value",) + response = await client.list_build_triggers( + project_id="project_id_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -1735,18 +1902,23 @@ async def test_list_build_triggers_flattened_async(): @pytest.mark.asyncio async def test_list_build_triggers_flattened_error_async(): - client = CloudBuildAsyncClient(credentials=credentials.AnonymousCredentials(),) + client = CloudBuildAsyncClient( + credentials=credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): await client.list_build_triggers( - cloudbuild.ListBuildTriggersRequest(), project_id="project_id_value", + cloudbuild.ListBuildTriggersRequest(), + project_id="project_id_value", ) def test_list_build_triggers_pager(): - client = CloudBuildClient(credentials=credentials.AnonymousCredentials,) + client = CloudBuildClient( + credentials=credentials.AnonymousCredentials, + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1762,12 +1934,21 @@ def test_list_build_triggers_pager(): ], next_page_token="abc", ), - cloudbuild.ListBuildTriggersResponse(triggers=[], next_page_token="def",), cloudbuild.ListBuildTriggersResponse( - triggers=[cloudbuild.BuildTrigger(),], next_page_token="ghi", + triggers=[], + next_page_token="def", + ), + cloudbuild.ListBuildTriggersResponse( + triggers=[ + cloudbuild.BuildTrigger(), + ], + next_page_token="ghi", ), cloudbuild.ListBuildTriggersResponse( - triggers=[cloudbuild.BuildTrigger(), cloudbuild.BuildTrigger(),], + triggers=[ + cloudbuild.BuildTrigger(), + cloudbuild.BuildTrigger(), + ], ), RuntimeError, ) @@ -1783,7 +1964,9 @@ def test_list_build_triggers_pager(): def test_list_build_triggers_pages(): - client = CloudBuildClient(credentials=credentials.AnonymousCredentials,) + client = CloudBuildClient( + credentials=credentials.AnonymousCredentials, + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1799,12 +1982,21 @@ def test_list_build_triggers_pages(): ], next_page_token="abc", ), - cloudbuild.ListBuildTriggersResponse(triggers=[], next_page_token="def",), cloudbuild.ListBuildTriggersResponse( - triggers=[cloudbuild.BuildTrigger(),], next_page_token="ghi", + triggers=[], + next_page_token="def", ), cloudbuild.ListBuildTriggersResponse( - triggers=[cloudbuild.BuildTrigger(), cloudbuild.BuildTrigger(),], + triggers=[ + cloudbuild.BuildTrigger(), + ], + next_page_token="ghi", + ), + cloudbuild.ListBuildTriggersResponse( + triggers=[ + cloudbuild.BuildTrigger(), + cloudbuild.BuildTrigger(), + ], ), RuntimeError, ) @@ -1815,7 +2007,9 @@ def test_list_build_triggers_pages(): @pytest.mark.asyncio async def test_list_build_triggers_async_pager(): - client = CloudBuildAsyncClient(credentials=credentials.AnonymousCredentials,) + client = CloudBuildAsyncClient( + credentials=credentials.AnonymousCredentials, + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1833,16 +2027,27 @@ async def test_list_build_triggers_async_pager(): ], next_page_token="abc", ), - cloudbuild.ListBuildTriggersResponse(triggers=[], next_page_token="def",), cloudbuild.ListBuildTriggersResponse( - triggers=[cloudbuild.BuildTrigger(),], next_page_token="ghi", + triggers=[], + next_page_token="def", ), cloudbuild.ListBuildTriggersResponse( - triggers=[cloudbuild.BuildTrigger(), cloudbuild.BuildTrigger(),], + triggers=[ + cloudbuild.BuildTrigger(), + ], + next_page_token="ghi", + ), + cloudbuild.ListBuildTriggersResponse( + triggers=[ + cloudbuild.BuildTrigger(), + cloudbuild.BuildTrigger(), + ], ), RuntimeError, ) - async_pager = await client.list_build_triggers(request={},) + async_pager = await client.list_build_triggers( + request={}, + ) assert async_pager.next_page_token == "abc" responses = [] async for response in async_pager: @@ -1854,7 +2059,9 @@ async def test_list_build_triggers_async_pager(): @pytest.mark.asyncio async def test_list_build_triggers_async_pages(): - client = CloudBuildAsyncClient(credentials=credentials.AnonymousCredentials,) + client = CloudBuildAsyncClient( + credentials=credentials.AnonymousCredentials, + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1872,12 +2079,21 @@ async def test_list_build_triggers_async_pages(): ], next_page_token="abc", ), - cloudbuild.ListBuildTriggersResponse(triggers=[], next_page_token="def",), cloudbuild.ListBuildTriggersResponse( - triggers=[cloudbuild.BuildTrigger(),], next_page_token="ghi", + triggers=[], + next_page_token="def", + ), + cloudbuild.ListBuildTriggersResponse( + triggers=[ + cloudbuild.BuildTrigger(), + ], + next_page_token="ghi", ), cloudbuild.ListBuildTriggersResponse( - triggers=[cloudbuild.BuildTrigger(), cloudbuild.BuildTrigger(),], + triggers=[ + cloudbuild.BuildTrigger(), + cloudbuild.BuildTrigger(), + ], ), RuntimeError, ) @@ -1890,7 +2106,8 @@ async def test_list_build_triggers_async_pages(): def test_delete_build_trigger(transport: str = "grpc"): client = CloudBuildClient( - credentials=credentials.AnonymousCredentials(), transport=transport, + credentials=credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1919,7 +2136,8 @@ def test_delete_build_trigger(transport: str = "grpc"): @pytest.mark.asyncio async def test_delete_build_trigger_async(transport: str = "grpc_asyncio"): client = CloudBuildAsyncClient( - credentials=credentials.AnonymousCredentials(), transport=transport, + credentials=credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1946,7 +2164,9 @@ async def test_delete_build_trigger_async(transport: str = "grpc_asyncio"): def test_delete_build_trigger_flattened(): - client = CloudBuildClient(credentials=credentials.AnonymousCredentials(),) + client = CloudBuildClient( + credentials=credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1958,7 +2178,8 @@ def test_delete_build_trigger_flattened(): # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. client.delete_build_trigger( - project_id="project_id_value", trigger_id="trigger_id_value", + project_id="project_id_value", + trigger_id="trigger_id_value", ) # Establish that the underlying call was made with the expected @@ -1972,7 +2193,9 @@ def test_delete_build_trigger_flattened(): def test_delete_build_trigger_flattened_error(): - client = CloudBuildClient(credentials=credentials.AnonymousCredentials(),) + client = CloudBuildClient( + credentials=credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. @@ -1986,7 +2209,9 @@ def test_delete_build_trigger_flattened_error(): @pytest.mark.asyncio async def test_delete_build_trigger_flattened_async(): - client = CloudBuildAsyncClient(credentials=credentials.AnonymousCredentials(),) + client = CloudBuildAsyncClient( + credentials=credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1999,7 +2224,8 @@ async def test_delete_build_trigger_flattened_async(): # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. response = await client.delete_build_trigger( - project_id="project_id_value", trigger_id="trigger_id_value", + project_id="project_id_value", + trigger_id="trigger_id_value", ) # Establish that the underlying call was made with the expected @@ -2014,7 +2240,9 @@ async def test_delete_build_trigger_flattened_async(): @pytest.mark.asyncio async def test_delete_build_trigger_flattened_error_async(): - client = CloudBuildAsyncClient(credentials=credentials.AnonymousCredentials(),) + client = CloudBuildAsyncClient( + credentials=credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. @@ -2028,7 +2256,8 @@ async def test_delete_build_trigger_flattened_error_async(): def test_update_build_trigger(transport: str = "grpc"): client = CloudBuildClient( - credentials=credentials.AnonymousCredentials(), transport=transport, + credentials=credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -2080,7 +2309,8 @@ def test_update_build_trigger(transport: str = "grpc"): @pytest.mark.asyncio async def test_update_build_trigger_async(transport: str = "grpc_asyncio"): client = CloudBuildAsyncClient( - credentials=credentials.AnonymousCredentials(), transport=transport, + credentials=credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -2131,7 +2361,9 @@ async def test_update_build_trigger_async(transport: str = "grpc_asyncio"): def test_update_build_trigger_flattened(): - client = CloudBuildClient(credentials=credentials.AnonymousCredentials(),) + client = CloudBuildClient( + credentials=credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2161,7 +2393,9 @@ def test_update_build_trigger_flattened(): def test_update_build_trigger_flattened_error(): - client = CloudBuildClient(credentials=credentials.AnonymousCredentials(),) + client = CloudBuildClient( + credentials=credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. @@ -2176,7 +2410,9 @@ def test_update_build_trigger_flattened_error(): @pytest.mark.asyncio async def test_update_build_trigger_flattened_async(): - client = CloudBuildAsyncClient(credentials=credentials.AnonymousCredentials(),) + client = CloudBuildAsyncClient( + credentials=credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2210,7 +2446,9 @@ async def test_update_build_trigger_flattened_async(): @pytest.mark.asyncio async def test_update_build_trigger_flattened_error_async(): - client = CloudBuildAsyncClient(credentials=credentials.AnonymousCredentials(),) + client = CloudBuildAsyncClient( + credentials=credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. @@ -2225,7 +2463,8 @@ async def test_update_build_trigger_flattened_error_async(): def test_run_build_trigger(transport: str = "grpc"): client = CloudBuildClient( - credentials=credentials.AnonymousCredentials(), transport=transport, + credentials=credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -2254,7 +2493,8 @@ def test_run_build_trigger(transport: str = "grpc"): @pytest.mark.asyncio async def test_run_build_trigger_async(transport: str = "grpc_asyncio"): client = CloudBuildAsyncClient( - credentials=credentials.AnonymousCredentials(), transport=transport, + credentials=credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -2283,7 +2523,9 @@ async def test_run_build_trigger_async(transport: str = "grpc_asyncio"): def test_run_build_trigger_flattened(): - client = CloudBuildClient(credentials=credentials.AnonymousCredentials(),) + client = CloudBuildClient( + credentials=credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2313,7 +2555,9 @@ def test_run_build_trigger_flattened(): def test_run_build_trigger_flattened_error(): - client = CloudBuildClient(credentials=credentials.AnonymousCredentials(),) + client = CloudBuildClient( + credentials=credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. @@ -2328,7 +2572,9 @@ def test_run_build_trigger_flattened_error(): @pytest.mark.asyncio async def test_run_build_trigger_flattened_async(): - client = CloudBuildAsyncClient(credentials=credentials.AnonymousCredentials(),) + client = CloudBuildAsyncClient( + credentials=credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2362,7 +2608,9 @@ async def test_run_build_trigger_flattened_async(): @pytest.mark.asyncio async def test_run_build_trigger_flattened_error_async(): - client = CloudBuildAsyncClient(credentials=credentials.AnonymousCredentials(),) + client = CloudBuildAsyncClient( + credentials=credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. @@ -2377,7 +2625,8 @@ async def test_run_build_trigger_flattened_error_async(): def test_create_worker_pool(transport: str = "grpc"): client = CloudBuildClient( - credentials=credentials.AnonymousCredentials(), transport=transport, + credentials=credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -2425,7 +2674,8 @@ def test_create_worker_pool(transport: str = "grpc"): @pytest.mark.asyncio async def test_create_worker_pool_async(transport: str = "grpc_asyncio"): client = CloudBuildAsyncClient( - credentials=credentials.AnonymousCredentials(), transport=transport, + credentials=credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -2474,7 +2724,8 @@ async def test_create_worker_pool_async(transport: str = "grpc_asyncio"): def test_get_worker_pool(transport: str = "grpc"): client = CloudBuildClient( - credentials=credentials.AnonymousCredentials(), transport=transport, + credentials=credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -2520,7 +2771,8 @@ def test_get_worker_pool(transport: str = "grpc"): @pytest.mark.asyncio async def test_get_worker_pool_async(transport: str = "grpc_asyncio"): client = CloudBuildAsyncClient( - credentials=credentials.AnonymousCredentials(), transport=transport, + credentials=credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -2569,7 +2821,8 @@ async def test_get_worker_pool_async(transport: str = "grpc_asyncio"): def test_delete_worker_pool(transport: str = "grpc"): client = CloudBuildClient( - credentials=credentials.AnonymousCredentials(), transport=transport, + credentials=credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -2598,7 +2851,8 @@ def test_delete_worker_pool(transport: str = "grpc"): @pytest.mark.asyncio async def test_delete_worker_pool_async(transport: str = "grpc_asyncio"): client = CloudBuildAsyncClient( - credentials=credentials.AnonymousCredentials(), transport=transport, + credentials=credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -2626,7 +2880,8 @@ async def test_delete_worker_pool_async(transport: str = "grpc_asyncio"): def test_update_worker_pool(transport: str = "grpc"): client = CloudBuildClient( - credentials=credentials.AnonymousCredentials(), transport=transport, + credentials=credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -2674,7 +2929,8 @@ def test_update_worker_pool(transport: str = "grpc"): @pytest.mark.asyncio async def test_update_worker_pool_async(transport: str = "grpc_asyncio"): client = CloudBuildAsyncClient( - credentials=credentials.AnonymousCredentials(), transport=transport, + credentials=credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -2723,7 +2979,8 @@ async def test_update_worker_pool_async(transport: str = "grpc_asyncio"): def test_list_worker_pools(transport: str = "grpc"): client = CloudBuildClient( - credentials=credentials.AnonymousCredentials(), transport=transport, + credentials=credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -2752,7 +3009,8 @@ def test_list_worker_pools(transport: str = "grpc"): @pytest.mark.asyncio async def test_list_worker_pools_async(transport: str = "grpc_asyncio"): client = CloudBuildAsyncClient( - credentials=credentials.AnonymousCredentials(), transport=transport, + credentials=credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -2787,7 +3045,8 @@ def test_credentials_transport_error(): ) with pytest.raises(ValueError): client = CloudBuildClient( - credentials=credentials.AnonymousCredentials(), transport=transport, + credentials=credentials.AnonymousCredentials(), + transport=transport, ) # It is an error to provide a credentials file and a transport instance. @@ -2806,7 +3065,8 @@ def test_credentials_transport_error(): ) with pytest.raises(ValueError): client = CloudBuildClient( - client_options={"scopes": ["1", "2"]}, transport=transport, + client_options={"scopes": ["1", "2"]}, + transport=transport, ) @@ -2836,8 +3096,13 @@ def test_transport_get_channel(): def test_transport_grpc_default(): # A client should use the gRPC transport by default. - client = CloudBuildClient(credentials=credentials.AnonymousCredentials(),) - assert isinstance(client._transport, transports.CloudBuildGrpcTransport,) + client = CloudBuildClient( + credentials=credentials.AnonymousCredentials(), + ) + assert isinstance( + client._transport, + transports.CloudBuildGrpcTransport, + ) def test_cloud_build_base_transport_error(): @@ -2889,7 +3154,9 @@ def test_cloud_build_base_transport_with_credentials_file(): # Instantiate the base transport with a credentials file with mock.patch.object(auth, "load_credentials_from_file") as load_creds: load_creds.return_value = (credentials.AnonymousCredentials(), None) - transport = transports.CloudBuildTransport(credentials_file="credentials.json",) + transport = transports.CloudBuildTransport( + credentials_file="credentials.json", + ) load_creds.assert_called_once_with( "credentials.json", scopes=("https://www.googleapis.com/auth/cloud-platform",), @@ -3113,12 +3380,16 @@ def test_cloud_build_grpc_asyncio_transport_channel_mtls_with_adc( def test_cloud_build_grpc_lro_client(): client = CloudBuildClient( - credentials=credentials.AnonymousCredentials(), transport="grpc", + credentials=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 @@ -3126,12 +3397,16 @@ def test_cloud_build_grpc_lro_client(): def test_cloud_build_grpc_lro_async_client(): client = CloudBuildAsyncClient( - credentials=credentials.AnonymousCredentials(), transport="grpc_asyncio", + credentials=credentials.AnonymousCredentials(), + transport="grpc_asyncio", ) transport = client._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