hyperstream.stream package¶
Submodules¶
hyperstream.stream.stream module¶
-
class
hyperstream.stream.stream.
DatabaseStream
(channel, stream_id, calculated_intervals, sandbox)[source]¶ Bases:
hyperstream.stream.stream.Stream
Simple subclass that overrides the calculated intervals property
-
calculated_intervals
¶
-
-
class
hyperstream.stream.stream.
Stream
(channel, stream_id, calculated_intervals, sandbox)[source]¶ Bases:
hyperstream.utils.utils.Hashable
Stream 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, 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: 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.TypedBiDict
Custom 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.Hashable
Helper 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() {u'stream_id.meta_data.house': u'1', u'stream_id.meta_data.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.StreamInstance
Simple 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.StreamMetaInstance
StreamInstance 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.Printable
Simple 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