- # Validate that the presence or lack of presence of a
- # `default_clock_snapshot` value is valid in the context of `stream_class`.
- @staticmethod
- def _validate_default_clock_snapshot(stream_class, default_clock_snapshot):
- stream_class_has_default_clock_class = stream_class.default_clock_class is not None
-
- if stream_class_has_default_clock_class and default_clock_snapshot is None:
- raise bt2.Error(
- 'stream class has a default clock class, default_clock_snapshot should not be None')
+ @property
+ def _bt_can_seek_beginning_from_native(self):
+ # Here, we mimic the behavior of the C API:
+ #
+ # - If the iterator has a _can_seek_beginning attribute, read it and use
+ # that result.
+ # - Otherwise, the presence or absence of a `_seek_beginning`
+ # method indicates whether the iterator can seek beginning.
+ if hasattr(self, '_can_seek_beginning'):
+ can_seek_beginning = self._can_seek_beginning
+ utils._check_bool(can_seek_beginning)
+ return can_seek_beginning
+ else:
+ return hasattr(self, '_seek_beginning')