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

Commit

Permalink
chore: upgrade gapic-generator-python to 0.46.3 (#146)
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 373649163

Source-Link: googleapis/googleapis@7e1b14e

Source-Link: googleapis/googleapis-gen@0a3c7d2

fix: add async client to %name_%version/init.py
chore: add autogenerated snippets
chore: remove auth, policy, and options from the reserved names list
feat: support self-signed JWT flow for service accounts
chore: enable GAPIC metadata generation
chore: sort subpackages in %namespace/%name/init.py
  • Loading branch information
gcf-owl-bot[bot] committed May 20, 2021
1 parent 4f7d32a commit 50da518
Show file tree
Hide file tree
Showing 87 changed files with 3,024 additions and 1,820 deletions.
28 changes: 14 additions & 14 deletions google/cloud/videointelligence/__init__.py
@@ -1,5 +1,4 @@
# -*- coding: utf-8 -*-

# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
Expand All @@ -15,12 +14,13 @@
# limitations under the License.
#

from google.cloud.videointelligence_v1.services.video_intelligence_service.async_client import (
VideoIntelligenceServiceAsyncClient,
)
from google.cloud.videointelligence_v1.services.video_intelligence_service.client import (
VideoIntelligenceServiceClient,
)
from google.cloud.videointelligence_v1.services.video_intelligence_service.async_client import (
VideoIntelligenceServiceAsyncClient,
)

from google.cloud.videointelligence_v1.types.video_intelligence import (
AnnotateVideoProgress,
)
Expand Down Expand Up @@ -51,17 +51,12 @@
)
from google.cloud.videointelligence_v1.types.video_intelligence import FaceFrame
from google.cloud.videointelligence_v1.types.video_intelligence import FaceSegment
from google.cloud.videointelligence_v1.types.video_intelligence import Feature
from google.cloud.videointelligence_v1.types.video_intelligence import LabelAnnotation
from google.cloud.videointelligence_v1.types.video_intelligence import (
LabelDetectionConfig,
)
from google.cloud.videointelligence_v1.types.video_intelligence import (
LabelDetectionMode,
)
from google.cloud.videointelligence_v1.types.video_intelligence import LabelFrame
from google.cloud.videointelligence_v1.types.video_intelligence import LabelSegment
from google.cloud.videointelligence_v1.types.video_intelligence import Likelihood
from google.cloud.videointelligence_v1.types.video_intelligence import (
LogoRecognitionAnnotation,
)
Expand Down Expand Up @@ -117,8 +112,15 @@
from google.cloud.videointelligence_v1.types.video_intelligence import VideoContext
from google.cloud.videointelligence_v1.types.video_intelligence import VideoSegment
from google.cloud.videointelligence_v1.types.video_intelligence import WordInfo
from google.cloud.videointelligence_v1.types.video_intelligence import Feature
from google.cloud.videointelligence_v1.types.video_intelligence import (
LabelDetectionMode,
)
from google.cloud.videointelligence_v1.types.video_intelligence import Likelihood

__all__ = (
"VideoIntelligenceServiceClient",
"VideoIntelligenceServiceAsyncClient",
"AnnotateVideoProgress",
"AnnotateVideoRequest",
"AnnotateVideoResponse",
Expand All @@ -133,13 +135,10 @@
"FaceDetectionConfig",
"FaceFrame",
"FaceSegment",
"Feature",
"LabelAnnotation",
"LabelDetectionConfig",
"LabelDetectionMode",
"LabelFrame",
"LabelSegment",
"Likelihood",
"LogoRecognitionAnnotation",
"NormalizedBoundingBox",
"NormalizedBoundingPoly",
Expand All @@ -163,8 +162,9 @@
"VideoAnnotationProgress",
"VideoAnnotationResults",
"VideoContext",
"VideoIntelligenceServiceAsyncClient",
"VideoIntelligenceServiceClient",
"VideoSegment",
"WordInfo",
"Feature",
"LabelDetectionMode",
"Likelihood",
)
13 changes: 7 additions & 6 deletions google/cloud/videointelligence_v1/__init__.py
@@ -1,5 +1,4 @@
# -*- coding: utf-8 -*-

# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
Expand All @@ -16,6 +15,8 @@
#

from .services.video_intelligence_service import VideoIntelligenceServiceClient
from .services.video_intelligence_service import VideoIntelligenceServiceAsyncClient

from .types.video_intelligence import AnnotateVideoProgress
from .types.video_intelligence import AnnotateVideoRequest
from .types.video_intelligence import AnnotateVideoResponse
Expand All @@ -30,13 +31,10 @@
from .types.video_intelligence import FaceDetectionConfig
from .types.video_intelligence import FaceFrame
from .types.video_intelligence import FaceSegment
from .types.video_intelligence import Feature
from .types.video_intelligence import LabelAnnotation
from .types.video_intelligence import LabelDetectionConfig
from .types.video_intelligence import LabelDetectionMode
from .types.video_intelligence import LabelFrame
from .types.video_intelligence import LabelSegment
from .types.video_intelligence import Likelihood
from .types.video_intelligence import LogoRecognitionAnnotation
from .types.video_intelligence import NormalizedBoundingBox
from .types.video_intelligence import NormalizedBoundingPoly
Expand All @@ -62,9 +60,12 @@
from .types.video_intelligence import VideoContext
from .types.video_intelligence import VideoSegment
from .types.video_intelligence import WordInfo

from .types.video_intelligence import Feature
from .types.video_intelligence import LabelDetectionMode
from .types.video_intelligence import Likelihood

__all__ = (
"VideoIntelligenceServiceAsyncClient",
"AnnotateVideoProgress",
"AnnotateVideoRequest",
"AnnotateVideoResponse",
Expand Down Expand Up @@ -109,7 +110,7 @@
"VideoAnnotationProgress",
"VideoAnnotationResults",
"VideoContext",
"VideoIntelligenceServiceClient",
"VideoSegment",
"WordInfo",
"VideoIntelligenceServiceClient",
)
33 changes: 33 additions & 0 deletions google/cloud/videointelligence_v1/gapic_metadata.json
@@ -0,0 +1,33 @@
{
"comment": "This file maps proto services/RPCs to the corresponding library clients/methods",
"language": "python",
"libraryPackage": "google.cloud.videointelligence_v1",
"protoPackage": "google.cloud.videointelligence.v1",
"schema": "1.0",
"services": {
"VideoIntelligenceService": {
"clients": {
"grpc": {
"libraryClient": "VideoIntelligenceServiceClient",
"rpcs": {
"AnnotateVideo": {
"methods": [
"annotate_video"
]
}
}
},
"grpc-async": {
"libraryClient": "VideoIntelligenceServiceAsyncClient",
"rpcs": {
"AnnotateVideo": {
"methods": [
"annotate_video"
]
}
}
}
}
}
}
}
1 change: 0 additions & 1 deletion google/cloud/videointelligence_v1/services/__init__.py
@@ -1,5 +1,4 @@
# -*- coding: utf-8 -*-

# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
Expand Down
@@ -1,5 +1,4 @@
# -*- coding: utf-8 -*-

# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
Expand All @@ -14,7 +13,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#

from .client import VideoIntelligenceServiceClient
from .async_client import VideoIntelligenceServiceAsyncClient

Expand Down
@@ -1,5 +1,4 @@
# -*- coding: utf-8 -*-

# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
Expand All @@ -14,24 +13,22 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#

from collections import OrderedDict
import functools
import re
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 import exceptions # 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 # type: ignore
from google.auth import credentials as ga_credentials # type: ignore
from google.oauth2 import service_account # type: ignore

from google.api_core import operation # type: ignore
from google.api_core import operation_async # type: ignore
from google.cloud.videointelligence_v1.types import video_intelligence

