-
Notifications
You must be signed in to change notification settings - Fork 27
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
Support missing namespace in parameter names in design_kw #163
Conversation
Can one of the admins verify this patch? |
41ff95c
to
acf323a
Compare
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.
I think this is a fair approach and the tests seems adequate 👍 I would like to see an added test for logging if that is the expected behaviour and in addition I think the implementation of rm_genkw_prefix
could be simplified a bit.
I'm supporting this direction
({"foo:bar": "value"}, {"bar": "value"}), | ||
({"foo:bar": "value", "foo:com": "value2"}, {"bar": "value", "com": "value2"}), | ||
({}, {}), | ||
# Duplicates are dropped, a warning is logged. |
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.
I don't think any warning is logged here...
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.
Added extra duplicates warning.
semeio/jobs/design_kw/design_kw.py
Outdated
@@ -116,3 +119,53 @@ def extract_key_value(parameters): | |||
if errors: | |||
raise ValueError("\n".join(errors)) | |||
return res | |||
|
|||
|
|||
def rm_genkw_prefix(str_or_dict, ignoreprefixes="LOG10_"): |
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.
Unless I've misunderstood the type of str_or_dict
will always be a dict on the first call, and then the string support is used internally on the keys afterwards. I think the implementation would be much cleaner if we utilised this assumption and hid the string-support within the function such that rm_genkw_prefix
only accepts dicts of depth one.
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.
New implementation written - it got a lot better with only dict as input.
6fcec8d
to
5e6bac1
Compare
semeio/jobs/design_kw/design_kw.py
Outdated
|
||
|
||
def rm_genkw_prefix(paramsdict, ignoreprefixes="LOG10_"): | ||
"""Remove anything before the first colon in a string, or remove |
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.
The doc string still need an update, besides that it looks good 👍 Nice clean up of rm_genkw_prefix
;)
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.
Updated.
rm_genkw_prefix is refactored and improved from fm_pyscal into design_kw. fm_pyscal will not any longer ignore a namespace prefix in the interpolation parameter names, if the user actually supplies a prefix (has probably never happened in practice yet) Update docs for design_kw accordingly
5e6bac1
to
9addc3a
Compare
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.
🚀
First attempt at solving #59
Check first if the behaviour imposed by the added tests is what we want, then assess whether the code achieving it was sufficiently elegant (perhaps it was not..)