diff --git a/neo/core/epoch.py b/neo/core/epoch.py index 88e22c587..419ade1c1 100644 --- a/neo/core/epoch.py +++ b/neo/core/epoch.py @@ -170,7 +170,14 @@ def __repr__(self): return '' % ', '.join(objs) def _repr_pretty_(self, pp, cycle): - super()._repr_pretty_(pp, cycle) + labels = "" + if self._labels is not None: + labels = " with labels" + pp.text(f"{self.__class__.__name__} containing {self.size} epochs{labels}; " + f"time units {self.units.dimensionality.string}; datatype {self.dtype} ") + if self._has_repr_pretty_attrs_(): + pp.breakable() + self._repr_pretty_attrs_(pp, cycle) def rescale(self, units): ''' diff --git a/neo/core/event.py b/neo/core/event.py index dcbe026e0..f6ff1cd00 100644 --- a/neo/core/event.py +++ b/neo/core/event.py @@ -148,7 +148,14 @@ def __repr__(self): return '' % ', '.join(objs) def _repr_pretty_(self, pp, cycle): - super()._repr_pretty_(pp, cycle) + labels = "" + if self._labels is not None: + labels = " with labels" + pp.text(f"{self.__class__.__name__} containing {self.size} events{labels}; " + f"time units {self.units.dimensionality.string}; datatype {self.dtype} ") + if self._has_repr_pretty_attrs_(): + pp.breakable() + self._repr_pretty_attrs_(pp, cycle) def rescale(self, units): ''' diff --git a/neo/core/spiketrain.py b/neo/core/spiketrain.py index 0b2ef566d..251531c13 100644 --- a/neo/core/spiketrain.py +++ b/neo/core/spiketrain.py @@ -346,7 +346,21 @@ def __init__(self, times, t_stop, units=None, dtype=None, copy=True, array_annotations=array_annotations, **annotations) def _repr_pretty_(self, pp, cycle): - super()._repr_pretty_(pp, cycle) + waveforms = "" + if self.waveforms: + waveforms = "with waveforms" + pp.text(f"{self.__class__.__name__} containing {self.size} spikes{waveforms}; " + f"units {self.units.dimensionality.string}; datatype {self.dtype} ") + if self._has_repr_pretty_attrs_(): + pp.breakable() + self._repr_pretty_attrs_(pp, cycle) + + def _pp(line): + pp.breakable() + with pp.group(indent=1): + pp.text(line) + + _pp(f"time: {self.t_start} to {self.t_stop}") def rescale(self, units): '''