from .transports.base import VideoIntelligenceServiceTransport, DEFAULT_CLIENT_INFO
from .transports.grpc_asyncio import VideoIntelligenceServiceGrpcAsyncIOTransport
from .client import VideoIntelligenceServiceClient
Expand All @@ -51,26 +48,22 @@ class VideoIntelligenceServiceAsyncClient:
parse_common_billing_account_path = staticmethod(
VideoIntelligenceServiceClient.parse_common_billing_account_path
)

common_folder_path = staticmethod(VideoIntelligenceServiceClient.common_folder_path)
parse_common_folder_path = staticmethod(
VideoIntelligenceServiceClient.parse_common_folder_path
)

common_organization_path = staticmethod(
VideoIntelligenceServiceClient.common_organization_path
)
parse_common_organization_path = staticmethod(
VideoIntelligenceServiceClient.parse_common_organization_path
)

common_project_path = staticmethod(
VideoIntelligenceServiceClient.common_project_path
)
parse_common_project_path = staticmethod(
VideoIntelligenceServiceClient.parse_common_project_path
)

common_location_path = staticmethod(
VideoIntelligenceServiceClient.common_location_path
)
Expand All @@ -80,7 +73,8 @@ class VideoIntelligenceServiceAsyncClient:

@classmethod
def from_service_account_info(cls, info: dict, *args, **kwargs):
"""Creates an instance of this client using the provided credentials info.
"""Creates an instance of this client using the provided credentials
info.
Args:
info (dict): The service account private key info.
Expand All @@ -95,7 +89,7 @@ def from_service_account_info(cls, info: dict, *args, **kwargs):
@classmethod
def from_service_account_file(cls, filename: str, *args, **kwargs):
"""Creates an instance of this client using the provided credentials
file.
file.
Args:
filename (str): The path to the service account private key json
Expand All @@ -112,7 +106,7 @@ def from_service_account_file(cls, filename: str, *args, **kwargs):

@property
def transport(self) -> VideoIntelligenceServiceTransport:
"""Return the transport used by the client instance.
"""Returns the transport used by the client instance.
Returns:
VideoIntelligenceServiceTransport: The transport used by the client instance.
Expand All @@ -127,12 +121,12 @@ def transport(self) -> VideoIntelligenceServiceTransport:
def __init__(
self,
*,
credentials: credentials.Credentials = None,
credentials: ga_credentials.Credentials = None,
transport: Union[str, VideoIntelligenceServiceTransport] = "grpc_asyncio",
client_options: ClientOptions = None,
client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO,
) -> None:
"""Instantiate the video intelligence service client.
"""Instantiates the video intelligence service client.
Args:
credentials (Optional[google.auth.credentials.Credentials]): The
Expand Down Expand Up @@ -164,7 +158,6 @@ def __init__(
google.auth.exceptions.MutualTlsChannelError: If mutual TLS transport
creation failed for any reason.
"""

self._client = VideoIntelligenceServiceClient(
credentials=credentials,
transport=transport,
Expand Down Expand Up @@ -217,7 +210,6 @@ async def annotate_video(
This corresponds to the ``features`` field
on the ``request`` instance; if ``request`` is provided, this
should not be set.
retry (google.api_core.retry.Retry): Designation of what errors, if any,
should be retried.
timeout (float): The timeout for this request.
Expand Down Expand Up @@ -247,10 +239,8 @@ async def annotate_video(

# If we have keyword arguments corresponding to fields on the
# request, apply these.

if input_uri is not None:
request.input_uri = input_uri

if features:
request.features.extend(features)

Expand All @@ -263,7 +253,8 @@ async def annotate_video(
maximum=120.0,
multiplier=2.5,
predicate=retries.if_exception_type(
exceptions.DeadlineExceeded, exceptions.ServiceUnavailable,
core_exceptions.DeadlineExceeded,
core_exceptions.ServiceUnavailable,
),
deadline=600.0,
),
Expand Down

0 comments on commit 50da518

Please sign in to comment.