-
Notifications
You must be signed in to change notification settings - Fork 16
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for dictionary overrides #750
Conversation
This is a workaround to fix the types of numeric keys as they can only be represented as strings in the json overrides.
# this is a workaround to fix the type of numeric keys as they can only be represented as strs in the json overrides | ||
for path in original_config: | ||
path_as_str = tuple(map(str, path)) | ||
if path_as_str in overrides and path not in overrides: | ||
value = overrides[path_as_str] | ||
del overrides[path_as_str] | ||
up_to_last_key = data | ||
for key in path_as_str[:-1]: | ||
up_to_last_key = up_to_last_key[key] | ||
del up_to_last_key[path_as_str[-1]] | ||
overrides[path] = value | ||
vals = reduce(lambda d, key: {key: d}, reversed(path), value) | ||
update_nested_dict(data, vals) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Whats this about?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Checks the type of the original format in the skill.yaml
and uses this for the override. The overrides can only contain str
keys, but they might be int
, float
, bool
, etc.
The tests will need to be fixed. The new overrides format is demonstrated on valory-xyz/trader#311. Additionally, breaking changes will be necessary in the |
20dd077
to
abbe71f
Compare
abbe71f
to
f95f465
Compare
Proposed changes
Adds support for dictionary overrides.
Fixes
n/a
Types of changes
What types of changes does your code introduce to agents-aea?
Put an
x
in the boxes that applyChecklist
Put an
x
in the boxes that apply.develop
branch (left side). Also you should start your branch off ourdevelop
.Further comments
n/a