Skip to content
This repository has been archived by the owner on Sep 21, 2023. It is now read-only.

chore: use gapic-generator-python 0.53.4 #112

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.video.transcoder_v1.services.transcoder_service import pagers
from google.cloud.video.transcoder_v1.types import resources
from google.cloud.video.transcoder_v1.types import services
Expand Down Expand Up @@ -177,18 +179,18 @@ def __init__(

async def create_job(
self,
request: services.CreateJobRequest = None,
request: Union[services.CreateJobRequest, dict] = None,
*,
parent: str = None,
job: resources.Job = None,
retry: retries.Retry = gapic_v1.method.DEFAULT,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: float = None,
metadata: Sequence[Tuple[str, str]] = (),
) -> resources.Job:
r"""Creates a job in the specified region.

Args:
request (:class:`google.cloud.video.transcoder_v1.types.CreateJobRequest`):
request (Union[google.cloud.video.transcoder_v1.types.CreateJobRequest, dict]):
The request object. Request message for
`TranscoderService.CreateJob`.
parent (:class:`str`):
Expand Down Expand Up @@ -256,17 +258,17 @@ async def create_job(

async def list_jobs(
self,
request: services.ListJobsRequest = None,
request: Union[services.ListJobsRequest, dict] = None,
*,
parent: str = None,
retry: retries.Retry = gapic_v1.method.DEFAULT,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: float = None,
metadata: Sequence[Tuple[str, str]] = (),
) -> pagers.ListJobsAsyncPager:
r"""Lists jobs in the specified region.

Args:
request (:class:`google.cloud.video.transcoder_v1.types.ListJobsRequest`):
request (Union[google.cloud.video.transcoder_v1.types.ListJobsRequest, dict]):
The request object. Request message for
`TranscoderService.ListJobs`. The parent location from
which to retrieve the collection of jobs.
Expand Down Expand Up @@ -336,17 +338,17 @@ async def list_jobs(

async def get_job(
self,
request: services.GetJobRequest = None,
request: Union[services.GetJobRequest, dict] = None,
*,
name: str = None,
retry: retries.Retry = gapic_v1.method.DEFAULT,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: float = None,
metadata: Sequence[Tuple[str, str]] = (),
) -> resources.Job:
r"""Returns the job data.

Args:
request (:class:`google.cloud.video.transcoder_v1.types.GetJobRequest`):
request (Union[google.cloud.video.transcoder_v1.types.GetJobRequest, dict]):
The request object. Request message for
`TranscoderService.GetJob`.
name (:class:`str`):
Expand Down Expand Up @@ -405,17 +407,17 @@ async def get_job(

async def delete_job(
self,
request: services.DeleteJobRequest = None,
request: Union[services.DeleteJobRequest, dict] = None,
*,
name: str = None,
retry: retries.Retry = gapic_v1.method.DEFAULT,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: float = None,
metadata: Sequence[Tuple[str, str]] = (),
) -> None:
r"""Deletes a job.

Args:
request (:class:`google.cloud.video.transcoder_v1.types.DeleteJobRequest`):
request (Union[google.cloud.video.transcoder_v1.types.DeleteJobRequest, dict]):
The request object. Request message for
`TranscoderService.DeleteJob`.
name (:class:`str`):
Expand Down Expand Up @@ -469,19 +471,19 @@ async def delete_job(

async def create_job_template(
self,
request: services.CreateJobTemplateRequest = None,
request: Union[services.CreateJobTemplateRequest, dict] = None,
*,
parent: str = None,
job_template: resources.JobTemplate = None,
job_template_id: str = None,
retry: retries.Retry = gapic_v1.method.DEFAULT,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: float = None,
metadata: Sequence[Tuple[str, str]] = (),
) -> resources.JobTemplate:
r"""Creates a job template in the specified region.

Args:
request (:class:`google.cloud.video.transcoder_v1.types.CreateJobTemplateRequest`):
request (Union[google.cloud.video.transcoder_v1.types.CreateJobTemplateRequest, dict]):
The request object. Request message for
`TranscoderService.CreateJobTemplate`.
parent (:class:`str`):
Expand Down Expand Up @@ -564,17 +566,17 @@ async def create_job_template(

async def list_job_templates(
self,
request: services.ListJobTemplatesRequest = None,
request: Union[services.ListJobTemplatesRequest, dict] = None,
*,
parent: str = None,
retry: retries.Retry = gapic_v1.method.DEFAULT,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: float = None,
metadata: Sequence[Tuple[str, str]] = (),
) -> pagers.ListJobTemplatesAsyncPager:
r"""Lists job templates in the specified region.

Args:
request (:class:`google.cloud.video.transcoder_v1.types.ListJobTemplatesRequest`):
request (Union[google.cloud.video.transcoder_v1.types.ListJobTemplatesRequest, dict]):
The request object. Request message for
`TranscoderService.ListJobTemplates`.
parent (:class:`str`):
Expand Down Expand Up @@ -644,17 +646,17 @@ async def list_job_templates(

async def get_job_template(
self,
request: services.GetJobTemplateRequest = None,
request: Union[services.GetJobTemplateRequest, dict] = None,
*,
name: str = None,
retry: retries.Retry = gapic_v1.method.DEFAULT,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: float = None,
metadata: Sequence[Tuple[str, str]] = (),
) -> resources.JobTemplate:
r"""Returns the job template data.

Args:
request (:class:`google.cloud.video.transcoder_v1.types.GetJobTemplateRequest`):
request (Union[google.cloud.video.transcoder_v1.types.GetJobTemplateRequest, dict]):
The request object. Request message for
`TranscoderService.GetJobTemplate`.
name (:class:`str`):
Expand Down Expand Up @@ -714,17 +716,17 @@ async def get_job_template(

async def delete_job_template(
self,
request: services.DeleteJobTemplateRequest = None,
request: Union[services.DeleteJobTemplateRequest, dict] = None,
*,
name: str = None,
retry: retries.Retry = gapic_v1.method.DEFAULT,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: float = None,
metadata: Sequence[Tuple[str, str]] = (),
) -> None:
r"""Deletes a job template.

Args:
request (:class:`google.cloud.video.transcoder_v1.types.DeleteJobTemplateRequest`):
request (Union[google.cloud.video.transcoder_v1.types.DeleteJobTemplateRequest, dict]):
The request object. Request message for
`TranscoderService.DeleteJobTemplate`.
name (: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.video.transcoder_v1.services.transcoder_service import pagers
from google.cloud.video.transcoder_v1.types import resources
from google.cloud.video.transcoder_v1.types import services
Expand Down Expand Up @@ -381,7 +383,7 @@ def create_job(
*,
parent: str = None,
job: resources.Job = None,
retry: retries.Retry = gapic_v1.method.DEFAULT,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: float = None,
metadata: Sequence[Tuple[str, str]] = (),
) -> resources.Job:
Expand Down Expand Up @@ -459,7 +461,7 @@ def list_jobs(
request: Union[services.ListJobsRequest, dict] = None,
*,
parent: str = None,
retry: retries.Retry = gapic_v1.method.DEFAULT,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: float = None,
metadata: Sequence[Tuple[str, str]] = (),
) -> pagers.ListJobsPager:
Expand Down Expand Up @@ -539,7 +541,7 @@ def get_job(
request: Union[services.GetJobRequest, dict] = None,
*,
name: str = None,
retry: retries.Retry = gapic_v1.method.DEFAULT,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: float = None,
metadata: Sequence[Tuple[str, str]] = (),
) -> resources.Job:
Expand Down Expand Up @@ -608,7 +610,7 @@ def delete_job(
request: Union[services.DeleteJobRequest, dict] = None,
*,
name: str = None,
retry: retries.Retry = gapic_v1.method.DEFAULT,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: float = None,
metadata: Sequence[Tuple[str, str]] = (),
) -> None:
Expand Down Expand Up @@ -674,7 +676,7 @@ def create_job_template(
parent: str = None,
job_template: resources.JobTemplate = None,
job_template_id: str = None,
retry: retries.Retry = gapic_v1.method.DEFAULT,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: float = None,
metadata: Sequence[Tuple[str, str]] = (),
) -> resources.JobTemplate:
Expand Down Expand Up @@ -767,7 +769,7 @@ def list_job_templates(
request: Union[services.ListJobTemplatesRequest, dict] = None,
*,
parent: str = None,
retry: retries.Retry = gapic_v1.method.DEFAULT,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: float = None,
metadata: Sequence[Tuple[str, str]] = (),
) -> pagers.ListJobTemplatesPager:
Expand Down Expand Up @@ -847,7 +849,7 @@ def get_job_template(
request: Union[services.GetJobTemplateRequest, dict] = None,
*,
name: str = None,
retry: retries.Retry = gapic_v1.method.DEFAULT,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: float = None,
metadata: Sequence[Tuple[str, str]] = (),
) -> resources.JobTemplate:
Expand Down Expand Up @@ -917,7 +919,7 @@ def delete_job_template(
request: Union[services.DeleteJobTemplateRequest, dict] = None,
*,
name: str = None,
retry: retries.Retry = gapic_v1.method.DEFAULT,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: float = None,
metadata: Sequence[Tuple[str, str]] = (),
) -> None:
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 TranscoderServiceTransport(abc.ABC):
"""Abstract transport class for TranscoderService."""
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
Loading