parser.py 文件源码

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

项目:atom-hw 作者: flame0 项目源码 文件源码
def get_dataset(filename):
    '''
    Iterator for dataset's items
    :param filename: Path to dataset's file
    :type filename: str
    :return: Dataset's items
    :raises OSError: if has problem with file
    :raises yaml.YAMLError: if has problem with format
    :raises ValueError: if has problem with content
    '''
    with open(filename, 'rt', encoding='utf-8') as input:
        package = load(input, Loader=Loader)
        dataset = package.get('dataset')
        if not isinstance(dataset, list):
            raise ValueError('wrong format')
        yield from dataset
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号