__init__.py 文件源码

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

项目:python-confidant-client 作者: lyft 项目源码 文件源码
def _load_config(self, config_files, profile):
        """Initialize client settings from config."""
        for filename in config_files:
            try:
                with open(os.path.expanduser(filename), 'r') as f:
                    config = yaml.safe_load(f.read())
                    return config.get(profile, {})
            except IOError:
                logging.debug('{0} config file not found.'.format(filename))
                pass
            except yaml.YAMLError as e:
                msg = 'Failed to parse {0}: {1}'.format(filename, e)
                logging.error(msg)
                raise ClientConfigurationError(msg)
        # No file found
        return {}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号