Skip to content

Commit

Permalink
chore: use gapic-generator-python 0.53.4 (#206)
Browse files Browse the repository at this point in the history
- [ ] Regenerate this pull request now.

docs: list oneofs in docstring
fix(deps): require google-api-core >= 1.28.0
fix(deps): drop packaging dependency

committer: busunkim96@
PiperOrigin-RevId: 406468269

Source-Link: googleapis/googleapis@83d81b0

Source-Link: googleapis/googleapis-gen@2ff001f
Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiMmZmMDAxZmJhY2I5ZTc3ZTcxZDczNGRlNWY5NTVjMDVmZGFlODUyNiJ9
  • Loading branch information
gcf-owl-bot[bot] authored Nov 1, 2021
1 parent c60779e commit 92abb2d
Show file tree
Hide file tree
Showing 7 changed files with 35 additions and 139 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,15 @@
from typing import Dict, Sequence, Tuple, Type, Union
import pkg_resources

import google.api_core.client_options as ClientOptions # type: ignore
from google.api_core.client_options import ClientOptions # type: ignore
from google.api_core import exceptions as core_exceptions # type: ignore
from google.api_core import gapic_v1 # type: ignore
from google.api_core import retry as retries # type: ignore
from google.auth import credentials as ga_credentials # type: ignore
from google.oauth2 import service_account # type: ignore

OptionalRetry = Union[retries.Retry, object]

from google.cloud.devtools.containeranalysis_v1.types import containeranalysis
from google.iam.v1 import iam_policy_pb2 # type: ignore
from google.iam.v1 import policy_pb2 # type: ignore
Expand Down Expand Up @@ -190,10 +192,10 @@ def get_grafeas_client(self) -> grafeas_v1.GrafeasClient:

async def set_iam_policy(
self,
request: iam_policy_pb2.SetIamPolicyRequest = None,
request: Union[iam_policy_pb2.SetIamPolicyRequest, dict] = None,
*,
resource: str = None,
retry: retries.Retry = gapic_v1.method.DEFAULT,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: float = None,
metadata: Sequence[Tuple[str, str]] = (),
) -> policy_pb2.Policy:
Expand All @@ -208,7 +210,7 @@ async def set_iam_policy(
occurrences.
Args:
request (:class:`google.iam.v1.iam_policy_pb2.SetIamPolicyRequest`):
request (Union[google.iam.v1.iam_policy_pb2.SetIamPolicyRequest, dict]):
The request object. Request message for `SetIamPolicy`
method.
resource (:class:`str`):
Expand Down Expand Up @@ -324,10 +326,10 @@ async def set_iam_policy(

async def get_iam_policy(
self,
request: iam_policy_pb2.GetIamPolicyRequest = None,
request: Union[iam_policy_pb2.GetIamPolicyRequest, dict] = None,
*,
resource: str = None,
retry: retries.Retry = gapic_v1.method.DEFAULT,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: float = None,
metadata: Sequence[Tuple[str, str]] = (),
) -> policy_pb2.Policy:
Expand All @@ -342,7 +344,7 @@ async def get_iam_policy(
occurrences.
Args:
request (:class:`google.iam.v1.iam_policy_pb2.GetIamPolicyRequest`):
request (Union[google.iam.v1.iam_policy_pb2.GetIamPolicyRequest, dict]):
The request object. Request message for `GetIamPolicy`
method.
resource (:class:`str`):
Expand Down Expand Up @@ -458,11 +460,11 @@ async def get_iam_policy(

async def test_iam_permissions(
self,
request: iam_policy_pb2.TestIamPermissionsRequest = None,
request: Union[iam_policy_pb2.TestIamPermissionsRequest, dict] = None,
*,
resource: str = None,
permissions: Sequence[str] = None,
retry: retries.Retry = gapic_v1.method.DEFAULT,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: float = None,
metadata: Sequence[Tuple[str, str]] = (),
) -> iam_policy_pb2.TestIamPermissionsResponse:
Expand All @@ -476,7 +478,7 @@ async def test_iam_permissions(
occurrences.
Args:
request (:class:`google.iam.v1.iam_policy_pb2.TestIamPermissionsRequest`):
request (Union[google.iam.v1.iam_policy_pb2.TestIamPermissionsRequest, dict]):
The request object. Request message for
`TestIamPermissions` method.
resource (:class:`str`):
Expand Down Expand Up @@ -548,19 +550,21 @@ async def test_iam_permissions(

async def get_vulnerability_occurrences_summary(
self,
request: containeranalysis.GetVulnerabilityOccurrencesSummaryRequest = None,
request: Union[
containeranalysis.GetVulnerabilityOccurrencesSummaryRequest, dict
] = None,
*,
parent: str = None,
filter: str = None,
retry: retries.Retry = gapic_v1.method.DEFAULT,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: float = None,
metadata: Sequence[Tuple[str, str]] = (),
) -> containeranalysis.VulnerabilityOccurrencesSummary:
r"""Gets a summary of the number and severity of
occurrences.
Args:
request (:class:`google.cloud.devtools.containeranalysis_v1.types.GetVulnerabilityOccurrencesSummaryRequest`):
request (Union[google.cloud.devtools.containeranalysis_v1.types.GetVulnerabilityOccurrencesSummaryRequest, dict]):
The request object. Request to get a vulnerability
summary for some set of occurrences.
parent (:class:`str`):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@
from google.auth.exceptions import MutualTLSChannelError # type: ignore
from google.oauth2 import service_account # type: ignore

OptionalRetry = Union[retries.Retry, object]

from google.cloud.devtools.containeranalysis_v1.types import containeranalysis
from google.iam.v1 import iam_policy_pb2 # type: ignore
from google.iam.v1 import policy_pb2 # type: ignore
Expand Down Expand Up @@ -367,7 +369,7 @@ def set_iam_policy(
request: Union[iam_policy_pb2.SetIamPolicyRequest, dict] = None,
*,
resource: str = None,
retry: retries.Retry = gapic_v1.method.DEFAULT,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: float = None,
metadata: Sequence[Tuple[str, str]] = (),
) -> policy_pb2.Policy:
Expand Down Expand Up @@ -500,7 +502,7 @@ def get_iam_policy(
request: Union[iam_policy_pb2.GetIamPolicyRequest, dict] = None,
*,
resource: str = None,
retry: retries.Retry = gapic_v1.method.DEFAULT,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: float = None,
metadata: Sequence[Tuple[str, str]] = (),
) -> policy_pb2.Policy:
Expand Down Expand Up @@ -634,7 +636,7 @@ def test_iam_permissions(
*,
resource: str = None,
permissions: Sequence[str] = None,
retry: retries.Retry = gapic_v1.method.DEFAULT,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: float = None,
metadata: Sequence[Tuple[str, str]] = (),
) -> iam_policy_pb2.TestIamPermissionsResponse:
Expand Down Expand Up @@ -725,7 +727,7 @@ def get_vulnerability_occurrences_summary(
*,
parent: str = None,
filter: str = None,
retry: retries.Retry = gapic_v1.method.DEFAULT,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: float = None,
metadata: Sequence[Tuple[str, str]] = (),
) -> containeranalysis.VulnerabilityOccurrencesSummary:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
#
import abc
from typing import Awaitable, Callable, Dict, Optional, Sequence, Union
import packaging.version
import pkg_resources

import google.auth # type: ignore
Expand All @@ -39,15 +38,6 @@
except pkg_resources.DistributionNotFound:
DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo()

try:
# google.auth.__version__ was added in 1.26.0
_GOOGLE_AUTH_VERSION = google.auth.__version__
except AttributeError:
try: # try pkg_resources if it is available
_GOOGLE_AUTH_VERSION = pkg_resources.get_distribution("google-auth").version
except pkg_resources.DistributionNotFound: # pragma: NO COVER
_GOOGLE_AUTH_VERSION = None


class ContainerAnalysisTransport(abc.ABC):
"""Abstract transport class for ContainerAnalysis."""
Expand Down Expand Up @@ -97,7 +87,7 @@ def __init__(
host += ":443"
self._host = host

scopes_kwargs = self._get_scopes_kwargs(self._host, scopes)
scopes_kwargs = {"scopes": scopes, "default_scopes": self.AUTH_SCOPES}

# Save the scopes.
self._scopes = scopes
Expand Down Expand Up @@ -130,29 +120,6 @@ def __init__(
# Save the credentials.
self._credentials = credentials

# TODO(busunkim): This method is in the base transport
# to avoid duplicating code across the transport classes. These functions
# should be deleted once the minimum required versions of google-auth is increased.

# TODO: Remove this function once google-auth >= 1.25.0 is required
@classmethod
def _get_scopes_kwargs(
cls, host: str, scopes: Optional[Sequence[str]]
) -> Dict[str, Optional[Sequence[str]]]:
"""Returns scopes kwargs to pass to google-auth methods depending on the google-auth version"""

scopes_kwargs = {}

if _GOOGLE_AUTH_VERSION and (
packaging.version.parse(_GOOGLE_AUTH_VERSION)
>= packaging.version.parse("1.25.0")
):
scopes_kwargs = {"scopes": scopes, "default_scopes": cls.AUTH_SCOPES}
else:
scopes_kwargs = {"scopes": scopes or cls.AUTH_SCOPES}

return scopes_kwargs

def _prep_wrapped_messages(self, client_info):
# Precompute the wrapped methods.
self._wrapped_methods = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
from google.api_core import grpc_helpers_async # type: ignore
from google.auth import credentials as ga_credentials # type: ignore
from google.auth.transport.grpc import SslCredentials # type: ignore
import packaging.version

import grpc # type: ignore
from grpc.experimental import aio # type: ignore
Expand Down
3 changes: 1 addition & 2 deletions packages/google-cloud-containeranalysis/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,9 @@
# NOTE: Maintainers, please do not require google-api-core>=2.x.x
# Until this issue is closed
# https://github.com/googleapis/google-cloud-python/issues/10566
"google-api-core[grpc] >= 1.26.0, <3.0.0dev",
"google-api-core[grpc] >= 1.28.0, <3.0.0dev",
"grpc-google-iam-v1 >= 0.12.3, < 0.13dev",
"proto-plus >= 1.4.0",
"packaging >= 14.3",
"grafeas >=1.0.0, <2.0dev",
]
extras = {"libcst": "libcst >= 0.2.5"}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,8 @@
#
# e.g., if setup.py has "foo >= 1.14.0, < 2.0.0dev",
# Then this file should have foo==1.14.0
google-api-core==1.26.0
google-api-core==1.28.0
grpc-google-iam-v1==0.12.3
proto-plus==1.4.0
libcst==0.2.5
grafeas==1.0.0
packaging==14.3
google-auth==1.24.0 # TODO: remove when google-auth>=1.25.0 is transitively required through google-api-core
Loading

0 comments on commit 92abb2d

Please sign in to comment.