def load(cls, config_path, **kwargs): """ :param config_path: Config file path :param kwargs: optional keyword parameters to be sanitized :: dict :return: cls.container() object holding config parameters """ root = ET.parse(config_path).getroot() return etree_to_container(root, cls.container())
def load_from_path(self, filepath, **kwargs): """ :param filepath: XML file path :param kwargs: optional keyword parameters to be sanitized :: dict :return: self.container object holding config parameters """ root = ET.parse(filepath).getroot() return etree_to_container(root, self.container)
def load_from_path(self, filepath, to_container, **kwargs): """ :param filepath: XML file path :param to_container: callble to make a container object :param kwargs: optional keyword parameters to be sanitized :return: Dict-like object holding config parameters """ root = ET.parse(filepath).getroot() return etree_to_container(root, to_container)
def etree_getroot_fromfile(f): return etree.parse(f).getroot()
def etree_getroot_fromsrc(src): """ :param src: A file name/path or a file[-like] object or a URL :return: etree object gotten by parsing ``s`` """ return etree.parse(src).getroot()