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

Commit 50da518

Browse files
chore: upgrade gapic-generator-python to 0.46.3 (#146)
PiperOrigin-RevId: 373649163 Source-Link: googleapis/googleapis@7e1b14e Source-Link: https://github.com/googleapis/googleapis-gen/commit/0a3c7d272d697796db75857bac73905c68e498c3 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
1 parent 4f7d32a commit 50da518

File tree

87 files changed

+3024
-1820
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

87 files changed

+3024
-1820
lines changed

google/cloud/videointelligence/__init__.py

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
# -*- coding: utf-8 -*-
2-
32
# Copyright 2020 Google LLC
43
#
54
# Licensed under the Apache License, Version 2.0 (the "License");
@@ -15,12 +14,13 @@
1514
# limitations under the License.
1615
#
1716

18-
from google.cloud.videointelligence_v1.services.video_intelligence_service.async_client import (
19-
VideoIntelligenceServiceAsyncClient,
20-
)
2117
from google.cloud.videointelligence_v1.services.video_intelligence_service.client import (
2218
VideoIntelligenceServiceClient,
2319
)
20+
from google.cloud.videointelligence_v1.services.video_intelligence_service.async_client import (
21+
VideoIntelligenceServiceAsyncClient,
22+
)
23+
2424
from google.cloud.videointelligence_v1.types.video_intelligence import (
2525
AnnotateVideoProgress,
2626
)
@@ -51,17 +51,12 @@
5151
)
5252
from google.cloud.videointelligence_v1.types.video_intelligence import FaceFrame
5353
from google.cloud.videointelligence_v1.types.video_intelligence import FaceSegment
54-
from google.cloud.videointelligence_v1.types.video_intelligence import Feature
5554
from google.cloud.videointelligence_v1.types.video_intelligence import LabelAnnotation
5655
from google.cloud.videointelligence_v1.types.video_intelligence import (
5756
LabelDetectionConfig,
5857
)
59-
from google.cloud.videointelligence_v1.types.video_intelligence import (
60-
LabelDetectionMode,
61-
)
6258
from google.cloud.videointelligence_v1.types.video_intelligence import LabelFrame
6359
from google.cloud.videointelligence_v1.types.video_intelligence import LabelSegment
64-
from google.cloud.videointelligence_v1.types.video_intelligence import Likelihood
6560
from google.cloud.videointelligence_v1.types.video_intelligence import (
6661
LogoRecognitionAnnotation,
6762
)
@@ -117,8 +112,15 @@
117112
from google.cloud.videointelligence_v1.types.video_intelligence import VideoContext
118113
from google.cloud.videointelligence_v1.types.video_intelligence import VideoSegment
119114
from google.cloud.videointelligence_v1.types.video_intelligence import WordInfo
115+
from google.cloud.videointelligence_v1.types.video_intelligence import Feature
116+
from google.cloud.videointelligence_v1.types.video_intelligence import (
117+
LabelDetectionMode,
118+
)
119+
from google.cloud.videointelligence_v1.types.video_intelligence import Likelihood
120120

121121
__all__ = (
122+
"VideoIntelligenceServiceClient",
123+
"VideoIntelligenceServiceAsyncClient",
122124
"AnnotateVideoProgress",
123125
"AnnotateVideoRequest",
124126
"AnnotateVideoResponse",
@@ -133,13 +135,10 @@
133135
"FaceDetectionConfig",
134136
"FaceFrame",
135137
"FaceSegment",
136-
"Feature",
137138
"LabelAnnotation",
138139
"LabelDetectionConfig",
139-
"LabelDetectionMode",
140140
"LabelFrame",
141141
"LabelSegment",
142-
"Likelihood",
143142
"LogoRecognitionAnnotation",
144143
"NormalizedBoundingBox",
145144
"NormalizedBoundingPoly",
@@ -163,8 +162,9 @@
163162
"VideoAnnotationProgress",
164163
"VideoAnnotationResults",
165164
"VideoContext",
166-
"VideoIntelligenceServiceAsyncClient",
167-
"VideoIntelligenceServiceClient",
168165
"VideoSegment",
169166
"WordInfo",
167+
"Feature",
168+
"LabelDetectionMode",
169+
"Likelihood",
170170
)

google/cloud/videointelligence_v1/__init__.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
# -*- coding: utf-8 -*-
2-
32
# Copyright 2020 Google LLC
43
#
54
# Licensed under the Apache License, Version 2.0 (the "License");
@@ -16,6 +15,8 @@
1615
#
1716

