Package lepl :: Package stream :: Module core
[hide private]
[frames] | no frames]

Module core

source code

Default implementations of the stream classes.

A stream is a tuple (state, helper), where state will vary from location to location, while helper is an "unchanging" instance of StreamHelper, defined below.

For simple streams state can be a simple integer and this approach avoids the repeated creation of objects. More complex streams may choose to not use the state at all, simply creating a new helper at each point.

Classes [hide private]
  StreamHelper
The interface that all helpers should implement.
  MutableMaxDepth
Track maximum depth (offset) reached and the associated stream.
  HashKey
Used to store a value with a given hash.
Variables [hide private]
  _StreamHelper = ABCMeta('_StreamHelper', (object,), {})
ABC used to identify streams.
  DUMMY_HELPER = object()
Allows tests to specify an arbitrary helper in results.
  s_key
  s_kargs
  s_fmt
  s_debug = lambda stream:
Invoke helper.debug()
  s_next
  s_join = lambda stream,* values:
Invoke helper.join(*values)
  s_empty = lambda stream:
Invoke helper.empty(state)
  s_line = lambda stream, empty_ok:
Invoke helper.line(state, empty_ok)
  s_len = lambda stream:
Invoke helper.len(state)
  s_stream
  s_deepest = lambda stream:
Invoke helper.deepest()
  s_delta = lambda stream:
Invoke helper.delta(state)
  s_eq = lambda stream1, stream2:
Compare two streams (which should have identical helpers)
  s_id = lambda stream:
Access the ID attribute.
  s_factory = lambda stream:
Access the factory attribute.
  s_max = lambda stream:
Access the max attribute.
  s_new_max = lambda stream:
Invoke helper.new_max(state).
  s_global_kargs = lambda stream:
Access the global_kargs attribute.
  s_cache_level = lambda stream:
Access the cache_level attribute.
  s_cacheable = lambda stream:
Is the stream cacheable?