schlichtanders.myobjects module

Again a favourit package: Objects for everything. Namespaces, Counts, and something I am really proud of: Structure. A Structure kind of implements a mixture between dicts and nested lists, which is highly useful for python-like complex access to datastructures. E.g. pyparsing uses a similar interface for its ParseResult.

class schlichtanders.myobjects.Count(_value=None)[source]

Bases: object

future-like counting object

The first time the attribute value is accessed, it gets computed by counting onwards from the total_count

eval()[source]
static eval_all()[source]
static reset(total_count=0)[source]
static reset_all(total_count=0)[source]
total_count = 0
value
weakrefs = []
schlichtanders.myobjects.Empty

alias of Namespace

class schlichtanders.myobjects.LazyProxy(initializer, *args, **kwargs)[source]

Bases: sphinx.ext.autodoc.ObjectProxy

this is an amazing class which allows you to postpone the initalization of an object until an attribute of it is asked for or it is called like a function

initialize()[source]
is_initialized

Bases: object

key
next
prev
class schlichtanders.myobjects.Namespace(_dict=None, **kwargs)[source]

Bases: object

simple class to use as namespace (like a struct object in Matlab)

class schlichtanders.myobjects.NestedNamespace(*instances)[source]

Bases: object

class schlichtanders.myobjects.OrderedSet(iterable=None)[source]

Bases: _abcoll.MutableSet

Set the remembers the order elements were added

add(key)[source]
copy()[source]
difference_update(s)[source]
discard(key)[source]
intersection_update(s)[source]
pop(last=True)[source]
union(s)[source]
update(iterable)[source]
schlichtanders.myobjects.Struct

alias of Namespace

class schlichtanders.myobjects.Structure(initializer='None', struct=None, leaves=None)[source]

Bases: _abcoll.Sequence

implements generic dict-list-combining structure like it is used in pyparsing.ParseResult

EMPTY_DEFAULT = 'EMPTY'
FLATTEN_LISTS = True
KEY_ACCESS_REDUCE_SINGLETONS = False

By default all key access return lists. With this option set to true, keys delivering singleton [object] will return object directly

LeafError = (<type 'exceptions.TypeError'>, <type 'exceptions.KeyError'>)
clear()[source]
deepcopy(memo=None)[source]
group(wrapper=None, pseudo=False, liftkeys=False)[source]

CAUTION: changes self inplace deepcopy before if you like to have a new object

if wrapper is specified, subgroup is regarded as new Leaf

iter_withpseudo()[source]

flattens out leaves, but not pseudo groups

keys()[source]
map(func, inplace=True)[source]

Structure is a functor =), func is mapped over leaves

set_name(name)[source]
schlichtanders.myobjects.check_deterministic(iterable)[source]
schlichtanders.myobjects.create_counter(classname='Count')[source]

this factory method is used to create independent Count classes CAUTION: for pickle to work, the classname must be the same name as the variable this factory-call is set to

schlichtanders.myobjects.pickle_deepcopy(o)[source]