Skip to content

Commit 2018e04

Browse files
committed
Merge branch 'rm-3.4' of https://github.com/hugovk/python-neo into hugovk-rm-3.4
# Conflicts: # doc/source/developers_guide.rst # neo/test/coretest/test_analogsignalarray.py
2 parents 495f8a7 + 81b676c commit 2018e04

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+215
-215
lines changed

.travis.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
language: python
22
python:
33
- "2.7"
4-
- "3.4"
54
- "3.5"
65
- "3.6"
76

doc/source/developers_guide.rst

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ Developers' guide
33
=================
44

55
These instructions are for developing on a Unix-like platform, e.g. Linux or
6-
Mac OS X, with the bash shell. If you develop on Windows, please get in touch.
6+
macOS, with the bash shell. If you develop on Windows, please get in touch.
77

88

99
Mailing lists
@@ -38,7 +38,7 @@ a GitHub account and then set to watch the repository at `GitHub Repository`_
3838
Requirements
3939
------------
4040

41-
* Python_ 2.7, 3.4 or later
41+
* Python_ 2.7, 3.5 or later
4242
* numpy_ >= 1.10.0
4343
* quantities_ >= 0.12.1
4444
* nose_ >= 1.1.2 (for running tests)
@@ -64,7 +64,7 @@ To get a local copy of the repository::
6464

6565
$ cd /some/directory
6666
$ git clone [email protected]:<username>/python-neo.git
67-
67+
6868
Now you need to make sure that the ``neo`` package is on your PYTHONPATH.
6969
You can do this either by installing Neo::
7070

@@ -200,7 +200,7 @@ open a pull request on GitHub
200200
Python version
201201
--------------
202202

203-
Neo core should work with both Python 2.7 and Python 3 (version 3.4 or newer).
203+
Neo core should work with both Python 2.7 and Python 3 (version 3.5 or newer).
204204
Neo IO modules should ideally work with both Python 2 and 3, but certain
205205
modules may only work with one or the other (see :doc:`install`).
206206

@@ -223,7 +223,7 @@ Coding standards and style
223223
--------------------------
224224

225225
All code should conform as much as possible to `PEP 8`_, and should run with
226-
Python 2.7, and 3.4 or newer.
226+
Python 2.7, and 3.5 or newer.
227227

228228
You can use the `pep8`_ program to check the code for PEP 8 conformity.
229229
You can also use `flake8`_, which combines pep8 and pyflakes.
@@ -264,7 +264,7 @@ Michael Denker and Julia Sprenger have the necessary permissions to do this)::
264264

265265
.. talk about readthedocs
266266
267-
267+
268268
269269
.. make a release branch
270270
@@ -279,7 +279,6 @@ See :ref:`io_dev_guide` for implementation of a new IO.
279279

280280
.. _Python: http://www.python.org
281281
.. _nose: http://somethingaboutorange.com/mrl/projects/nose/
282-
.. _unittest2: http://pypi.python.org/pypi/unittest2
283282
.. _Setuptools: https://pypi.python.org/pypi/setuptools/
284283
.. _tox: http://codespeak.net/tox/
285284
.. _coverage: http://nedbatchelder.com/code/coverage/

neo/core/analogsignal.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -440,8 +440,8 @@ def _pp(line):
440440
with pp.group(indent=1):
441441
pp.text(line)
442442

443-
for line in ["sampling rate: {0}".format(self.sampling_rate),
444-
"time: {0} to {1}".format(self.t_start, self.t_stop)]:
443+
for line in ["sampling rate: {}".format(self.sampling_rate),
444+
"time: {} to {}".format(self.t_start, self.t_stop)]:
445445
_pp(line)
446446

447447
def time_index(self, t):

