Skip to content

Commit 800525a

Browse files
authored
Merge pull request #1468 from NeuralEnsemble/black-formatting
Black formatting
2 parents f96c340 + 3a3cfe3 commit 800525a

21 files changed

+76
-54
lines changed

neo/core/baseneo.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
class MergeError(Exception):
3535
pass
3636

37+
3738
class NeoReadWriteError(IOError):
3839
"""
3940
This is the main neo-specific error that has to deal with
@@ -46,13 +47,14 @@ class NeoReadWriteError(IOError):
4647
* Different sampling rates among streams
4748
* Different expectations for a file format (could also be
4849
a NotImplementedError depending on circumstances)
49-
50+
5051
It should NOT be used when other errors more accurately describe
5152
the problem:
5253
1) ValueError: for incorrect values (like t_start, t_stop)
5354
2) TypeError: use of an inappropriate type for an argument
5455
3) FileNotFoundError: for use when a file is not found
5556
"""
57+
5658
pass
5759

5860

neo/core/dataobject.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ def array_annotate(self, **array_annotations):
193193
----------
194194
**array_annotations: dict
195195
Series of keyword annotations to add to the object
196-
196+
197197
Examples
198198
--------
199199
>>> obj.array_annotate(code=['a', 'b', 'a'], category=[2, 1, 1])
@@ -211,7 +211,7 @@ def array_annotations_at_index(self, index):
211211
----------
212212
index: int | list | np.ndarray
213213
The index (indices) from which the annotations are extracted
214-
214+
215215
Returns
216216
-------
217217
index_annotations: dict
@@ -252,12 +252,12 @@ def _merge_array_annotations(self, other):
252252
----------
253253
other: any
254254
The annotation to attemp to merge
255-
255+
256256
Returns
257257
-------
258258
merged_array_annotations: dict
259259
The merged annotations
260-
260+
261261
Notes
262262
-----
263263
The merge happens in such a way that the result fits the merged data
@@ -312,12 +312,12 @@ def rescale(self, units, dtype=None):
312312
The units to convert the object to
313313
dtype: a numpy dtype
314314
Only exists for backward compatibility see [1]
315-
315+
316316
Returns
317317
-------
318318
self.copy(): Any
319319
A copy of the object with the desired units
320-
320+
321321
Notes
322322
-----
323323
[1] The `dtype` argument exists only for backward compatibility within quantities, see
@@ -358,7 +358,7 @@ def as_array(self, units=None):
358358
----------
359359
units: quantities units | None, default: None
360360
The data return as a np.ndarray with units requested
361-
361+
362362
Returns
363363
-------
364364
data_array: np.ndarray
@@ -430,7 +430,7 @@ def __deepcopy__(self, memo):
430430
return new_obj
431431

432432

433-
class ArrayDict(dict):
433+
class ArrayDict(dict):
434434
"""Dictionary subclass to handle array annotations
435435
436436
When setting `obj.array_annotations[key]=value`, checks for consistency

neo/core/event.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,7 @@ def merge(self, other):
262262
---------
263263
other: neo.core.Event
264264
The `Event` to merge into this one
265-
265+
266266
Notes
267267
-----
268268
* The :class:`Event` objects are concatenated horizontally

neo/core/filters.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ def __init__(self, control: Any) -> None:
4141
4242
Parameters
4343
----------
44-
control: Any
44+
control: Any
4545
The control value to be used for filtering.
4646
4747
Notes

neo/core/irregularlysampledsignal.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ class IrregularlySampledSignal(BaseSignal):
110110
array_annotations: dict | None, default: None
111111
Dict mapping strings to numpy arrays containing annotations for all data points
112112
**annotations: dict
113-
Optional additional metadata supplied by the user as a dict. Will be stored in
113+
Optional additional metadata supplied by the user as a dict. Will be stored in
114114
the annotations attribute of the object
115115
116116
Notes
@@ -354,7 +354,7 @@ def _check_consistency(self, other) -> None:
354354
ValueError
355355
* Dimensionality of objects don't match for signal
356356
* If times are different between the two objects
357-
357+
358358
Returns
359359
-------
360360
None if check passes
@@ -488,8 +488,8 @@ def resample(self, sample_count, **kwargs):
488488
def time_slice(self, t_start, t_stop):
489489
"""
490490
Creates a new :class:`IrregularlySampledSignal` corresponding to the time slice of
491-
the original :class:`IrregularlySampledSignal`
492-
491+
the original :class:`IrregularlySampledSignal`
492+
493493
Parameters
494494
----------
495495
t_start: float | None

