def buildSelect(action, outputs): #***THIS IS THE CANONICAL BUILD*** select_data = [] if hasattr(action, "select"): try: target = outputs[action.select["source"]] includekey = action.select["include"]["key"] includevalue = action.select["include"]["value"] excludekey = action.select["exclude"]["key"] excludevalue = action.select["exclude"]["value"] for item in target: include_match = True exclude_match = True if includekey: include_match = item[includekey] == includevalue if excludekey: exclude_match = item[excludekey] != excludevalue if include_match and exclude_match: select_data.append(item) #outputs[{action.select["source"]}] = select_data outputs[action.alias] = select_data print("DEBUGGING", action.alias) print(outputs[action.alias]) return select_data, action, outputs except (KeyError, TypeError): print("Error in selection") #select_data = ["no selection"] return select_data, action, outputs