DEMutilities. enumerate_properties

In order to be able to use this module import it like this:

import DEMutilities.enumerate_properties
#or assign it to a shorter name
import DEMutilities.enumerate_properties as enu
DEMutilities.enumerate_properties.checker_all(typetocheck)

returns True for all types

DEMutilities.enumerate_properties.checker_all_R3(typetocheck)

returns True for types: int, float, tuple

DEMutilities.enumerate_properties.checker_only_float(typetocheck)

returns True for types: float

DEMutilities.enumerate_properties.load_pickled_properties(fname)

loads pickled property dictionary - actually, just unpickles a file and returns its contents.

DEMutilities.enumerate_properties.pickle_properties(root_node, fname=None, typechecker=<function checker_all_R3>)

pickles a dictionary of all property values of a pyDEMeter.BaseObject tree, by default restricted to ints, floats, and vectors.

Parameters:

  • fname: the filname (default: root_node.name()+”_properties.pickle”)
  • typechecker: must be a unary function returning a bool for each property value, normally used to select properties of a certain type.
DEMutilities.enumerate_properties.property_dictionary(root_node, typechecker=<function checker_all>)

returns a dictionary of all properties of a pyDEMeter.BaseObject tree typechecker must be a unary function returning a bool for each property value, normally used to select properties of a certain type.

DEMutilities.enumerate_properties.property_dictionary_printable_values(root_node, typechecker=<function checker_all>)
DEMutilities.enumerate_properties.property_dictionary_values(root_node, typechecker=<function checker_all_R3>)

returns a dictionary of all property values of a pyDEMeter.BaseObject tree, by default restricted to ints, floats, and vectors. typechecker must be a unary function returning a bool for each property value, normally used to select properties of a certain type.

DEMutilities.enumerate_properties.set_properties_from_dict(root_node, property_dict, verbose=False)

Sets properties in subtree of root_node to the values contained in ‘property_dict’. The keys in ‘property_dict’ must be the ‘paths’ in the tree.

Basically, this duplicates the set_with_dict() functionality of a pyDEMeter.BaseObject from python.