@@ -928,7 +928,7 @@ def deidentify_with_time_extract(
928928 input_csv_file : str ,
929929 output_csv_file : str ,
930930) -> None :
931- """ Uses the Data Loss Prevention API to deidentify dates in a CSV file through
931+ """Uses the Data Loss Prevention API to deidentify dates in a CSV file through
932932 time part extraction.
933933 Args:
934934 project: The Google Cloud project id to use as a parent resource.
@@ -968,9 +968,7 @@ def map_data(value):
968968 try :
969969 date = datetime .strptime (value , "%m/%d/%Y" )
970970 return {
971- "date_value" : {
972- "year" : date .year , "month" : date .month , "day" : date .day
973- }
971+ "date_value" : {"year" : date .year , "month" : date .month , "day" : date .day }
974972 }
975973 except ValueError :
976974 return {"string_value" : value }
@@ -995,9 +993,7 @@ def map_rows(row):
995993 "field_transformations" : [
996994 {
997995 "primitive_transformation" : {
998- "time_part_config" : {
999- "part_to_extract" : "YEAR"
1000- }
996+ "time_part_config" : {"part_to_extract" : "YEAR" }
1001997 },
1002998 "fields" : date_fields ,
1003999 }
@@ -2266,14 +2262,14 @@ def deidentify_table_with_multiple_crypto_hash(
22662262 time_extract_parser .add_argument (
22672263 "input_csv_file" ,
22682264 help = "The path to the CSV file to deidentify. The first row of the "
2269- "file must specify column names, and all other rows must contain "
2270- "valid values." ,
2265+ "file must specify column names, and all other rows must contain "
2266+ "valid values." ,
22712267 )
22722268 time_extract_parser .add_argument (
22732269 "date_fields" ,
22742270 nargs = "+" ,
22752271 help = "The list of date fields in the CSV file to de-identify. Example: "
2276- "['birth_date', 'register_date']" ,
2272+ "['birth_date', 'register_date']" ,
22772273 )
22782274 time_extract_parser .add_argument (
22792275 "output_csv_file" , help = "The path to save the time-extracted data."
0 commit comments