示例#1
0
    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())
示例#2
0
    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)
示例#3
0
    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)
示例#4
0
    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)
示例#5
0
文件: xml_.py 项目: gloaec/trifle
 def etree_getroot_fromfile(f):
     return etree.parse(f).getroot()
示例#6
0
 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()
示例#7
0
 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()