Remove extra copy.deepcopy

This method is called recursively (ie deeply) by default
so there doesn't seem to be a good reason to deepcopy over
and over and over at every recusion level especially since
a new output dictionary is getting created anyway.

Change-Id: I644ef881e487c06dc4db77d60cfe765b0e59b547
This commit is contained in:
Joshua Harlow 2018-07-19 12:17:42 -07:00
parent 7f8397091f
commit 25ed5ceb58
1 changed files with 1 additions and 4 deletions

View File

@ -17,7 +17,6 @@
System-level utilities and helper functions.
"""
import copy
import math
import re
import unicodedata
@ -394,9 +393,7 @@ def mask_dict_password(dictionary, secret="***"): # nosec
if not isinstance(dictionary, dict):
raise TypeError("Expected a dictionary, got %s instead."
% type(dictionary))
out = copy.deepcopy(dictionary)
out = {}
for k, v in dictionary.items():
if isinstance(v, dict):
out[k] = mask_dict_password(v, secret=secret)