Skip to content

Commit 79d8e00

Browse files
fix(translate): add py2 deprecation warning; bump copyright year to 2020; add 3.8 unit tests (via synth) (#9943)
1 parent ca7f003 commit 79d8e00

16 files changed

+49
-47
lines changed

translate/google/cloud/translate.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# -*- coding: utf-8 -*-
22
#
3-
# Copyright 2019 Google LLC
3+
# Copyright 2020 Google LLC
44
#
55
# Licensed under the Apache License, Version 2.0 (the "License");
66
# you may not use this file except in compliance with the License.

translate/google/cloud/translate_v3/__init__.py

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# -*- coding: utf-8 -*-
22
#
3-
# Copyright 2019 Google LLC
3+
# Copyright 2020 Google LLC
44
#
55
# Licensed under the Apache License, Version 2.0 (the "License");
66
# you may not use this file except in compliance with the License.
@@ -16,11 +16,22 @@
1616

1717

1818
from __future__ import absolute_import
19+
import sys
20+
import warnings
1921

2022
from google.cloud.translate_v3 import types
2123
from google.cloud.translate_v3.gapic import translation_service_client
2224

2325

26+
if sys.version_info[:2] == (2, 7):
27+
message = (
28+
"A future version of this library will drop support for Python 2.7."
29+
"More details about Python 2 support for Google Cloud Client Libraries"
30+
"can be found at https://cloud.google.com/python/docs/python2-sunset/"
31+
)
32+
warnings.warn(message, DeprecationWarning)
33+
34+
2435
class TranslationServiceClient(translation_service_client.TranslationServiceClient):
2536
__doc__ = translation_service_client.TranslationServiceClient.__doc__
2637

translate/google/cloud/translate_v3/gapic/translation_service_client.py

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# -*- coding: utf-8 -*-
22
#
3-
# Copyright 2019 Google LLC
3+
# Copyright 2020 Google LLC
44
#
55
# Licensed under the Apache License, Version 2.0 (the "License");
66
# 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):
8080

8181
@classmethod
8282
def glossary_path(cls, project, location, glossary):
83-
"""DEPRECATED. Return a fully-qualified glossary string."""
84-
warnings.warn(
85-
"Resource name helper functions are deprecated.",
86-
PendingDeprecationWarning,
87-
stacklevel=1,
88-
)
83+
"""Return a fully-qualified glossary string."""
8984
return google.api_core.path_template.expand(
9085
"projects/{project}/locations/{location}/glossaries/{glossary}",
9186
project=project,
@@ -95,12 +90,7 @@ def glossary_path(cls, project, location, glossary):
9590

9691
@classmethod
9792
def location_path(cls, project, location):
98-
"""DEPRECATED. Return a fully-qualified location string."""
99-
warnings.warn(
100-
"Resource name helper functions are deprecated.",
101-
PendingDeprecationWarning,
102-
stacklevel=1,
103-
)
93+
"""Return a fully-qualified location string."""
10494
return google.api_core.path_template.expand(
10595
"projects/{project}/locations/{location}",
10696
project=project,

translate/google/cloud/translate_v3/gapic/transports/translation_service_grpc_transport.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# -*- coding: utf-8 -*-
22
#
3-
# Copyright 2019 Google LLC
3+
# Copyright 2020 Google LLC
44
#
55
# Licensed under the Apache License, Version 2.0 (the "License");
66
# you may not use this file except in compliance with the License.

translate/google/cloud/translate_v3/proto/translation_service_pb2.py

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

translate/google/cloud/translate_v3/types.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# -*- coding: utf-8 -*-
22
#
3-
# Copyright 2019 Google LLC
3+
# Copyright 2020 Google LLC
44
#
55
# Licensed under the Apache License, Version 2.0 (the "License");
66
# you may not use this file except in compliance with the License.

translate/google/cloud/translate_v3beta1/__init__.py

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# -*- coding: utf-8 -*-
22
#
3-
# Copyright 2019 Google LLC
3+
# Copyright 2020 Google LLC
44
#
55
# Licensed under the Apache License, Version 2.0 (the "License");
66
# you may not use this file except in compliance with the License.
@@ -16,11 +16,22 @@
1616

1717

1818
from __future__ import absolute_import
19+
import sys
20+
import warnings
1921

2022
from google.cloud.translate_v3beta1 import types
2123
from google.cloud.translate_v3beta1.gapic import translation_service_client
2224

2325

26+
if sys.version_info[:2] == (2, 7):
27+
message = (
28+
"A future version of this library will drop support for Python 2.7."
29+
"More details about Python 2 support for Google Cloud Client Libraries"
30+
"can be found at https://cloud.google.com/python/docs/python2-sunset/"
31+
)
32+
warnings.warn(message, DeprecationWarning)
33+
34+
2435
class TranslationServiceClient(translation_service_client.TranslationServiceClient):
2536
__doc__ = translation_service_client.TranslationServiceClient.__doc__
2637

translate/google/cloud/translate_v3beta1/gapic/translation_service_client.py

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# -*- coding: utf-8 -*-
22
#
3-
# Copyright 2019 Google LLC
3+
# Copyright 2020 Google LLC
44
#
55
# Licensed under the Apache License, Version 2.0 (the "License");
66
# 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):
8080

8181
@classmethod
8282
def glossary_path(cls, project, location, glossary):
83-
"""DEPRECATED. Return a fully-qualified glossary string."""
84-
warnings.warn(
85-
"Resource name helper functions are deprecated.",
86-
PendingDeprecationWarning,
87-
stacklevel=1,
88-
)
83+
"""Return a fully-qualified glossary string."""
8984
return google.api_core.path_template.expand(
9085
"projects/{project}/locations/{location}/glossaries/{glossary}",
9186
project=project,
@@ -95,12 +90,7 @@ def glossary_path(cls, project, location, glossary):
9590

9691
@classmethod
9792
def location_path(cls, project, location):
98-
"""DEPRECATED. Return a fully-qualified location string."""
99-
warnings.warn(
100-
"Resource name helper functions are deprecated.",
101-
PendingDeprecationWarning,
102-
stacklevel=1,
103-
)
93+
"""Return a fully-qualified location string."""
10494
return google.api_core.path_template.expand(
10595
"projects/{project}/locations/{location}",
10696
project=project,

translate/google/cloud/translate_v3beta1/gapic/transports/translation_service_grpc_transport.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# -*- coding: utf-8 -*-
22
#
3-
# Copyright 2019 Google LLC
3+
# Copyright 2020 Google LLC
44
#
55
# Licensed under the Apache License, Version 2.0 (the "License");
66
# you may not use this file except in compliance with the License.

translate/google/cloud/translate_v3beta1/proto/translation_service_pb2.py

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

0 commit comments

Comments
 (0)