-
Notifications
You must be signed in to change notification settings - Fork 15
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
fix: backwards compatibility of NWMRequest
#511
Conversation
@@ -51,8 +51,9 @@ def __init__( | |||
super().__init__(**data) | |||
else: | |||
data["request_body"] = dict() | |||
nwm_inner_request_body = {"config_data_id": config_data_id} | |||
data["request_body"]["nwm"] = nwm_inner_request_body | |||
data["request_body"]["nwm"] = data["model"]["nwm"] |
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.
Either this or the unit tests are wrong - looks like model
isn't coming in through data
.
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.
@christophertubbs, nice catch, I just fixed it.
ecbc6c0
to
ed48107
Compare
ed48107
to
7d425c1
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.
Looks good.
Stylistic opinion:
Using an approach like:
if "request_body" not in data:
if "model" in data:
request_body = data["model"][self.get_model_name()]
else:
request_body = {}
if config_data_id is not None:
request_body['config_data_id'] = config_data_id
data['request_body'] = {
self.get_model_name(): request_body
}
super().__init__(**data)
will have a single terminal point instead of two and might be a little easier to step through and predict. That's not important here since it's not exactly performing the most convoluted operation, but it is something that caught my eye.
Fix backwards compatible handling of
NWMRequest
config_data_id
initializer argument.dmod.communication
--0.16.2
Changes
NWMRequest
config_data_id
initializer argument.