neo/core/baseneo.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ def merge_annotation(a, b):
7272
For strings: concatenate with ';'
7373
Otherwise: fail if the annotations are not equal
7474
"""
75-
assert type(a) == type(b), 'type(%s) %s != type(%s) %s' % (a, type(a),
75+
assert type(a) == type(b), 'type({}) {} != type({}) {}'.format(a, type(a),
7676
b, type(b))
7777
if isinstance(a, dict):
7878
return merge_annotations(a, b)
@@ -86,7 +86,7 @@ def merge_annotation(a, b):
8686
else:
8787
return a + ";" + b
8888
else:
89-
assert a == b, '%s != %s' % (a, b)
89+
assert a == b, '{} != {}'.format(a, b)
9090
return a
9191

9292

@@ -308,7 +308,7 @@ def _repr_pretty_attrs_(self, pp, cycle):
308308
else:
309309
pp.breakable()
310310
with pp.group(indent=1):
311-
pp.text("{0}: ".format(key))
311+
pp.text("{}: ".format(key))
312312
pp.pretty(value)
313313

314314
def _repr_pretty_(self, pp, cycle):

neo/core/basesignal.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,7 @@ def merge(self, other):
264264
if attr_self == attr_other:
265265
kwargs[name] = attr_self
266266
else:
267-
kwargs[name] = "merge(%s, %s)" % (attr_self, attr_other)
267+
kwargs[name] = "merge({}, {})".format(attr_self, attr_other)
268268
merged_annotations = merge_annotations(self.annotations, other.annotations)
269269
kwargs.update(merged_annotations)
270270

neo/core/channelindex.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,12 @@ class ChannelIndex(Container):
2222
2323
This container has several purposes:
2424
25-
* Grouping all :class:`AnalogSignal`\s and
26-
:class:`IrregularlySampledSignal`\s inside a :class:`Block` across
27-
:class:`Segment`\s;
25+
* Grouping all :class:`AnalogSignal`\\s and
26+
:class:`IrregularlySampledSignal`\\s inside a :class:`Block` across
27+
:class:`Segment`\\s;
2828
* Indexing a subset of the channels within an :class:`AnalogSignal` and
29-
:class:`IrregularlySampledSignal`\s;
30-
* Container of :class:`Unit`\s. Discharges of multiple neurons
29+
:class:`IrregularlySampledSignal`\\s;
30+
* Container of :class:`Unit`\\s. Discharges of multiple neurons
3131
(:class:`Unit`\'s) can be seen on the same channel.
3232
3333
*Usage 1* providing channel IDs across multiple :class:`Segment`::

neo/core/container.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -374,8 +374,8 @@ def size(self):
374374
Get dictionary containing the names of child containers in the current
375375
object as keys and the number of children of that type as values.
376376
"""
377-
return dict((name, len(getattr(self, name)))
378-
for name in self._child_containers)
377+
return {name: len(getattr(self, name))
378+
for name in self._child_containers}
379379

380380
def filter(self, targdict=None, data=True, container=False, recursive=True,
381381
objects=None, **kwargs):
@@ -569,7 +569,7 @@ def merge(self, other):
569569
# merge containers with the same name
570570
for container in (self._container_child_containers +
571571
self._multi_child_containers):
572-
lookup = dict((obj.name, obj) for obj in getattr(self, container))
572+
lookup = {obj.name: obj for obj in getattr(self, container)}
573573
ids = [id(obj) for obj in getattr(self, container)]
574574
for obj in getattr(other, container):
575575
if id(obj) in ids:
@@ -584,7 +584,7 @@ def merge(self, other):
584584
# for data objects, ignore the name and just add them
585585
for container in self._data_child_containers:
586586
objs = getattr(self, container)
587-
lookup = dict((obj.name, i) for i, obj in enumerate(objs))
587+
lookup = {obj.name: i for i, obj in enumerate(objs)}
588588
ids = [id(obj) for obj in objs]
589589
for obj in getattr(other, container):
590590
if id(obj) in ids:
@@ -617,7 +617,7 @@ def _repr_pretty_(self, pp, cycle):
617617
for container in self._child_containers:
618618
objs = getattr(self, container)
619619
if objs:
620-
vals.append('%s %s' % (len(objs), container))
620+
vals.append('{} {}'.format(len(objs), container))
621621
pp.text(', '.join(vals))
622622

