Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(translate)!: make v3 the default client #9498

Merged
merged 2 commits into from
Oct 23, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
19 changes: 8 additions & 11 deletions translate/google/cloud/translate.py
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -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",
nnegrey marked this conversation as resolved.
Show resolved Hide resolved
"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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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.

Original file line number Diff line number Diff line change
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