database_handler.py 文件源码

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

项目:audio-feeder 作者: pganssle 项目源码 文件源码
def load_table(table_loc, table_type):
    """
    Loads a table of type ``table_type`` from the YAML file ``table_loc``.
    """
    with open(table_loc, 'r') as yf:
        table_file = yaml.safe_load(yf)

    assert table_file['db_version'] == DB_VERSION
    table_list = table_file['data']

    raw_table = (table_type(**params) for params in table_list)
    table_by_id = {x.id: x for x in raw_table}

    return table_by_id
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号