Skip to content

Commit debe98e

Browse files
committed
Fix docstring nits
1 parent 4b0d97e commit debe98e

File tree

1 file changed

+14
-13
lines changed

1 file changed

+14
-13
lines changed

dlp/deid.py

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,13 @@
2121

2222
# [START dlp_deidentify_masking]
2323
def deidentify_with_mask(
24-
project, string, info_types, masking_character=None, number_to_mask=0
24+
project, input_str, info_types, masking_character=None, number_to_mask=0
2525
):
2626
"""Uses the Data Loss Prevention API to deidentify sensitive data in a
2727
string by masking it with a character.
2828
Args:
2929
project: The Google Cloud project id to use as a parent resource.
30-
item: The string to deidentify (will be treated as text).
30+
input_str: The string to deidentify (will be treated as text).
3131
masking_character: The character to mask matching sensitive data with.
3232
number_to_mask: The maximum number of sensitive characters to mask in
3333
a match. If omitted or set to zero, the API will default to no
@@ -67,7 +67,7 @@ def deidentify_with_mask(
6767
}
6868

6969
# Construct item
70-
item = {"value": string}
70+
item = {"value": input_str}
7171

7272
# Call the API
7373
response = dlp.deidentify_content(
@@ -86,15 +86,16 @@ def deidentify_with_mask(
8686
# [START dlp_deidentify_replace]
8787
def deidentify_with_replace(
8888
project,
89-
string,
89+
input_str,
9090
info_types,
91-
replacement_str=None,
91+
replacement_str="REPLACEMENT_STR",
9292
):
9393
"""Uses the Data Loss Prevention API to deidentify sensitive data in a
9494
string by replacing matched input values with a value you specify.
9595
Args:
9696
project: The Google Cloud project id to use as a parent resource.
97-
string: The string to deidentify (will be treated as text).
97+
input_str: The string to deidentify (will be treated as text).
98+
info_types: A list of strings representing info types to look for.
9899
replacement_str: The string to replace all values that match given
99100
info types.
100101
Returns:
@@ -131,7 +132,7 @@ def deidentify_with_replace(
131132
}
132133

133134
# Construct item
134-
item = {"value": string}
135+
item = {"value": input_str}
135136

136137
# Call the API
137138
response = dlp.deidentify_content(
@@ -151,7 +152,7 @@ def deidentify_with_replace(
151152

152153
def deidentify_with_fpe(
153154
project,
154-
string,
155+
input_str,
155156
info_types,
156157
alphabet=None,
157158
surrogate_type=None,
@@ -162,7 +163,7 @@ def deidentify_with_fpe(
162163
string using Format Preserving Encryption (FPE).
163164
Args:
164165
project: The Google Cloud project id to use as a parent resource.
165-
item: The string to deidentify (will be treated as text).
166+
input_str: The string to deidentify (will be treated as text).
166167
alphabet: The set of characters to replace sensitive ones with. For
167168
more information, see https://cloud.google.com/dlp/docs/reference/
168169
rest/v2beta2/organizations.deidentifyTemplates#ffxcommonnativealphabet
@@ -230,7 +231,7 @@ def deidentify_with_fpe(
230231
}
231232

232233
# Convert string to item
233-
item = {"value": string}
234+
item = {"value": input_str}
234235

235236
# Call the API
236237
response = dlp.deidentify_content(
@@ -250,7 +251,7 @@ def deidentify_with_fpe(
250251
# [START dlp_reidentify_fpe]
251252
def reidentify_with_fpe(
252253
project,
253-
string,
254+
input_str,
254255
alphabet=None,
255256
surrogate_type=None,
256257
key_name=None,
@@ -260,7 +261,7 @@ def reidentify_with_fpe(
260261
string that was encrypted by Format Preserving Encryption (FPE).
261262
Args:
262263
project: The Google Cloud project id to use as a parent resource.
263-
item: The string to deidentify (will be treated as text).
264+
input_str: The string to deidentify (will be treated as text).
264265
alphabet: The set of characters to replace sensitive ones with. For
265266
more information, see https://cloud.google.com/dlp/docs/reference/
266267
rest/v2beta2/organizations.deidentifyTemplates#ffxcommonnativealphabet
@@ -319,7 +320,7 @@ def reidentify_with_fpe(
319320
}
320321

321322
# Convert string to item
322-
item = {"value": string}
323+
item = {"value": input_str}
323324

324325
# Call the API
325326
response = dlp.reidentify_content(

0 commit comments

Comments
 (0)