From 438d443f20f2e5a8923c1021f6f45917419d8aae Mon Sep 17 00:00:00 2001 From: yoshi-automation Date: Sat, 7 Dec 2019 05:29:55 -0800 Subject: [PATCH 1/4] [CHANGE ME] Re-generated translate to pick up changes in the API or client library generator. --- translate/noxfile.py | 2 +- translate/synth.metadata | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/translate/noxfile.py b/translate/noxfile.py index a2eefbb6765f..7949a4e3925a 100644 --- a/translate/noxfile.py +++ b/translate/noxfile.py @@ -86,7 +86,7 @@ def default(session): ) -@nox.session(python=["2.7", "3.5", "3.6", "3.7"]) +@nox.session(python=["2.7", "3.5", "3.6", "3.7", "3.8"]) def unit(session): """Run the unit test suite.""" default(session) diff --git a/translate/synth.metadata b/translate/synth.metadata index 8cc62e796551..e9630fe8e1d9 100644 --- a/translate/synth.metadata +++ b/translate/synth.metadata @@ -1,5 +1,5 @@ { - "updateTime": "2019-11-19T13:38:48.307240Z", + "updateTime": "2019-12-07T13:29:54.673468Z", "sources": [ { "generator": { @@ -12,8 +12,8 @@ "git": { "name": "googleapis", "remote": "https://github.com/googleapis/googleapis.git", - "sha": "d8dd7fe8d5304f7bd1c52207703d7f27d5328c5a", - "internalRef": "281088257" + "sha": "a4adac3a12aca6e3a792c9c35ee850435fe7cf7e", + "internalRef": "284277770" } }, { From 43a16c89d6ac901f5de5e7b1c993a9ad12541260 Mon Sep 17 00:00:00 2001 From: Bu Sun Kim Date: Wed, 29 Jan 2020 18:02:46 -0800 Subject: [PATCH 2/4] test: modify expected http call; use template noxfile; regen --- translate/google/cloud/translate.py | 2 +- translate/google/cloud/translate_v3/__init__.py | 13 ++++++++++++- .../gapic/translation_service_client.py | 16 +++------------- .../translation_service_grpc_transport.py | 2 +- .../proto/translation_service_pb2.py | 4 ++-- translate/google/cloud/translate_v3/types.py | 2 +- .../google/cloud/translate_v3beta1/__init__.py | 13 ++++++++++++- .../gapic/translation_service_client.py | 16 +++------------- .../translation_service_grpc_transport.py | 2 +- .../proto/translation_service_pb2.py | 8 ++++---- .../google/cloud/translate_v3beta1/types.py | 2 +- .../v3/test_translation_service_client_v3.py | 2 +- .../test_translation_service_client_v3beta1.py | 2 +- translate/tests/unit/v2/test__http.py | 4 ++-- 14 files changed, 45 insertions(+), 43 deletions(-) diff --git a/translate/google/cloud/translate.py b/translate/google/cloud/translate.py index 27d23f137628..541da1b57081 100644 --- a/translate/google/cloud/translate.py +++ b/translate/google/cloud/translate.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- # -# Copyright 2019 Google LLC +# Copyright 2020 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/translate/google/cloud/translate_v3/__init__.py b/translate/google/cloud/translate_v3/__init__.py index f4e61721160a..dec3a565b8b0 100644 --- a/translate/google/cloud/translate_v3/__init__.py +++ b/translate/google/cloud/translate_v3/__init__.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- # -# Copyright 2019 Google LLC +# Copyright 2020 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -16,11 +16,22 @@ from __future__ import absolute_import +import sys +import warnings from google.cloud.translate_v3 import types from google.cloud.translate_v3.gapic import translation_service_client +if sys.version_info[:2] == (2, 7): + message = ( + "A future version of this library will drop support for Python 2.7." + "More details about Python 2 support for Google Cloud Client Libraries" + "can be found at https://cloud.google.com/python/docs/python2-sunset/" + ) + warnings.warn(message, DeprecationWarning) + + class TranslationServiceClient(translation_service_client.TranslationServiceClient): __doc__ = translation_service_client.TranslationServiceClient.__doc__ diff --git a/translate/google/cloud/translate_v3/gapic/translation_service_client.py b/translate/google/cloud/translate_v3/gapic/translation_service_client.py index d59c9eaadc6b..1540f9c72c54 100644 --- a/translate/google/cloud/translate_v3/gapic/translation_service_client.py +++ b/translate/google/cloud/translate_v3/gapic/translation_service_client.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- # -# Copyright 2019 Google LLC +# Copyright 2020 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -80,12 +80,7 @@ def from_service_account_file(cls, filename, *args, **kwargs): @classmethod def glossary_path(cls, project, location, glossary): - """DEPRECATED. Return a fully-qualified glossary string.""" - warnings.warn( - "Resource name helper functions are deprecated.", - PendingDeprecationWarning, - stacklevel=1, - ) + """Return a fully-qualified glossary string.""" return google.api_core.path_template.expand( "projects/{project}/locations/{location}/glossaries/{glossary}", project=project, @@ -95,12 +90,7 @@ def glossary_path(cls, project, location, glossary): @classmethod def location_path(cls, project, location): - """DEPRECATED. Return a fully-qualified location string.""" - warnings.warn( - "Resource name helper functions are deprecated.", - PendingDeprecationWarning, - stacklevel=1, - ) + """Return a fully-qualified location string.""" return google.api_core.path_template.expand( "projects/{project}/locations/{location}", project=project, diff --git a/translate/google/cloud/translate_v3/gapic/transports/translation_service_grpc_transport.py b/translate/google/cloud/translate_v3/gapic/transports/translation_service_grpc_transport.py index ed038e376db0..45c59003ca19 100644 --- a/translate/google/cloud/translate_v3/gapic/transports/translation_service_grpc_transport.py +++ b/translate/google/cloud/translate_v3/gapic/transports/translation_service_grpc_transport.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- # -# Copyright 2019 Google LLC +# Copyright 2020 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/translate/google/cloud/translate_v3/proto/translation_service_pb2.py b/translate/google/cloud/translate_v3/proto/translation_service_pb2.py index 7bc7e15d284e..be22c28cd793 100644 --- a/translate/google/cloud/translate_v3/proto/translation_service_pb2.py +++ b/translate/google/cloud/translate_v3/proto/translation_service_pb2.py @@ -2796,8 +2796,8 @@ dict( DESCRIPTOR=_TRANSLATETEXTGLOSSARYCONFIG, __module__="google.cloud.translation_v3.proto.translation_service_pb2", - __doc__="""Configures which glossary should be used for a specific target language, - and defines options for applying that glossary. + __doc__="""Configures which glossary should be used for a specific + target language, and defines options for applying that glossary. Attributes: diff --git a/translate/google/cloud/translate_v3/types.py b/translate/google/cloud/translate_v3/types.py index 14c494adc850..b1e9aad339a4 100644 --- a/translate/google/cloud/translate_v3/types.py +++ b/translate/google/cloud/translate_v3/types.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- # -# Copyright 2019 Google LLC +# Copyright 2020 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/translate/google/cloud/translate_v3beta1/__init__.py b/translate/google/cloud/translate_v3beta1/__init__.py index 397226dd1df8..7323f3e39441 100644 --- a/translate/google/cloud/translate_v3beta1/__init__.py +++ b/translate/google/cloud/translate_v3beta1/__init__.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- # -# Copyright 2019 Google LLC +# Copyright 2020 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -16,11 +16,22 @@ from __future__ import absolute_import +import sys +import warnings from google.cloud.translate_v3beta1 import types from google.cloud.translate_v3beta1.gapic import translation_service_client +if sys.version_info[:2] == (2, 7): + message = ( + "A future version of this library will drop support for Python 2.7." + "More details about Python 2 support for Google Cloud Client Libraries" + "can be found at https://cloud.google.com/python/docs/python2-sunset/" + ) + warnings.warn(message, DeprecationWarning) + + class TranslationServiceClient(translation_service_client.TranslationServiceClient): __doc__ = translation_service_client.TranslationServiceClient.__doc__ diff --git a/translate/google/cloud/translate_v3beta1/gapic/translation_service_client.py b/translate/google/cloud/translate_v3beta1/gapic/translation_service_client.py index 2d5ead5c2ddd..ed8de5d6c718 100644 --- a/translate/google/cloud/translate_v3beta1/gapic/translation_service_client.py +++ b/translate/google/cloud/translate_v3beta1/gapic/translation_service_client.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- # -# Copyright 2019 Google LLC +# Copyright 2020 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -80,12 +80,7 @@ def from_service_account_file(cls, filename, *args, **kwargs): @classmethod def glossary_path(cls, project, location, glossary): - """DEPRECATED. Return a fully-qualified glossary string.""" - warnings.warn( - "Resource name helper functions are deprecated.", - PendingDeprecationWarning, - stacklevel=1, - ) + """Return a fully-qualified glossary string.""" return google.api_core.path_template.expand( "projects/{project}/locations/{location}/glossaries/{glossary}", project=project, @@ -95,12 +90,7 @@ def glossary_path(cls, project, location, glossary): @classmethod def location_path(cls, project, location): - """DEPRECATED. Return a fully-qualified location string.""" - warnings.warn( - "Resource name helper functions are deprecated.", - PendingDeprecationWarning, - stacklevel=1, - ) + """Return a fully-qualified location string.""" return google.api_core.path_template.expand( "projects/{project}/locations/{location}", project=project, diff --git a/translate/google/cloud/translate_v3beta1/gapic/transports/translation_service_grpc_transport.py b/translate/google/cloud/translate_v3beta1/gapic/transports/translation_service_grpc_transport.py index 46f9c525ea6c..d3aeadc91763 100644 --- a/translate/google/cloud/translate_v3beta1/gapic/transports/translation_service_grpc_transport.py +++ b/translate/google/cloud/translate_v3beta1/gapic/transports/translation_service_grpc_transport.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- # -# Copyright 2019 Google LLC +# Copyright 2020 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/translate/google/cloud/translate_v3beta1/proto/translation_service_pb2.py b/translate/google/cloud/translate_v3beta1/proto/translation_service_pb2.py index 8a423d69322f..b58cc60089ea 100644 --- a/translate/google/cloud/translate_v3beta1/proto/translation_service_pb2.py +++ b/translate/google/cloud/translate_v3beta1/proto/translation_service_pb2.py @@ -2796,8 +2796,8 @@ dict( DESCRIPTOR=_TRANSLATETEXTGLOSSARYCONFIG, __module__="google.cloud.translation_v3beta1.proto.translation_service_pb2", - __doc__="""Configures which glossary should be used for a specific target language, - and defines options for applying that glossary. + __doc__="""Configures which glossary should be used for a specific + target language, and defines options for applying that glossary. Attributes: @@ -3109,8 +3109,8 @@ dict( DESCRIPTOR=_SUPPORTEDLANGUAGE, __module__="google.cloud.translation_v3beta1.proto.translation_service_pb2", - __doc__="""A single supported language response corresponds to information related - to one supported language. + __doc__="""A single supported language response corresponds to + information related to one supported language. Attributes: diff --git a/translate/google/cloud/translate_v3beta1/types.py b/translate/google/cloud/translate_v3beta1/types.py index 41868ccff503..335149a637ac 100644 --- a/translate/google/cloud/translate_v3beta1/types.py +++ b/translate/google/cloud/translate_v3beta1/types.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- # -# Copyright 2019 Google LLC +# Copyright 2020 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/translate/tests/unit/gapic/v3/test_translation_service_client_v3.py b/translate/tests/unit/gapic/v3/test_translation_service_client_v3.py index 16180aace4ad..65b0d020f60d 100644 --- a/translate/tests/unit/gapic/v3/test_translation_service_client_v3.py +++ b/translate/tests/unit/gapic/v3/test_translation_service_client_v3.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- # -# Copyright 2019 Google LLC +# Copyright 2020 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/translate/tests/unit/gapic/v3beta1/test_translation_service_client_v3beta1.py b/translate/tests/unit/gapic/v3beta1/test_translation_service_client_v3beta1.py index 6bd32d82c20a..fa2bccc23c79 100644 --- a/translate/tests/unit/gapic/v3beta1/test_translation_service_client_v3beta1.py +++ b/translate/tests/unit/gapic/v3beta1/test_translation_service_client_v3beta1.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- # -# Copyright 2019 Google LLC +# Copyright 2020 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/translate/tests/unit/v2/test__http.py b/translate/tests/unit/v2/test__http.py index 208f207c8380..917bf800c333 100644 --- a/translate/tests/unit/v2/test__http.py +++ b/translate/tests/unit/v2/test__http.py @@ -80,11 +80,11 @@ def test_extra_headers(self): self.assertEqual(result, data) expected_headers = { - "Accept-Encoding": "gzip", base_http.CLIENT_INFO_HEADER: conn.user_agent, "User-Agent": conn.user_agent, + "Accept-Encoding": "gzip" } expected_uri = conn.build_api_url("/rainbow") http.request.assert_called_once_with( - data=req_data, headers=expected_headers, method="GET", url=expected_uri + data=req_data, headers=expected_headers, method="GET", timeout=None, url=expected_uri ) From e7b77896a0af96a5ffc00e4c9da17da231fee230 Mon Sep 17 00:00:00 2001 From: Bu Sun Kim Date: Wed, 29 Jan 2020 18:23:58 -0800 Subject: [PATCH 3/4] test: set expected timeout to 60 --- translate/tests/unit/v2/test__http.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/translate/tests/unit/v2/test__http.py b/translate/tests/unit/v2/test__http.py index 917bf800c333..68da86b680c0 100644 --- a/translate/tests/unit/v2/test__http.py +++ b/translate/tests/unit/v2/test__http.py @@ -86,5 +86,5 @@ def test_extra_headers(self): } expected_uri = conn.build_api_url("/rainbow") http.request.assert_called_once_with( - data=req_data, headers=expected_headers, method="GET", timeout=None, url=expected_uri + data=req_data, headers=expected_headers, method="GET", timeout=60, url=expected_uri ) From 9acb3963ed516888bf07b655da2119a4e0483dd1 Mon Sep 17 00:00:00 2001 From: Bu Sun Kim Date: Wed, 29 Jan 2020 18:43:13 -0800 Subject: [PATCH 4/4] chore: blacken --- translate/tests/unit/v2/test__http.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/translate/tests/unit/v2/test__http.py b/translate/tests/unit/v2/test__http.py index ff630cf22580..d2c3b9b69fab 100644 --- a/translate/tests/unit/v2/test__http.py +++ b/translate/tests/unit/v2/test__http.py @@ -82,7 +82,7 @@ def test_extra_headers(self): expected_headers = { base_http.CLIENT_INFO_HEADER: conn.user_agent, "User-Agent": conn.user_agent, - "Accept-Encoding": "gzip" + "Accept-Encoding": "gzip", } expected_uri = conn.build_api_url("/rainbow") http.request.assert_called_once_with(