Skip to content

Commit 126bec5

Browse files
committed
Modify a check that prevented Segment from being subclasses (see #1725)
1 parent 873dcb5 commit 126bec5

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

neo/core/spiketrainlist.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,8 +113,10 @@ def __init__(self, items=None, parent=None):
113113
self._channel_id_array = None
114114
self._all_channel_ids = None
115115
self._spiketrain_metadata = {}
116-
if parent is not None and parent.__class__.__name__ != "Segment":
117-
raise AttributeError("The parent class must be a Segment")
116+
117+
from .segment import Segment # import here rather than at the top to avoid circular import
118+
if parent is not None and not isinstance(parent, Segment):
119+
raise AttributeError("If provided, the parent class must be a Segment")
118120
self.segment = parent
119121

120122
@property

0 commit comments

Comments
 (0)