neo/core/spiketrain.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ def _check_time_in_range(value, t_start, t_stop, view=False) -> None:
7474
* If t_stop < t_start
7575
* value.min() < t_start
7676
* value.max() > t_start
77-
77+
7878
Returns
7979
-------
8080
None: If check passes
@@ -106,7 +106,7 @@ def _check_waveform_dimensions(spiketrain) -> None:
106106
----------
107107
spiketrain: neo.core.SpikeTrain
108108
The neo.core.SpikeTrain to check for waveforms
109-
109+
110110
Raises
111111
------
112112
ValueError
@@ -238,10 +238,10 @@ class SpikeTrain(DataObject):
238238
----------
239239
times: quantity array 1D | numpy array 1D | list
240240
The times of each spike.
241-
t_stop: quantity scalar | numpy scalar |float
241+
t_stop: quantity scalar | numpy scalar |float
242242
Time at which the SpikeTrain ended. This will be converted to thesame units as `times`.
243243
This argument is required because it specifies the period of time over which spikes could have occurred.
244-
Note that :attr:`t_start` is highly recommended for the same reason.
244+
Note that :attr:`t_start` is highly recommended for the same reason.
245245
units: (quantity units) | None, default: None
246246
Required if `times` is a list or numpy.ndarray`
247247
Not required if times is a quantities.Quantity
@@ -266,7 +266,7 @@ class SpikeTrain(DataObject):
266266
A text description of this dataset
267267
file_origin: str | Filesystem path | URL | None, default: None
268268
The path or location of the original data file.
269-
array_annotations: dict
269+
array_annotations: dict
270270
A dictonary mapping of strings to numpy arrays containing annotations for all data points
271271
**annotations: dict
272272
Other user defined metadata given as a dict
@@ -279,7 +279,7 @@ class SpikeTrain(DataObject):
279279
Interval between two samples (1/`sampling_rate`)
280280
* duration: quantity scalar
281281
Duration over which spikes can occur read-only (`t_stop` - `t_start`)
282-
* spike_duration: quantity scalar
282+
* spike_duration: quantity scalar
283283
Duration of a waveform, read-only (`waveform`.shape[2] * `sampling_period`)
284284
* right_sweep: quantity scalar
285285
Time from the trigger times of the spikes to the end of the waveforms, read-only
@@ -293,7 +293,7 @@ class SpikeTrain(DataObject):
293293
metadata, except that :attr:`waveforms` is also sliced in the same way
294294
(along dimension 0). Note that t_start and t_stop are not changed
295295
automatically, although you can still manually change them.
296-
296+
297297
Examples
298298
--------
299299
@@ -311,7 +311,7 @@ class SpikeTrain(DataObject):
311311
<SpikeTrain(array([ 3., 4., 5.]) * s, [0.0 s, 10.0 s])>
312312
>>> train2
313313
<SpikeTrain(array([ 4., 5.]) * s, [0.0 s, 10.0 s])>
314-
314+
315315
"""
316316

317317
_parent_objects = ("Segment",)

neo/core/spiketrainlist.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ def unique(quantities):
2424
Parameters
2525
----------
2626
quantities: array-like[pq.Quantity dtype]
27-
An array-like object containing quantities
27+
An array-like object containing quantities
2828
2929
Returns
3030
-------
@@ -257,7 +257,7 @@ def __radd__(self, other):
257257
def append(self, obj):
258258
"""
259259
Appends to the SpikeTrainList with a new neo.core.SpikeTrain
260-
260+
261261
Parameters
262262
----------
263263
obj: neo.core.SpikeTrain
@@ -281,12 +281,12 @@ def append(self, obj):
281281

282282
def extend(self, iterable):
283283
"""Extends the SpikeTrainList with additional SpikeTrain's from an iterable
284-
284+
285285
Parameters
286286
----------
287287
iterable: iterable[neo.core.SpikeTrain]
288288
A list-like or array-like object containing neo.core.SpikeTrain to be added to the SpikeTrainList
289-
289+
290290
Examples
291291
--------
292292
# with SpikeTrainList stl with two SpikeTrains and stl_other with three SpikeTrains

neo/core/view.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ class ChannelView(BaseNeo):
3030
Filesystem path or URL of the original data file.
3131
array_annotations: dict | None, default: None
3232
Dict mapping strings to numpy arrays containing annotations for all data points
33-
**annotations: dict
33+
**annotations: dict
3434
Other use-specified metadata with keywords
3535
"""
3636

neo/io/basefromrawio.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,9 @@ def read_segment(
244244
if time_slice is not None:
245245
raise ValueError("For lazy=True you must specify a time_slice when LazyObject.load(time_slice=...)")
246246
if load_waveforms:
247-
raise ValueError("For lazy=True you must specify load_waveforms when SpikeTrain.load(load_waveforms=...)")
247+
raise ValueError(
248+
"For lazy=True you must specify load_waveforms when SpikeTrain.load(load_waveforms=...)"
249+
)
248250

249251
if signal_group_mode is None:
250252
signal_group_mode = self._prefered_signal_group_mode

neo/io/baseio.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
RectangularRegionOfInterest,
3636
CircularRegionOfInterest,
3737
PolygonRegionOfInterest,
38-
NeoReadWriteError
38+
NeoReadWriteError,
3939
)
4040

4141
read_error = "This type is not supported by this file format for reading"
@@ -175,8 +175,10 @@ def write(self, bl, **kargs):
175175
self.write_block(bl, **kargs)
176176
elif Segment in self.writeable_objects:
177177
if len(bl.segments) != 1:
178-
raise NeoReadWriteError(f"{self.__class__.__name__} is based on segment so if you try to write a block it "
179-
+ "must contain only one Segment")
178+
raise NeoReadWriteError(
179+
f"{self.__class__.__name__} is based on segment so if you try to write a block it "
180+
+ "must contain only one Segment"
181+
)
180182
self.write_segment(bl.segments[0], **kargs)
181183
else:
182184
raise NotImplementedError

0 commit comments

Comments
 (0)