Skip to content

Commit 51b7a67

Browse files
committed
flake fixes
1 parent a446135 commit 51b7a67

4 files changed

Lines changed: 12 additions & 9 deletions

File tree

mffpy/header_block/header_block.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ def encode_rate_depth(rate: int, depth: int) -> int:
142142
assert depth < (
143143
1 << 8), f"depth must be smaller than 256 (got {depth})"
144144
assert rate < (
145-
1 << 24), f"depth must be smaller than {1<<24} (got {rate})"
145+
1 << 24), f"depth must be smaller than {1 << 24} (got {rate})"
146146
return (rate << 8) + depth
147147

148148
@staticmethod

mffpy/reader.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,7 @@ def get_physical_samples(self, t0: float = 0.0, dt: Optional[float] = None,
250250
channels: Optional[List[str]] = None,
251251
block_slice: Optional[slice] = None
252252
) -> Dict[str, Tuple[np.ndarray, float]]:
253-
"""return signal data in the range `(t0, t0+dt)` in seconds from `channels`
253+
"""return signal data in range `(t0, t0+dt)` seconds from `channels`
254254
255255
Use `get_physical_samples_from_epoch` instead."""
256256
if channels is None:

mffpy/tests/test_xml_files.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ def test_from_file(lxml_only):
139139
filepath = join(examples_path, 'example_5.mff', 'categories.xml')
140140
assert exists(filepath), f"Not found: '{filepath}'"
141141
output = XML.from_file(filepath)
142-
assert type(output) == type(XML)._tag_registry['categories']
142+
assert isinstance(output, type(XML)._tag_registry['categories'])
143143
expected_names = ['Category A_', 'Category B_', 'Category C_']
144144
category_names = sorted(output.categories.keys())
145145
assert category_names == expected_names
@@ -446,7 +446,7 @@ def test_EventTrack_to_xml():
446446
xml_stream.seek(0)
447447
# read the .xml and test content
448448
output = XML.from_file(xml_stream)
449-
assert type(output) == type(XML)._tag_registry['eventTrack']
449+
assert isinstance(output, type(XML)._tag_registry['eventTrack'])
450450
assert output.name == name
451451
assert output.trackType == trackType
452452
assert len(output.events) == len(events)
@@ -550,7 +550,7 @@ def test_Categories_to_xml(channel_status):
550550
xml_stream.seek(0)
551551
# read the .xml and test content
552552
output = XML.from_file(xml_stream)
553-
assert type(output) == type(XML)._tag_registry['categories']
553+
assert isinstance(output, type(XML)._tag_registry['categories'])
554554
categories = output.categories
555555
for name, category in categories.items():
556556
expected_category = expected_categories[name]
@@ -664,7 +664,7 @@ def test_history_to_xml():
664664
xml_declaration=True, method='xml')
665665
xml_stream.seek(0)
666666
output = XML.from_file(xml_stream)
667-
assert type(output) == type(XML)._tag_registry['historyEntries']
667+
assert isinstance(output, type(XML)._tag_registry['historyEntries'])
668668
assert len(output) == len(entries)
669669
for entry, expected in zip(entries, output.entries):
670670
assert entry == expected

mffpy/xml_files.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,8 @@ def set_backend(backend: str) -> None:
4141
"backend. Install it with: pip install defusedxml"
4242
)
4343
_xml_backend = backend
44+
45+
4446
"""
4547
Copyright 2019 Brain Electrophysiology Laboratory Company LLC
4648
@@ -1325,9 +1327,10 @@ def dipoles(self) -> Dict[str, np.ndarray]:
13251327

13261328
# check that all dipole attributes have same lengths and 3 components
13271329
shp = (len(dipole_tags), 3)
1328-
assert all(v.shape == shp for v in d_arrays.values()), f"""
1329-
Parsing dipoles result in broken shape. Found {[(k, v.shape) for k, v
1330-
in d_arrays.items()]}"""
1330+
shapes = [(k, v.shape) for k, v in d_arrays.items()]
1331+
assert all(v.shape == shp for v in d_arrays.values()), (
1332+
f"Parsing dipoles result in broken shape. Found {shapes}"
1333+
)
13311334
return d_arrays
13321335

13331336
def get_content(self):

0 commit comments

Comments
 (0)