From b1797ac5087787113c724f6051a127515fea0bdc 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:58:27 +0000 Subject: [PATCH] chore(python): use black==22.3.0 (#154) Source-Link: https://github.com/googleapis/synthtool/commit/6fab84af09f2cf89a031fd8671d1def6b2931b11 Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-python:latest@sha256:7cffbc10910c3ab1b852c05114a08d374c195a81cdec1d4a67a1d129331d0bfe --- packages/grafeas/.github/.OwlBot.lock.yaml | 3 +- packages/grafeas/docs/conf.py | 23 +- .../services/grafeas/async_client.py | 121 ++- .../grafeas_v1/services/grafeas/client.py | 188 +++- .../services/grafeas/transports/base.py | 30 +- .../services/grafeas/transports/grpc.py | 3 +- .../grafeas/grafeas_v1/types/attestation.py | 40 +- .../grafeas/grafeas/grafeas_v1/types/build.py | 28 +- .../grafeas/grafeas_v1/types/common.py | 52 +- .../grafeas/grafeas_v1/types/compliance.py | 83 +- .../grafeas/grafeas/grafeas_v1/types/cvss.py | 140 ++- .../grafeas/grafeas_v1/types/deployment.py | 47 +- .../grafeas/grafeas_v1/types/discovery.py | 41 +- .../grafeas_v1/types/dsse_attestation.py | 22 +- .../grafeas/grafeas_v1/types/grafeas.py | 360 ++++++-- .../grafeas/grafeas/grafeas_v1/types/image.py | 65 +- .../grafeas_v1/types/intoto_provenance.py | 94 +- .../grafeas_v1/types/intoto_statement.py | 33 +- .../grafeas/grafeas_v1/types/package.py | 99 +- .../grafeas/grafeas_v1/types/provenance.py | 254 +++++- .../grafeas/grafeas_v1/types/severity.py | 7 +- .../grafeas_v1/types/slsa_provenance.py | 111 ++- .../grafeas/grafeas_v1/types/upgrade.py | 120 ++- .../grafeas/grafeas_v1/types/vulnerability.py | 227 ++++- packages/grafeas/noxfile.py | 9 +- .../unit/gapic/grafeas_v1/test_grafeas.py | 861 ++++++++++++++---- 26 files changed, 2454 insertions(+), 607 deletions(-) diff --git a/packages/grafeas/.github/.OwlBot.lock.yaml b/packages/grafeas/.github/.OwlBot.lock.yaml index b668c04d5d65..87dd00611576 100644 --- a/packages/grafeas/.github/.OwlBot.lock.yaml +++ b/packages/grafeas/.github/.OwlBot.lock.yaml @@ -13,5 +13,4 @@ # limitations under the License. docker: image: gcr.io/cloud-devrel-public-resources/owlbot-python:latest - digest: sha256:ed1f9983d5a935a89fe8085e8bb97d94e41015252c5b6c9771257cf8624367e6 - + digest: sha256:7cffbc10910c3ab1b852c05114a08d374c195a81cdec1d4a67a1d129331d0bfe diff --git a/packages/grafeas/docs/conf.py b/packages/grafeas/docs/conf.py index 9b541166ffb2..7ab9f1a4e97b 100644 --- a/packages/grafeas/docs/conf.py +++ b/packages/grafeas/docs/conf.py @@ -279,7 +279,13 @@ # (source start file, target name, title, # author, documentclass [howto, manual, or own class]). latex_documents = [ - (root_doc, "grafeas.tex", "grafeas Documentation", author, "manual",) + ( + root_doc, + "grafeas.tex", + "grafeas Documentation", + author, + "manual", + ) ] # The name of an image file (relative to this directory) to place at the top of @@ -307,7 +313,15 @@ # One entry per manual page. List of tuples # (source start file, name, description, authors, manual section). -man_pages = [(root_doc, "grafeas", "grafeas Documentation", [author], 1,)] +man_pages = [ + ( + root_doc, + "grafeas", + "grafeas Documentation", + [author], + 1, + ) +] # If true, show URL addresses after external links. # man_show_urls = False @@ -347,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/packages/grafeas/grafeas/grafeas_v1/services/grafeas/async_client.py b/packages/grafeas/grafeas/grafeas_v1/services/grafeas/async_client.py index 0db742a5df26..29fc5c05e772 100644 --- a/packages/grafeas/grafeas/grafeas_v1/services/grafeas/async_client.py +++ b/packages/grafeas/grafeas/grafeas_v1/services/grafeas/async_client.py @@ -124,7 +124,9 @@ def transport(self) -> GrafeasTransport: ) def __init__( - self, *, transport: Union[str, GrafeasTransport] = "grpc_asyncio", + self, + *, + transport: Union[str, GrafeasTransport] = "grpc_asyncio", ) -> None: """Instantiate the grafeas client. @@ -137,7 +139,9 @@ def __init__( creation failed for any reason. """ - self._client = GrafeasClient(transport=transport,) + self._client = GrafeasClient( + transport=transport, + ) async def get_occurrence( self, @@ -233,7 +237,12 @@ def sample_get_occurrence(): ) # 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 @@ -343,12 +352,20 @@ def sample_list_occurrences(): ) # 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.ListOccurrencesAsyncPager( - method=rpc, request=request, response=response, metadata=metadata, + method=rpc, + request=request, + response=response, + metadata=metadata, ) # Done; return the response. @@ -443,7 +460,10 @@ def sample_delete_occurrence(): # Send the request. await rpc( - request, retry=retry, timeout=timeout, metadata=metadata, + request, + retry=retry, + timeout=timeout, + metadata=metadata, ) async def create_occurrence( @@ -539,7 +559,12 @@ def sample_create_occurrence(): ) # 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 @@ -640,7 +665,12 @@ def sample_batch_create_occurrences(): ) # 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 @@ -745,7 +775,12 @@ def sample_update_occurrence(): ) # 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 @@ -848,7 +883,12 @@ def sample_get_occurrence_note(): ) # 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 @@ -947,7 +987,12 @@ def sample_get_note(): ) # 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 @@ -1057,12 +1102,20 @@ def sample_list_notes(): ) # 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.ListNotesAsyncPager( - method=rpc, request=request, response=response, metadata=metadata, + method=rpc, + request=request, + response=response, + metadata=metadata, ) # Done; return the response. @@ -1154,7 +1207,10 @@ def sample_delete_note(): # Send the request. await rpc( - request, retry=retry, timeout=timeout, metadata=metadata, + request, + retry=retry, + timeout=timeout, + metadata=metadata, ) async def create_note( @@ -1259,7 +1315,12 @@ def sample_create_note(): ) # 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 @@ -1358,7 +1419,12 @@ def sample_batch_create_notes(): ) # 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 @@ -1463,7 +1529,12 @@ def sample_update_note(): ) # 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 @@ -1579,12 +1650,20 @@ def sample_list_note_occurrences(): ) # 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.ListNoteOccurrencesAsyncPager( - method=rpc, request=request, response=response, metadata=metadata, + method=rpc, + request=request, + response=response, + metadata=metadata, ) # Done; return the response. @@ -1599,7 +1678,9 @@ async def __aexit__(self, exc_type, exc, tb): try: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution("grafeas",).version, + gapic_version=pkg_resources.get_distribution( + "grafeas", + ).version, ) except pkg_resources.DistributionNotFound: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() diff --git a/packages/grafeas/grafeas/grafeas_v1/services/grafeas/client.py b/packages/grafeas/grafeas/grafeas_v1/services/grafeas/client.py index 68f0a88c7387..04b7c2927203 100644 --- a/packages/grafeas/grafeas/grafeas_v1/services/grafeas/client.py +++ b/packages/grafeas/grafeas/grafeas_v1/services/grafeas/client.py @@ -66,7 +66,10 @@ class GrafeasClientMeta(type): _transport_registry["grpc"] = GrafeasGrpcTransport _transport_registry["grpc_asyncio"] = GrafeasGrpcAsyncIOTransport - def get_transport_class(cls, label: str = None,) -> Type[GrafeasTransport]: + def get_transport_class( + cls, + label: str = None, + ) -> Type[GrafeasTransport]: """Returns an appropriate transport class. Args: @@ -162,9 +165,15 @@ def transport(self) -> GrafeasTransport: return self._transport @staticmethod - def note_path(project: str, note: str,) -> str: + def note_path( + project: str, + note: str, + ) -> str: """Returns a fully-qualified note string.""" - return "projects/{project}/notes/{note}".format(project=project, note=note,) + return "projects/{project}/notes/{note}".format( + project=project, + note=note, + ) @staticmethod def parse_note_path(path: str) -> Dict[str, str]: @@ -173,10 +182,14 @@ def parse_note_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def occurrence_path(project: str, occurrence: str,) -> str: + def occurrence_path( + project: str, + occurrence: str, + ) -> str: """Returns a fully-qualified occurrence string.""" return "projects/{project}/occurrences/{occurrence}".format( - project=project, occurrence=occurrence, + project=project, + occurrence=occurrence, ) @staticmethod @@ -188,9 +201,13 @@ def parse_occurrence_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def project_path(project: str,) -> str: + def 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_project_path(path: str) -> Dict[str, str]: @@ -199,7 +216,9 @@ def parse_project_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, @@ -212,9 +231,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]: @@ -223,9 +246,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]: @@ -234,9 +261,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]: @@ -245,10 +276,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 @@ -257,13 +292,17 @@ def parse_common_location_path(path: str) -> Dict[str, str]: m = re.match(r"^projects/(?P.+?)/locations/(?P.+?)$", path) return m.groupdict() if m else {} - def __init__(self, *, transport: Union[str, GrafeasTransport] = None,) -> None: + def __init__( + self, + *, + transport: Union[str, GrafeasTransport] = None, + ) -> None: """Instantiate the grafeas client. Args: transport (Union[str, ~.GrafeasTransport]): The transport to use. - + Raises: google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport @@ -360,7 +399,12 @@ def sample_get_occurrence(): ) # 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 @@ -460,12 +504,20 @@ def sample_list_occurrences(): ) # 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.ListOccurrencesPager( - method=rpc, request=request, response=response, metadata=metadata, + method=rpc, + request=request, + response=response, + metadata=metadata, ) # Done; return the response. @@ -550,7 +602,10 @@ def sample_delete_occurrence(): # Send the request. rpc( - request, retry=retry, timeout=timeout, metadata=metadata, + request, + retry=retry, + timeout=timeout, + metadata=metadata, ) def create_occurrence( @@ -646,7 +701,12 @@ def sample_create_occurrence(): ) # 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 @@ -747,7 +807,12 @@ def sample_batch_create_occurrences(): ) # 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 @@ -852,7 +917,12 @@ def sample_update_occurrence(): ) # 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 @@ -945,7 +1015,12 @@ def sample_get_occurrence_note(): ) # 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 @@ -1034,7 +1109,12 @@ def sample_get_note(): ) # 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 @@ -1134,12 +1214,20 @@ def sample_list_notes(): ) # 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.ListNotesPager( - method=rpc, request=request, response=response, metadata=metadata, + method=rpc, + request=request, + response=response, + metadata=metadata, ) # Done; return the response. @@ -1221,7 +1309,10 @@ def sample_delete_note(): # Send the request. rpc( - request, retry=retry, timeout=timeout, metadata=metadata, + request, + retry=retry, + timeout=timeout, + metadata=metadata, ) def create_note( @@ -1326,7 +1417,12 @@ def sample_create_note(): ) # 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 @@ -1424,7 +1520,12 @@ def sample_batch_create_notes(): ) # 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 @@ -1529,7 +1630,12 @@ def sample_update_note(): ) # 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 @@ -1635,12 +1741,20 @@ def sample_list_note_occurrences(): ) # 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.ListNoteOccurrencesPager( - method=rpc, request=request, response=response, metadata=metadata, + method=rpc, + request=request, + response=response, + metadata=metadata, ) # Done; return the response. @@ -1662,7 +1776,9 @@ def __exit__(self, type, value, traceback): try: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution("grafeas",).version, + gapic_version=pkg_resources.get_distribution( + "grafeas", + ).version, ) except pkg_resources.DistributionNotFound: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() diff --git a/packages/grafeas/grafeas/grafeas_v1/services/grafeas/transports/base.py b/packages/grafeas/grafeas/grafeas_v1/services/grafeas/transports/base.py index b98e5733d616..1bc965f9aac1 100644 --- a/packages/grafeas/grafeas/grafeas_v1/services/grafeas/transports/base.py +++ b/packages/grafeas/grafeas/grafeas_v1/services/grafeas/transports/base.py @@ -30,7 +30,9 @@ try: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution("grafeas",).version, + gapic_version=pkg_resources.get_distribution( + "grafeas", + ).version, ) except pkg_resources.DistributionNotFound: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() @@ -165,7 +167,9 @@ def _prep_wrapped_messages(self, client_info): client_info=client_info, ), self.create_occurrence: gapic_v1.method.wrap_method( - self.create_occurrence, default_timeout=30.0, client_info=client_info, + self.create_occurrence, + default_timeout=30.0, + client_info=client_info, ), self.batch_create_occurrences: gapic_v1.method.wrap_method( self.batch_create_occurrences, @@ -173,7 +177,9 @@ def _prep_wrapped_messages(self, client_info): client_info=client_info, ), self.update_occurrence: gapic_v1.method.wrap_method( - self.update_occurrence, default_timeout=30.0, client_info=client_info, + self.update_occurrence, + default_timeout=30.0, + client_info=client_info, ), self.get_occurrence_note: gapic_v1.method.wrap_method( self.get_occurrence_note, @@ -236,13 +242,19 @@ def _prep_wrapped_messages(self, client_info): client_info=client_info, ), self.create_note: gapic_v1.method.wrap_method( - self.create_note, default_timeout=30.0, client_info=client_info, + self.create_note, + default_timeout=30.0, + client_info=client_info, ), self.batch_create_notes: gapic_v1.method.wrap_method( - self.batch_create_notes, default_timeout=30.0, client_info=client_info, + self.batch_create_notes, + default_timeout=30.0, + client_info=client_info, ), self.update_note: gapic_v1.method.wrap_method( - self.update_note, default_timeout=30.0, client_info=client_info, + self.update_note, + default_timeout=30.0, + client_info=client_info, ), self.list_note_occurrences: gapic_v1.method.wrap_method( self.list_note_occurrences, @@ -264,9 +276,9 @@ def _prep_wrapped_messages(self, 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/packages/grafeas/grafeas/grafeas_v1/services/grafeas/transports/grpc.py b/packages/grafeas/grafeas/grafeas_v1/services/grafeas/transports/grpc.py index 4924e605d332..cd4ae6871a4f 100644 --- a/packages/grafeas/grafeas/grafeas_v1/services/grafeas/transports/grpc.py +++ b/packages/grafeas/grafeas/grafeas_v1/services/grafeas/transports/grpc.py @@ -240,8 +240,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/packages/grafeas/grafeas/grafeas_v1/types/attestation.py b/packages/grafeas/grafeas/grafeas_v1/types/attestation.py index 7470f7981cb6..403bf2243ff5 100644 --- a/packages/grafeas/grafeas/grafeas_v1/types/attestation.py +++ b/packages/grafeas/grafeas/grafeas_v1/types/attestation.py @@ -19,7 +19,12 @@ __protobuf__ = proto.module( - package="grafeas.v1", manifest={"AttestationNote", "Jwt", "AttestationOccurrence",}, + package="grafeas.v1", + manifest={ + "AttestationNote", + "Jwt", + "AttestationOccurrence", + }, ) @@ -56,9 +61,16 @@ class Hint(proto.Message): attestation authority, for example "qa". """ - human_readable_name = proto.Field(proto.STRING, number=1,) + human_readable_name = proto.Field( + proto.STRING, + number=1, + ) - hint = proto.Field(proto.MESSAGE, number=1, message=Hint,) + hint = proto.Field( + proto.MESSAGE, + number=1, + message=Hint, + ) class Jwt(proto.Message): @@ -72,7 +84,10 @@ class Jwt(proto.Message): https://tools.ietf.org/html/rfc7515.html#section-3.1 """ - compact_jwt = proto.Field(proto.STRING, number=1,) + compact_jwt = proto.Field( + proto.STRING, + number=1, + ) class AttestationOccurrence(proto.Message): @@ -109,9 +124,20 @@ class AttestationOccurrence(proto.Message): Grafeas. """ - serialized_payload = proto.Field(proto.BYTES, number=1,) - signatures = proto.RepeatedField(proto.MESSAGE, number=2, message=common.Signature,) - jwts = proto.RepeatedField(proto.MESSAGE, number=3, message="Jwt",) + serialized_payload = proto.Field( + proto.BYTES, + number=1, + ) + signatures = proto.RepeatedField( + proto.MESSAGE, + number=2, + message=common.Signature, + ) + jwts = proto.RepeatedField( + proto.MESSAGE, + number=3, + message="Jwt", + ) __all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/packages/grafeas/grafeas/grafeas_v1/types/build.py b/packages/grafeas/grafeas/grafeas_v1/types/build.py index dbd4ccc4d025..bf10a9d2ce51 100644 --- a/packages/grafeas/grafeas/grafeas_v1/types/build.py +++ b/packages/grafeas/grafeas/grafeas_v1/types/build.py @@ -21,7 +21,11 @@ __protobuf__ = proto.module( - package="grafeas.v1", manifest={"BuildNote", "BuildOccurrence",}, + package="grafeas.v1", + manifest={ + "BuildNote", + "BuildOccurrence", + }, ) @@ -36,7 +40,10 @@ class BuildNote(proto.Message): which produced this build. """ - builder_version = proto.Field(proto.STRING, number=1,) + builder_version = proto.Field( + proto.STRING, + number=1, + ) class BuildOccurrence(proto.Message): @@ -70,14 +77,23 @@ class BuildOccurrence(proto.Message): """ provenance = proto.Field( - proto.MESSAGE, number=1, message=g_provenance.BuildProvenance, + proto.MESSAGE, + number=1, + message=g_provenance.BuildProvenance, + ) + provenance_bytes = proto.Field( + proto.STRING, + number=2, ) - provenance_bytes = proto.Field(proto.STRING, number=2,) intoto_provenance = proto.Field( - proto.MESSAGE, number=3, message=g_intoto_provenance.InTotoProvenance, + proto.MESSAGE, + number=3, + message=g_intoto_provenance.InTotoProvenance, ) intoto_statement = proto.Field( - proto.MESSAGE, number=4, message=g_intoto_statement.InTotoStatement, + proto.MESSAGE, + number=4, + message=g_intoto_statement.InTotoStatement, ) diff --git a/packages/grafeas/grafeas/grafeas_v1/types/common.py b/packages/grafeas/grafeas/grafeas_v1/types/common.py index 63c4ded3465d..c432e4106550 100644 --- a/packages/grafeas/grafeas/grafeas_v1/types/common.py +++ b/packages/grafeas/grafeas/grafeas_v1/types/common.py @@ -18,7 +18,13 @@ __protobuf__ = proto.module( package="grafeas.v1", - manifest={"NoteKind", "RelatedUrl", "Signature", "Envelope", "EnvelopeSignature",}, + manifest={ + "NoteKind", + "RelatedUrl", + "Signature", + "Envelope", + "EnvelopeSignature", + }, ) @@ -47,8 +53,14 @@ class RelatedUrl(proto.Message): Label to describe usage of the URL. """ - url = proto.Field(proto.STRING, number=1,) - label = proto.Field(proto.STRING, number=2,) + url = proto.Field( + proto.STRING, + number=1, + ) + label = proto.Field( + proto.STRING, + number=2, + ) class Signature(proto.Message): @@ -114,8 +126,14 @@ class Signature(proto.Message): - "nih:///sha-256;703f68f42aba2c6de30f488a5ea122fef76324679c9bf89791ba95a1271589a5". """ - signature = proto.Field(proto.BYTES, number=1,) - public_key_id = proto.Field(proto.STRING, number=2,) + signature = proto.Field( + proto.BYTES, + number=1, + ) + public_key_id = proto.Field( + proto.STRING, + number=2, + ) class Envelope(proto.Message): @@ -132,10 +150,18 @@ class Envelope(proto.Message): """ - payload = proto.Field(proto.BYTES, number=1,) - payload_type = proto.Field(proto.STRING, number=2,) + payload = proto.Field( + proto.BYTES, + number=1, + ) + payload_type = proto.Field( + proto.STRING, + number=2, + ) signatures = proto.RepeatedField( - proto.MESSAGE, number=3, message="EnvelopeSignature", + proto.MESSAGE, + number=3, + message="EnvelopeSignature", ) @@ -149,8 +175,14 @@ class EnvelopeSignature(proto.Message): """ - sig = proto.Field(proto.BYTES, number=1,) - keyid = proto.Field(proto.STRING, number=2,) + sig = proto.Field( + proto.BYTES, + number=1, + ) + keyid = proto.Field( + proto.STRING, + number=2, + ) __all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/packages/grafeas/grafeas/grafeas_v1/types/compliance.py b/packages/grafeas/grafeas/grafeas_v1/types/compliance.py index 8299bc89cd6e..031f09b9a290 100644 --- a/packages/grafeas/grafeas/grafeas_v1/types/compliance.py +++ b/packages/grafeas/grafeas/grafeas_v1/types/compliance.py @@ -67,18 +67,47 @@ class CisBenchmark(proto.Message): """ - profile_level = proto.Field(proto.INT32, number=1,) - severity = proto.Field(proto.ENUM, number=2, enum=g_severity.Severity,) - - title = proto.Field(proto.STRING, number=1,) - description = proto.Field(proto.STRING, number=2,) - version = proto.RepeatedField(proto.MESSAGE, number=3, message="ComplianceVersion",) - rationale = proto.Field(proto.STRING, number=4,) - remediation = proto.Field(proto.STRING, number=5,) + profile_level = proto.Field( + proto.INT32, + number=1, + ) + severity = proto.Field( + proto.ENUM, + number=2, + enum=g_severity.Severity, + ) + + title = proto.Field( + proto.STRING, + number=1, + ) + description = proto.Field( + proto.STRING, + number=2, + ) + version = proto.RepeatedField( + proto.MESSAGE, + number=3, + message="ComplianceVersion", + ) + rationale = proto.Field( + proto.STRING, + number=4, + ) + remediation = proto.Field( + proto.STRING, + number=5, + ) cis_benchmark = proto.Field( - proto.MESSAGE, number=6, oneof="compliance_type", message=CisBenchmark, + proto.MESSAGE, + number=6, + oneof="compliance_type", + message=CisBenchmark, + ) + scan_instructions = proto.Field( + proto.BYTES, + number=7, ) - scan_instructions = proto.Field(proto.BYTES, number=7,) class ComplianceVersion(proto.Message): @@ -96,8 +125,14 @@ class ComplianceVersion(proto.Message): benchmark is defined in. """ - cpe_uri = proto.Field(proto.STRING, number=1,) - version = proto.Field(proto.STRING, number=2,) + cpe_uri = proto.Field( + proto.STRING, + number=1, + ) + version = proto.Field( + proto.STRING, + number=2, + ) class ComplianceOccurrence(proto.Message): @@ -113,9 +148,14 @@ class ComplianceOccurrence(proto.Message): """ non_compliant_files = proto.RepeatedField( - proto.MESSAGE, number=2, message="NonCompliantFile", + proto.MESSAGE, + number=2, + message="NonCompliantFile", + ) + non_compliance_reason = proto.Field( + proto.STRING, + number=3, ) - non_compliance_reason = proto.Field(proto.STRING, number=3,) class NonCompliantFile(proto.Message): @@ -131,9 +171,18 @@ class NonCompliantFile(proto.Message): CIS check. """ - path = proto.Field(proto.STRING, number=1,) - display_command = proto.Field(proto.STRING, number=2,) - reason = proto.Field(proto.STRING, number=3,) + path = proto.Field( + proto.STRING, + number=1, + ) + display_command = proto.Field( + proto.STRING, + number=2, + ) + reason = proto.Field( + proto.STRING, + number=3, + ) __all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/packages/grafeas/grafeas/grafeas_v1/types/cvss.py b/packages/grafeas/grafeas/grafeas_v1/types/cvss.py index fb110b7d20e5..f04d57c540a5 100644 --- a/packages/grafeas/grafeas/grafeas_v1/types/cvss.py +++ b/packages/grafeas/grafeas/grafeas_v1/types/cvss.py @@ -16,7 +16,13 @@ import proto # type: ignore -__protobuf__ = proto.module(package="grafeas.v1", manifest={"CVSSv3", "CVSS",},) +__protobuf__ = proto.module( + package="grafeas.v1", + manifest={ + "CVSSv3", + "CVSS", + }, +) class CVSSv3(proto.Message): @@ -93,17 +99,58 @@ class Impact(proto.Enum): IMPACT_LOW = 2 IMPACT_NONE = 3 - base_score = proto.Field(proto.FLOAT, number=1,) - exploitability_score = proto.Field(proto.FLOAT, number=2,) - impact_score = proto.Field(proto.FLOAT, number=3,) - attack_vector = proto.Field(proto.ENUM, number=5, enum=AttackVector,) - attack_complexity = proto.Field(proto.ENUM, number=6, enum=AttackComplexity,) - privileges_required = proto.Field(proto.ENUM, number=7, enum=PrivilegesRequired,) - user_interaction = proto.Field(proto.ENUM, number=8, enum=UserInteraction,) - scope = proto.Field(proto.ENUM, number=9, enum=Scope,) - confidentiality_impact = proto.Field(proto.ENUM, number=10, enum=Impact,) - integrity_impact = proto.Field(proto.ENUM, number=11, enum=Impact,) - availability_impact = proto.Field(proto.ENUM, number=12, enum=Impact,) + base_score = proto.Field( + proto.FLOAT, + number=1, + ) + exploitability_score = proto.Field( + proto.FLOAT, + number=2, + ) + impact_score = proto.Field( + proto.FLOAT, + number=3, + ) + attack_vector = proto.Field( + proto.ENUM, + number=5, + enum=AttackVector, + ) + attack_complexity = proto.Field( + proto.ENUM, + number=6, + enum=AttackComplexity, + ) + privileges_required = proto.Field( + proto.ENUM, + number=7, + enum=PrivilegesRequired, + ) + user_interaction = proto.Field( + proto.ENUM, + number=8, + enum=UserInteraction, + ) + scope = proto.Field( + proto.ENUM, + number=9, + enum=Scope, + ) + confidentiality_impact = proto.Field( + proto.ENUM, + number=10, + enum=Impact, + ) + integrity_impact = proto.Field( + proto.ENUM, + number=11, + enum=Impact, + ) + availability_impact = proto.Field( + proto.ENUM, + number=12, + enum=Impact, + ) class CVSS(proto.Message): @@ -193,18 +240,63 @@ class Impact(proto.Enum): IMPACT_LOW = 2 IMPACT_NONE = 3 - base_score = proto.Field(proto.FLOAT, number=1,) - exploitability_score = proto.Field(proto.FLOAT, number=2,) - impact_score = proto.Field(proto.FLOAT, number=3,) - attack_vector = proto.Field(proto.ENUM, number=4, enum=AttackVector,) - attack_complexity = proto.Field(proto.ENUM, number=5, enum=AttackComplexity,) - authentication = proto.Field(proto.ENUM, number=6, enum=Authentication,) - privileges_required = proto.Field(proto.ENUM, number=7, enum=PrivilegesRequired,) - user_interaction = proto.Field(proto.ENUM, number=8, enum=UserInteraction,) - scope = proto.Field(proto.ENUM, number=9, enum=Scope,) - confidentiality_impact = proto.Field(proto.ENUM, number=10, enum=Impact,) - integrity_impact = proto.Field(proto.ENUM, number=11, enum=Impact,) - availability_impact = proto.Field(proto.ENUM, number=12, enum=Impact,) + base_score = proto.Field( + proto.FLOAT, + number=1, + ) + exploitability_score = proto.Field( + proto.FLOAT, + number=2, + ) + impact_score = proto.Field( + proto.FLOAT, + number=3, + ) + attack_vector = proto.Field( + proto.ENUM, + number=4, + enum=AttackVector, + ) + attack_complexity = proto.Field( + proto.ENUM, + number=5, + enum=AttackComplexity, + ) + authentication = proto.Field( + proto.ENUM, + number=6, + enum=Authentication, + ) + privileges_required = proto.Field( + proto.ENUM, + number=7, + enum=PrivilegesRequired, + ) + user_interaction = proto.Field( + proto.ENUM, + number=8, + enum=UserInteraction, + ) + scope = proto.Field( + proto.ENUM, + number=9, + enum=Scope, + ) + confidentiality_impact = proto.Field( + proto.ENUM, + number=10, + enum=Impact, + ) + integrity_impact = proto.Field( + proto.ENUM, + number=11, + enum=Impact, + ) + availability_impact = proto.Field( + proto.ENUM, + number=12, + enum=Impact, + ) __all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/packages/grafeas/grafeas/grafeas_v1/types/deployment.py b/packages/grafeas/grafeas/grafeas_v1/types/deployment.py index 2af6e3dc57f5..4e58881aa598 100644 --- a/packages/grafeas/grafeas/grafeas_v1/types/deployment.py +++ b/packages/grafeas/grafeas/grafeas_v1/types/deployment.py @@ -19,7 +19,11 @@ __protobuf__ = proto.module( - package="grafeas.v1", manifest={"DeploymentNote", "DeploymentOccurrence",}, + package="grafeas.v1", + manifest={ + "DeploymentNote", + "DeploymentOccurrence", + }, ) @@ -32,7 +36,10 @@ class DeploymentNote(proto.Message): deployed. """ - resource_uri = proto.RepeatedField(proto.STRING, number=1,) + resource_uri = proto.RepeatedField( + proto.STRING, + number=1, + ) class DeploymentOccurrence(proto.Message): @@ -68,15 +75,37 @@ class Platform(proto.Enum): FLEX = 2 CUSTOM = 3 - user_email = proto.Field(proto.STRING, number=1,) - deploy_time = proto.Field(proto.MESSAGE, number=2, message=timestamp_pb2.Timestamp,) + user_email = proto.Field( + proto.STRING, + number=1, + ) + deploy_time = proto.Field( + proto.MESSAGE, + number=2, + message=timestamp_pb2.Timestamp, + ) undeploy_time = proto.Field( - proto.MESSAGE, number=3, message=timestamp_pb2.Timestamp, + proto.MESSAGE, + number=3, + message=timestamp_pb2.Timestamp, + ) + config = proto.Field( + proto.STRING, + number=4, + ) + address = proto.Field( + proto.STRING, + number=5, + ) + resource_uri = proto.RepeatedField( + proto.STRING, + number=6, + ) + platform = proto.Field( + proto.ENUM, + number=7, + enum=Platform, ) - config = proto.Field(proto.STRING, number=4,) - address = proto.Field(proto.STRING, number=5,) - resource_uri = proto.RepeatedField(proto.STRING, number=6,) - platform = proto.Field(proto.ENUM, number=7, enum=Platform,) __all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/packages/grafeas/grafeas/grafeas_v1/types/discovery.py b/packages/grafeas/grafeas/grafeas_v1/types/discovery.py index 8cf83834a4e2..dc4f251ffa09 100644 --- a/packages/grafeas/grafeas/grafeas_v1/types/discovery.py +++ b/packages/grafeas/grafeas/grafeas_v1/types/discovery.py @@ -21,7 +21,11 @@ __protobuf__ = proto.module( - package="grafeas.v1", manifest={"DiscoveryNote", "DiscoveryOccurrence",}, + package="grafeas.v1", + manifest={ + "DiscoveryNote", + "DiscoveryOccurrence", + }, ) @@ -36,7 +40,11 @@ class DiscoveryNote(proto.Message): that is handled by this discovery. """ - analysis_kind = proto.Field(proto.ENUM, number=1, enum=common.NoteKind,) + analysis_kind = proto.Field( + proto.ENUM, + number=1, + enum=common.NoteKind, + ) class DiscoveryOccurrence(proto.Message): @@ -80,17 +88,34 @@ class AnalysisStatus(proto.Enum): FINISHED_FAILED = 4 FINISHED_UNSUPPORTED = 5 - continuous_analysis = proto.Field(proto.ENUM, number=1, enum=ContinuousAnalysis,) - analysis_status = proto.Field(proto.ENUM, number=2, enum=AnalysisStatus,) + continuous_analysis = proto.Field( + proto.ENUM, + number=1, + enum=ContinuousAnalysis, + ) + analysis_status = proto.Field( + proto.ENUM, + number=2, + enum=AnalysisStatus, + ) analysis_status_error = proto.Field( - proto.MESSAGE, number=3, message=status_pb2.Status, + proto.MESSAGE, + number=3, + message=status_pb2.Status, + ) + cpe = proto.Field( + proto.STRING, + number=4, ) - cpe = proto.Field(proto.STRING, number=4,) last_scan_time = proto.Field( - proto.MESSAGE, number=5, message=timestamp_pb2.Timestamp, + proto.MESSAGE, + number=5, + message=timestamp_pb2.Timestamp, ) archive_time = proto.Field( - proto.MESSAGE, number=6, message=timestamp_pb2.Timestamp, + proto.MESSAGE, + number=6, + message=timestamp_pb2.Timestamp, ) diff --git a/packages/grafeas/grafeas/grafeas_v1/types/dsse_attestation.py b/packages/grafeas/grafeas/grafeas_v1/types/dsse_attestation.py index 5b0287169b3b..fa5cfd63efbd 100644 --- a/packages/grafeas/grafeas/grafeas_v1/types/dsse_attestation.py +++ b/packages/grafeas/grafeas/grafeas_v1/types/dsse_attestation.py @@ -21,7 +21,10 @@ __protobuf__ = proto.module( package="grafeas.v1", - manifest={"DSSEAttestationNote", "DSSEAttestationOccurrence",}, + manifest={ + "DSSEAttestationNote", + "DSSEAttestationOccurrence", + }, ) @@ -51,9 +54,16 @@ class DSSEHint(proto.Message): "cloudbuild-prod". """ - human_readable_name = proto.Field(proto.STRING, number=1,) + human_readable_name = proto.Field( + proto.STRING, + number=1, + ) - hint = proto.Field(proto.MESSAGE, number=1, message=DSSEHint,) + hint = proto.Field( + proto.MESSAGE, + number=1, + message=DSSEHint, + ) class DSSEAttestationOccurrence(proto.Message): @@ -72,7 +82,11 @@ class DSSEAttestationOccurrence(proto.Message): This field is a member of `oneof`_ ``decoded_payload``. """ - envelope = proto.Field(proto.MESSAGE, number=1, message=common.Envelope,) + envelope = proto.Field( + proto.MESSAGE, + number=1, + message=common.Envelope, + ) statement = proto.Field( proto.MESSAGE, number=2, diff --git a/packages/grafeas/grafeas/grafeas_v1/types/grafeas.py b/packages/grafeas/grafeas/grafeas_v1/types/grafeas.py index b5f142f7894c..87ccf24ed5db 100644 --- a/packages/grafeas/grafeas/grafeas_v1/types/grafeas.py +++ b/packages/grafeas/grafeas/grafeas_v1/types/grafeas.py @@ -146,13 +146,37 @@ class Occurrence(proto.Message): https://github.com/secure-systems-lab/dsse """ - name = proto.Field(proto.STRING, number=1,) - resource_uri = proto.Field(proto.STRING, number=2,) - note_name = proto.Field(proto.STRING, number=3,) - kind = proto.Field(proto.ENUM, number=4, enum=common.NoteKind,) - remediation = proto.Field(proto.STRING, number=5,) - create_time = proto.Field(proto.MESSAGE, number=6, message=timestamp_pb2.Timestamp,) - update_time = proto.Field(proto.MESSAGE, number=7, message=timestamp_pb2.Timestamp,) + name = proto.Field( + proto.STRING, + number=1, + ) + resource_uri = proto.Field( + proto.STRING, + number=2, + ) + note_name = proto.Field( + proto.STRING, + number=3, + ) + kind = proto.Field( + proto.ENUM, + number=4, + enum=common.NoteKind, + ) + remediation = proto.Field( + proto.STRING, + number=5, + ) + create_time = proto.Field( + proto.MESSAGE, + number=6, + message=timestamp_pb2.Timestamp, + ) + update_time = proto.Field( + proto.MESSAGE, + number=7, + message=timestamp_pb2.Timestamp, + ) vulnerability = proto.Field( proto.MESSAGE, number=8, @@ -160,13 +184,22 @@ class Occurrence(proto.Message): message=g_vulnerability.VulnerabilityOccurrence, ) build = proto.Field( - proto.MESSAGE, number=9, oneof="details", message=g_build.BuildOccurrence, + proto.MESSAGE, + number=9, + oneof="details", + message=g_build.BuildOccurrence, ) image = proto.Field( - proto.MESSAGE, number=10, oneof="details", message=g_image.ImageOccurrence, + proto.MESSAGE, + number=10, + oneof="details", + message=g_image.ImageOccurrence, ) package = proto.Field( - proto.MESSAGE, number=11, oneof="details", message=g_package.PackageOccurrence, + proto.MESSAGE, + number=11, + oneof="details", + message=g_package.PackageOccurrence, ) deployment = proto.Field( proto.MESSAGE, @@ -187,7 +220,10 @@ class Occurrence(proto.Message): message=g_attestation.AttestationOccurrence, ) upgrade = proto.Field( - proto.MESSAGE, number=15, oneof="details", message=g_upgrade.UpgradeOccurrence, + proto.MESSAGE, + number=15, + oneof="details", + message=g_upgrade.UpgradeOccurrence, ) compliance = proto.Field( proto.MESSAGE, @@ -201,7 +237,11 @@ class Occurrence(proto.Message): oneof="details", message=g_dsse_attestation.DSSEAttestationOccurrence, ) - envelope = proto.Field(proto.MESSAGE, number=18, message=common.Envelope,) + envelope = proto.Field( + proto.MESSAGE, + number=18, + message=common.Envelope, + ) class Note(proto.Message): @@ -286,19 +326,47 @@ class Note(proto.Message): This field is a member of `oneof`_ ``type``. """ - name = proto.Field(proto.STRING, number=1,) - short_description = proto.Field(proto.STRING, number=2,) - long_description = proto.Field(proto.STRING, number=3,) - kind = proto.Field(proto.ENUM, number=4, enum=common.NoteKind,) + name = proto.Field( + proto.STRING, + number=1, + ) + short_description = proto.Field( + proto.STRING, + number=2, + ) + long_description = proto.Field( + proto.STRING, + number=3, + ) + kind = proto.Field( + proto.ENUM, + number=4, + enum=common.NoteKind, + ) related_url = proto.RepeatedField( - proto.MESSAGE, number=5, message=common.RelatedUrl, + proto.MESSAGE, + number=5, + message=common.RelatedUrl, ) expiration_time = proto.Field( - proto.MESSAGE, number=6, message=timestamp_pb2.Timestamp, + proto.MESSAGE, + number=6, + message=timestamp_pb2.Timestamp, + ) + create_time = proto.Field( + proto.MESSAGE, + number=7, + message=timestamp_pb2.Timestamp, + ) + update_time = proto.Field( + proto.MESSAGE, + number=8, + message=timestamp_pb2.Timestamp, + ) + related_note_names = proto.RepeatedField( + proto.STRING, + number=9, ) - create_time = proto.Field(proto.MESSAGE, number=7, message=timestamp_pb2.Timestamp,) - update_time = proto.Field(proto.MESSAGE, number=8, message=timestamp_pb2.Timestamp,) - related_note_names = proto.RepeatedField(proto.STRING, number=9,) vulnerability = proto.Field( proto.MESSAGE, number=10, @@ -306,28 +374,52 @@ class Note(proto.Message): message=g_vulnerability.VulnerabilityNote, ) build = proto.Field( - proto.MESSAGE, number=11, oneof="type", message=g_build.BuildNote, + proto.MESSAGE, + number=11, + oneof="type", + message=g_build.BuildNote, ) image = proto.Field( - proto.MESSAGE, number=12, oneof="type", message=g_image.ImageNote, + proto.MESSAGE, + number=12, + oneof="type", + message=g_image.ImageNote, ) package = proto.Field( - proto.MESSAGE, number=13, oneof="type", message=g_package.PackageNote, + proto.MESSAGE, + number=13, + oneof="type", + message=g_package.PackageNote, ) deployment = proto.Field( - proto.MESSAGE, number=14, oneof="type", message=g_deployment.DeploymentNote, + proto.MESSAGE, + number=14, + oneof="type", + message=g_deployment.DeploymentNote, ) discovery = proto.Field( - proto.MESSAGE, number=15, oneof="type", message=g_discovery.DiscoveryNote, + proto.MESSAGE, + number=15, + oneof="type", + message=g_discovery.DiscoveryNote, ) attestation = proto.Field( - proto.MESSAGE, number=16, oneof="type", message=g_attestation.AttestationNote, + proto.MESSAGE, + number=16, + oneof="type", + message=g_attestation.AttestationNote, ) upgrade = proto.Field( - proto.MESSAGE, number=17, oneof="type", message=g_upgrade.UpgradeNote, + proto.MESSAGE, + number=17, + oneof="type", + message=g_upgrade.UpgradeNote, ) compliance = proto.Field( - proto.MESSAGE, number=18, oneof="type", message=g_compliance.ComplianceNote, + proto.MESSAGE, + number=18, + oneof="type", + message=g_compliance.ComplianceNote, ) dsse_attestation = proto.Field( proto.MESSAGE, @@ -346,7 +438,10 @@ class GetOccurrenceRequest(proto.Message): ``projects/[PROJECT_ID]/occurrences/[OCCURRENCE_ID]``. """ - name = proto.Field(proto.STRING, number=1,) + name = proto.Field( + proto.STRING, + number=1, + ) class ListOccurrencesRequest(proto.Message): @@ -367,10 +462,22 @@ class ListOccurrencesRequest(proto.Message): in the list. """ - parent = proto.Field(proto.STRING, number=1,) - filter = proto.Field(proto.STRING, number=2,) - page_size = proto.Field(proto.INT32, number=3,) - page_token = proto.Field(proto.STRING, number=4,) + parent = proto.Field( + proto.STRING, + number=1, + ) + filter = proto.Field( + proto.STRING, + number=2, + ) + page_size = proto.Field( + proto.INT32, + number=3, + ) + page_token = proto.Field( + proto.STRING, + number=4, + ) class ListOccurrencesResponse(proto.Message): @@ -389,8 +496,15 @@ class ListOccurrencesResponse(proto.Message): def raw_page(self): return self - occurrences = proto.RepeatedField(proto.MESSAGE, number=1, message="Occurrence",) - next_page_token = proto.Field(proto.STRING, number=2,) + occurrences = proto.RepeatedField( + proto.MESSAGE, + number=1, + message="Occurrence", + ) + next_page_token = proto.Field( + proto.STRING, + number=2, + ) class DeleteOccurrenceRequest(proto.Message): @@ -402,7 +516,10 @@ class DeleteOccurrenceRequest(proto.Message): ``projects/[PROJECT_ID]/occurrences/[OCCURRENCE_ID]``. """ - name = proto.Field(proto.STRING, number=1,) + name = proto.Field( + proto.STRING, + number=1, + ) class CreateOccurrenceRequest(proto.Message): @@ -417,8 +534,15 @@ class CreateOccurrenceRequest(proto.Message): The occurrence to create. """ - parent = proto.Field(proto.STRING, number=1,) - occurrence = proto.Field(proto.MESSAGE, number=2, message="Occurrence",) + parent = proto.Field( + proto.STRING, + number=1, + ) + occurrence = proto.Field( + proto.MESSAGE, + number=2, + message="Occurrence", + ) class UpdateOccurrenceRequest(proto.Message): @@ -434,10 +558,19 @@ class UpdateOccurrenceRequest(proto.Message): The fields to update. """ - name = proto.Field(proto.STRING, number=1,) - occurrence = proto.Field(proto.MESSAGE, number=2, message="Occurrence",) + name = proto.Field( + proto.STRING, + number=1, + ) + occurrence = proto.Field( + proto.MESSAGE, + number=2, + message="Occurrence", + ) update_mask = proto.Field( - proto.MESSAGE, number=3, message=field_mask_pb2.FieldMask, + proto.MESSAGE, + number=3, + message=field_mask_pb2.FieldMask, ) @@ -450,7 +583,10 @@ class GetNoteRequest(proto.Message): ``projects/[PROVIDER_ID]/notes/[NOTE_ID]``. """ - name = proto.Field(proto.STRING, number=1,) + name = proto.Field( + proto.STRING, + number=1, + ) class GetOccurrenceNoteRequest(proto.Message): @@ -463,7 +599,10 @@ class GetOccurrenceNoteRequest(proto.Message): ``projects/[PROJECT_ID]/occurrences/[OCCURRENCE_ID]``. """ - name = proto.Field(proto.STRING, number=1,) + name = proto.Field( + proto.STRING, + number=1, + ) class ListNotesRequest(proto.Message): @@ -484,10 +623,22 @@ class ListNotesRequest(proto.Message): in the list. """ - parent = proto.Field(proto.STRING, number=1,) - filter = proto.Field(proto.STRING, number=2,) - page_size = proto.Field(proto.INT32, number=3,) - page_token = proto.Field(proto.STRING, number=4,) + parent = proto.Field( + proto.STRING, + number=1, + ) + filter = proto.Field( + proto.STRING, + number=2, + ) + page_size = proto.Field( + proto.INT32, + number=3, + ) + page_token = proto.Field( + proto.STRING, + number=4, + ) class ListNotesResponse(proto.Message): @@ -506,8 +657,15 @@ class ListNotesResponse(proto.Message): def raw_page(self): return self - notes = proto.RepeatedField(proto.MESSAGE, number=1, message="Note",) - next_page_token = proto.Field(proto.STRING, number=2,) + notes = proto.RepeatedField( + proto.MESSAGE, + number=1, + message="Note", + ) + next_page_token = proto.Field( + proto.STRING, + number=2, + ) class DeleteNoteRequest(proto.Message): @@ -519,7 +677,10 @@ class DeleteNoteRequest(proto.Message): ``projects/[PROVIDER_ID]/notes/[NOTE_ID]``. """ - name = proto.Field(proto.STRING, number=1,) + name = proto.Field( + proto.STRING, + number=1, + ) class CreateNoteRequest(proto.Message): @@ -536,9 +697,19 @@ class CreateNoteRequest(proto.Message): The note to create. """ - parent = proto.Field(proto.STRING, number=1,) - note_id = proto.Field(proto.STRING, number=2,) - note = proto.Field(proto.MESSAGE, number=3, message="Note",) + parent = proto.Field( + proto.STRING, + number=1, + ) + note_id = proto.Field( + proto.STRING, + number=2, + ) + note = proto.Field( + proto.MESSAGE, + number=3, + message="Note", + ) class UpdateNoteRequest(proto.Message): @@ -554,10 +725,19 @@ class UpdateNoteRequest(proto.Message): The fields to update. """ - name = proto.Field(proto.STRING, number=1,) - note = proto.Field(proto.MESSAGE, number=2, message="Note",) + name = proto.Field( + proto.STRING, + number=1, + ) + note = proto.Field( + proto.MESSAGE, + number=2, + message="Note", + ) update_mask = proto.Field( - proto.MESSAGE, number=3, message=field_mask_pb2.FieldMask, + proto.MESSAGE, + number=3, + message=field_mask_pb2.FieldMask, ) @@ -577,10 +757,22 @@ class ListNoteOccurrencesRequest(proto.Message): in the list. """ - name = proto.Field(proto.STRING, number=1,) - filter = proto.Field(proto.STRING, number=2,) - page_size = proto.Field(proto.INT32, number=3,) - page_token = proto.Field(proto.STRING, number=4,) + name = proto.Field( + proto.STRING, + number=1, + ) + filter = proto.Field( + proto.STRING, + number=2, + ) + page_size = proto.Field( + proto.INT32, + number=3, + ) + page_token = proto.Field( + proto.STRING, + number=4, + ) class ListNoteOccurrencesResponse(proto.Message): @@ -599,8 +791,15 @@ class ListNoteOccurrencesResponse(proto.Message): def raw_page(self): return self - occurrences = proto.RepeatedField(proto.MESSAGE, number=1, message="Occurrence",) - next_page_token = proto.Field(proto.STRING, number=2,) + occurrences = proto.RepeatedField( + proto.MESSAGE, + number=1, + message="Occurrence", + ) + next_page_token = proto.Field( + proto.STRING, + number=2, + ) class BatchCreateNotesRequest(proto.Message): @@ -616,8 +815,16 @@ class BatchCreateNotesRequest(proto.Message): 1000. """ - parent = proto.Field(proto.STRING, number=1,) - notes = proto.MapField(proto.STRING, proto.MESSAGE, number=2, message="Note",) + parent = proto.Field( + proto.STRING, + number=1, + ) + notes = proto.MapField( + proto.STRING, + proto.MESSAGE, + number=2, + message="Note", + ) class BatchCreateNotesResponse(proto.Message): @@ -628,7 +835,11 @@ class BatchCreateNotesResponse(proto.Message): The notes that were created. """ - notes = proto.RepeatedField(proto.MESSAGE, number=1, message="Note",) + notes = proto.RepeatedField( + proto.MESSAGE, + number=1, + message="Note", + ) class BatchCreateOccurrencesRequest(proto.Message): @@ -644,8 +855,15 @@ class BatchCreateOccurrencesRequest(proto.Message): is 1000. """ - parent = proto.Field(proto.STRING, number=1,) - occurrences = proto.RepeatedField(proto.MESSAGE, number=2, message="Occurrence",) + parent = proto.Field( + proto.STRING, + number=1, + ) + occurrences = proto.RepeatedField( + proto.MESSAGE, + number=2, + message="Occurrence", + ) class BatchCreateOccurrencesResponse(proto.Message): @@ -656,7 +874,11 @@ class BatchCreateOccurrencesResponse(proto.Message): The occurrences that were created. """ - occurrences = proto.RepeatedField(proto.MESSAGE, number=1, message="Occurrence",) + occurrences = proto.RepeatedField( + proto.MESSAGE, + number=1, + message="Occurrence", + ) __all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/packages/grafeas/grafeas/grafeas_v1/types/image.py b/packages/grafeas/grafeas/grafeas_v1/types/image.py index aec8e19532d8..082f9ccddc65 100644 --- a/packages/grafeas/grafeas/grafeas_v1/types/image.py +++ b/packages/grafeas/grafeas/grafeas_v1/types/image.py @@ -18,7 +18,12 @@ __protobuf__ = proto.module( package="grafeas.v1", - manifest={"Layer", "Fingerprint", "ImageNote", "ImageOccurrence",}, + manifest={ + "Layer", + "Fingerprint", + "ImageNote", + "ImageOccurrence", + }, ) @@ -36,8 +41,14 @@ class Layer(proto.Message): directive. """ - directive = proto.Field(proto.STRING, number=1,) - arguments = proto.Field(proto.STRING, number=2,) + directive = proto.Field( + proto.STRING, + number=1, + ) + arguments = proto.Field( + proto.STRING, + number=2, + ) class Fingerprint(proto.Message): @@ -57,9 +68,18 @@ class Fingerprint(proto.Message): v2_name[N+1]) Only the name of the final blob is kept. """ - v1_name = proto.Field(proto.STRING, number=1,) - v2_blob = proto.RepeatedField(proto.STRING, number=2,) - v2_name = proto.Field(proto.STRING, number=3,) + v1_name = proto.Field( + proto.STRING, + number=1, + ) + v2_blob = proto.RepeatedField( + proto.STRING, + number=2, + ) + v2_name = proto.Field( + proto.STRING, + number=3, + ) class ImageNote(proto.Message): @@ -77,8 +97,15 @@ class ImageNote(proto.Message): base image. """ - resource_url = proto.Field(proto.STRING, number=1,) - fingerprint = proto.Field(proto.MESSAGE, number=2, message="Fingerprint",) + resource_url = proto.Field( + proto.STRING, + number=1, + ) + fingerprint = proto.Field( + proto.MESSAGE, + number=2, + message="Fingerprint", + ) class ImageOccurrence(proto.Message): @@ -104,10 +131,24 @@ class ImageOccurrence(proto.Message): for the derived image occurrence. """ - fingerprint = proto.Field(proto.MESSAGE, number=1, message="Fingerprint",) - distance = proto.Field(proto.INT32, number=2,) - layer_info = proto.RepeatedField(proto.MESSAGE, number=3, message="Layer",) - base_resource_url = proto.Field(proto.STRING, number=4,) + fingerprint = proto.Field( + proto.MESSAGE, + number=1, + message="Fingerprint", + ) + distance = proto.Field( + proto.INT32, + number=2, + ) + layer_info = proto.RepeatedField( + proto.MESSAGE, + number=3, + message="Layer", + ) + base_resource_url = proto.Field( + proto.STRING, + number=4, + ) __all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/packages/grafeas/grafeas/grafeas_v1/types/intoto_provenance.py b/packages/grafeas/grafeas/grafeas_v1/types/intoto_provenance.py index 6f09781e0b3f..7ac37b6c1f55 100644 --- a/packages/grafeas/grafeas/grafeas_v1/types/intoto_provenance.py +++ b/packages/grafeas/grafeas/grafeas_v1/types/intoto_provenance.py @@ -78,11 +78,28 @@ class Recipe(proto.Message): is of form "Any". """ - type_ = proto.Field(proto.STRING, number=1,) - defined_in_material = proto.Field(proto.INT64, number=2,) - entry_point = proto.Field(proto.STRING, number=3,) - arguments = proto.RepeatedField(proto.MESSAGE, number=4, message=any_pb2.Any,) - environment = proto.RepeatedField(proto.MESSAGE, number=5, message=any_pb2.Any,) + type_ = proto.Field( + proto.STRING, + number=1, + ) + defined_in_material = proto.Field( + proto.INT64, + number=2, + ) + entry_point = proto.Field( + proto.STRING, + number=3, + ) + arguments = proto.RepeatedField( + proto.MESSAGE, + number=4, + message=any_pb2.Any, + ) + environment = proto.RepeatedField( + proto.MESSAGE, + number=5, + message=any_pb2.Any, + ) class Completeness(proto.Message): @@ -105,9 +122,18 @@ class Completeness(proto.Message): "hermetic". """ - arguments = proto.Field(proto.BOOL, number=1,) - environment = proto.Field(proto.BOOL, number=2,) - materials = proto.Field(proto.BOOL, number=3,) + arguments = proto.Field( + proto.BOOL, + number=1, + ) + environment = proto.Field( + proto.BOOL, + number=2, + ) + materials = proto.Field( + proto.BOOL, + number=3, + ) class Metadata(proto.Message): @@ -132,15 +158,29 @@ class Metadata(proto.Message): identical output. """ - build_invocation_id = proto.Field(proto.STRING, number=1,) + build_invocation_id = proto.Field( + proto.STRING, + number=1, + ) build_started_on = proto.Field( - proto.MESSAGE, number=2, message=timestamp_pb2.Timestamp, + proto.MESSAGE, + number=2, + message=timestamp_pb2.Timestamp, ) build_finished_on = proto.Field( - proto.MESSAGE, number=3, message=timestamp_pb2.Timestamp, + proto.MESSAGE, + number=3, + message=timestamp_pb2.Timestamp, + ) + completeness = proto.Field( + proto.MESSAGE, + number=4, + message="Completeness", + ) + reproducible = proto.Field( + proto.BOOL, + number=5, ) - completeness = proto.Field(proto.MESSAGE, number=4, message="Completeness",) - reproducible = proto.Field(proto.BOOL, number=5,) class BuilderConfig(proto.Message): @@ -151,7 +191,10 @@ class BuilderConfig(proto.Message): """ - id = proto.Field(proto.STRING, number=1,) + id = proto.Field( + proto.STRING, + number=1, + ) class InTotoProvenance(proto.Message): @@ -177,10 +220,25 @@ class InTotoProvenance(proto.Message): or null is equivalent to empty. """ - builder_config = proto.Field(proto.MESSAGE, number=1, message="BuilderConfig",) - recipe = proto.Field(proto.MESSAGE, number=2, message="Recipe",) - metadata = proto.Field(proto.MESSAGE, number=3, message="Metadata",) - materials = proto.RepeatedField(proto.STRING, number=4,) + builder_config = proto.Field( + proto.MESSAGE, + number=1, + message="BuilderConfig", + ) + recipe = proto.Field( + proto.MESSAGE, + number=2, + message="Recipe", + ) + metadata = proto.Field( + proto.MESSAGE, + number=3, + message="Metadata", + ) + materials = proto.RepeatedField( + proto.STRING, + number=4, + ) __all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/packages/grafeas/grafeas/grafeas_v1/types/intoto_statement.py b/packages/grafeas/grafeas/grafeas_v1/types/intoto_statement.py index ecbc2717e2f1..2585c6e20f9e 100644 --- a/packages/grafeas/grafeas/grafeas_v1/types/intoto_statement.py +++ b/packages/grafeas/grafeas/grafeas_v1/types/intoto_statement.py @@ -20,7 +20,11 @@ __protobuf__ = proto.module( - package="grafeas.v1", manifest={"InTotoStatement", "Subject",}, + package="grafeas.v1", + manifest={ + "InTotoStatement", + "Subject", + }, ) @@ -53,9 +57,19 @@ class InTotoStatement(proto.Message): This field is a member of `oneof`_ ``predicate``. """ - type_ = proto.Field(proto.STRING, number=1,) - subject = proto.RepeatedField(proto.MESSAGE, number=2, message="Subject",) - predicate_type = proto.Field(proto.STRING, number=3,) + type_ = proto.Field( + proto.STRING, + number=1, + ) + subject = proto.RepeatedField( + proto.MESSAGE, + number=2, + message="Subject", + ) + predicate_type = proto.Field( + proto.STRING, + number=3, + ) provenance = proto.Field( proto.MESSAGE, number=4, @@ -82,8 +96,15 @@ class Subject(proto.Message): https://github.com/in-toto/attestation/blob/main/spec/field_types.md#DigestSet """ - name = proto.Field(proto.STRING, number=1,) - digest = proto.MapField(proto.STRING, proto.STRING, number=2,) + name = proto.Field( + proto.STRING, + number=1, + ) + digest = proto.MapField( + proto.STRING, + proto.STRING, + number=2, + ) __all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/packages/grafeas/grafeas/grafeas_v1/types/package.py b/packages/grafeas/grafeas/grafeas_v1/types/package.py index be90cc3c061d..f10dffcc8281 100644 --- a/packages/grafeas/grafeas/grafeas_v1/types/package.py +++ b/packages/grafeas/grafeas/grafeas_v1/types/package.py @@ -64,12 +64,32 @@ class Distribution(proto.Message): of this package. """ - cpe_uri = proto.Field(proto.STRING, number=1,) - architecture = proto.Field(proto.ENUM, number=2, enum="Architecture",) - latest_version = proto.Field(proto.MESSAGE, number=3, message="Version",) - maintainer = proto.Field(proto.STRING, number=4,) - url = proto.Field(proto.STRING, number=5,) - description = proto.Field(proto.STRING, number=6,) + cpe_uri = proto.Field( + proto.STRING, + number=1, + ) + architecture = proto.Field( + proto.ENUM, + number=2, + enum="Architecture", + ) + latest_version = proto.Field( + proto.MESSAGE, + number=3, + message="Version", + ) + maintainer = proto.Field( + proto.STRING, + number=4, + ) + url = proto.Field( + proto.STRING, + number=5, + ) + description = proto.Field( + proto.STRING, + number=6, + ) class Location(proto.Message): @@ -89,9 +109,19 @@ class Location(proto.Message): package/version is installed. """ - cpe_uri = proto.Field(proto.STRING, number=1,) - version = proto.Field(proto.MESSAGE, number=2, message="Version",) - path = proto.Field(proto.STRING, number=3,) + cpe_uri = proto.Field( + proto.STRING, + number=1, + ) + version = proto.Field( + proto.MESSAGE, + number=2, + message="Version", + ) + path = proto.Field( + proto.STRING, + number=3, + ) class PackageNote(proto.Message): @@ -107,9 +137,14 @@ class PackageNote(proto.Message): distributed. """ - name = proto.Field(proto.STRING, number=1,) + name = proto.Field( + proto.STRING, + number=1, + ) distribution = proto.RepeatedField( - proto.MESSAGE, number=10, message="Distribution", + proto.MESSAGE, + number=10, + message="Distribution", ) @@ -127,8 +162,15 @@ class PackageOccurrence(proto.Message): found. """ - name = proto.Field(proto.STRING, number=1,) - location = proto.RepeatedField(proto.MESSAGE, number=2, message="Location",) + name = proto.Field( + proto.STRING, + number=1, + ) + location = proto.RepeatedField( + proto.MESSAGE, + number=2, + message="Location", + ) class Version(proto.Message): @@ -173,12 +215,31 @@ class VersionKind(proto.Enum): MINIMUM = 2 MAXIMUM = 3 - epoch = proto.Field(proto.INT32, number=1,) - name = proto.Field(proto.STRING, number=2,) - revision = proto.Field(proto.STRING, number=3,) - inclusive = proto.Field(proto.BOOL, number=6,) - kind = proto.Field(proto.ENUM, number=4, enum=VersionKind,) - full_name = proto.Field(proto.STRING, number=5,) + epoch = proto.Field( + proto.INT32, + number=1, + ) + name = proto.Field( + proto.STRING, + number=2, + ) + revision = proto.Field( + proto.STRING, + number=3, + ) + inclusive = proto.Field( + proto.BOOL, + number=6, + ) + kind = proto.Field( + proto.ENUM, + number=4, + enum=VersionKind, + ) + full_name = proto.Field( + proto.STRING, + number=5, + ) __all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/packages/grafeas/grafeas/grafeas_v1/types/provenance.py b/packages/grafeas/grafeas/grafeas_v1/types/provenance.py index f6abb069ba4c..3048712f51cd 100644 --- a/packages/grafeas/grafeas/grafeas_v1/types/provenance.py +++ b/packages/grafeas/grafeas/grafeas_v1/types/provenance.py @@ -83,19 +83,65 @@ class BuildProvenance(proto.Message): this build was executed. """ - id = proto.Field(proto.STRING, number=1,) - project_id = proto.Field(proto.STRING, number=2,) - commands = proto.RepeatedField(proto.MESSAGE, number=3, message="Command",) - built_artifacts = proto.RepeatedField(proto.MESSAGE, number=4, message="Artifact",) - create_time = proto.Field(proto.MESSAGE, number=5, message=timestamp_pb2.Timestamp,) - start_time = proto.Field(proto.MESSAGE, number=6, message=timestamp_pb2.Timestamp,) - end_time = proto.Field(proto.MESSAGE, number=7, message=timestamp_pb2.Timestamp,) - creator = proto.Field(proto.STRING, number=8,) - logs_uri = proto.Field(proto.STRING, number=9,) - source_provenance = proto.Field(proto.MESSAGE, number=10, message="Source",) - trigger_id = proto.Field(proto.STRING, number=11,) - build_options = proto.MapField(proto.STRING, proto.STRING, number=12,) - builder_version = proto.Field(proto.STRING, number=13,) + id = proto.Field( + proto.STRING, + number=1, + ) + project_id = proto.Field( + proto.STRING, + number=2, + ) + commands = proto.RepeatedField( + proto.MESSAGE, + number=3, + message="Command", + ) + built_artifacts = proto.RepeatedField( + proto.MESSAGE, + number=4, + message="Artifact", + ) + create_time = proto.Field( + proto.MESSAGE, + number=5, + message=timestamp_pb2.Timestamp, + ) + start_time = proto.Field( + proto.MESSAGE, + number=6, + message=timestamp_pb2.Timestamp, + ) + end_time = proto.Field( + proto.MESSAGE, + number=7, + message=timestamp_pb2.Timestamp, + ) + creator = proto.Field( + proto.STRING, + number=8, + ) + logs_uri = proto.Field( + proto.STRING, + number=9, + ) + source_provenance = proto.Field( + proto.MESSAGE, + number=10, + message="Source", + ) + trigger_id = proto.Field( + proto.STRING, + number=11, + ) + build_options = proto.MapField( + proto.STRING, + proto.STRING, + number=12, + ) + builder_version = proto.Field( + proto.STRING, + number=13, + ) class Source(proto.Message): @@ -130,13 +176,25 @@ class Source(proto.Message): field. """ - artifact_storage_source_uri = proto.Field(proto.STRING, number=1,) + artifact_storage_source_uri = proto.Field( + proto.STRING, + number=1, + ) file_hashes = proto.MapField( - proto.STRING, proto.MESSAGE, number=2, message="FileHashes", + proto.STRING, + proto.MESSAGE, + number=2, + message="FileHashes", + ) + context = proto.Field( + proto.MESSAGE, + number=3, + message="SourceContext", ) - context = proto.Field(proto.MESSAGE, number=3, message="SourceContext",) additional_contexts = proto.RepeatedField( - proto.MESSAGE, number=4, message="SourceContext", + proto.MESSAGE, + number=4, + message="SourceContext", ) @@ -150,7 +208,11 @@ class FileHashes(proto.Message): Required. 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): @@ -164,8 +226,14 @@ class Hash(proto.Message): Required. The hash value. """ - type_ = proto.Field(proto.STRING, number=1,) - value = proto.Field(proto.BYTES, number=2,) + type_ = proto.Field( + proto.STRING, + number=1, + ) + value = proto.Field( + proto.BYTES, + number=2, + ) class Command(proto.Message): @@ -194,12 +262,30 @@ class Command(proto.Message): depends on. """ - name = proto.Field(proto.STRING, number=1,) - env = proto.RepeatedField(proto.STRING, number=2,) - args = proto.RepeatedField(proto.STRING, number=3,) - dir_ = proto.Field(proto.STRING, number=4,) - id = proto.Field(proto.STRING, number=5,) - wait_for = proto.RepeatedField(proto.STRING, number=6,) + name = proto.Field( + proto.STRING, + number=1, + ) + env = proto.RepeatedField( + proto.STRING, + number=2, + ) + args = proto.RepeatedField( + proto.STRING, + number=3, + ) + dir_ = proto.Field( + proto.STRING, + number=4, + ) + id = proto.Field( + proto.STRING, + number=5, + ) + wait_for = proto.RepeatedField( + proto.STRING, + number=6, + ) class Artifact(proto.Message): @@ -222,9 +308,18 @@ class Artifact(proto.Message): to one image. """ - checksum = proto.Field(proto.STRING, number=1,) - id = proto.Field(proto.STRING, number=2,) - names = proto.RepeatedField(proto.STRING, number=3,) + checksum = proto.Field( + proto.STRING, + number=1, + ) + id = proto.Field( + proto.STRING, + number=2, + ) + names = proto.RepeatedField( + proto.STRING, + number=3, + ) class SourceContext(proto.Message): @@ -260,15 +355,28 @@ class SourceContext(proto.Message): """ cloud_repo = proto.Field( - proto.MESSAGE, number=1, oneof="context", message="CloudRepoSourceContext", + proto.MESSAGE, + number=1, + oneof="context", + message="CloudRepoSourceContext", ) gerrit = proto.Field( - proto.MESSAGE, number=2, oneof="context", message="GerritSourceContext", + proto.MESSAGE, + number=2, + oneof="context", + message="GerritSourceContext", ) git = proto.Field( - proto.MESSAGE, number=3, oneof="context", message="GitSourceContext", + proto.MESSAGE, + number=3, + oneof="context", + message="GitSourceContext", + ) + labels = proto.MapField( + proto.STRING, + proto.STRING, + number=4, ) - labels = proto.MapField(proto.STRING, proto.STRING, number=4,) class AliasContext(proto.Message): @@ -288,8 +396,15 @@ class Kind(proto.Enum): MOVABLE = 2 OTHER = 4 - kind = proto.Field(proto.ENUM, number=1, enum=Kind,) - name = proto.Field(proto.STRING, number=2,) + kind = proto.Field( + proto.ENUM, + number=1, + enum=Kind, + ) + name = proto.Field( + proto.STRING, + number=2, + ) class CloudRepoSourceContext(proto.Message): @@ -316,10 +431,21 @@ class CloudRepoSourceContext(proto.Message): This field is a member of `oneof`_ ``revision``. """ - repo_id = proto.Field(proto.MESSAGE, number=1, message="RepoId",) - revision_id = proto.Field(proto.STRING, number=2, oneof="revision",) + repo_id = proto.Field( + proto.MESSAGE, + number=1, + message="RepoId", + ) + revision_id = proto.Field( + proto.STRING, + number=2, + oneof="revision", + ) alias_context = proto.Field( - proto.MESSAGE, number=3, oneof="revision", message="AliasContext", + proto.MESSAGE, + number=3, + oneof="revision", + message="AliasContext", ) @@ -351,11 +477,24 @@ class GerritSourceContext(proto.Message): This field is a member of `oneof`_ ``revision``. """ - host_uri = proto.Field(proto.STRING, number=1,) - gerrit_project = proto.Field(proto.STRING, number=2,) - revision_id = proto.Field(proto.STRING, number=3, oneof="revision",) + host_uri = proto.Field( + proto.STRING, + number=1, + ) + gerrit_project = proto.Field( + proto.STRING, + number=2, + ) + revision_id = proto.Field( + proto.STRING, + number=3, + oneof="revision", + ) alias_context = proto.Field( - proto.MESSAGE, number=4, oneof="revision", message="AliasContext", + proto.MESSAGE, + number=4, + oneof="revision", + message="AliasContext", ) @@ -370,8 +509,14 @@ class GitSourceContext(proto.Message): Git commit hash. """ - url = proto.Field(proto.STRING, number=1,) - revision_id = proto.Field(proto.STRING, number=2,) + url = proto.Field( + proto.STRING, + number=1, + ) + revision_id = proto.Field( + proto.STRING, + number=2, + ) class RepoId(proto.Message): @@ -398,9 +543,16 @@ class RepoId(proto.Message): """ project_repo_id = proto.Field( - proto.MESSAGE, number=1, oneof="id", message="ProjectRepoId", + proto.MESSAGE, + number=1, + oneof="id", + message="ProjectRepoId", + ) + uid = proto.Field( + proto.STRING, + number=2, + oneof="id", ) - uid = proto.Field(proto.STRING, number=2, oneof="id",) class ProjectRepoId(proto.Message): @@ -415,8 +567,14 @@ class ProjectRepoId(proto.Message): default repo. """ - project_id = proto.Field(proto.STRING, number=1,) - repo_name = proto.Field(proto.STRING, number=2,) + project_id = proto.Field( + proto.STRING, + number=1, + ) + repo_name = proto.Field( + proto.STRING, + number=2, + ) __all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/packages/grafeas/grafeas/grafeas_v1/types/severity.py b/packages/grafeas/grafeas/grafeas_v1/types/severity.py index d3b058e22175..838deed32363 100644 --- a/packages/grafeas/grafeas/grafeas_v1/types/severity.py +++ b/packages/grafeas/grafeas/grafeas_v1/types/severity.py @@ -16,7 +16,12 @@ import proto # type: ignore -__protobuf__ = proto.module(package="grafeas.v1", manifest={"Severity",},) +__protobuf__ = proto.module( + package="grafeas.v1", + manifest={ + "Severity", + }, +) class Severity(proto.Enum): diff --git a/packages/grafeas/grafeas/grafeas_v1/types/slsa_provenance.py b/packages/grafeas/grafeas/grafeas_v1/types/slsa_provenance.py index c79d4c863569..2c62f71ff94e 100644 --- a/packages/grafeas/grafeas/grafeas_v1/types/slsa_provenance.py +++ b/packages/grafeas/grafeas/grafeas_v1/types/slsa_provenance.py @@ -19,7 +19,12 @@ from google.protobuf import timestamp_pb2 # type: ignore -__protobuf__ = proto.module(package="grafeas.v1", manifest={"SlsaProvenance",},) +__protobuf__ = proto.module( + package="grafeas.v1", + manifest={ + "SlsaProvenance", + }, +) class SlsaProvenance(proto.Message): @@ -89,11 +94,28 @@ class SlsaRecipe(proto.Message): recipe Type, the structure may be different. """ - type_ = proto.Field(proto.STRING, number=1,) - defined_in_material = proto.Field(proto.INT64, number=2,) - entry_point = proto.Field(proto.STRING, number=3,) - arguments = proto.Field(proto.MESSAGE, number=4, message=any_pb2.Any,) - environment = proto.Field(proto.MESSAGE, number=5, message=any_pb2.Any,) + type_ = proto.Field( + proto.STRING, + number=1, + ) + defined_in_material = proto.Field( + proto.INT64, + number=2, + ) + entry_point = proto.Field( + proto.STRING, + number=3, + ) + arguments = proto.Field( + proto.MESSAGE, + number=4, + message=any_pb2.Any, + ) + environment = proto.Field( + proto.MESSAGE, + number=5, + message=any_pb2.Any, + ) class SlsaCompleteness(proto.Message): r"""Indicates that the builder claims certain fields in this @@ -115,9 +137,18 @@ class SlsaCompleteness(proto.Message): "hermetic". """ - arguments = proto.Field(proto.BOOL, number=1,) - environment = proto.Field(proto.BOOL, number=2,) - materials = proto.Field(proto.BOOL, number=3,) + arguments = proto.Field( + proto.BOOL, + number=1, + ) + environment = proto.Field( + proto.BOOL, + number=2, + ) + materials = proto.Field( + proto.BOOL, + number=3, + ) class SlsaMetadata(proto.Message): r"""Other properties of the build. @@ -141,17 +172,29 @@ class SlsaMetadata(proto.Message): identical output. """ - build_invocation_id = proto.Field(proto.STRING, number=1,) + build_invocation_id = proto.Field( + proto.STRING, + number=1, + ) build_started_on = proto.Field( - proto.MESSAGE, number=2, message=timestamp_pb2.Timestamp, + proto.MESSAGE, + number=2, + message=timestamp_pb2.Timestamp, ) build_finished_on = proto.Field( - proto.MESSAGE, number=3, message=timestamp_pb2.Timestamp, + proto.MESSAGE, + number=3, + message=timestamp_pb2.Timestamp, ) completeness = proto.Field( - proto.MESSAGE, number=4, message="SlsaProvenance.SlsaCompleteness", + proto.MESSAGE, + number=4, + message="SlsaProvenance.SlsaCompleteness", + ) + reproducible = proto.Field( + proto.BOOL, + number=5, ) - reproducible = proto.Field(proto.BOOL, number=5,) class SlsaBuilder(proto.Message): r""" @@ -161,7 +204,10 @@ class SlsaBuilder(proto.Message): """ - id = proto.Field(proto.STRING, number=1,) + id = proto.Field( + proto.STRING, + number=1, + ) class Material(proto.Message): r""" @@ -173,13 +219,36 @@ class Material(proto.Message): """ - uri = proto.Field(proto.STRING, number=1,) - digest = proto.MapField(proto.STRING, proto.STRING, number=2,) + uri = proto.Field( + proto.STRING, + number=1, + ) + digest = proto.MapField( + proto.STRING, + proto.STRING, + number=2, + ) - builder = proto.Field(proto.MESSAGE, number=1, message=SlsaBuilder,) - recipe = proto.Field(proto.MESSAGE, number=2, message=SlsaRecipe,) - metadata = proto.Field(proto.MESSAGE, number=3, message=SlsaMetadata,) - materials = proto.RepeatedField(proto.MESSAGE, number=4, message=Material,) + builder = proto.Field( + proto.MESSAGE, + number=1, + message=SlsaBuilder, + ) + recipe = proto.Field( + proto.MESSAGE, + number=2, + message=SlsaRecipe, + ) + metadata = proto.Field( + proto.MESSAGE, + number=3, + message=SlsaMetadata, + ) + materials = proto.RepeatedField( + proto.MESSAGE, + number=4, + message=Material, + ) __all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/packages/grafeas/grafeas/grafeas_v1/types/upgrade.py b/packages/grafeas/grafeas/grafeas_v1/types/upgrade.py index 1d8af72ae52c..6e89f911eaef 100644 --- a/packages/grafeas/grafeas/grafeas_v1/types/upgrade.py +++ b/packages/grafeas/grafeas/grafeas_v1/types/upgrade.py @@ -52,12 +52,25 @@ class UpgradeNote(proto.Message): metadata about the Windows update. """ - package = proto.Field(proto.STRING, number=1,) - version = proto.Field(proto.MESSAGE, number=2, message=g_package.Version,) + package = proto.Field( + proto.STRING, + number=1, + ) + version = proto.Field( + proto.MESSAGE, + number=2, + message=g_package.Version, + ) distributions = proto.RepeatedField( - proto.MESSAGE, number=3, message="UpgradeDistribution", + proto.MESSAGE, + number=3, + message="UpgradeDistribution", + ) + windows_update = proto.Field( + proto.MESSAGE, + number=4, + message="WindowsUpdate", ) - windows_update = proto.Field(proto.MESSAGE, number=4, message="WindowsUpdate",) class UpgradeDistribution(proto.Message): @@ -84,10 +97,22 @@ class UpgradeDistribution(proto.Message): The cve tied to this Upgrade. """ - cpe_uri = proto.Field(proto.STRING, number=1,) - classification = proto.Field(proto.STRING, number=2,) - severity = proto.Field(proto.STRING, number=3,) - cve = proto.RepeatedField(proto.STRING, number=4,) + cpe_uri = proto.Field( + proto.STRING, + number=1, + ) + classification = proto.Field( + proto.STRING, + number=2, + ) + severity = proto.Field( + proto.STRING, + number=3, + ) + cve = proto.RepeatedField( + proto.STRING, + number=4, + ) class WindowsUpdate(proto.Message): @@ -128,8 +153,14 @@ class Identity(proto.Message): The revision number of the update. """ - update_id = proto.Field(proto.STRING, number=1,) - revision = proto.Field(proto.INT32, number=2,) + update_id = proto.Field( + proto.STRING, + number=1, + ) + revision = proto.Field( + proto.INT32, + number=2, + ) class Category(proto.Message): r"""The category to which the update belongs. @@ -141,17 +172,45 @@ class Category(proto.Message): The localized name of the category. """ - category_id = proto.Field(proto.STRING, number=1,) - name = proto.Field(proto.STRING, number=2,) + category_id = proto.Field( + proto.STRING, + number=1, + ) + name = proto.Field( + proto.STRING, + number=2, + ) - identity = proto.Field(proto.MESSAGE, number=1, message=Identity,) - title = proto.Field(proto.STRING, number=2,) - description = proto.Field(proto.STRING, number=3,) - categories = proto.RepeatedField(proto.MESSAGE, number=4, message=Category,) - kb_article_ids = proto.RepeatedField(proto.STRING, number=5,) - support_url = proto.Field(proto.STRING, number=6,) + identity = proto.Field( + proto.MESSAGE, + number=1, + message=Identity, + ) + title = proto.Field( + proto.STRING, + number=2, + ) + description = proto.Field( + proto.STRING, + number=3, + ) + categories = proto.RepeatedField( + proto.MESSAGE, + number=4, + message=Category, + ) + kb_article_ids = proto.RepeatedField( + proto.STRING, + number=5, + ) + support_url = proto.Field( + proto.STRING, + number=6, + ) last_published_timestamp = proto.Field( - proto.MESSAGE, number=7, message=timestamp_pb2.Timestamp, + proto.MESSAGE, + number=7, + message=timestamp_pb2.Timestamp, ) @@ -179,10 +238,25 @@ class UpgradeOccurrence(proto.Message): metadata about the Windows update. """ - package = proto.Field(proto.STRING, number=1,) - parsed_version = proto.Field(proto.MESSAGE, number=3, message=g_package.Version,) - distribution = proto.Field(proto.MESSAGE, number=4, message="UpgradeDistribution",) - windows_update = proto.Field(proto.MESSAGE, number=5, message="WindowsUpdate",) + package = proto.Field( + proto.STRING, + number=1, + ) + parsed_version = proto.Field( + proto.MESSAGE, + number=3, + message=g_package.Version, + ) + distribution = proto.Field( + proto.MESSAGE, + number=4, + message="UpgradeDistribution", + ) + windows_update = proto.Field( + proto.MESSAGE, + number=5, + message="WindowsUpdate", + ) __all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/packages/grafeas/grafeas/grafeas_v1/types/vulnerability.py b/packages/grafeas/grafeas/grafeas_v1/types/vulnerability.py index a312b3aa8a38..de0f8528df0b 100644 --- a/packages/grafeas/grafeas/grafeas_v1/types/vulnerability.py +++ b/packages/grafeas/grafeas/grafeas_v1/types/vulnerability.py @@ -23,7 +23,11 @@ __protobuf__ = proto.module( - package="grafeas.v1", manifest={"VulnerabilityNote", "VulnerabilityOccurrence",}, + package="grafeas.v1", + manifest={ + "VulnerabilityNote", + "VulnerabilityOccurrence", + }, ) @@ -127,26 +131,66 @@ class Detail(proto.Message): The name of the vendor of the product. """ - severity_name = proto.Field(proto.STRING, number=1,) - description = proto.Field(proto.STRING, number=2,) - package_type = proto.Field(proto.STRING, number=3,) - affected_cpe_uri = proto.Field(proto.STRING, number=4,) - affected_package = proto.Field(proto.STRING, number=5,) + severity_name = proto.Field( + proto.STRING, + number=1, + ) + description = proto.Field( + proto.STRING, + number=2, + ) + package_type = proto.Field( + proto.STRING, + number=3, + ) + affected_cpe_uri = proto.Field( + proto.STRING, + number=4, + ) + affected_package = proto.Field( + proto.STRING, + number=5, + ) affected_version_start = proto.Field( - proto.MESSAGE, number=6, message=package.Version, + proto.MESSAGE, + number=6, + message=package.Version, ) affected_version_end = proto.Field( - proto.MESSAGE, number=7, message=package.Version, + proto.MESSAGE, + number=7, + message=package.Version, + ) + fixed_cpe_uri = proto.Field( + proto.STRING, + number=8, + ) + fixed_package = proto.Field( + proto.STRING, + number=9, + ) + fixed_version = proto.Field( + proto.MESSAGE, + number=10, + message=package.Version, + ) + is_obsolete = proto.Field( + proto.BOOL, + number=11, ) - fixed_cpe_uri = proto.Field(proto.STRING, number=8,) - fixed_package = proto.Field(proto.STRING, number=9,) - fixed_version = proto.Field(proto.MESSAGE, number=10, message=package.Version,) - is_obsolete = proto.Field(proto.BOOL, number=11,) source_update_time = proto.Field( - proto.MESSAGE, number=12, message=timestamp_pb2.Timestamp, + proto.MESSAGE, + number=12, + message=timestamp_pb2.Timestamp, + ) + source = proto.Field( + proto.STRING, + number=13, + ) + vendor = proto.Field( + proto.STRING, + number=14, ) - source = proto.Field(proto.STRING, number=13,) - vendor = proto.Field(proto.STRING, number=14,) class WindowsDetail(proto.Message): r""" @@ -181,27 +225,61 @@ class KnowledgeBase(proto.Message): (https://www.catalog.update.microsoft.com/). """ - name = proto.Field(proto.STRING, number=1,) - url = proto.Field(proto.STRING, number=2,) + name = proto.Field( + proto.STRING, + number=1, + ) + url = proto.Field( + proto.STRING, + number=2, + ) - cpe_uri = proto.Field(proto.STRING, number=1,) - name = proto.Field(proto.STRING, number=2,) - description = proto.Field(proto.STRING, number=3,) + cpe_uri = proto.Field( + proto.STRING, + number=1, + ) + name = proto.Field( + proto.STRING, + number=2, + ) + description = proto.Field( + proto.STRING, + number=3, + ) fixing_kbs = proto.RepeatedField( proto.MESSAGE, number=4, message="VulnerabilityNote.WindowsDetail.KnowledgeBase", ) - cvss_score = proto.Field(proto.FLOAT, number=1,) - severity = proto.Field(proto.ENUM, number=2, enum=g_severity.Severity,) - details = proto.RepeatedField(proto.MESSAGE, number=3, message=Detail,) - cvss_v3 = proto.Field(proto.MESSAGE, number=4, message=cvss.CVSSv3,) + cvss_score = proto.Field( + proto.FLOAT, + number=1, + ) + severity = proto.Field( + proto.ENUM, + number=2, + enum=g_severity.Severity, + ) + details = proto.RepeatedField( + proto.MESSAGE, + number=3, + message=Detail, + ) + cvss_v3 = proto.Field( + proto.MESSAGE, + number=4, + message=cvss.CVSSv3, + ) windows_details = proto.RepeatedField( - proto.MESSAGE, number=5, message=WindowsDetail, + proto.MESSAGE, + number=5, + message=WindowsDetail, ) source_update_time = proto.Field( - proto.MESSAGE, number=6, message=timestamp_pb2.Timestamp, + proto.MESSAGE, + number=6, + message=timestamp_pb2.Timestamp, ) @@ -296,32 +374,91 @@ class PackageIssue(proto.Message): when it is not available. """ - affected_cpe_uri = proto.Field(proto.STRING, number=1,) - affected_package = proto.Field(proto.STRING, number=2,) + affected_cpe_uri = proto.Field( + proto.STRING, + number=1, + ) + affected_package = proto.Field( + proto.STRING, + number=2, + ) affected_version = proto.Field( - proto.MESSAGE, number=3, message=package.Version, + proto.MESSAGE, + number=3, + message=package.Version, + ) + fixed_cpe_uri = proto.Field( + proto.STRING, + number=4, + ) + fixed_package = proto.Field( + proto.STRING, + number=5, + ) + fixed_version = proto.Field( + proto.MESSAGE, + number=6, + message=package.Version, + ) + fix_available = proto.Field( + proto.BOOL, + number=7, + ) + package_type = proto.Field( + proto.STRING, + number=8, ) - fixed_cpe_uri = proto.Field(proto.STRING, number=4,) - fixed_package = proto.Field(proto.STRING, number=5,) - fixed_version = proto.Field(proto.MESSAGE, number=6, message=package.Version,) - fix_available = proto.Field(proto.BOOL, number=7,) - package_type = proto.Field(proto.STRING, number=8,) effective_severity = proto.Field( - proto.ENUM, number=9, enum=g_severity.Severity, + proto.ENUM, + number=9, + enum=g_severity.Severity, ) - type_ = proto.Field(proto.STRING, number=1,) - severity = proto.Field(proto.ENUM, number=2, enum=g_severity.Severity,) - cvss_score = proto.Field(proto.FLOAT, number=3,) - cvssv3 = proto.Field(proto.MESSAGE, number=10, message=cvss.CVSS,) - package_issue = proto.RepeatedField(proto.MESSAGE, number=4, message=PackageIssue,) - short_description = proto.Field(proto.STRING, number=5,) - long_description = proto.Field(proto.STRING, number=6,) + type_ = proto.Field( + proto.STRING, + number=1, + ) + severity = proto.Field( + proto.ENUM, + number=2, + enum=g_severity.Severity, + ) + cvss_score = proto.Field( + proto.FLOAT, + number=3, + ) + cvssv3 = proto.Field( + proto.MESSAGE, + number=10, + message=cvss.CVSS, + ) + package_issue = proto.RepeatedField( + proto.MESSAGE, + number=4, + message=PackageIssue, + ) + short_description = proto.Field( + proto.STRING, + number=5, + ) + long_description = proto.Field( + proto.STRING, + number=6, + ) related_urls = proto.RepeatedField( - proto.MESSAGE, number=7, message=common.RelatedUrl, + proto.MESSAGE, + number=7, + message=common.RelatedUrl, + ) + effective_severity = proto.Field( + proto.ENUM, + number=8, + enum=g_severity.Severity, + ) + fix_available = proto.Field( + proto.BOOL, + number=9, ) - effective_severity = proto.Field(proto.ENUM, number=8, enum=g_severity.Severity,) - fix_available = proto.Field(proto.BOOL, number=9,) __all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/packages/grafeas/noxfile.py b/packages/grafeas/noxfile.py index f7c714696101..7663e2e9b8db 100644 --- a/packages/grafeas/noxfile.py +++ b/packages/grafeas/noxfile.py @@ -24,7 +24,7 @@ import nox -BLACK_VERSION = "black==19.10b0" +BLACK_VERSION = "black==22.3.0" BLACK_PATHS = ["docs", "grafeas", "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", "grafeas", "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/packages/grafeas/tests/unit/gapic/grafeas_v1/test_grafeas.py b/packages/grafeas/tests/unit/gapic/grafeas_v1/test_grafeas.py index bbde2b715519..02e57ce8f068 100644 --- a/packages/grafeas/tests/unit/gapic/grafeas_v1/test_grafeas.py +++ b/packages/grafeas/tests/unit/gapic/grafeas_v1/test_grafeas.py @@ -65,9 +65,17 @@ def client_cert_source_callback(): return b"cert bytes", b"key bytes" -@pytest.mark.parametrize("request_type", [grafeas.GetOccurrenceRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + grafeas.GetOccurrenceRequest, + dict, + ], +) def test_get_occurrence(request_type, transport: str = "grpc"): - client = GrafeasClient(transport=transport,) + client = GrafeasClient( + transport=transport, + ) # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. @@ -103,7 +111,9 @@ def test_get_occurrence(request_type, transport: str = "grpc"): def test_get_occurrence_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 = GrafeasClient(transport="grpc",) + client = GrafeasClient( + transport="grpc", + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_occurrence), "__call__") as call: @@ -117,7 +127,9 @@ def test_get_occurrence_empty_call(): async def test_get_occurrence_async( transport: str = "grpc_asyncio", request_type=grafeas.GetOccurrenceRequest ): - client = GrafeasAsyncClient(transport=transport,) + client = GrafeasAsyncClient( + transport=transport, + ) # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. @@ -177,7 +189,10 @@ def test_get_occurrence_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 @@ -202,7 +217,10 @@ async def test_get_occurrence_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_occurrence_flattened(): @@ -214,7 +232,9 @@ def test_get_occurrence_flattened(): call.return_value = grafeas.Occurrence() # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.get_occurrence(name="name_value",) + client.get_occurrence( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -232,7 +252,8 @@ def test_get_occurrence_flattened_error(): # fields is an error. with pytest.raises(ValueError): client.get_occurrence( - grafeas.GetOccurrenceRequest(), name="name_value", + grafeas.GetOccurrenceRequest(), + name="name_value", ) @@ -248,7 +269,9 @@ async def test_get_occurrence_flattened_async(): call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(grafeas.Occurrence()) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.get_occurrence(name="name_value",) + response = await client.get_occurrence( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -267,13 +290,22 @@ async def test_get_occurrence_flattened_error_async(): # fields is an error. with pytest.raises(ValueError): await client.get_occurrence( - grafeas.GetOccurrenceRequest(), name="name_value", + grafeas.GetOccurrenceRequest(), + name="name_value", ) -@pytest.mark.parametrize("request_type", [grafeas.ListOccurrencesRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + grafeas.ListOccurrencesRequest, + dict, + ], +) def test_list_occurrences(request_type, transport: str = "grpc"): - client = GrafeasClient(transport=transport,) + client = GrafeasClient( + transport=transport, + ) # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. @@ -300,7 +332,9 @@ def test_list_occurrences(request_type, transport: str = "grpc"): def test_list_occurrences_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 = GrafeasClient(transport="grpc",) + client = GrafeasClient( + transport="grpc", + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.list_occurrences), "__call__") as call: @@ -314,7 +348,9 @@ def test_list_occurrences_empty_call(): async def test_list_occurrences_async( transport: str = "grpc_asyncio", request_type=grafeas.ListOccurrencesRequest ): - client = GrafeasAsyncClient(transport=transport,) + client = GrafeasAsyncClient( + transport=transport, + ) # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. @@ -324,7 +360,9 @@ async def test_list_occurrences_async( with mock.patch.object(type(client.transport.list_occurrences), "__call__") as call: # Designate an appropriate return value for the call. call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - grafeas.ListOccurrencesResponse(next_page_token="next_page_token_value",) + grafeas.ListOccurrencesResponse( + next_page_token="next_page_token_value", + ) ) response = await client.list_occurrences(request) @@ -364,7 +402,10 @@ def test_list_occurrences_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "parent=parent/value", + ) in kw["metadata"] @pytest.mark.asyncio @@ -391,7 +432,10 @@ async def test_list_occurrences_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "parent=parent/value", + ) in kw["metadata"] def test_list_occurrences_flattened(): @@ -404,7 +448,8 @@ def test_list_occurrences_flattened(): # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. client.list_occurrences( - parent="parent_value", filter="filter_value", + parent="parent_value", + filter="filter_value", ) # Establish that the underlying call was made with the expected @@ -447,7 +492,8 @@ async def test_list_occurrences_flattened_async(): # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. response = await client.list_occurrences( - parent="parent_value", filter="filter_value", + parent="parent_value", + filter="filter_value", ) # Establish that the underlying call was made with the expected @@ -477,7 +523,9 @@ async def test_list_occurrences_flattened_error_async(): def test_list_occurrences_pager(transport_name: str = "grpc"): - client = GrafeasClient(transport=transport_name,) + client = GrafeasClient( + transport=transport_name, + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.list_occurrences), "__call__") as call: @@ -491,12 +539,21 @@ def test_list_occurrences_pager(transport_name: str = "grpc"): ], next_page_token="abc", ), - grafeas.ListOccurrencesResponse(occurrences=[], next_page_token="def",), grafeas.ListOccurrencesResponse( - occurrences=[grafeas.Occurrence(),], next_page_token="ghi", + occurrences=[], + next_page_token="def", ), grafeas.ListOccurrencesResponse( - occurrences=[grafeas.Occurrence(), grafeas.Occurrence(),], + occurrences=[ + grafeas.Occurrence(), + ], + next_page_token="ghi", + ), + grafeas.ListOccurrencesResponse( + occurrences=[ + grafeas.Occurrence(), + grafeas.Occurrence(), + ], ), RuntimeError, ) @@ -515,7 +572,9 @@ def test_list_occurrences_pager(transport_name: str = "grpc"): def test_list_occurrences_pages(transport_name: str = "grpc"): - client = GrafeasClient(transport=transport_name,) + client = GrafeasClient( + transport=transport_name, + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.list_occurrences), "__call__") as call: @@ -529,12 +588,21 @@ def test_list_occurrences_pages(transport_name: str = "grpc"): ], next_page_token="abc", ), - grafeas.ListOccurrencesResponse(occurrences=[], next_page_token="def",), grafeas.ListOccurrencesResponse( - occurrences=[grafeas.Occurrence(),], next_page_token="ghi", + occurrences=[], + next_page_token="def", + ), + grafeas.ListOccurrencesResponse( + occurrences=[ + grafeas.Occurrence(), + ], + next_page_token="ghi", ), grafeas.ListOccurrencesResponse( - occurrences=[grafeas.Occurrence(), grafeas.Occurrence(),], + occurrences=[ + grafeas.Occurrence(), + grafeas.Occurrence(), + ], ), RuntimeError, ) @@ -561,16 +629,27 @@ async def test_list_occurrences_async_pager(): ], next_page_token="abc", ), - grafeas.ListOccurrencesResponse(occurrences=[], next_page_token="def",), grafeas.ListOccurrencesResponse( - occurrences=[grafeas.Occurrence(),], next_page_token="ghi", + occurrences=[], + next_page_token="def", ), grafeas.ListOccurrencesResponse( - occurrences=[grafeas.Occurrence(), grafeas.Occurrence(),], + occurrences=[ + grafeas.Occurrence(), + ], + next_page_token="ghi", + ), + grafeas.ListOccurrencesResponse( + occurrences=[ + grafeas.Occurrence(), + grafeas.Occurrence(), + ], ), RuntimeError, ) - async_pager = await client.list_occurrences(request={},) + async_pager = await client.list_occurrences( + request={}, + ) assert async_pager.next_page_token == "abc" responses = [] async for response in async_pager: @@ -598,12 +677,21 @@ async def test_list_occurrences_async_pages(): ], next_page_token="abc", ), - grafeas.ListOccurrencesResponse(occurrences=[], next_page_token="def",), grafeas.ListOccurrencesResponse( - occurrences=[grafeas.Occurrence(),], next_page_token="ghi", + occurrences=[], + next_page_token="def", + ), + grafeas.ListOccurrencesResponse( + occurrences=[ + grafeas.Occurrence(), + ], + next_page_token="ghi", ), grafeas.ListOccurrencesResponse( - occurrences=[grafeas.Occurrence(), grafeas.Occurrence(),], + occurrences=[ + grafeas.Occurrence(), + grafeas.Occurrence(), + ], ), RuntimeError, ) @@ -614,9 +702,17 @@ async def test_list_occurrences_async_pages(): assert page_.raw_page.next_page_token == token -@pytest.mark.parametrize("request_type", [grafeas.DeleteOccurrenceRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + grafeas.DeleteOccurrenceRequest, + dict, + ], +) def test_delete_occurrence(request_type, transport: str = "grpc"): - client = GrafeasClient(transport=transport,) + client = GrafeasClient( + transport=transport, + ) # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. @@ -642,7 +738,9 @@ def test_delete_occurrence(request_type, transport: str = "grpc"): def test_delete_occurrence_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 = GrafeasClient(transport="grpc",) + client = GrafeasClient( + transport="grpc", + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -658,7 +756,9 @@ def test_delete_occurrence_empty_call(): async def test_delete_occurrence_async( transport: str = "grpc_asyncio", request_type=grafeas.DeleteOccurrenceRequest ): - client = GrafeasAsyncClient(transport=transport,) + client = GrafeasAsyncClient( + transport=transport, + ) # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. @@ -709,7 +809,10 @@ def test_delete_occurrence_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 @@ -736,7 +839,10 @@ async def test_delete_occurrence_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_delete_occurrence_flattened(): @@ -750,7 +856,9 @@ def test_delete_occurrence_flattened(): call.return_value = None # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.delete_occurrence(name="name_value",) + client.delete_occurrence( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -768,7 +876,8 @@ def test_delete_occurrence_flattened_error(): # fields is an error. with pytest.raises(ValueError): client.delete_occurrence( - grafeas.DeleteOccurrenceRequest(), name="name_value", + grafeas.DeleteOccurrenceRequest(), + name="name_value", ) @@ -786,7 +895,9 @@ async def test_delete_occurrence_flattened_async(): call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(None) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.delete_occurrence(name="name_value",) + response = await client.delete_occurrence( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -805,13 +916,22 @@ async def test_delete_occurrence_flattened_error_async(): # fields is an error. with pytest.raises(ValueError): await client.delete_occurrence( - grafeas.DeleteOccurrenceRequest(), name="name_value", + grafeas.DeleteOccurrenceRequest(), + name="name_value", ) -@pytest.mark.parametrize("request_type", [grafeas.CreateOccurrenceRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + grafeas.CreateOccurrenceRequest, + dict, + ], +) def test_create_occurrence(request_type, transport: str = "grpc"): - client = GrafeasClient(transport=transport,) + client = GrafeasClient( + transport=transport, + ) # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. @@ -849,7 +969,9 @@ def test_create_occurrence(request_type, transport: str = "grpc"): def test_create_occurrence_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 = GrafeasClient(transport="grpc",) + client = GrafeasClient( + transport="grpc", + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -865,7 +987,9 @@ def test_create_occurrence_empty_call(): async def test_create_occurrence_async( transport: str = "grpc_asyncio", request_type=grafeas.CreateOccurrenceRequest ): - client = GrafeasAsyncClient(transport=transport,) + client = GrafeasAsyncClient( + transport=transport, + ) # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. @@ -929,7 +1053,10 @@ def test_create_occurrence_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "parent=parent/value", + ) in kw["metadata"] @pytest.mark.asyncio @@ -956,7 +1083,10 @@ async def test_create_occurrence_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "parent=parent/value", + ) in kw["metadata"] def test_create_occurrence_flattened(): @@ -971,7 +1101,8 @@ def test_create_occurrence_flattened(): # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. client.create_occurrence( - parent="parent_value", occurrence=grafeas.Occurrence(name="name_value"), + parent="parent_value", + occurrence=grafeas.Occurrence(name="name_value"), ) # Establish that the underlying call was made with the expected @@ -1014,7 +1145,8 @@ async def test_create_occurrence_flattened_async(): # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. response = await client.create_occurrence( - parent="parent_value", occurrence=grafeas.Occurrence(name="name_value"), + parent="parent_value", + occurrence=grafeas.Occurrence(name="name_value"), ) # Establish that the underlying call was made with the expected @@ -1043,9 +1175,17 @@ async def test_create_occurrence_flattened_error_async(): ) -@pytest.mark.parametrize("request_type", [grafeas.BatchCreateOccurrencesRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + grafeas.BatchCreateOccurrencesRequest, + dict, + ], +) def test_batch_create_occurrences(request_type, transport: str = "grpc"): - client = GrafeasClient(transport=transport,) + client = GrafeasClient( + transport=transport, + ) # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. @@ -1071,7 +1211,9 @@ def test_batch_create_occurrences(request_type, transport: str = "grpc"): def test_batch_create_occurrences_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 = GrafeasClient(transport="grpc",) + client = GrafeasClient( + transport="grpc", + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1087,7 +1229,9 @@ def test_batch_create_occurrences_empty_call(): async def test_batch_create_occurrences_async( transport: str = "grpc_asyncio", request_type=grafeas.BatchCreateOccurrencesRequest ): - client = GrafeasAsyncClient(transport=transport,) + client = GrafeasAsyncClient( + transport=transport, + ) # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. @@ -1140,7 +1284,10 @@ def test_batch_create_occurrences_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "parent=parent/value", + ) in kw["metadata"] @pytest.mark.asyncio @@ -1169,7 +1316,10 @@ async def test_batch_create_occurrences_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "parent=parent/value", + ) in kw["metadata"] def test_batch_create_occurrences_flattened(): @@ -1184,7 +1334,8 @@ def test_batch_create_occurrences_flattened(): # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. client.batch_create_occurrences( - parent="parent_value", occurrences=[grafeas.Occurrence(name="name_value")], + parent="parent_value", + occurrences=[grafeas.Occurrence(name="name_value")], ) # Establish that the underlying call was made with the expected @@ -1229,7 +1380,8 @@ async def test_batch_create_occurrences_flattened_async(): # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. response = await client.batch_create_occurrences( - parent="parent_value", occurrences=[grafeas.Occurrence(name="name_value")], + parent="parent_value", + occurrences=[grafeas.Occurrence(name="name_value")], ) # Establish that the underlying call was made with the expected @@ -1258,9 +1410,17 @@ async def test_batch_create_occurrences_flattened_error_async(): ) -@pytest.mark.parametrize("request_type", [grafeas.UpdateOccurrenceRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + grafeas.UpdateOccurrenceRequest, + dict, + ], +) def test_update_occurrence(request_type, transport: str = "grpc"): - client = GrafeasClient(transport=transport,) + client = GrafeasClient( + transport=transport, + ) # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. @@ -1298,7 +1458,9 @@ def test_update_occurrence(request_type, transport: str = "grpc"): def test_update_occurrence_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 = GrafeasClient(transport="grpc",) + client = GrafeasClient( + transport="grpc", + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1314,7 +1476,9 @@ def test_update_occurrence_empty_call(): async def test_update_occurrence_async( transport: str = "grpc_asyncio", request_type=grafeas.UpdateOccurrenceRequest ): - client = GrafeasAsyncClient(transport=transport,) + client = GrafeasAsyncClient( + transport=transport, + ) # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. @@ -1378,7 +1542,10 @@ def test_update_occurrence_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 @@ -1405,7 +1572,10 @@ async def test_update_occurrence_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_update_occurrence_flattened(): @@ -1504,9 +1674,17 @@ async def test_update_occurrence_flattened_error_async(): ) -@pytest.mark.parametrize("request_type", [grafeas.GetOccurrenceNoteRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + grafeas.GetOccurrenceNoteRequest, + dict, + ], +) def test_get_occurrence_note(request_type, transport: str = "grpc"): - client = GrafeasClient(transport=transport,) + client = GrafeasClient( + transport=transport, + ) # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. @@ -1544,7 +1722,9 @@ def test_get_occurrence_note(request_type, transport: str = "grpc"): def test_get_occurrence_note_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 = GrafeasClient(transport="grpc",) + client = GrafeasClient( + transport="grpc", + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1560,7 +1740,9 @@ def test_get_occurrence_note_empty_call(): async def test_get_occurrence_note_async( transport: str = "grpc_asyncio", request_type=grafeas.GetOccurrenceNoteRequest ): - client = GrafeasAsyncClient(transport=transport,) + client = GrafeasAsyncClient( + transport=transport, + ) # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. @@ -1624,7 +1806,10 @@ def test_get_occurrence_note_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 @@ -1651,7 +1836,10 @@ async def test_get_occurrence_note_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_occurrence_note_flattened(): @@ -1665,7 +1853,9 @@ def test_get_occurrence_note_flattened(): call.return_value = grafeas.Note() # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.get_occurrence_note(name="name_value",) + client.get_occurrence_note( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -1683,7 +1873,8 @@ def test_get_occurrence_note_flattened_error(): # fields is an error. with pytest.raises(ValueError): client.get_occurrence_note( - grafeas.GetOccurrenceNoteRequest(), name="name_value", + grafeas.GetOccurrenceNoteRequest(), + name="name_value", ) @@ -1701,7 +1892,9 @@ async def test_get_occurrence_note_flattened_async(): call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(grafeas.Note()) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.get_occurrence_note(name="name_value",) + response = await client.get_occurrence_note( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -1720,13 +1913,22 @@ async def test_get_occurrence_note_flattened_error_async(): # fields is an error. with pytest.raises(ValueError): await client.get_occurrence_note( - grafeas.GetOccurrenceNoteRequest(), name="name_value", + grafeas.GetOccurrenceNoteRequest(), + name="name_value", ) -@pytest.mark.parametrize("request_type", [grafeas.GetNoteRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + grafeas.GetNoteRequest, + dict, + ], +) def test_get_note(request_type, transport: str = "grpc"): - client = GrafeasClient(transport=transport,) + client = GrafeasClient( + transport=transport, + ) # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. @@ -1762,7 +1964,9 @@ def test_get_note(request_type, transport: str = "grpc"): def test_get_note_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 = GrafeasClient(transport="grpc",) + client = GrafeasClient( + transport="grpc", + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_note), "__call__") as call: @@ -1776,7 +1980,9 @@ def test_get_note_empty_call(): async def test_get_note_async( transport: str = "grpc_asyncio", request_type=grafeas.GetNoteRequest ): - client = GrafeasAsyncClient(transport=transport,) + client = GrafeasAsyncClient( + transport=transport, + ) # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. @@ -1836,7 +2042,10 @@ def test_get_note_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 @@ -1861,7 +2070,10 @@ async def test_get_note_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_note_flattened(): @@ -1873,7 +2085,9 @@ def test_get_note_flattened(): call.return_value = grafeas.Note() # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.get_note(name="name_value",) + client.get_note( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -1891,7 +2105,8 @@ def test_get_note_flattened_error(): # fields is an error. with pytest.raises(ValueError): client.get_note( - grafeas.GetNoteRequest(), name="name_value", + grafeas.GetNoteRequest(), + name="name_value", ) @@ -1907,7 +2122,9 @@ async def test_get_note_flattened_async(): call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(grafeas.Note()) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.get_note(name="name_value",) + response = await client.get_note( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -1926,13 +2143,22 @@ async def test_get_note_flattened_error_async(): # fields is an error. with pytest.raises(ValueError): await client.get_note( - grafeas.GetNoteRequest(), name="name_value", + grafeas.GetNoteRequest(), + name="name_value", ) -@pytest.mark.parametrize("request_type", [grafeas.ListNotesRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + grafeas.ListNotesRequest, + dict, + ], +) def test_list_notes(request_type, transport: str = "grpc"): - client = GrafeasClient(transport=transport,) + client = GrafeasClient( + transport=transport, + ) # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. @@ -1959,7 +2185,9 @@ def test_list_notes(request_type, transport: str = "grpc"): def test_list_notes_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 = GrafeasClient(transport="grpc",) + client = GrafeasClient( + transport="grpc", + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.list_notes), "__call__") as call: @@ -1973,7 +2201,9 @@ def test_list_notes_empty_call(): async def test_list_notes_async( transport: str = "grpc_asyncio", request_type=grafeas.ListNotesRequest ): - client = GrafeasAsyncClient(transport=transport,) + client = GrafeasAsyncClient( + transport=transport, + ) # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. @@ -1983,7 +2213,9 @@ async def test_list_notes_async( with mock.patch.object(type(client.transport.list_notes), "__call__") as call: # Designate an appropriate return value for the call. call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - grafeas.ListNotesResponse(next_page_token="next_page_token_value",) + grafeas.ListNotesResponse( + next_page_token="next_page_token_value", + ) ) response = await client.list_notes(request) @@ -2023,7 +2255,10 @@ def test_list_notes_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "parent=parent/value", + ) in kw["metadata"] @pytest.mark.asyncio @@ -2050,7 +2285,10 @@ async def test_list_notes_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "parent=parent/value", + ) in kw["metadata"] def test_list_notes_flattened(): @@ -2063,7 +2301,8 @@ def test_list_notes_flattened(): # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. client.list_notes( - parent="parent_value", filter="filter_value", + parent="parent_value", + filter="filter_value", ) # Establish that the underlying call was made with the expected @@ -2085,7 +2324,9 @@ def test_list_notes_flattened_error(): # fields is an error. with pytest.raises(ValueError): client.list_notes( - grafeas.ListNotesRequest(), parent="parent_value", filter="filter_value", + grafeas.ListNotesRequest(), + parent="parent_value", + filter="filter_value", ) @@ -2104,7 +2345,8 @@ async def test_list_notes_flattened_async(): # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. response = await client.list_notes( - parent="parent_value", filter="filter_value", + parent="parent_value", + filter="filter_value", ) # Establish that the underlying call was made with the expected @@ -2127,24 +2369,45 @@ async def test_list_notes_flattened_error_async(): # fields is an error. with pytest.raises(ValueError): await client.list_notes( - grafeas.ListNotesRequest(), parent="parent_value", filter="filter_value", + grafeas.ListNotesRequest(), + parent="parent_value", + filter="filter_value", ) def test_list_notes_pager(transport_name: str = "grpc"): - client = GrafeasClient(transport=transport_name,) + client = GrafeasClient( + transport=transport_name, + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.list_notes), "__call__") as call: # Set the response to a series of pages. call.side_effect = ( grafeas.ListNotesResponse( - notes=[grafeas.Note(), grafeas.Note(), grafeas.Note(),], + notes=[ + grafeas.Note(), + grafeas.Note(), + grafeas.Note(), + ], next_page_token="abc", ), - grafeas.ListNotesResponse(notes=[], next_page_token="def",), - grafeas.ListNotesResponse(notes=[grafeas.Note(),], next_page_token="ghi",), - grafeas.ListNotesResponse(notes=[grafeas.Note(), grafeas.Note(),],), + grafeas.ListNotesResponse( + notes=[], + next_page_token="def", + ), + grafeas.ListNotesResponse( + notes=[ + grafeas.Note(), + ], + next_page_token="ghi", + ), + grafeas.ListNotesResponse( + notes=[ + grafeas.Note(), + grafeas.Note(), + ], + ), RuntimeError, ) @@ -2162,19 +2425,38 @@ def test_list_notes_pager(transport_name: str = "grpc"): def test_list_notes_pages(transport_name: str = "grpc"): - client = GrafeasClient(transport=transport_name,) + client = GrafeasClient( + transport=transport_name, + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.list_notes), "__call__") as call: # Set the response to a series of pages. call.side_effect = ( grafeas.ListNotesResponse( - notes=[grafeas.Note(), grafeas.Note(), grafeas.Note(),], + notes=[ + grafeas.Note(), + grafeas.Note(), + grafeas.Note(), + ], next_page_token="abc", ), - grafeas.ListNotesResponse(notes=[], next_page_token="def",), - grafeas.ListNotesResponse(notes=[grafeas.Note(),], next_page_token="ghi",), - grafeas.ListNotesResponse(notes=[grafeas.Note(), grafeas.Note(),],), + grafeas.ListNotesResponse( + notes=[], + next_page_token="def", + ), + grafeas.ListNotesResponse( + notes=[ + grafeas.Note(), + ], + next_page_token="ghi", + ), + grafeas.ListNotesResponse( + notes=[ + grafeas.Note(), + grafeas.Note(), + ], + ), RuntimeError, ) pages = list(client.list_notes(request={}).pages) @@ -2193,15 +2475,34 @@ async def test_list_notes_async_pager(): # Set the response to a series of pages. call.side_effect = ( grafeas.ListNotesResponse( - notes=[grafeas.Note(), grafeas.Note(), grafeas.Note(),], + notes=[ + grafeas.Note(), + grafeas.Note(), + grafeas.Note(), + ], next_page_token="abc", ), - grafeas.ListNotesResponse(notes=[], next_page_token="def",), - grafeas.ListNotesResponse(notes=[grafeas.Note(),], next_page_token="ghi",), - grafeas.ListNotesResponse(notes=[grafeas.Note(), grafeas.Note(),],), + grafeas.ListNotesResponse( + notes=[], + next_page_token="def", + ), + grafeas.ListNotesResponse( + notes=[ + grafeas.Note(), + ], + next_page_token="ghi", + ), + grafeas.ListNotesResponse( + notes=[ + grafeas.Note(), + grafeas.Note(), + ], + ), RuntimeError, ) - async_pager = await client.list_notes(request={},) + async_pager = await client.list_notes( + request={}, + ) assert async_pager.next_page_token == "abc" responses = [] async for response in async_pager: @@ -2222,12 +2523,29 @@ async def test_list_notes_async_pages(): # Set the response to a series of pages. call.side_effect = ( grafeas.ListNotesResponse( - notes=[grafeas.Note(), grafeas.Note(), grafeas.Note(),], + notes=[ + grafeas.Note(), + grafeas.Note(), + grafeas.Note(), + ], next_page_token="abc", ), - grafeas.ListNotesResponse(notes=[], next_page_token="def",), - grafeas.ListNotesResponse(notes=[grafeas.Note(),], next_page_token="ghi",), - grafeas.ListNotesResponse(notes=[grafeas.Note(), grafeas.Note(),],), + grafeas.ListNotesResponse( + notes=[], + next_page_token="def", + ), + grafeas.ListNotesResponse( + notes=[ + grafeas.Note(), + ], + next_page_token="ghi", + ), + grafeas.ListNotesResponse( + notes=[ + grafeas.Note(), + grafeas.Note(), + ], + ), RuntimeError, ) pages = [] @@ -2237,9 +2555,17 @@ async def test_list_notes_async_pages(): assert page_.raw_page.next_page_token == token -@pytest.mark.parametrize("request_type", [grafeas.DeleteNoteRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + grafeas.DeleteNoteRequest, + dict, + ], +) def test_delete_note(request_type, transport: str = "grpc"): - client = GrafeasClient(transport=transport,) + client = GrafeasClient( + transport=transport, + ) # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. @@ -2263,7 +2589,9 @@ def test_delete_note(request_type, transport: str = "grpc"): def test_delete_note_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 = GrafeasClient(transport="grpc",) + client = GrafeasClient( + transport="grpc", + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.delete_note), "__call__") as call: @@ -2277,7 +2605,9 @@ def test_delete_note_empty_call(): async def test_delete_note_async( transport: str = "grpc_asyncio", request_type=grafeas.DeleteNoteRequest ): - client = GrafeasAsyncClient(transport=transport,) + client = GrafeasAsyncClient( + transport=transport, + ) # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. @@ -2324,7 +2654,10 @@ def test_delete_note_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 @@ -2349,7 +2682,10 @@ async def test_delete_note_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_delete_note_flattened(): @@ -2361,7 +2697,9 @@ def test_delete_note_flattened(): call.return_value = None # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.delete_note(name="name_value",) + client.delete_note( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -2379,7 +2717,8 @@ def test_delete_note_flattened_error(): # fields is an error. with pytest.raises(ValueError): client.delete_note( - grafeas.DeleteNoteRequest(), name="name_value", + grafeas.DeleteNoteRequest(), + name="name_value", ) @@ -2395,7 +2734,9 @@ async def test_delete_note_flattened_async(): call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(None) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.delete_note(name="name_value",) + response = await client.delete_note( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -2414,13 +2755,22 @@ async def test_delete_note_flattened_error_async(): # fields is an error. with pytest.raises(ValueError): await client.delete_note( - grafeas.DeleteNoteRequest(), name="name_value", + grafeas.DeleteNoteRequest(), + name="name_value", ) -@pytest.mark.parametrize("request_type", [grafeas.CreateNoteRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + grafeas.CreateNoteRequest, + dict, + ], +) def test_create_note(request_type, transport: str = "grpc"): - client = GrafeasClient(transport=transport,) + client = GrafeasClient( + transport=transport, + ) # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. @@ -2456,7 +2806,9 @@ def test_create_note(request_type, transport: str = "grpc"): def test_create_note_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 = GrafeasClient(transport="grpc",) + client = GrafeasClient( + transport="grpc", + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.create_note), "__call__") as call: @@ -2470,7 +2822,9 @@ def test_create_note_empty_call(): async def test_create_note_async( transport: str = "grpc_asyncio", request_type=grafeas.CreateNoteRequest ): - client = GrafeasAsyncClient(transport=transport,) + client = GrafeasAsyncClient( + transport=transport, + ) # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. @@ -2530,7 +2884,10 @@ def test_create_note_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "parent=parent/value", + ) in kw["metadata"] @pytest.mark.asyncio @@ -2555,7 +2912,10 @@ async def test_create_note_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "parent=parent/value", + ) in kw["metadata"] def test_create_note_flattened(): @@ -2650,9 +3010,17 @@ async def test_create_note_flattened_error_async(): ) -@pytest.mark.parametrize("request_type", [grafeas.BatchCreateNotesRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + grafeas.BatchCreateNotesRequest, + dict, + ], +) def test_batch_create_notes(request_type, transport: str = "grpc"): - client = GrafeasClient(transport=transport,) + client = GrafeasClient( + transport=transport, + ) # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. @@ -2678,7 +3046,9 @@ def test_batch_create_notes(request_type, transport: str = "grpc"): def test_batch_create_notes_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 = GrafeasClient(transport="grpc",) + client = GrafeasClient( + transport="grpc", + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2694,7 +3064,9 @@ def test_batch_create_notes_empty_call(): async def test_batch_create_notes_async( transport: str = "grpc_asyncio", request_type=grafeas.BatchCreateNotesRequest ): - client = GrafeasAsyncClient(transport=transport,) + client = GrafeasAsyncClient( + transport=transport, + ) # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. @@ -2747,7 +3119,10 @@ def test_batch_create_notes_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "parent=parent/value", + ) in kw["metadata"] @pytest.mark.asyncio @@ -2776,7 +3151,10 @@ async def test_batch_create_notes_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "parent=parent/value", + ) in kw["metadata"] def test_batch_create_notes_flattened(): @@ -2791,7 +3169,8 @@ def test_batch_create_notes_flattened(): # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. client.batch_create_notes( - parent="parent_value", notes={"key_value": grafeas.Note(name="name_value")}, + parent="parent_value", + notes={"key_value": grafeas.Note(name="name_value")}, ) # Establish that the underlying call was made with the expected @@ -2836,7 +3215,8 @@ async def test_batch_create_notes_flattened_async(): # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. response = await client.batch_create_notes( - parent="parent_value", notes={"key_value": grafeas.Note(name="name_value")}, + parent="parent_value", + notes={"key_value": grafeas.Note(name="name_value")}, ) # Establish that the underlying call was made with the expected @@ -2865,9 +3245,17 @@ async def test_batch_create_notes_flattened_error_async(): ) -@pytest.mark.parametrize("request_type", [grafeas.UpdateNoteRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + grafeas.UpdateNoteRequest, + dict, + ], +) def test_update_note(request_type, transport: str = "grpc"): - client = GrafeasClient(transport=transport,) + client = GrafeasClient( + transport=transport, + ) # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. @@ -2903,7 +3291,9 @@ def test_update_note(request_type, transport: str = "grpc"): def test_update_note_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 = GrafeasClient(transport="grpc",) + client = GrafeasClient( + transport="grpc", + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.update_note), "__call__") as call: @@ -2917,7 +3307,9 @@ def test_update_note_empty_call(): async def test_update_note_async( transport: str = "grpc_asyncio", request_type=grafeas.UpdateNoteRequest ): - client = GrafeasAsyncClient(transport=transport,) + client = GrafeasAsyncClient( + transport=transport, + ) # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. @@ -2977,7 +3369,10 @@ def test_update_note_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 @@ -3002,7 +3397,10 @@ async def test_update_note_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_update_note_flattened(): @@ -3097,9 +3495,17 @@ async def test_update_note_flattened_error_async(): ) -@pytest.mark.parametrize("request_type", [grafeas.ListNoteOccurrencesRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + grafeas.ListNoteOccurrencesRequest, + dict, + ], +) def test_list_note_occurrences(request_type, transport: str = "grpc"): - client = GrafeasClient(transport=transport,) + client = GrafeasClient( + transport=transport, + ) # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. @@ -3128,7 +3534,9 @@ def test_list_note_occurrences(request_type, transport: str = "grpc"): def test_list_note_occurrences_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 = GrafeasClient(transport="grpc",) + client = GrafeasClient( + transport="grpc", + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3144,7 +3552,9 @@ def test_list_note_occurrences_empty_call(): async def test_list_note_occurrences_async( transport: str = "grpc_asyncio", request_type=grafeas.ListNoteOccurrencesRequest ): - client = GrafeasAsyncClient(transport=transport,) + client = GrafeasAsyncClient( + transport=transport, + ) # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. @@ -3200,7 +3610,10 @@ def test_list_note_occurrences_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 @@ -3229,7 +3642,10 @@ async def test_list_note_occurrences_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_list_note_occurrences_flattened(): @@ -3244,7 +3660,8 @@ def test_list_note_occurrences_flattened(): # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. client.list_note_occurrences( - name="name_value", filter="filter_value", + name="name_value", + filter="filter_value", ) # Establish that the underlying call was made with the expected @@ -3289,7 +3706,8 @@ async def test_list_note_occurrences_flattened_async(): # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. response = await client.list_note_occurrences( - name="name_value", filter="filter_value", + name="name_value", + filter="filter_value", ) # Establish that the underlying call was made with the expected @@ -3319,7 +3737,9 @@ async def test_list_note_occurrences_flattened_error_async(): def test_list_note_occurrences_pager(transport_name: str = "grpc"): - client = GrafeasClient(transport=transport_name,) + client = GrafeasClient( + transport=transport_name, + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3335,12 +3755,21 @@ def test_list_note_occurrences_pager(transport_name: str = "grpc"): ], next_page_token="abc", ), - grafeas.ListNoteOccurrencesResponse(occurrences=[], next_page_token="def",), grafeas.ListNoteOccurrencesResponse( - occurrences=[grafeas.Occurrence(),], next_page_token="ghi", + occurrences=[], + next_page_token="def", ), grafeas.ListNoteOccurrencesResponse( - occurrences=[grafeas.Occurrence(), grafeas.Occurrence(),], + occurrences=[ + grafeas.Occurrence(), + ], + next_page_token="ghi", + ), + grafeas.ListNoteOccurrencesResponse( + occurrences=[ + grafeas.Occurrence(), + grafeas.Occurrence(), + ], ), RuntimeError, ) @@ -3359,7 +3788,9 @@ def test_list_note_occurrences_pager(transport_name: str = "grpc"): def test_list_note_occurrences_pages(transport_name: str = "grpc"): - client = GrafeasClient(transport=transport_name,) + client = GrafeasClient( + transport=transport_name, + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3375,12 +3806,21 @@ def test_list_note_occurrences_pages(transport_name: str = "grpc"): ], next_page_token="abc", ), - grafeas.ListNoteOccurrencesResponse(occurrences=[], next_page_token="def",), grafeas.ListNoteOccurrencesResponse( - occurrences=[grafeas.Occurrence(),], next_page_token="ghi", + occurrences=[], + next_page_token="def", ), grafeas.ListNoteOccurrencesResponse( - occurrences=[grafeas.Occurrence(), grafeas.Occurrence(),], + occurrences=[ + grafeas.Occurrence(), + ], + next_page_token="ghi", + ), + grafeas.ListNoteOccurrencesResponse( + occurrences=[ + grafeas.Occurrence(), + grafeas.Occurrence(), + ], ), RuntimeError, ) @@ -3409,16 +3849,27 @@ async def test_list_note_occurrences_async_pager(): ], next_page_token="abc", ), - grafeas.ListNoteOccurrencesResponse(occurrences=[], next_page_token="def",), grafeas.ListNoteOccurrencesResponse( - occurrences=[grafeas.Occurrence(),], next_page_token="ghi", + occurrences=[], + next_page_token="def", ), grafeas.ListNoteOccurrencesResponse( - occurrences=[grafeas.Occurrence(), grafeas.Occurrence(),], + occurrences=[ + grafeas.Occurrence(), + ], + next_page_token="ghi", + ), + grafeas.ListNoteOccurrencesResponse( + occurrences=[ + grafeas.Occurrence(), + grafeas.Occurrence(), + ], ), RuntimeError, ) - async_pager = await client.list_note_occurrences(request={},) + async_pager = await client.list_note_occurrences( + request={}, + ) assert async_pager.next_page_token == "abc" responses = [] async for response in async_pager: @@ -3448,12 +3899,21 @@ async def test_list_note_occurrences_async_pages(): ], next_page_token="abc", ), - grafeas.ListNoteOccurrencesResponse(occurrences=[], next_page_token="def",), grafeas.ListNoteOccurrencesResponse( - occurrences=[grafeas.Occurrence(),], next_page_token="ghi", + occurrences=[], + next_page_token="def", ), grafeas.ListNoteOccurrencesResponse( - occurrences=[grafeas.Occurrence(), grafeas.Occurrence(),], + occurrences=[ + grafeas.Occurrence(), + ], + next_page_token="ghi", + ), + grafeas.ListNoteOccurrencesResponse( + occurrences=[ + grafeas.Occurrence(), + grafeas.Occurrence(), + ], ), RuntimeError, ) @@ -3484,7 +3944,10 @@ def test_transport_get_channel(): @pytest.mark.parametrize( "transport_class", - [transports.GrafeasGrpcTransport, transports.GrafeasGrpcAsyncIOTransport,], + [ + transports.GrafeasGrpcTransport, + transports.GrafeasGrpcAsyncIOTransport, + ], ) def test_transport_adc(transport_class): # Test default credentials are used if not provided. @@ -3497,7 +3960,10 @@ def test_transport_adc(transport_class): def test_transport_grpc_default(): # A client should use the gRPC transport by default. client = GrafeasClient() - assert isinstance(client.transport, transports.GrafeasGrpcTransport,) + assert isinstance( + client.transport, + transports.GrafeasGrpcTransport, + ) def test_grafeas_base_transport(): @@ -3544,7 +4010,8 @@ def test_grafeas_base_transport_with_credentials_file(): Transport.return_value = None load_creds.return_value = (ga_credentials.AnonymousCredentials(), None) transport = transports.GrafeasTransport( - credentials_file="credentials.json", quota_project_id="octopus", + credentials_file="credentials.json", + quota_project_id="octopus", ) load_creds.assert_called_once_with( "credentials.json", @@ -3571,13 +4038,18 @@ def test_grafeas_auth_adc(): adc.return_value = (ga_credentials.AnonymousCredentials(), None) GrafeasClient() adc.assert_called_once_with( - scopes=None, default_scopes=(), quota_project_id=None, + scopes=None, + default_scopes=(), + quota_project_id=None, ) @pytest.mark.parametrize( "transport_class", - [transports.GrafeasGrpcTransport, transports.GrafeasGrpcAsyncIOTransport,], + [ + transports.GrafeasGrpcTransport, + transports.GrafeasGrpcAsyncIOTransport, + ], ) def test_grafeas_transport_auth_adc(transport_class): # If credentials and host are not provided, the transport class should use @@ -3586,7 +4058,9 @@ def test_grafeas_transport_auth_adc(transport_class): adc.return_value = (ga_credentials.AnonymousCredentials(), None) transport_class(quota_project_id="octopus", scopes=["1", "2"]) adc.assert_called_once_with( - scopes=["1", "2"], default_scopes=(), quota_project_id="octopus", + scopes=["1", "2"], + default_scopes=(), + quota_project_id="octopus", ) @@ -3672,7 +4146,8 @@ def test_grafeas_grpc_transport_channel(): # Check that channel is used if provided. transport = transports.GrafeasGrpcTransport( - host="squid.clam.whelk", channel=channel, + host="squid.clam.whelk", + channel=channel, ) assert transport.grpc_channel == channel assert transport._host == "squid.clam.whelk:443" @@ -3684,7 +4159,8 @@ def test_grafeas_grpc_asyncio_transport_channel(): # Check that channel is used if provided. transport = transports.GrafeasGrpcAsyncIOTransport( - host="squid.clam.whelk", channel=channel, + host="squid.clam.whelk", + channel=channel, ) assert transport.grpc_channel == channel assert transport._host == "squid.clam.whelk:443" @@ -3786,7 +4262,10 @@ def test_grafeas_transport_channel_mtls_with_adc(transport_class): def test_note_path(): project = "squid" note = "clam" - expected = "projects/{project}/notes/{note}".format(project=project, note=note,) + expected = "projects/{project}/notes/{note}".format( + project=project, + note=note, + ) actual = GrafeasClient.note_path(project, note) assert expected == actual @@ -3807,7 +4286,8 @@ def test_occurrence_path(): project = "oyster" occurrence = "nudibranch" expected = "projects/{project}/occurrences/{occurrence}".format( - project=project, occurrence=occurrence, + project=project, + occurrence=occurrence, ) actual = GrafeasClient.occurrence_path(project, occurrence) assert expected == actual @@ -3827,7 +4307,9 @@ def test_parse_occurrence_path(): def test_project_path(): project = "winkle" - expected = "projects/{project}".format(project=project,) + expected = "projects/{project}".format( + project=project, + ) actual = GrafeasClient.project_path(project) assert expected == actual @@ -3865,7 +4347,9 @@ def test_parse_common_billing_account_path(): def test_common_folder_path(): folder = "squid" - expected = "folders/{folder}".format(folder=folder,) + expected = "folders/{folder}".format( + folder=folder, + ) actual = GrafeasClient.common_folder_path(folder) assert expected == actual @@ -3883,7 +4367,9 @@ def test_parse_common_folder_path(): def test_common_organization_path(): organization = "whelk" - expected = "organizations/{organization}".format(organization=organization,) + expected = "organizations/{organization}".format( + organization=organization, + ) actual = GrafeasClient.common_organization_path(organization) assert expected == actual @@ -3901,7 +4387,9 @@ def test_parse_common_organization_path(): def test_common_project_path(): project = "oyster" - expected = "projects/{project}".format(project=project,) + expected = "projects/{project}".format( + project=project, + ) actual = GrafeasClient.common_project_path(project) assert expected == actual @@ -3921,7 +4409,8 @@ def test_common_location_path(): project = "cuttlefish" location = "mussel" expected = "projects/{project}/locations/{location}".format( - project=project, location=location, + project=project, + location=location, ) actual = GrafeasClient.common_location_path(project, location) assert expected == actual @@ -3941,7 +4430,9 @@ def test_parse_common_location_path(): @pytest.mark.asyncio async def test_transport_close_async(): - client = GrafeasAsyncClient(transport="grpc_asyncio",) + client = GrafeasAsyncClient( + transport="grpc_asyncio", + ) with mock.patch.object( type(getattr(client.transport, "grpc_channel")), "close" ) as close: