Content-Length: 823729 | pFad | https://github.com/googleapis/google-cloud-python/commit/b35a9835f357f667a4d830a79984d3cdec35dade

88 feat(automl): undeprecate resource name helper methods, add 2.7 depre… · googleapis/google-cloud-python@b35a983 · GitHub
Skip to content

Commit b35a983

Browse files
yoshi-automationbusunkim96
authored andcommitted
feat(automl): undeprecate resource name helper methods, add 2.7 deprecation warning (via synth) (#10037)
1 parent 9df3d9c commit b35a983

File tree

7 files changed

+3940
-89
lines changed

7 files changed

+3940
-89
lines changed

automl/google/cloud/automl_v1/__init__.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,24 @@
1616

1717

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

2022
from google.cloud.automl_v1 import types
2123
from google.cloud.automl_v1.gapic import auto_ml_client
2224
from google.cloud.automl_v1.gapic import enums
2325
from google.cloud.automl_v1.gapic import prediction_service_client
2426

2527

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

automl/google/cloud/automl_v1/gapic/auto_ml_client.py

Lines changed: 5 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -101,12 +101,7 @@ def from_service_account_file(cls, filename, *args, **kwargs):
101101

102102
@classmethod
103103
def annotation_spec_path(cls, project, location, dataset, annotation_spec):
104-
"""DEPRECATED. Return a fully-qualified annotation_spec string."""
105-
warnings.warn(
106-
"Resource name helper functions are deprecated.",
107-
PendingDeprecationWarning,
108-
stacklevel=1,
109-
)
104+
"""Return a fully-qualified annotation_spec string."""
110105
return google.api_core.path_template.expand(
111106
"projects/{project}/locations/{location}/datasets/{dataset}/annotationSpecs/{annotation_spec}",
112107
project=project,
@@ -117,12 +112,7 @@ def annotation_spec_path(cls, project, location, dataset, annotation_spec):
117112

118113
@classmethod
119114
def dataset_path(cls, project, location, dataset):
120-
"""DEPRECATED. Return a fully-qualified dataset string."""
121-
warnings.warn(
122-
"Resource name helper functions are deprecated.",
123-
PendingDeprecationWarning,
124-
stacklevel=1,
125-
)
115+
"""Return a fully-qualified dataset string."""
126116
return google.api_core.path_template.expand(
127117
"projects/{project}/locations/{location}/datasets/{dataset}",
128118
project=project,
@@ -132,12 +122,7 @@ def dataset_path(cls, project, location, dataset):
132122

133123
@classmethod
134124
def location_path(cls, project, location):
135-
"""DEPRECATED. Return a fully-qualified location string."""
136-
warnings.warn(
137-
"Resource name helper functions are deprecated.",
138-
PendingDeprecationWarning,
139-
stacklevel=1,
140-
)
125+
"""Return a fully-qualified location string."""
141126
return google.api_core.path_template.expand(
142127
"projects/{project}/locations/{location}",
143128
project=project,
@@ -146,12 +131,7 @@ def location_path(cls, project, location):
146131

147132
@classmethod
148133
def model_path(cls, project, location, model):
149-
"""DEPRECATED. Return a fully-qualified model string."""
150-
warnings.warn(
151-
"Resource name helper functions are deprecated.",
152-
PendingDeprecationWarning,
153-
stacklevel=1,
154-
)
134+
"""Return a fully-qualified model string."""
155135
return google.api_core.path_template.expand(
156136
"projects/{project}/locations/{location}/models/{model}",
157137
project=project,
@@ -161,12 +141,7 @@ def model_path(cls, project, location, model):
161141

162142
@classmethod
163143
def model_evaluation_path(cls, project, location, model, model_evaluation):
164-
"""DEPRECATED. Return a fully-qualified model_evaluation string."""
165-
warnings.warn(
166-
"Resource name helper functions are deprecated.",
167-
PendingDeprecationWarning,
168-
stacklevel=1,
169-
)
144+
"""Return a fully-qualified model_evaluation string."""
170145
return google.api_core.path_template.expand(
171146
"projects/{project}/locations/{location}/models/{model}/modelEvaluations/{model_evaluation}",
172147
project=project,

automl/google/cloud/automl_v1/gapic/prediction_service_client.py

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -91,12 +91,7 @@ def from_service_account_file(cls, filename, *args, **kwargs):
9191

9292
@classmethod
9393
def model_path(cls, project, location, model):
94-
"""DEPRECATED. Return a fully-qualified model string."""
95-
warnings.warn(
96-
"Resource name helper functions are deprecated.",
97-
PendingDeprecationWarning,
98-
stacklevel=1,
99-
)
94+
"""Return a fully-qualified model string."""
10095
return google.api_core.path_template.expand(
10196
"projects/{project}/locations/{location}/models/{model}",
10297
project=project,

automl/google/cloud/automl_v1beta1/__init__.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616

1717

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

2022
from google.cloud.automl_v1beta1 import types
2123
from google.cloud.automl_v1beta1.gapic import auto_ml_client
@@ -33,6 +35,15 @@ class GcsClient(gcs_client.GcsClient):
3335
__doc__ = gcs_client.GcsClient.__doc__
3436

3537

38+
if sys.version_info[:2] == (2, 7):
39+
message = (
40+
"A future version of this library will drop support for Python 2.7."
41+
"More details about Python 2 support for Google Cloud Client Libraries"
42+
"can be found at https://cloud.google.com/python/docs/python2-sunset/"
43+
)
44+
warnings.warn(message, DeprecationWarning)
45+
46+
3647
class AutoMlClient(auto_ml_client.AutoMlClient):
3748
__doc__ = auto_ml_client.AutoMlClient.__doc__
3849
enums = enums

automl/google/cloud/automl_v1beta1/gapic/auto_ml_client.py

Lines changed: 7 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -103,12 +103,7 @@ def from_service_account_file(cls, filename, *args, **kwargs):
103103

104104
@classmethod
105105
def annotation_spec_path(cls, project, location, dataset, annotation_spec):
106-
"""DEPRECATED. Return a fully-qualified annotation_spec string."""
107-
warnings.warn(
108-
"Resource name helper functions are deprecated.",
109-
PendingDeprecationWarning,
110-
stacklevel=1,
111-
)
106+
"""Return a fully-qualified annotation_spec string."""
112107
return google.api_core.path_template.expand(
113108
"projects/{project}/locations/{location}/datasets/{dataset}/annotationSpecs/{annotation_spec}",
114109
project=project,
@@ -119,12 +114,7 @@ def annotation_spec_path(cls, project, location, dataset, annotation_spec):
119114

120115
@classmethod
121116
def column_spec_path(cls, project, location, dataset, table_spec, column_spec):
122-
"""DEPRECATED. Return a fully-qualified column_spec string."""
123-
warnings.warn(
124-
"Resource name helper functions are deprecated.",
125-
PendingDeprecationWarning,
126-
stacklevel=1,
127-
)
117+
"""Return a fully-qualified column_spec string."""
128118
return google.api_core.path_template.expand(
129119
"projects/{project}/locations/{location}/datasets/{dataset}/tableSpecs/{table_spec}/columnSpecs/{column_spec}",
130120
project=project,
@@ -136,12 +126,7 @@ def column_spec_path(cls, project, location, dataset, table_spec, column_spec):
136126

137127
@classmethod
138128
def dataset_path(cls, project, location, dataset):
139-
"""DEPRECATED. Return a fully-qualified dataset string."""
140-
warnings.warn(
141-
"Resource name helper functions are deprecated.",
142-
PendingDeprecationWarning,
143-
stacklevel=1,
144-
)
129+
"""Return a fully-qualified dataset string."""
145130
return google.api_core.path_template.expand(
146131
"projects/{project}/locations/{location}/datasets/{dataset}",
147132
project=project,
@@ -151,12 +136,7 @@ def dataset_path(cls, project, location, dataset):
151136

152137
@classmethod
153138
def location_path(cls, project, location):
154-
"""DEPRECATED. Return a fully-qualified location string."""
155-
warnings.warn(
156-
"Resource name helper functions are deprecated.",
157-
PendingDeprecationWarning,
158-
stacklevel=1,
159-
)
139+
"""Return a fully-qualified location string."""
160140
return google.api_core.path_template.expand(
161141
"projects/{project}/locations/{location}",
162142
project=project,
@@ -165,12 +145,7 @@ def location_path(cls, project, location):
165145

166146
@classmethod
167147
def model_path(cls, project, location, model):
168-
"""DEPRECATED. Return a fully-qualified model string."""
169-
warnings.warn(
170-
"Resource name helper functions are deprecated.",
171-
PendingDeprecationWarning,
172-
stacklevel=1,
173-
)
148+
"""Return a fully-qualified model string."""
174149
return google.api_core.path_template.expand(
175150
"projects/{project}/locations/{location}/models/{model}",
176151
project=project,
@@ -180,12 +155,7 @@ def model_path(cls, project, location, model):
180155

181156
@classmethod
182157
def model_evaluation_path(cls, project, location, model, model_evaluation):
183-
"""DEPRECATED. Return a fully-qualified model_evaluation string."""
184-
warnings.warn(
185-
"Resource name helper functions are deprecated.",
186-
PendingDeprecationWarning,
187-
stacklevel=1,
188-
)
158+
"""Return a fully-qualified model_evaluation string."""
189159
return google.api_core.path_template.expand(
190160
"projects/{project}/locations/{location}/models/{model}/modelEvaluations/{model_evaluation}",
191161
project=project,
@@ -196,12 +166,7 @@ def model_evaluation_path(cls, project, location, model, model_evaluation):
196166

197167
@classmethod
198168
def table_spec_path(cls, project, location, dataset, table_spec):
199-
"""DEPRECATED. Return a fully-qualified table_spec string."""
200-
warnings.warn(
201-
"Resource name helper functions are deprecated.",
202-
PendingDeprecationWarning,
203-
stacklevel=1,
204-
)
169+
"""Return a fully-qualified table_spec string."""
205170
return google.api_core.path_template.expand(
206171
"projects/{project}/locations/{location}/datasets/{dataset}/tableSpecs/{table_spec}",
207172
project=project,

automl/google/cloud/automl_v1beta1/gapic/prediction_service_client.py

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -95,12 +95,7 @@ def from_service_account_file(cls, filename, *args, **kwargs):
9595

9696
@classmethod
9797
def model_path(cls, project, location, model):
98-
"""DEPRECATED. Return a fully-qualified model string."""
99-
warnings.warn(
100-
"Resource name helper functions are deprecated.",
101-
PendingDeprecationWarning,
102-
stacklevel=1,
103-
)
98+
"""Return a fully-qualified model string."""
10499
return google.api_core.path_template.expand(
105100
"projects/{project}/locations/{location}/models/{model}",
106101
project=project,

0 commit comments

Comments
 (0)








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: https://github.com/googleapis/google-cloud-python/commit/b35a9835f357f667a4d830a79984d3cdec35dade

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy