Skip to content

Commit e3f6bac

Browse files
authored
feat(translate)!: make v3 the default client (#9498)
1 parent 7492996 commit e3f6bac

File tree

7 files changed

+19
-32
lines changed

7 files changed

+19
-32
lines changed
Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,24 @@
1-
# Copyright 2017 Google LLC
1+
# -*- coding: utf-8 -*-
2+
#
3+
# Copyright 2019 Google LLC
24
#
35
# Licensed under the Apache License, Version 2.0 (the "License");
46
# you may not use this file except in compliance with the License.
57
# You may obtain a copy of the License at
68
#
7-
# http://www.apache.org/licenses/LICENSE-2.0
9+
# https://www.apache.org/licenses/LICENSE-2.0
810
#
911
# Unless required by applicable law or agreed to in writing, software
1012
# distributed under the License is distributed on an "AS IS" BASIS,
1113
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1214
# See the License for the specific language governing permissions and
1315
# limitations under the License.
1416

15-
"""Google Cloud Translation API wrapper."""
16-
1717

18-
from google.cloud.translate_v2 import __version__
19-
from google.cloud.translate_v2.client import Client
18+
from __future__ import absolute_import
2019

21-
# These constants are essentially deprecated; strings should be used instead.
22-
# They are imported here for backwards compatibility.
23-
from google.cloud.translate_v2.client import BASE
24-
from google.cloud.translate_v2.client import NMT
20+
from google.cloud.translate_v3 import TranslationServiceClient
21+
from google.cloud.translate_v3 import types
2522

2623

27-
__all__ = ("__version__", "BASE", "Client", "NMT")
24+
__all__ = ("types", "TranslationServiceClient")

packages/google-cloud-translate/synth.metadata

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
11
{
2-
"updateTime": "2019-10-05T12:42:06.391804Z",
2+
"updateTime": "2019-10-18T22:49:41.466785Z",
33
"sources": [
44
{
55
"generator": {
66
"name": "artman",
7-
"version": "0.38.0",
8-
"dockerImage": "googleapis/artman@sha256:0d2f8d429110aeb8d82df6550ef4ede59d40df9062d260a1580fce688b0512bf"
7+
"version": "0.40.0",
8+
"dockerImage": "googleapis/artman@sha256:fd2b49cce3d652929cc80157ec2d91bebe993f7cd4e89afaad80f9c785f8bf36"
99
}
1010
},
1111
{
1212
"git": {
1313
"name": "googleapis",
1414
"remote": "https://github.com/googleapis/googleapis.git",
15-
"sha": "ceb8e2fb12f048cc94caae532ef0b4cf026a78f3",
16-
"internalRef": "272971705"
15+
"sha": "0e9a6d15fcb944ed40921ba0aad2082ee1bc7edd",
16+
"internalRef": "275543900"
1717
}
1818
},
1919
{

packages/google-cloud-translate/synth.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,9 @@
4848
f"google.cloud.translate_{version}.proto",
4949
)
5050

51+
# Use the highest version library to generate documentation import alias.
52+
s.move(library / "google/cloud/translate.py")
53+
5154
s.replace(
5255
"google/cloud/**/translation_service_pb2.py",
5356
r"""record delimiters are ':raw-latex:`\\n`' instead of

packages/google-cloud-translate/tests/system.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
import unittest
1818

19-
from google.cloud import translate
19+
from google.cloud import translate_v2
2020

2121

2222
class Config(object):
@@ -30,7 +30,7 @@ class Config(object):
3030

3131

3232
def setUpModule():
33-
Config.CLIENT = translate.Client()
33+
Config.CLIENT = translate_v2.Client()
3434

3535

3636
class TestTranslate(unittest.TestCase):

packages/google-cloud-translate/tests/unit/__init__.py

Lines changed: 0 additions & 13 deletions
This file was deleted.

packages/google-cloud-translate/tests/unit/test__http.py renamed to packages/google-cloud-translate/tests/unit/v2/test__http.py

File renamed without changes.

packages/google-cloud-translate/tests/unit/test_client.py renamed to packages/google-cloud-translate/tests/unit/v2/test_client.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
class TestClient(unittest.TestCase):
1919
@staticmethod
2020
def _get_target_class():
21-
from google.cloud.translate import Client
21+
from google.cloud.translate_v2 import Client
2222

2323
return Client
2424

0 commit comments

Comments
 (0)