1817
from .services.video_intelligence_service import VideoIntelligenceServiceClient
18+
from .services.video_intelligence_service import VideoIntelligenceServiceAsyncClient
19+
1920
from .types.video_intelligence import AnnotateVideoProgress
2021
from .types.video_intelligence import AnnotateVideoRequest
2122
from .types.video_intelligence import AnnotateVideoResponse
@@ -30,13 +31,10 @@
3031
from .types.video_intelligence import FaceDetectionConfig
3132
from .types.video_intelligence import FaceFrame
3233
from .types.video_intelligence import FaceSegment
33-
from .types.video_intelligence import Feature
3434
from .types.video_intelligence import LabelAnnotation
3535
from .types.video_intelligence import LabelDetectionConfig
36-
from .types.video_intelligence import LabelDetectionMode
3736
from .types.video_intelligence import LabelFrame
3837
from .types.video_intelligence import LabelSegment
39-
from .types.video_intelligence import Likelihood
4038
from .types.video_intelligence import LogoRecognitionAnnotation
4139
from .types.video_intelligence import NormalizedBoundingBox
4240
from .types.video_intelligence import NormalizedBoundingPoly
@@ -62,9 +60,12 @@
6260
from .types.video_intelligence import VideoContext
6361
from .types.video_intelligence import VideoSegment
6462
from .types.video_intelligence import WordInfo
65-
63+
from .types.video_intelligence import Feature
64+
from .types.video_intelligence import LabelDetectionMode
65+
from .types.video_intelligence import Likelihood
6666

6767
__all__ = (
68+
"VideoIntelligenceServiceAsyncClient",
6869
"AnnotateVideoProgress",
6970
"AnnotateVideoRequest",
7071
"AnnotateVideoResponse",
@@ -109,7 +110,7 @@
109110
"VideoAnnotationProgress",
110111
"VideoAnnotationResults",
111112
"VideoContext",
113+
"VideoIntelligenceServiceClient",
112114
"VideoSegment",
113115
"WordInfo",
114-
"VideoIntelligenceServiceClient",
115116
)
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
{
2+
"comment": "This file maps proto services/RPCs to the corresponding library clients/methods",
3+
"language": "python",
4+
"libraryPackage": "google.cloud.videointelligence_v1",
5+
"protoPackage": "google.cloud.videointelligence.v1",
6+
"schema": "1.0",
7+
"services": {
8+
"VideoIntelligenceService": {
9+
"clients": {
10+
"grpc": {
11+
"libraryClient": "VideoIntelligenceServiceClient",
12+
"rpcs": {
13+
"AnnotateVideo": {
14+
"methods": [
15+
"annotate_video"
16+
]
17+
}
18+
}
19+
},
20+
"grpc-async": {
21+
"libraryClient": "VideoIntelligenceServiceAsyncClient",
22+
"rpcs": {
23+
"AnnotateVideo": {
24+
"methods": [
25+
"annotate_video"
26+
]
27+
}
28+
}
29+
}
30+
}
31+
}
32+
}
33+
}

google/cloud/videointelligence_v1/services/__init__.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
# -*- coding: utf-8 -*-
2-
32
# Copyright 2020 Google LLC
43
#
54
# Licensed under the Apache License, Version 2.0 (the "License");

google/cloud/videointelligence_v1/services/video_intelligence_service/__init__.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
# -*- coding: utf-8 -*-
2-
32
# Copyright 2020 Google LLC
43
#
54
# Licensed under the Apache License, Version 2.0 (the "License");
@@ -14,7 +13,6 @@
1413
# See the License for the specific language governing permissions and
1514
# limitations under the License.
1615
#
17-
1816
from .client import VideoIntelligenceServiceClient
1917
from .async_client import VideoIntelligenceServiceAsyncClient
2018

google/cloud/videointelligence_v1/services/video_intelligence_service/async_client.py

Lines changed: 10 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
# -*- coding: utf-8 -*-
2-
32
# Copyright 2020 Google LLC
43
#
54
# Licensed under the Apache License, Version 2.0 (the "License");
@@ -14,24 +13,22 @@
1413
# See the License for the specific language governing permissions and
1514
# limitations under the License.
1615
#
17-
1816
from collections import OrderedDict
1917
import functools
2018
import re
2119
from typing import Dict, Sequence, Tuple, Type, Union
2220
import pkg_resources
2321

2422
import google.api_core.client_options as ClientOptions # type: ignore
25-
from google.api_core import exceptions # type: ignore
23+
from google.api_core import exceptions as core_exceptions # type: ignore
2624
from google.api_core import gapic_v1 # type: ignore
2725
from google.api_core import retry as retries # type: ignore
28-
from google.auth import credentials # type: ignore
26+
from google.auth import credentials as ga_credentials # type: ignore
2927
from google.oauth2 import service_account # type: ignore
3028

