def load_custom_properties(self): filepath = self.config["paths"]["custom_properties"] if not filepath: custom_properties = {} else: with open(filepath, "r") as properties: custom_properties = yaml.load(properties) property_names.update( {k: v["pretty_name"] for k, v in custom_properties.items()}) public_custom_properties = { k: v for k, v in custom_properties.items() if not v.get("private", False) } device_properties.extend(list(custom_properties)) pool_device_properties.extend(list(public_custom_properties)) for properties_table in table_properties, filtering_properties: properties_table["device"].extend(list(public_custom_properties)) device_diagram_properties.extend( list(p for p, v in custom_properties.items() if v["add_to_dashboard"])) private_properties.extend( list(p for p, v in custom_properties.items() if v.get("private", False))) return custom_properties
def load_custom_properties(self) -> dict: filepath = environ.get("PATH_CUSTOM_PROPERTIES") if not filepath: custom_properties: dict = {} else: with open(filepath, "r") as properties: custom_properties = load(properties, Loader=BaseLoader) property_names.update( {k: v["pretty_name"] for k, v in custom_properties.items()}) for object_properties in (device_properties, pool_device_properties): object_properties.extend(list(custom_properties)) for properties_table in table_properties, filtering_properties: properties_table["device"].extend(list(custom_properties)) device_diagram_properties.extend( list(p for p, v in custom_properties.items() if v["add_to_dashboard"])) return custom_properties