hyperstream.stream package¶
Submodules¶
hyperstream.stream.stream module¶
-
class
hyperstream.stream.stream.AssetStream(channel, stream_id, calculated_intervals, last_accessed, last_updated, sandbox, commit=True)[source]¶ Bases:
hyperstream.stream.stream.DatabaseStreamSimple subclass that overrides the calculated intervals property
-
calculated_intervals¶
-
-
class
hyperstream.stream.stream.DatabaseStream(channel, stream_id, calculated_intervals, last_accessed, last_updated, sandbox, commit=True)[source]¶ Bases:
hyperstream.stream.stream.StreamSimple subclass that overrides the calculated intervals property
-
calculated_intervals¶ Gets the calculated intervals from the database :return: The calculated intervals
-
last_accessed¶ Gets the last accessed time from the database :return: The last accessed time
-
last_updated¶ Gets the last updated time from the database :return: The last updated time
-
-
class
hyperstream.stream.stream.Stream(channel, stream_id, calculated_intervals, sandbox)[source]¶ Bases:
hyperstream.utils.utils.HashableStream reference class
-
calculated_intervals¶ Get the calculated intervals This will be read from the stream_status collection if it’s in the database channel :return: The calculated intervals
-
parent_node¶
-
window(time_interval=None, force_calculation=False)[source]¶ Gets a view on this stream for the time interval given :param time_interval: either a TimeInterval object or (start, end) tuple of type str or datetime :param force_calculation: Whether we should force calculation for this stream view if data does not exist :type time_interval: None | Iterable | TimeInterval :type force_calculation: bool :return: a stream view object
-
writer¶
-
hyperstream.stream.stream_collections module¶
-
class
hyperstream.stream.stream_collections.StreamDict(*args, **kwargs)[source]¶ Bases:
hyperstream.utils.utils.TypedBiDictCustom bi-directional dictionary where keys are StreamID objects and values are Stream objects. Raises ValueDuplicationError if the same Stream is added again
hyperstream.stream.stream_id module¶
-
class
hyperstream.stream.stream_id.StreamId(name, meta_data=None)[source]¶ Bases:
hyperstream.utils.utils.HashableHelper class for stream identifiers. A stream identifier contains the stream name and any meta-data
-
as_raw()[source]¶ Return a representation of this object that can be used with mongoengine Document.objects(__raw__=x) Example:
>>> stream_id = StreamId(name='test', meta_data=((u'house', u'1'), (u'resident', u'1'))) >>> stream_id.as_raw() {'stream_id.meta_data': [(u'house', u'1'), (u'resident', u'1')], 'stream_id.name': 'test'}
Returns: The raw representation of this object.
-
hyperstream.stream.stream_instance module¶
-
class
hyperstream.stream.stream_instance.StreamInstance[source]¶ Bases:
hyperstream.stream.stream_instance.StreamInstanceSimple helper class for storing data instances that’s a bit neater than simple tuples
-
class
hyperstream.stream.stream_instance.StreamMetaInstance[source]¶ Bases:
hyperstream.stream.stream_instance.StreamMetaInstanceStreamInstance that also contains meta data
hyperstream.stream.stream_view module¶
-
class
hyperstream.stream.stream_view.StreamView(stream, time_interval, force_calculation=False)[source]¶ Bases:
hyperstream.utils.utils.PrintableSimple helper class for storing streams with a time interval (i.e. a “view” on a stream) :param stream: The stream upon which this is a view :param time_interval: The time interval over which this view is defined :param force_calculation: Whether we should force calculation for this stream view if data does not exist :type stream: Stream :type time_interval: TimeInterval