3129
from google.api_core import operation # type: ignore
3230
from google.api_core import operation_async # type: ignore
3331
from google.cloud.videointelligence_v1.types import video_intelligence
34-
3532
from .transports.base import VideoIntelligenceServiceTransport, DEFAULT_CLIENT_INFO
3633
from .transports.grpc_asyncio import VideoIntelligenceServiceGrpcAsyncIOTransport
3734
from .client import VideoIntelligenceServiceClient
@@ -51,26 +48,22 @@ class VideoIntelligenceServiceAsyncClient:
5148
parse_common_billing_account_path = staticmethod(
5249
VideoIntelligenceServiceClient.parse_common_billing_account_path
5350
)
54-
5551
common_folder_path = staticmethod(VideoIntelligenceServiceClient.common_folder_path)
5652
parse_common_folder_path = staticmethod(
5753
VideoIntelligenceServiceClient.parse_common_folder_path
5854
)
59-
6055
common_organization_path = staticmethod(
6156
VideoIntelligenceServiceClient.common_organization_path
6257
)
6358
parse_common_organization_path = staticmethod(
6459
VideoIntelligenceServiceClient.parse_common_organization_path
6560
)
66-
6761
common_project_path = staticmethod(
6862
VideoIntelligenceServiceClient.common_project_path
6963
)
7064
parse_common_project_path = staticmethod(
7165
VideoIntelligenceServiceClient.parse_common_project_path
7266
)
73-
7467
common_location_path = staticmethod(
7568
VideoIntelligenceServiceClient.common_location_path
7669
)
@@ -80,7 +73,8 @@ class VideoIntelligenceServiceAsyncClient:
8073

8174
@classmethod
8275
def from_service_account_info(cls, info: dict, *args, **kwargs):
83-
"""Creates an instance of this client using the provided credentials info.
76+
"""Creates an instance of this client using the provided credentials
77+
info.
8478
8579
Args:
8680
info (dict): The service account private key info.
@@ -95,7 +89,7 @@ def from_service_account_info(cls, info: dict, *args, **kwargs):
9589
@classmethod
9690
def from_service_account_file(cls, filename: str, *args, **kwargs):
9791
"""Creates an instance of this client using the provided credentials
98-
file.
92+
file.
9993
10094
Args:
10195
filename (str): The path to the service account private key json
@@ -112,7 +106,7 @@ def from_service_account_file(cls, filename: str, *args, **kwargs):
112106

113107
@property
114108
def transport(self) -> VideoIntelligenceServiceTransport:
115-
"""Return the transport used by the client instance.
109+
"""Returns the transport used by the client instance.
116110
117111
Returns:
118112
VideoIntelligenceServiceTransport: The transport used by the client instance.
@@ -127,12 +121,12 @@ def transport(self) -> VideoIntelligenceServiceTransport:
127121
def __init__(
128122
self,
129123
*,
130-
credentials: credentials.Credentials = None,
124+
credentials: ga_credentials.Credentials = None,
131125
transport: Union[str, VideoIntelligenceServiceTransport] = "grpc_asyncio",
132126
client_options: ClientOptions = None,
133127
client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO,
134128
) -> None:
135-
"""Instantiate the video intelligence service client.
129+
"""Instantiates the video intelligence service client.
136130
137131
Args:
138132
credentials (Optional[google.auth.credentials.Credentials]): The
@@ -164,7 +158,6 @@ def __init__(
164158
google.auth.exceptions.MutualTlsChannelError: If mutual TLS transport
165159
creation failed for any reason.
166160
"""
167-
168161
self._client = VideoIntelligenceServiceClient(
169162
credentials=credentials,
170163
transport=transport,
@@ -217,7 +210,6 @@ async def annotate_video(
217210
This corresponds to the ``features`` field
218211
on the ``request`` instance; if ``request`` is provided, this
219212
should not be set.
220-
221213
retry (google.api_core.retry.Retry): Designation of what errors, if any,
222214
should be retried.
223215
timeout (float): The timeout for this request.
@@ -247,10 +239,8 @@ async def annotate_video(
247239

248240
# If we have keyword arguments corresponding to fields on the
249241
# request, apply these.
250-
251242
if input_uri is not None:
252243
request.input_uri = input_uri
253-
254244
if features:
255245
request.features.extend(features)
256246

@@ -263,7 +253,8 @@ async def annotate_video(
263253
maximum=120.0,
264254
multiplier=2.5,
265255
predicate=retries.if_exception_type(
266-
exceptions.DeadlineExceeded, exceptions.ServiceUnavailable,
256+
core_exceptions.DeadlineExceeded,
257+
core_exceptions.ServiceUnavailable,
267258
),
268259
deadline=600.0,
269260
),

0 commit comments

Comments
 (0)