Skip to content

Commit

Permalink
fix contribs dict copy
Browse files Browse the repository at this point in the history
  • Loading branch information
tschaume committed Apr 9, 2024
1 parent af82260 commit 45fdd31
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions mpcontribs-client/mpcontribs/client/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2166,14 +2166,16 @@ def submit_contributions(
contrib_copy = {}
for k in fields:
if k in contrib:
flat = {}
for kk, vv in flatten(contrib[k], reducer="dot").items():
if isinstance(vv, bool):
flat[kk] = "Yes" if vv else "No"
elif isinstance(vv, str):
flat[kk] = vv

contrib_copy[k] = deepcopy(unflatten(flat, splitter="dot"))
if isinstance(contrib[k], dict):
flat = {}
for kk, vv in flatten(contrib[k], reducer="dot").items():
if isinstance(vv, bool):
flat[kk] = "Yes" if vv else "No"
elif isinstance(vv, str) and vv:
flat[kk] = vv
contrib_copy[k] = deepcopy(unflatten(flat, splitter="dot"))
else:
contrib_copy[k] = deepcopy(contrib[k])

contribs[project_name].append(contrib_copy)

Expand Down

0 comments on commit 45fdd31

Please sign in to comment.