Skip to content

ENH: IO interfaces to JSON files #1020

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

Merged
merged 15 commits into from
Feb 9, 2015
Merged

Conversation

oesteban
Copy link
Contributor

A grabber/sink pair to read/write parameters from json files.

@coveralls
Copy link

Coverage Status

Coverage increased (+0.01%) when pulling cb17ee6 on oesteban:enh/JSONFileInterface into ccc4166 on nipy:master.

@satra
Copy link
Member

satra commented Jan 16, 2015

this looks good. could you please update the changes file?

@oesteban
Copy link
Contributor Author

@satra sorry, I forgot about that. Fixed.

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.02%) when pulling fe6a054 on oesteban:enh/JSONFileInterface into ccc4166 on nipy:master.

return outputs


class JSONFileSinkInputSpec(DynamicTraitedSpec, BaseInterfaceInputSpec):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

how about adding an input that accepts a dictionary?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry @satra, I don't understand what you mean :S.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

something like in_dict = Dict(desc='input JSON dictionary')

so that you can pass a dictionary output of another node directly into the jsonsink node? and it will populate the relevant fields.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok I see 👍

@satra
Copy link
Member

satra commented Jan 20, 2015

should we consider:
a. adding the elements using on_trait_change for in_dict, i.e., whenever this is changed, instead of only a single input?
or
b. making it behave more like datasink with the a[.[@]b[.[@]c] formulation to create arbitrary dictionaries?

this would allow connecting multiple nodes to the same JSONsink.

@oesteban
Copy link
Contributor Author

oesteban commented Feb 9, 2015

Hi @satra, I've been thinking this around, but I can't see what would be a good end to this PR.

From your last comment, I don't see why it is not possible to connect multiple nodes to the same JSONSink, provided with you specify the input in input_names.

Regarding your considerations, I'd prefer not to go for b), as I'm not fond of the datasink formulation. I find it particularly cumbersome (of course, this is just one opinion).

Regarding a), you mean that every time in_dict changed, a new json file would be written/updated?.

@satra
Copy link
Member

satra commented Feb 9, 2015

@oesteban

Regarding your considerations, I'd prefer not to go for b), as I'm not fond of the datasink formulation. I find it particularly cumbersome (of course, this is just one opinion).

happy to entertain other thoughts on that. but we will leave it for a separate issue.

Regarding a), you mean that every time in_dict changed, a new json file would be written/updated?.

i meant that this input acts as an accumulator, but i can now see how that wouldn't be great. let's merge this and then consider the datasink formulation (also what an alternative to becoming less cumbersome would be).

satra added a commit that referenced this pull request Feb 9, 2015
@satra satra merged commit 2410411 into nipy:master Feb 9, 2015
@oesteban oesteban deleted the enh/JSONFileInterface branch February 9, 2015 19:33
@oesteban oesteban mentioned this pull request Feb 10, 2015
3 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants