Skip to content

Commit

Permalink
Remove deepcopy (#173)
Browse files Browse the repository at this point in the history
  • Loading branch information
stympy authored Jun 14, 2024
1 parent e338262 commit 8642c7b
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions honeybadger/utils.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import copy
import json


Expand All @@ -11,13 +10,11 @@ def default(self, o):


def filter_dict(data, filter_keys):
# filter_keys = set(data.keys())
if type(data) != dict:
return data

data_copy = copy.deepcopy(data)

for key, value in data_copy.items():
keys = list(data.keys())
for key in keys:
# While tuples are considered valid dictionary keys,
# they are not json serializable
# so we remove them from the dictionary
Expand All @@ -28,7 +25,7 @@ def filter_dict(data, filter_keys):
if key in filter_keys:
data[key] = "[FILTERED]"

if type(value) == dict:
if type(data[key]) == dict:
data[key] = filter_dict(data[key], filter_keys)

return data

0 comments on commit 8642c7b

Please sign in to comment.