/ . / SessionUtil / objecttree.py
Functions
|
|
|
escape_dictionary_key
|
escape_dictionary_key ( key )
Make sure the word class does not occur as a dictionary key.
Prefix a key that is class with a backslash. Also prefix all keys
that start with a backslash with another backslash.
|
|
write_simple_sequence
|
write_simple_sequence (
btree,
file,
indent,
)
Write sequence elements on one line.
|
|
write_sequence
|
write_sequence (
btree,
file,
indent,
sindent,
)
Write sequence elements on separate lines.
|
|
is_simple_sequence
|
is_simple_sequence ( seq )
A simple sequence is of length <= 4 and contains only numbers or None.
|
|
basic_tree_to_instance_tree
|
basic_tree_to_instance_tree ( btree, name_to_class )
Exceptions
|
|
ValueError, "Can't convert type " + str(type( btree ) )
ValueError, 'Unknown class ' + classname
|
|
|
instance_tree_to_basic_tree
|
instance_tree_to_basic_tree (
itree,
already_converted=None,
allow_conversion=1,
)
Exceptions
|
|
ValueError, 'Not allowed to convert instance ' + str( itree )
ValueError, 'Instance appears more than once in tree ' + str( itree )
ValueError, "Can't convert type " + str(type( itree ) )
|
|
|
unescape_dictionary_key
|
unescape_dictionary_key ( key )
Remove leading backslash from string keys.
|
|
write_basic_tree
|
write_basic_tree (
btree,
file,
indent='',
start_of_line=1,
)
Write a tree involving only basic Python types (numbers, strings, None,
tuples, lists, dictionaries) to a file formatted for human readability.
Exceptions
|
|
ValueError, "Can't write type " + str(type( btree ) )
|
|
|
|