harbor run -t openthoughts/tasktrove-exp-flat25-pseudocode-v2-5k-pseudocode-2060harbor download openthoughts/tasktrove-exp-flat25-pseudocode-v2-5k-pseudocode-2060PSEUDOCODE
MODULE flow_tools EXPORT PropertyManager
MODULE flow_tools.constants CONSTANT TASK_INPUT_FILES = []
MODULE flow_tools._property_manager.property_manager CLASS PropertyManager CLASS_VARIABLE shared
FUNCTION __init__(self)
self.task_input_properties = self._load_task_input_properties()
FUNCTION _load_task_input_properties(self)
files = flow_tools.constants.TASK_INPUT_FILES
IF any(file_path does not exist for file_path in files)
RETURN empty_dictionary
merged_properties = empty_dictionary
FOR file_path IN files (in order)
props = self.get_properties_from_file(file_path)
FOR each key, value IN props
merged_properties[key] = value // override earlier values with later files
RETURN merged_properties
FUNCTION get_properties_from_file(self, file_path)
properties = empty_dictionary
current_key = NULL
OPEN file_path USING UTF-8 AS f
FOR line IN f
line = line without trailing newline
IF line is empty OR line contains only whitespace
CONTINUE
IF line trimmed starts with '#'
CONTINUE
IF line CONTAINS first '='
idx = index of first '=' in line
key_part = substring of line from start to idx
value_part = substring of line from idx+1 to end
key = key_part trimmed of surrounding whitespace
value = value_part // preserve exactly as after '=' (including trailing spaces)
properties[key] = value
current_key = key
ELSE IF line STARTS WITH whitespace AND current_key IS NOT NULL
// continuation line for multi-line value
properties[current_key] = properties[current_key] + "\n" + line
ELSE
// line does not define a new key and is not a continuation; ignore
END FOR
CLOSE f
RETURN properties
END MODULE flow_tools._property_manager.property_manager
// Instantiate the singleton on module load PropertyManager.shared = PropertyManager()
// Notes for behavior // - When tests patch flow_tools.constants.TASK_INPUT_FILES, all methods reading files should reflect the patched list // - If any path in TASK_INPUT_FILES does not exist, PropertyManager().task_input_properties should be {} // - If all paths exist, task_input_properties is the merged dictionary from all files in order // - get_properties_from_file(file_path) returns a dict with: // * Keys trimmed; values preserved exactly after the first '=' // * Multi-line values: continuation lines appended with newline separators // * Lines starting with '#': ignored // * Inline '#' inside values preserved // * Empty lines ignored // * UTF-8 encoding; cross-platform line endings supported // - Trailing spaces in values are preserved (e.g., "Python 2 (version 2.7.16) ")
// Structure guidance (files) // flow_tools/init.py // Re-export PropertyManager
// flow_tools/_property_manager/constants.py // TASK_INPUT_FILES = []
// flow_tools/_property_manager/property_manager.py // Implement PropertyManager as above
End MODULE flow_tools