Content-Length: 538889 | pFad | https://github.com/googleapis/python-dlp/commit/b30d7c1cd48fba47fdddb7b9232e421261108a52

CF feat(dlp): undeprecate resource name helper methods, add 2.7 deprecat… · googleapis/python-dlp@b30d7c1 · GitHub
Skip to content
This repository was archived by the owner on Dec 10, 2023. It is now read-only.

Commit b30d7c1

Browse files
yoshi-automationbusunkim96
authored andcommitted
feat(dlp): undeprecate resource name helper methods, add 2.7 deprecation warning (via synth) (#10040)
1 parent d21e82a commit b30d7c1

File tree

3 files changed

+3445
-65
lines changed

3 files changed

+3445
-65
lines changed

google/cloud/dlp_v2/__init__.py

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

1717

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

2022
from google.cloud.dlp_v2 import types
2123
from google.cloud.dlp_v2.gapic import dlp_service_client
2224
from google.cloud.dlp_v2.gapic import enums
2325

2426

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

google/cloud/dlp_v2/gapic/dlp_service_client.py

Lines changed: 10 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -86,36 +86,21 @@ def from_service_account_file(cls, filename, *args, **kwargs):
8686

8787
@classmethod
8888
def dlp_job_path(cls, project, dlp_job):
89-
"""DEPRECATED. Return a fully-qualified dlp_job string."""
90-
warnings.warn(
91-
"Resource name helper functions are deprecated.",
92-
PendingDeprecationWarning,
93-
stacklevel=1,
94-
)
89+
"""Return a fully-qualified dlp_job string."""
9590
return google.api_core.path_template.expand(
9691
"projects/{project}/dlpJobs/{dlp_job}", project=project, dlp_job=dlp_job
9792
)
9893

9994
@classmethod
10095
def organization_path(cls, organization):
101-
"""DEPRECATED. Return a fully-qualified organization string."""
102-
warnings.warn(
103-
"Resource name helper functions are deprecated.",
104-
PendingDeprecationWarning,
105-
stacklevel=1,
106-
)
96+
"""Return a fully-qualified organization string."""
10797
return google.api_core.path_template.expand(
10898
"organizations/{organization}", organization=organization
10999
)
110100

111101
@classmethod
112102
def organization_deidentify_template_path(cls, organization, deidentify_template):
113-
"""DEPRECATED. Return a fully-qualified organization_deidentify_template string."""
114-
warnings.warn(
115-
"Resource name helper functions are deprecated.",
116-
PendingDeprecationWarning,
117-
stacklevel=1,
118-
)
103+
"""Return a fully-qualified organization_deidentify_template string."""
119104
return google.api_core.path_template.expand(
120105
"organizations/{organization}/deidentifyTemplates/{deidentify_template}",
121106
organization=organization,
@@ -124,12 +109,7 @@ def organization_deidentify_template_path(cls, organization, deidentify_template
124109

125110
@classmethod
126111
def organization_inspect_template_path(cls, organization, inspect_template):
127-
"""DEPRECATED. Return a fully-qualified organization_inspect_template string."""
128-
warnings.warn(
129-
"Resource name helper functions are deprecated.",
130-
PendingDeprecationWarning,
131-
stacklevel=1,
132-
)
112+
"""Return a fully-qualified organization_inspect_template string."""
133113
return google.api_core.path_template.expand(
134114
"organizations/{organization}/inspectTemplates/{inspect_template}",
135115
organization=organization,
@@ -138,12 +118,7 @@ def organization_inspect_template_path(cls, organization, inspect_template):
138118

139119
@classmethod
140120
def organization_stored_info_type_path(cls, organization, stored_info_type):
141-
"""DEPRECATED. Return a fully-qualified organization_stored_info_type string."""
142-
warnings.warn(
143-
"Resource name helper functions are deprecated.",
144-
PendingDeprecationWarning,
145-
stacklevel=1,
146-
)
121+
"""Return a fully-qualified organization_stored_info_type string."""
147122
return google.api_core.path_template.expand(
148123
"organizations/{organization}/storedInfoTypes/{stored_info_type}",
149124
organization=organization,
@@ -152,24 +127,14 @@ def organization_stored_info_type_path(cls, organization, stored_info_type):
152127

153128
@classmethod
154129
def project_path(cls, project):
155-
"""DEPRECATED. Return a fully-qualified project string."""
156-
warnings.warn(
157-
"Resource name helper functions are deprecated.",
158-
PendingDeprecationWarning,
159-
stacklevel=1,
160-
)
130+
"""Return a fully-qualified project string."""
161131
return google.api_core.path_template.expand(
162132
"projects/{project}", project=project
163133
)
164134

165135
@classmethod
166136
def project_deidentify_template_path(cls, project, deidentify_template):
167-
"""DEPRECATED. Return a fully-qualified project_deidentify_template string."""
168-
warnings.warn(
169-
"Resource name helper functions are deprecated.",
170-
PendingDeprecationWarning,
171-
stacklevel=1,
172-
)
137+
"""Return a fully-qualified project_deidentify_template string."""
173138
return google.api_core.path_template.expand(
174139
"projects/{project}/deidentifyTemplates/{deidentify_template}",
175140
project=project,
@@ -178,12 +143,7 @@ def project_deidentify_template_path(cls, project, deidentify_template):
178143

179144
@classmethod
180145
def project_inspect_template_path(cls, project, inspect_template):
181-
"""DEPRECATED. Return a fully-qualified project_inspect_template string."""
182-
warnings.warn(
183-
"Resource name helper functions are deprecated.",
184-
PendingDeprecationWarning,
185-
stacklevel=1,
186-
)
146+
"""Return a fully-qualified project_inspect_template string."""
187147
return google.api_core.path_template.expand(
188148
"projects/{project}/inspectTemplates/{inspect_template}",
189149
project=project,
@@ -192,12 +152,7 @@ def project_inspect_template_path(cls, project, inspect_template):
192152

193153
@classmethod
194154
def project_job_trigger_path(cls, project, job_trigger):
195-
"""DEPRECATED. Return a fully-qualified project_job_trigger string."""
196-
warnings.warn(
197-
"Resource name helper functions are deprecated.",
198-
PendingDeprecationWarning,
199-
stacklevel=1,
200-
)
155+
"""Return a fully-qualified project_job_trigger string."""
201156
return google.api_core.path_template.expand(
202157
"projects/{project}/jobTriggers/{job_trigger}",
203158
project=project,
@@ -206,12 +161,7 @@ def project_job_trigger_path(cls, project, job_trigger):
206161

207162
@classmethod
208163
def project_stored_info_type_path(cls, project, stored_info_type):
209-
"""DEPRECATED. Return a fully-qualified project_stored_info_type string."""
210-
warnings.warn(
211-
"Resource name helper functions are deprecated.",
212-
PendingDeprecationWarning,
213-
stacklevel=1,
214-
)
164+
"""Return a fully-qualified project_stored_info_type string."""
215165
return google.api_core.path_template.expand(
216166
"projects/{project}/storedInfoTypes/{stored_info_type}",
217167
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/python-dlp/commit/b30d7c1cd48fba47fdddb7b9232e421261108a52

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy