options.py 文件源码

python
阅读 22 收藏 0 点赞 0 评论 0

项目:PyQYT 作者: collinsctk 项目源码 文件源码
def parse_config_file(self, path, final=True):
        """Parses and loads the Python config file at the given path.

        If ``final`` is ``False``, parse callbacks will not be run.
        This is useful for applications that wish to combine configurations
        from multiple sources.

        .. versionchanged:: 4.1
           Config files are now always interpreted as utf-8 instead of
           the system default encoding.
        """
        config = {}
        with open(path, 'rb') as f:
            exec_in(native_str(f.read()), config, config)
        for name in config:
            normalized = self._normalize_name(name)
            if normalized in self._options:
                self._options[normalized].set(config[name])

        if final:
            self.run_parse_callbacks()
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号