Skip to content
This repository has been archived by the owner on Sep 27, 2023. It is now read-only.

Commit

Permalink
deep copy participant
Browse files Browse the repository at this point in the history
  • Loading branch information
leoporoli committed Sep 25, 2023
1 parent 1be6117 commit cc8b731
Showing 1 changed file with 13 additions and 8 deletions.
21 changes: 13 additions & 8 deletions package_io/input_parser.star
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,12 @@ def parse_input(input_args):
elif attr == "participants":
participants = []
for participant in input_args["participants"]:
new_participant = create_new_participant(participant)
new_participant = default_participant()
for sub_attr, sub_value in participant.items():
# if the value is set in input we set it in participant
new_participant[sub_attr] = sub_value
for _ in range(0, new_participant["count"]):
participant_copy = deep_copy_participant(new_participant)
participants.append(new_participant)
result["participants"] = participants

Expand Down Expand Up @@ -174,13 +178,14 @@ def parse_input(input_args):

return result

def create_new_participant(participant_from_args):
new_participant = default_participant()
for sub_attr, sub_value in participant_from_args.items():
# if the value is set in input we set it in participant
new_participant[sub_attr] = sub_value

return new_participant
def deep_copy_participant(participant):
part = {}
for k, v in participant.items():
if type(v) == type([]):
part[k] = list(v)
else:
part[k] = v
return part

def get_client_log_level_or_default(participant_log_level, global_log_level, client_log_levels):
log_level = participant_log_level
Expand Down

0 comments on commit cc8b731

Please sign in to comment.