Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit fd8fe56

Browse files
authored
chore: write synth replace to keep features a keyword argument (#10)
1 parent 69c169c commit fd8fe56

File tree

5 files changed

+70
-11
lines changed

5 files changed

+70
-11
lines changed

packages/google-cloud-videointelligence/google/cloud/videointelligence_v1/gapic/video_intelligence_service_client.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,9 @@ def annotate_video(
193193
self,
194194
input_uri=None,
195195
input_content=None,
196+
# NOTE: Keep features a keyword param that comes after `input_uri` until
197+
# the microgenerator migration to avoid breaking users.
198+
# See https://github.com/googleapis/python-videointelligence/issues/7.
196199
features=None,
197200
video_context=None,
198201
output_uri=None,

packages/google-cloud-videointelligence/google/cloud/videointelligence_v1/proto/video_intelligence_pb2.py

Lines changed: 2 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/google-cloud-videointelligence/google/cloud/videointelligence_v1p2beta1/proto/video_intelligence_pb2.py

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/google-cloud-videointelligence/synth.metadata

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,33 @@
11
{
2-
"updateTime": "2020-02-05T13:22:43.739935Z",
2+
"updateTime": "2020-02-14T23:28:20.105798Z",
33
"sources": [
4+
{
5+
"git": {
6+
"name": ".",
7+
"remote": "[email protected]:googleapis/python-videointelligence.git",
8+
"sha": "4eeaab856387d71afc921a41270f067f069fa190"
9+
}
10+
},
411
{
512
"generator": {
613
"name": "artman",
7-
"version": "0.44.4",
8-
"dockerImage": "googleapis/artman@sha256:19e945954fc960a4bdfee6cb34695898ab21a8cf0bac063ee39b91f00a1faec8"
14+
"version": "0.45.0",
15+
"dockerImage": "googleapis/artman@sha256:6aec9c34db0e4be221cdaf6faba27bdc07cfea846808b3d3b964dfce3a9a0f9b"
916
}
1017
},
1118
{
1219
"git": {
1320
"name": "googleapis",
1421
"remote": "https://github.com/googleapis/googleapis.git",
15-
"sha": "a8ed9d921fdddc61d8467bfd7c1668f0ad90435c",
16-
"internalRef": "293257997",
17-
"log": "a8ed9d921fdddc61d8467bfd7c1668f0ad90435c\nfix: set Ruby module name for OrgPolicy\n\nPiperOrigin-RevId: 293257997\n\n6c7d28509bd8315de8af0889688ee20099594269\nredis: v1beta1 add UpgradeInstance and connect_mode field to Instance\n\nPiperOrigin-RevId: 293242878\n\nae0abed4fcb4c21f5cb67a82349a049524c4ef68\nredis: v1 add connect_mode field to Instance\n\nPiperOrigin-RevId: 293241914\n\n3f7a0d29b28ee9365771da2b66edf7fa2b4e9c56\nAdds service config definition for bigqueryreservation v1beta1\n\nPiperOrigin-RevId: 293234418\n\n0c88168d5ed6fe353a8cf8cbdc6bf084f6bb66a5\naddition of BUILD & configuration for accessapproval v1\n\nPiperOrigin-RevId: 293219198\n\n39bedc2e30f4778ce81193f6ba1fec56107bcfc4\naccessapproval: v1 publish protos\n\nPiperOrigin-RevId: 293167048\n\n69d9945330a5721cd679f17331a78850e2618226\nAdd file-level `Session` resource definition\n\nPiperOrigin-RevId: 293080182\n\nf6a1a6b417f39694275ca286110bc3c1ca4db0dc\nAdd file-level `Session` resource definition\n\nPiperOrigin-RevId: 293080178\n\n"
22+
"sha": "ee4dddf805072004ab19ac94df2ce669046eec26",
23+
"internalRef": "295238095"
1824
}
1925
},
2026
{
2127
"template": {
2228
"name": "python_split_library",
2329
"origin": "synthtool.gcp",
24-
"version": "2019.10.17"
30+
"version": "2020.2.4"
2531
}
2632
}
2733
],

packages/google-cloud-videointelligence/synth.py

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
# limitations under the License.
1414

1515
"""This script is used to synthesize generated parts of this library."""
16+
import re
1617

1718
import synthtool as s
1819
from synthtool import gcp
@@ -62,6 +63,54 @@
6263
"\g<1> input_uri=input_uri, features=features)",
6364
)
6465

66+
# Keep features a keyword param until the microgenerator migration
67+
# https://github.com/googleapis/python-videointelligence/issues/7
68+
# -------------------------------------------------------------------------------
69+
s.replace(
70+
"google/cloud/videointelligence_v1/gapic/video_intelligence_service_client.py",
71+
">>> response = client\.annotate_video\(features, input_uri=input_uri\)",
72+
">>> response = client.annotate_video(input_uri=input_uri, features=features)",
73+
)
74+
s.replace(
75+
"google/cloud/videointelligence_v1/gapic/video_intelligence_service_client.py",
76+
"""(?P<features>\s+features \(list.+?)\n"""
77+
"""(?P<input_uri>\s+input_uri \(str\).+?should be unset\.\n)"""
78+
"""(?P<input_content>\s+input_content \(bytes\).+?should be unset\.)""",
79+
"""\n\g<input_uri>\g<input_content>\g<features>""",
80+
re.DOTALL|re.MULTILINE,
81+
)
82+
83+
s.replace(
84+
"google/cloud/videointelligence_v1/gapic/video_intelligence_service_client.py",
85+
""" self,
86+
features,
87+
input_uri=None,
88+
input_content=None,
89+
video_context=None,
90+
output_uri=None,
91+
location_id=None,
92+
retry=google\.api_core\.gapic_v1\.method\.DEFAULT,
93+
timeout=google\.api_core\.gapic_v1\.method\.DEFAULT,
94+
metadata=None""",
95+
""" self,
96+
input_uri=None,
97+
input_content=None,
98+
# NOTE: Keep features a keyword param that comes after `input_uri` until
99+
# the microgenerator migration to avoid breaking users.
100+
# See https://github.com/googleapis/python-videointelligence/issues/7.
101+
features=None,
102+
video_context=None,
103+
output_uri=None,
104+
location_id=None,
105+
retry=google.api_core.gapic_v1.method.DEFAULT,
106+
timeout=google.api_core.gapic_v1.method.DEFAULT,
107+
metadata=None""",
108+
)
109+
110+
s.replace("tests/**/test_video_intelligence_service_client_v1.py",
111+
"response = client\.annotate_video\(features, input_uri=input_uri\)",
112+
"response = client.annotate_video(input_uri=input_uri, features=features)")
113+
65114
# ----------------------------------------------------------------------------
66115
# Add templated files
67116
# ----------------------------------------------------------------------------

0 commit comments

Comments
 (0)