Skip to content
  • Matias Guijarro's avatar
    config: Node object refactoring to allow on-demand references evaluation, and... · c9a73209
    Matias Guijarro authored
    config: Node object refactoring to allow on-demand references evaluation, and improvements on cloning and conversion to dictionary
    
    * introduction of the Reference object
        - reference object has an 'eval' function to evaluate a reference
        - evaluation returns an object from config, or the value of an object attribute
    * '$' prefix in YAML values now creates a Reference
        - no reference evaluation at YAML parsing time
    * backward compatibility
        - getting a key with a reference returns the value, not the Reference
            * => introduction of ConfigList object to represent lists
        - '.raw_*' methods returns the raw contents, ie. with Reference objects instead of reference evaluated values
    * node filenames are kept in Node objects
        - removed 'node2file' dictionary
    * nodes are indexed automatically when inserting a 'name' key
        - no need for 'create_index'
        - same for tags
    * '.to_dict()' method relies on the Python JSON decoder
        - simplification of the code
    * '.deep_copy()' is renamed to '.clone()'
    * '.deep_copy()' now relies on pickle
        - simplification of the code
        - nodes need a reference to the Config object => a trick is used to allow pickling/unpickling
            * the config object is saved to a tmp dict on pickling, and popped out on unpickling
    * removed call to 'gc.collect()'
        - unclear why it was there at the first place
    * removed weakref to Config object in nodes
        - nodes need the config, the config has to stay alive as long as nodes are there
    c9a73209