[med-svn] [python-mne] 01/03: Imported Upstream version 0.7.3
Alexandre Gramfort
agramfort-guest at moszumanska.debian.org
Sat Jan 18 20:39:28 UTC 2014
This is an automated email from the git hooks/post-receive script.
agramfort-guest pushed a commit to branch master
in repository python-mne.
commit 2d5dab26cb2659a05ecc406737afc3102ce29a45
Author: Alexandre Gramfort <alexandre.gramfort at m4x.org>
Date: Sat Jan 18 21:27:52 2014 +0100
Imported Upstream version 0.7.3
---
doc/Makefile | 13 +++++-
doc/source/_templates/layout.html | 9 ++--
doc/source/_templates/sidebar.html | 5 +++
doc/source/conf.py | 7 +++-
doc/sphinxext/gen_rst.py | 24 ++++++-----
doc/upload_html.sh | 4 +-
mne/fiff/brainvision/brainvision.py | 29 +++++++++----
mne/fiff/tag.py | 9 ++--
mne/forward/forward.py | 4 +-
mne/gui/_file_traits.py | 2 +-
mne/gui/tests/test_coreg_gui.py | 81 ++++++++++++++++++------------------
mne/tests/test_epochs.py | 2 +-
mne/tests/test_utils.py | 10 ++---
mne/time_frequency/tests/test_csd.py | 16 +++----
mne/utils.py | 46 +++++++++++++-------
15 files changed, 158 insertions(+), 103 deletions(-)
diff --git a/doc/Makefile b/doc/Makefile
index 96a8dbc..0911f13 100644
--- a/doc/Makefile
+++ b/doc/Makefile
@@ -15,7 +15,8 @@ ALLSPHINXOPTS = -d build/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) source
help:
@echo "Please use \`make <target>' where <target> is one of"
- @echo " html to make standalone HTML files"
+ @echo " html to make standalone HTML files (stable version)"
+ @echo " dev_html to make standalone HTML files (dev version)"
@echo " dirhtml to make HTML files named index.html in directories"
@echo " pickle to make pickle files"
@echo " json to make JSON files"
@@ -39,11 +40,21 @@ html:
@echo
@echo "Build finished. The HTML pages are in build/html."
+html_dev:
+ BUILD_DEV_HTML=1 $(SPHINXBUILD) -b html $(ALLSPHINXOPTS) build/html
+ @echo
+ @echo "Build finished. The HTML pages are in build/html."
+
html-noplot:
$(SPHINXBUILD) -D plot_gallery=False -b html $(ALLSPHINXOPTS) build/html
@echo
@echo "Build finished. The HTML pages are in build/html/stable."
+html_dev-noplot:
+ BUILD_DEV_HTML=1 $(SPHINXBUILD) -D plot_gallery=False -b html $(ALLSPHINXOPTS) build/html
+ @echo
+ @echo "Build finished. The HTML pages are in build/html/stable."
+
dirhtml:
$(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) build/dirhtml
@echo
diff --git a/doc/source/_templates/layout.html b/doc/source/_templates/layout.html
index 6a5bd02..c71a450 100755
--- a/doc/source/_templates/layout.html
+++ b/doc/source/_templates/layout.html
@@ -45,8 +45,12 @@
<!-- <li><a href="{{ pathto('search') }}">Search</a></li> -->
{% endblock %}
-
{% block relbar1 %}
+{% if build_dev_html|tobool %}
+<div style="background-color: red; color: white; font-weight:bold; text-align: center; padding: 10px; min-width: 910px">
+This documentation is for the development version ({{ release }}) - <a href="http://martinos.org/mne/stable">Stable version</a>
+</div>
+{% endif %}
<div style="background-color: white; text-align: left; padding: 10px 7px 15px 15px; min-width: 910px">
<div style="float: left">
<a href="{{ pathto('index') }}"><img src="{{
@@ -64,5 +68,4 @@ pathto("_static/institutions.png", 1) }}" border="0" alt="py4sci"/></a>
{# put the sidebar before the body #}
{% block sidebar1 %}{{ sidebar() }}{% endblock %}
-{% block sidebar2 %}{% endblock %}
-
+{% block sidebar2 %}{% endblock %}
\ No newline at end of file
diff --git a/doc/source/_templates/sidebar.html b/doc/source/_templates/sidebar.html
new file mode 100644
index 0000000..85d65f8
--- /dev/null
+++ b/doc/source/_templates/sidebar.html
@@ -0,0 +1,5 @@
+<h3>Versions</h3>
+<ul class="current">
+ <li class="toctree-l1"><a href=http://martinos.org/mne/stable>Stable</a></li>
+ <li class="toctree-l1"><a href=http://martinos.org/mne/dev>Development</a></li>
+</ul>
\ No newline at end of file
diff --git a/doc/source/conf.py b/doc/source/conf.py
index b5c406b..3050a81 100644
--- a/doc/source/conf.py
+++ b/doc/source/conf.py
@@ -160,7 +160,8 @@ html_last_updated_fmt = '%b %d, %Y'
#html_use_smartypants = True
# Custom sidebar templates, maps document names to template names.
-#html_sidebars = {}
+html_sidebars = {'**': ['globaltoc.html', 'sourcelink.html', 'searchbox.html',
+ 'sidebar.html']}
# Additional templates that should be rendered to pages, maps page names to
# template names.
@@ -179,8 +180,10 @@ html_use_index = False
html_show_sourcelink = False
# variables to pass to HTML templating engine
+build_dev_html = bool(int(os.environ.get('BUILD_DEV_HTML', False)))
+
html_context = {'use_google_analytics':True, 'use_twitter':True,
- 'use_media_buttons':True}
+ 'use_media_buttons':True, 'build_dev_html':build_dev_html}
# If true, an OpenSearch description file will be output, and all pages will
# contain a <link> tag referring to it. The value of this option must be the
diff --git a/doc/sphinxext/gen_rst.py b/doc/sphinxext/gen_rst.py
index 7d27f84..03d5f4b 100644
--- a/doc/sphinxext/gen_rst.py
+++ b/doc/sphinxext/gen_rst.py
@@ -61,16 +61,20 @@ class Tee(object):
def get_data(url):
"""Helper function to get data over http or from a local file"""
if url.startswith('http://'):
- resp = urllib2.urlopen(url)
- encoding = resp.headers.dict.get('content-encoding', 'plain')
- data = resp.read()
- if encoding == 'plain':
- pass
- elif encoding == 'gzip':
- data = StringIO(data)
- data = gzip.GzipFile(fileobj=data).read()
- else:
- raise RuntimeError('unknown encoding')
+ try:
+ resp = urllib2.urlopen(url)
+ encoding = resp.headers.dict.get('content-encoding', 'plain')
+ data = resp.read()
+ if encoding == 'plain':
+ pass
+ elif encoding == 'gzip':
+ data = StringIO(data)
+ data = gzip.GzipFile(fileobj=data).read()
+ else:
+ raise RuntimeError('unknown encoding')
+ except urllib2.HTTPError as err:
+ print 'Error downloading %s: %s' % (url, str(err))
+ return ''
else:
with open(url, 'r') as fid:
data = fid.read()
diff --git a/doc/upload_html.sh b/doc/upload_html.sh
index e9ff7e4..ed75d88 100755
--- a/doc/upload_html.sh
+++ b/doc/upload_html.sh
@@ -1,5 +1,5 @@
#!/usr/bin/env bash
#scp -r build/html/* martinos-data:/web/html/mne/
-rsync -rltvz --delete --perms --chmod=g+w build/html/ martinos-data:/web/html/ext/mne/ -essh
-ssh martinos-data "chgrp -R megweb /web/html/ext/mne"
+rsync -rltvz --delete --perms --chmod=g+w build/html/ martinos-data:/web/html/ext/mne/stable -essh
+ssh martinos-data "chgrp -R megweb /web/html/ext/mne/stable"
diff --git a/mne/fiff/brainvision/brainvision.py b/mne/fiff/brainvision/brainvision.py
index afbe9f7..aa78d0c 100644
--- a/mne/fiff/brainvision/brainvision.py
+++ b/mne/fiff/brainvision/brainvision.py
@@ -205,16 +205,27 @@ def _read_vmrk(vmrk_fname):
stim_channel : array
An array containing the whole recording's event marking
"""
-
- with open(vmrk_fname) as f:
- # setup config reader
- assert (f.readline().strip() ==
- 'Brain Vision Data Exchange Marker File, Version 1.0')
-
- cfg = SafeConfigParser()
- cfg.readfp(f)
+ # read vmrk file
+ with open(vmrk_fname) as fid:
+ txt = fid.read()
+
+ start_tag = 'Brain Vision Data Exchange Marker File, Version 1.0'
+ if not txt.startswith(start_tag):
+ raise ValueError("vmrk file should start with %r" % start_tag)
+
+ # extract Marker Infos block
+ m = re.search("\[Marker Infos\]", txt)
+ if not m:
+ return np.zeros(0)
+ mk_txt = txt[m.end():]
+ m = re.search("\[.*\]", mk_txt)
+ if m:
+ mk_txt = mk_txt[:m.start()]
+
+ # extract event information
+ items = re.findall("^Mk\d+=(.*)", mk_txt, re.MULTILINE)
events = []
- for _, info in cfg.items('Marker Infos'):
+ for info in items:
mtype, mdesc, offset, duration = info.split(',')[:4]
if mtype == 'Stimulus':
trigger = int(re.findall('S\s?(\d+)', mdesc)[0])
diff --git a/mne/fiff/tag.py b/mne/fiff/tag.py
index fb9f4a2..c814fb1 100644
--- a/mne/fiff/tag.py
+++ b/mne/fiff/tag.py
@@ -94,11 +94,14 @@ def read_big(fid, size=None):
>>> with open(fname, 'wb') as fid: x.tofile(fid)
>>> with open(fname, 'rb') as fid: y = np.fromstring(read_big(fid))
>>> assert np.all(x == y)
- >>> with gzip.open(fname_gz, 'wb') as fid: fid.write(x.tostring())
- 24000000
- >>> with gzip.open(fname_gz, 'rb') as fid: y = np.fromstring(read_big(fid))
+ >>> fid_gz = gzip.open(fname_gz, 'wb')
+ >>> _ = fid_gz.write(x.tostring())
+ >>> fid_gz.close()
+ >>> fid_gz = gzip.open(fname_gz, 'rb')
+ >>> y = np.fromstring(read_big(fid_gz))
>>> assert np.all(x == y)
>>> shutil.rmtree(os.path.dirname(fname))
+ >>> fid_gz.close()
"""
# buf_size is chosen as a largest working power of 2 (16 MB):
diff --git a/mne/forward/forward.py b/mne/forward/forward.py
index 8ebf7f3..fd66990 100644
--- a/mne/forward/forward.py
+++ b/mne/forward/forward.py
@@ -1500,8 +1500,8 @@ def do_forward_solution(subject, meas, fname=None, src=None, spacing=None,
logger.info('Running forward solution generation command with '
'subjects_dir %s' % subjects_dir)
run_subprocess(cmd, env=env)
- except Exception as exception:
- raise exception
+ except:
+ raise
else:
fwd = read_forward_solution(op.join(path, fname), verbose=False)
finally:
diff --git a/mne/gui/_file_traits.py b/mne/gui/_file_traits.py
index 758d346..a0e9bdb 100644
--- a/mne/gui/_file_traits.py
+++ b/mne/gui/_file_traits.py
@@ -297,7 +297,7 @@ class RawSource(HasPrivateTraits):
def _get_fid_points(self):
if not self.raw:
return {}
- digs = {d['ident']: d for d in self.fid_dig}
+ digs = dict((d['ident'], d) for d in self.fid_dig)
return digs
@cached_property
diff --git a/mne/gui/tests/test_coreg_gui.py b/mne/gui/tests/test_coreg_gui.py
index 8b41ff5..2e80af1 100644
--- a/mne/gui/tests/test_coreg_gui.py
+++ b/mne/gui/tests/test_coreg_gui.py
@@ -4,11 +4,10 @@
import os
-import numpy as np
+import numpy as np
from numpy.testing import assert_allclose
from nose.tools import (assert_equal, assert_almost_equal, assert_false,
- assert_is_instance, assert_less, assert_raises,
- assert_true)
+ assert_raises, assert_true)
import mne
from mne.datasets import sample
@@ -22,8 +21,8 @@ kit_raw_path = os.path.join(kit_data_dir, 'test_bin.fif')
subjects_dir = os.path.join(data_path, 'subjects')
tempdir = _TempDir()
-
-trans_dst = os.path.join(tempdir, 'test-trans.fif')
+
+trans_dst = os.path.join(tempdir, 'test-trans.fif')
@sample.requires_sample_data
@@ -37,40 +36,40 @@ def test_coreg_model():
model.mri.subjects_dir = subjects_dir
model.mri.subject = 'sample'
-
- assert_false(model.mri.fid_ok)
- model.mri.lpa = [[-0.06, 0, 0]]
- model.mri.nasion = [[0, 0.05, 0]]
- model.mri.rpa = [[0.08, 0, 0]]
- assert_true(model.mri.fid_ok)
-
- model.hsp.file = raw_path
- assert_allclose(model.hsp.lpa, [[-7.137e-2, 0, 5.122e-9]], 1e-4)
- assert_allclose(model.hsp.rpa, [[ 7.527e-2, 0, 5.588e-9]], 1e-4)
- assert_allclose(model.hsp.nasion, [[ 3.725e-9, 1.026e-1, 4.191e-9]], 1e-4)
- assert_true(model.has_fid_data)
+
+ assert_false(model.mri.fid_ok)
+ model.mri.lpa = [[-0.06, 0, 0]]
+ model.mri.nasion = [[0, 0.05, 0]]
+ model.mri.rpa = [[0.08, 0, 0]]
+ assert_true(model.mri.fid_ok)
+
+ model.hsp.file = raw_path
+ assert_allclose(model.hsp.lpa, [[-7.137e-2, 0, 5.122e-9]], 1e-4)
+ assert_allclose(model.hsp.rpa, [[+7.527e-2, 0, 5.588e-9]], 1e-4)
+ assert_allclose(model.hsp.nasion, [[+3.725e-9, 1.026e-1, 4.191e-9]], 1e-4)
+ assert_true(model.has_fid_data)
lpa_distance = model.lpa_distance
nasion_distance = model.nasion_distance
rpa_distance = model.rpa_distance
avg_point_distance = np.mean(model.point_distance)
- model.fit_auricular_points()
- old_x = lpa_distance ** 2 + rpa_distance ** 2
+ model.fit_auricular_points()
+ old_x = lpa_distance ** 2 + rpa_distance ** 2
new_x = model.lpa_distance ** 2 + model.rpa_distance ** 2
- assert_less(new_x, old_x)
-
- model.fit_fiducials()
- old_x = lpa_distance ** 2 + rpa_distance ** 2 + nasion_distance ** 2
+ assert_true(new_x < old_x)
+
+ model.fit_fiducials()
+ old_x = lpa_distance ** 2 + rpa_distance ** 2 + nasion_distance ** 2
new_x = (model.lpa_distance ** 2 + model.rpa_distance ** 2
- + model.nasion_distance ** 2)
- assert_less(new_x, old_x)
-
- model.fit_hsp_points()
- assert_less(np.mean(model.point_distance), avg_point_distance)
-
- model.save_trans(trans_dst)
- trans = mne.read_trans(trans_dst)
+ + model.nasion_distance ** 2)
+ assert_true(new_x < old_x)
+
+ model.fit_hsp_points()
+ assert_true(np.mean(model.point_distance) < avg_point_distance)
+
+ model.save_trans(trans_dst)
+ trans = mne.read_trans(trans_dst)
assert_allclose(trans['trans'], model.head_mri_trans)
# test restoring trans
@@ -94,9 +93,9 @@ def test_coreg_model():
assert_almost_equal(model.rot_z, rot_z)
# info
- assert_is_instance(model.fid_eval_str, basestring)
- assert_is_instance(model.points_eval_str, basestring)
-
+ assert_true(isinstance(model.fid_eval_str, basestring))
+ assert_true(isinstance(model.points_eval_str, basestring))
+
@sample.requires_sample_data
@requires_traits
@@ -129,22 +128,22 @@ def test_coreg_model_with_fsaverage():
assert_equal(model.hsp.n_omitted, 1)
# scale with 1 parameter
- model.n_scale_params = 1
-
- model.fit_scale_auricular_points()
+ model.n_scale_params = 1
+
+ model.fit_scale_auricular_points()
old_x = lpa_distance ** 2 + rpa_distance ** 2
new_x = model.lpa_distance ** 2 + model.rpa_distance ** 2
- assert_less(new_x, old_x)
+ assert_true(new_x < old_x)
model.fit_scale_fiducials()
old_x = lpa_distance ** 2 + rpa_distance ** 2 + nasion_distance ** 2
new_x = (model.lpa_distance ** 2 + model.rpa_distance ** 2
+ model.nasion_distance ** 2)
- assert_less(new_x, old_x)
+ assert_true(new_x < old_x)
model.fit_scale_hsp_points()
avg_point_distance_1param = np.mean(model.point_distance)
- assert_less(avg_point_distance_1param, avg_point_distance)
+ assert_true(avg_point_distance_1param < avg_point_distance)
desc, func, args, kwargs = model.get_scaling_job('test')
assert_true(isinstance(desc, basestring))
@@ -156,7 +155,7 @@ def test_coreg_model_with_fsaverage():
# scale with 3 parameters
model.n_scale_params = 3
model.fit_scale_hsp_points()
- assert_less(np.mean(model.point_distance), avg_point_distance_1param)
+ assert_true(np.mean(model.point_distance) < avg_point_distance_1param)
# test switching raw disables point omission
assert_equal(model.hsp.n_omitted, 1)
diff --git a/mne/tests/test_epochs.py b/mne/tests/test_epochs.py
index ca7b03c..a294871 100644
--- a/mne/tests/test_epochs.py
+++ b/mne/tests/test_epochs.py
@@ -664,7 +664,7 @@ def test_epoch_eq():
epochs[key]
except KeyError:
caught += 1
- assert_raises(caught == 2)
+ assert_raises(Exception, caught == 2)
assert_true(not np.any(epochs.events[:, 2] == 1))
assert_true(not np.any(epochs.events[:, 2] == 2))
epochs = combine_event_ids(epochs, ['c', 'd'], {'cd': 34})
diff --git a/mne/tests/test_utils.py b/mne/tests/test_utils.py
index 201a6a0..080295e 100644
--- a/mne/tests/test_utils.py
+++ b/mne/tests/test_utils.py
@@ -122,14 +122,14 @@ def test_config():
del os.environ[key]
# catch the warning about it being a non-standard config key
with warnings.catch_warnings(True) as w:
- set_config(key, None)
+ set_config(key, None, home_dir=tempdir)
assert_true(len(w) == 1)
- assert_true(get_config(key) is None)
+ assert_true(get_config(key, home_dir=tempdir) is None)
assert_raises(KeyError, get_config, key, raise_error=True)
with warnings.catch_warnings(True):
- set_config(key, value)
- assert_true(get_config(key) == value)
- set_config(key, None)
+ set_config(key, value, home_dir=tempdir)
+ assert_true(get_config(key, home_dir=tempdir) == value)
+ set_config(key, None, home_dir=tempdir)
if old_val is not None:
os.environ[key] = old_val
diff --git a/mne/time_frequency/tests/test_csd.py b/mne/time_frequency/tests/test_csd.py
index 45ae9ec..ba5c574 100644
--- a/mne/time_frequency/tests/test_csd.py
+++ b/mne/time_frequency/tests/test_csd.py
@@ -1,5 +1,6 @@
import numpy as np
-from nose.tools import assert_raises, assert_equal, assert_almost_equal
+from nose.tools import (assert_raises, assert_equal, assert_almost_equal,
+ assert_true)
from numpy.testing import assert_array_equal
from os import path as op
@@ -124,8 +125,8 @@ def test_compute_epochs_csd_on_artificial_data():
data_csd_mt = compute_epochs_csd(epochs_sin, mode='multitaper')
fourier_power = np.abs(data_csd_fourier.data[0, 0]) * sfreq
mt_power = np.abs(data_csd_mt.data[0, 0]) * sfreq
- assert_almost_equal(fourier_power, signal_power, delta=0.5)
- assert_almost_equal(mt_power, signal_power, delta=1)
+ assert_true(abs(fourier_power - signal_power) <= 0.5)
+ assert_true(abs(mt_power - signal_power) <= 1)
# Power per sample should not depend on time window length
for tmax in [0.2, 0.4, 0.6, 0.8]:
@@ -139,9 +140,8 @@ def test_compute_epochs_csd_on_artificial_data():
fmax=np.inf, n_fft=n_fft)
fourier_power_per_sample = np.abs(data_csd_fourier.data[0, 0]) *\
sfreq / data_csd_fourier.n_fft
- assert_almost_equal(signal_power_per_sample,
- fourier_power_per_sample, delta=0.003)
-
+ assert_true(abs(signal_power_per_sample -
+ fourier_power_per_sample) < 0.003)
# Power per sample should not depend on number of tapers
for n_tapers in [1, 2, 3, 5]:
for add_n_fft in [30, 0, 30]:
@@ -159,5 +159,5 @@ def test_compute_epochs_csd_on_artificial_data():
delta = 0.05
else:
delta = 0.004
- assert_almost_equal(signal_power_per_sample,
- mt_power_per_sample, delta=delta)
+ assert_true(abs(signal_power_per_sample - mt_power_per_sample)
+ < delta)
diff --git a/mne/utils.py b/mne/utils.py
index b54e19d..54488cd 100644
--- a/mne/utils.py
+++ b/mne/utils.py
@@ -215,8 +215,12 @@ def run_subprocess(command, *args, **kwargs):
output = (stdout_, stderr)
if p.returncode:
- print output
- raise subprocess.CalledProcessError(p.returncode, command, output)
+ print(output)
+ err_fun = subprocess.CalledProcessError.__init__
+ if 'output' in inspect.getargspec(err_fun).args:
+ raise subprocess.CalledProcessError(p.returncode, command, output)
+ else:
+ raise subprocess.CalledProcessError(p.returncode, command)
return output
@@ -704,9 +708,15 @@ def get_subjects_dir(subjects_dir=None, raise_error=False):
return subjects_dir
-def get_config_path():
+def get_config_path(home_dir=None):
"""Get path to standard mne-python config file
+ Parameters
+ ----------
+ home_dir : str | None
+ The folder that contains the .mne config folder.
+ If None, it is found automatically.
+
Returns
-------
config_path : str
@@ -714,16 +724,17 @@ def get_config_path():
will be '%APPDATA%\.mne\mne-python.json'. On every other
system, this will be $HOME/.mne/mne-python.json.
"""
+ if home_dir is None:
+ # this has been checked on OSX64, Linux64, and Win32
+ home_dir = os.getenv('APPDATA' if 'nt' == os.name.lower() else 'HOME',
+ None)
- # this has been checked on OSX64, Linux64, and Win32
- val = os.getenv('APPDATA' if 'nt' == os.name.lower() else 'HOME', None)
- if val is None:
+ if home_dir is None:
raise ValueError('mne-python config file path could '
'not be determined, please report this '
'error to mne-python developers')
- val = op.join(val, '.mne', 'mne-python.json')
- return val
+ return op.join(home_dir, '.mne', 'mne-python.json')
def set_cache_dir(cache_dir):
@@ -787,7 +798,7 @@ known_config_wildcards = [
]
-def get_config(key, default=None, raise_error=False):
+def get_config(key, default=None, raise_error=False, home_dir=None):
"""Read mne(-python) preference from env, then mne-python config
Parameters
@@ -800,6 +811,9 @@ def get_config(key, default=None, raise_error=False):
raise_error : bool
If True, raise an error if the key is not found (instead of returning
default).
+ home_dir : str | None
+ The folder that contains the .mne config folder.
+ If None, it is found automatically.
Returns
-------
@@ -815,7 +829,7 @@ def get_config(key, default=None, raise_error=False):
return os.environ[key]
# second, look for it in mne-python config file
- config_path = get_config_path()
+ config_path = get_config_path(home_dir=home_dir)
if not op.isfile(config_path):
key_found = False
val = default
@@ -838,7 +852,7 @@ def get_config(key, default=None, raise_error=False):
return val
-def set_config(key, value):
+def set_config(key, value, home_dir=None):
"""Set mne-python preference in config
Parameters
@@ -848,8 +862,10 @@ def set_config(key, value):
value : str | None
The value to assign to the preference key. If None, the key is
deleted.
+ home_dir : str | None
+ The folder that contains the .mne config folder.
+ If None, it is found automatically.
"""
-
if not isinstance(key, basestring):
raise ValueError('key must be a string')
# While JSON allow non-string types, we allow users to override config
@@ -861,7 +877,7 @@ def set_config(key, value):
warnings.warn('Setting non-standard config type: "%s"' % key)
# Read all previous values
- config_path = get_config_path()
+ config_path = get_config_path(home_dir=home_dir)
if op.isfile(config_path):
with open(config_path, 'r') as fid:
config = json.load(fid)
@@ -921,7 +937,7 @@ class ProgressBar(object):
"""
spinner_symbols = ['|', '/', '-', '\\']
- template = '\r[{}{}] {:.05f} {} {} '
+ template = '\r[{0}{1}] {2:.05f} {3} {4} '
def __init__(self, max_value, initial_value=0, mesg='', max_chars=40,
progress_character='.', spinner=False):
@@ -1162,7 +1178,7 @@ def sizeof_fmt(num):
exponent = min(int(log(num, 1024)), len(unit_list) - 1)
quotient = float(num) / 1024 ** exponent
unit, num_decimals = unit_list[exponent]
- format_string = '{:.%sf} {}' % (num_decimals)
+ format_string = '{0:.%sf} {1}' % (num_decimals)
return format_string.format(quotient, unit)
if num == 0:
return '0 bytes'
--
Alioth's /git/debian-med/git-commit-notice on /srv/git.debian.org/git/debian-med/python-mne.git
More information about the debian-med-commit
mailing list