Skip to content
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

Enhance API:mne.get_config to return config dict when called wthout para... #1135

Merged
merged 4 commits into from
Feb 17, 2014
Merged

Conversation

saketkc
Copy link
Contributor

@saketkc saketkc commented Feb 16, 2014

Fixes #1112. Comments required for json unicode encoding, commented as of now.
Also added tests.

The preference key to look for. The os evironment is searched first,
then the mne-python config file is parsed.
If None, all the config parameters present in the path are returned
Copy link
Member

Choose a reason for hiding this comment

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

Period at the end of the line

@larsoner
Copy link
Member

What's the unicode problem? They come in as unicode strings? I think that's okay...

@larsoner
Copy link
Member

There is a failure on 3.3 BTW.

@dengemann
Copy link
Member

@saketkc could elaborate the unicode issue? I would expect this to be handled at the json level. If not conversion using externals.six.string_types could be considered.

key = 'MNE_PYTHON_TESTING_KEY'
config = {key: value}
set_config(key, value, home_dir=tempdir)
assert_equal(get_config(home_dir=tempdir), config)
Copy link
Member

Choose a reason for hiding this comment

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

this returns None for some reason in Python 3.3.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Not able to figure this one out.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

For some reason, python3.3 seems to check if key is in os.environ : https://travis-ci.org/mne-tools/mne-python/jobs/19015348#L2301

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixing this, was too trivial, don't know how I missed.

@coveralls
Copy link

Coverage Status

Coverage increased (+0.14%) when pulling 370c84c on saketkc:issue#1112 into 0beb58d on mne-tools:master.

@agramfort
Copy link
Member

can I merge this?

@saketkc
Copy link
Contributor Author

saketkc commented Feb 17, 2014

👍 from me :)

dengemann pushed a commit that referenced this pull request Feb 17, 2014
Enhance API:mne.get_config to return config dict when called wthout para...
@dengemann dengemann merged commit a470847 into mne-tools:master Feb 17, 2014
@dengemann
Copy link
Member

Thanks @saketkc ! This will make people happy.

@saketkc
Copy link
Contributor Author

saketkc commented Feb 17, 2014

So true @dengemann :)

@dengemann
Copy link
Member

Btw. @saketkc works like a charm on my box across different Pythons. Beautiful.

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.

API: mne.get_config
5 participants