configure.py 文件源码

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

项目:opyrant 作者: opyrant 项目源码 文件源码
def load(cls, config_file):
        """ Load experiment parameters from a YAML configuration file

        Parameters
        ----------
        config_file: string
            path to a YAML configuration file

        Returns
        -------
        dictionary (or list of dictionaries) of parameters to pass to a behavior
        """
        try:
            import yaml
        except ImportError:
            raise ImportError("Pyyaml is required to use a .yaml configuration file")

        parameters = list()
        with open(config_file, "rb") as config:
            for val in yaml.load_all(config):
                parameters.append(val)

        if len(parameters) == 1:
            parameters = parameters[0]

        return parameters
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号