def get_local_assets()

in assets/__init__.py [0:0]


def get_local_assets(package, path):
    """
    Retrieve the list of a package's local assets.

    :param package: name and version of the package, ex. 'endpoint/8.3.0'
    :param path: path on disk searched for the assets
    :return: generator yielding (path, content) pairs as they are traversed
    """

    saved_cwd = os.getcwd()
    os.chdir(path)
    try:
        if not Path(package).exists():
            raise ValueError(f"Package not found: {package}")
        for root, _, files in os.walk(package):
            for file in files:
                with open(Path(root) / file, "rb") as f:
                    yield f.name, f.read()
    finally:
        os.chdir(saved_cwd)