From 25ed5ceb582ba670bd49bdd6359b740b6cb396d1 Mon Sep 17 00:00:00 2001 From: Joshua Harlow Date: Thu, 19 Jul 2018 12:17:42 -0700 Subject: 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 --- oslo_utils/strutils.py | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/oslo_utils/strutils.py b/oslo_utils/strutils.py index 922ad22..ebcc104 100644 --- a/oslo_utils/strutils.py +++ b/oslo_utils/strutils.py @@ -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) -- cgit v1.2.1