Skip to content
Discussion options

You must be logged in to vote

There is no ready-made function, but the implementation is relatively easy.

folder = 'myfolder'
config_dict = ut.json2dict(f'{folder}/config.json')
runs = ut.json2dict(f'{folder}/runs.json')

Let's say now you are interested in the first run

run = list(runs.values())[0]

Then to extract the argument arg, you can do as follows:

run_kwargs = ut.set_values_recursive(config_dict, run['args'])
arg_value = ut.extract_nested(run_kwargs, arg)

A one liner option could instead be

arg_value = ut.extact_nested(run['args'], arg, ut.extract_nested(config_dict, arg))

The third argument of ut.extract_nested is the default value to return if it is not present in the dicionary

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by AlessandroLovo
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
documentation Improvements or additions to documentation help wanted Extra attention is needed
2 participants