Package lepl :: Package support :: Module lib
[hide private]
[frames] | no frames]

Module lib

source code

Library routines / utilities (some unused).
Classes [hide private]
  str
unicode(string [, encoding[, errors]]) -> object
  basestring
unicode(string [, encoding[, errors]]) -> object
  CircularFifo
A FIFO queue with a fixed maximum size that silently discards data on overflow.
  LogMixin
Add standard Python logging to a class.
Functions [hide private]
Unicode character
chr(i)
Return a Unicode string of one character with ordinal i; 0 <= i <= 0x10ffff.
 
assert_type(name, value, type_, none_ok=False)
If the value is not of the given type, raise a syntax error.
source code
 
open_stop(spec)
In Python 2.6 open [] appears to use maxint or similar, which is not available in Python 3.
source code
 
lmap(function, values)
A map that returns a list rather than an iterator.
source code
 
compose(fun_a, fun_b)
Functional composition (assumes fun_a takes a single argument).
source code
 
compose_tuple(fun_a, fun_b)
Functional composition (assumes fun_b returns a sequence which is supplied to fun_a via *args).
source code
 
empty()
An empty generator.
source code
 
count(value=0, step=1)
Identical to itertools.count for recent Python, but 2.6 lacks the step.
source code
 
safe_in(value, container, default=False)
Test for membership without an error for unhashable items.
source code
 
safe_add(container, value)
Add items to a container, if they are hashable.
source code
 
fallback_add(container, value)
Add items to a container.
source code
 
fold(fun, start, sequence)
Fold over a sequence.
source code
 
sample(prefix, rest, size=40)
Provide a small sample of a string.
source code
 
singleton(key, factory=None)
Manage singletons for various types.
source code
 
fmt(template, *args, **kargs)
Guarantee that template is always unicode, as embedding unicode in ascii can cause errors.
source code
 
identity(x) source code
 
document(destn, source, text=None)
Copy function name and docs.
source code
 
add_defaults(original, defaults, prefix='')
Add defaults to original dict if not already present.
source code
Variables [hide private]
  file = IOBase
  __SINGLETONS = {}
Map from factory (constructor/class) to singleton.
Function Details [hide private]

open_stop(spec)

source code 
In Python 2.6 open [] appears to use maxint or similar, which is not available in Python 3. This uses a minimum value for maxint I found somewhere; hopefully no-one ever wants finite repeats larger than this.

fallback_add(container, value)

source code 
Add items to a container. Call initially with a set, but accept the returned collection, which will fallback to a list of necessary (if the contents are unhashable).