623623
if self._has_repr_pretty_attrs_():
@@ -627,7 +627,7 @@ def _repr_pretty_(self, pp, cycle):
627627
for container in self._repr_pretty_containers:
628628
pp.breakable()
629629
objs = getattr(self, container)
630-
pp.text("# %s (N=%s)" % (container, len(objs)))
630+
pp.text("# {} (N={})".format(container, len(objs)))
631631
for (i, obj) in enumerate(objs):
632632
pp.breakable()
633633
pp.text("%s: " % i)

neo/core/epoch.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,7 @@ def merge(self, other):
248248
if attr_self == attr_other:
249249
kwargs[name] = attr_self
250250
else:
251-
kwargs[name] = "merge(%s, %s)" % (attr_self, attr_other)
251+
kwargs[name] = "merge({}, {})".format(attr_self, attr_other)
252252

253253
merged_annotations = merge_annotations(self.annotations, other.annotations)
254254
kwargs.update(merged_annotations)

neo/core/event.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ def __new__(cls, times=None, labels=None, units=None, name=None, description=Non
106106
# reference dimensionality
107107
if (len(dim) != 1 or list(dim.values())[0] != 1 or not isinstance(list(dim.keys())[0],
108108
pq.UnitTime)):
109-
ValueError("Unit %s has dimensions %s, not [time]" % (units, dim.simplified))
109+
ValueError("Unit {} has dimensions {}, not [time]".format(units, dim.simplified))
110110

111111
obj = pq.Quantity(times, units=dim).view(cls)
112112
obj._labels = labels
@@ -192,7 +192,7 @@ def merge(self, other):
192192
if attr_self == attr_other:
193193
kwargs[name] = attr_self
194194
else:
195-
kwargs[name] = "merge(%s, %s)" % (attr_self, attr_other)
195+
kwargs[name] = "merge({}, {})".format(attr_self, attr_other)
196196

197197
print('Event: merge annotations')
198198
merged_annotations = merge_annotations(self.annotations, other.annotations)

neo/core/irregularlysampledsignal.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ def __repr__(self):
191191
'''
192192
Returns a string representing the :class:`IrregularlySampledSignal`.
193193
'''
194-
return '<%s(%s at times %s)>' % (
194+
return '<{}({} at times {})>'.format(
195195
self.__class__.__name__, super(IrregularlySampledSignal, self).__repr__(), self.times)
196196

197197
def __getitem__(self, i):
@@ -285,15 +285,16 @@ def _check_consistency(self, other):
285285
return
286286
# dimensionality should match
287287
if self.ndim != other.ndim:
288-
raise ValueError('Dimensionality does not match: %s vs %s' % (self.ndim, other.ndim))
288+
raise ValueError('Dimensionality does not match: {} vs {}'.format(
289+
self.ndim, other.ndim))
289290
# if if the other array does not have a times property,
290291
# then it should be okay to add it directly
291292
if not hasattr(other, 'times'):
292293
return
293294

294295
# if there is a times property, the times need to be the same
295296
if not (self.times == other.times).all():
296-
raise ValueError('Times do not match: %s vs %s' % (self.times, other.times))
297+
raise ValueError('Times do not match: {} vs {}'.format(self.times, other.times))
297298

298299
def __rsub__(self, other, *args):
299300
'''
@@ -320,7 +321,7 @@ def _pp(line):
320321
with pp.group(indent=1):
321322
pp.text(line)
322323

323-
for line in ["sample times: {0}".format(self.times)]:
324+
for line in ["sample times: {}".format(self.times)]:
324325
_pp(line)
325326

326327
@property
@@ -453,7 +454,7 @@ def merge(self, other):
453454
if attr_self == attr_other:
454455
kwargs[name] = attr_self
455456
else:
456-
kwargs[name] = "merge(%s, %s)" % (attr_self, attr_other)
457+
kwargs[name] = "merge({}, {})".format(attr_self, attr_other)
457458
merged_annotations = merge_annotations(self.annotations, other.annotations)
458459
kwargs.update(merged_annotations)
459460

0 commit comments

Comments
 (0)