Skip to content

Commit

Permalink
feat(translate)!: make v3 the default client (#9498)
Browse files Browse the repository at this point in the history
  • Loading branch information
busunkim96 committed Oct 23, 2019
1 parent d66e1d7 commit bde08e9
Show file tree
Hide file tree
Showing 7 changed files with 19 additions and 32 deletions.
19 changes: 8 additions & 11 deletions translate/google/cloud/translate.py
@@ -1,27 +1,24 @@
# Copyright 2017 Google LLC
# -*- coding: utf-8 -*-
#
# Copyright 2019 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

"""Google Cloud Translation API wrapper."""


from google.cloud.translate_v2 import __version__
from google.cloud.translate_v2.client import Client
from __future__ import absolute_import

# These constants are essentially deprecated; strings should be used instead.
# They are imported here for backwards compatibility.
from google.cloud.translate_v2.client import BASE
from google.cloud.translate_v2.client import NMT
from google.cloud.translate_v3 import TranslationServiceClient
from google.cloud.translate_v3 import types


__all__ = ("__version__", "BASE", "Client", "NMT")
__all__ = ("types", "TranslationServiceClient")
10 changes: 5 additions & 5 deletions translate/synth.metadata
@@ -1,19 +1,19 @@
{
"updateTime": "2019-10-05T12:42:06.391804Z",
"updateTime": "2019-10-18T22:49:41.466785Z",
"sources": [
{
"generator": {
"name": "artman",
"version": "0.38.0",
"dockerImage": "googleapis/artman@sha256:0d2f8d429110aeb8d82df6550ef4ede59d40df9062d260a1580fce688b0512bf"
"version": "0.40.0",
"dockerImage": "googleapis/artman@sha256:fd2b49cce3d652929cc80157ec2d91bebe993f7cd4e89afaad80f9c785f8bf36"
}
},
{
"git": {
"name": "googleapis",
"remote": "https://github.com/googleapis/googleapis.git",
"sha": "ceb8e2fb12f048cc94caae532ef0b4cf026a78f3",
"internalRef": "272971705"
"sha": "0e9a6d15fcb944ed40921ba0aad2082ee1bc7edd",
"internalRef": "275543900"
}
},
{
Expand Down
3 changes: 3 additions & 0 deletions translate/synth.py
Expand Up @@ -48,6 +48,9 @@
f"google.cloud.translate_{version}.proto",
)

# Use the highest version library to generate documentation import alias.
s.move(library / "google/cloud/translate.py")

s.replace(
"google/cloud/**/translation_service_pb2.py",
r"""record delimiters are ':raw-latex:`\\n`' instead of
Expand Down
4 changes: 2 additions & 2 deletions translate/tests/system.py
Expand Up @@ -16,7 +16,7 @@

import unittest

from google.cloud import translate
from google.cloud import translate_v2


class Config(object):
Expand All @@ -30,7 +30,7 @@ class Config(object):


def setUpModule():
Config.CLIENT = translate.Client()
Config.CLIENT = translate_v2.Client()


class TestTranslate(unittest.TestCase):
Expand Down
13 changes: 0 additions & 13 deletions translate/tests/unit/__init__.py

This file was deleted.

File renamed without changes.
Expand Up @@ -18,7 +18,7 @@
class TestClient(unittest.TestCase):
@staticmethod
def _get_target_class():
from google.cloud.translate import Client
from google.cloud.translate_v2 import Client

return Client

Expand Down

0 comments on commit bde08e9

Please sign in to comment.