cli.py 文件源码

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

项目:mccurse 作者: khardix 项目源码 文件源码
def modpack_file(path: Path) -> Generator[ModPack, None, None]:
    """Context manager for manipulation of existing mod-pack.

    Keyword arguments:
        path: Path to the existing ModPack file, which should be provided.

    Yields:
        ModPack loaded from path. If no exception occurs, the provided modpack
        is written (with changes) back to the file on context exit.
    """

    with path.open(encoding='utf-8', mode='r') as istream:
        mp = ModPack.load(istream)

    yield mp

    with path.open(encoding='utf-8', mode='w') as ostream:
        mp.dump(ostream)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号