sandbox/utils.py
def extract(env: str, path: str) -> Optional[BinaryIO]:
    """Extract and returns the file at <path> inside <env>, returns None of either the environment
    or the file could not be found."""
    env_path = get_env(env)
    if env_path is None:
        raise HTTPExceptions.NOT_FOUND.with_content(f"No environment with UUID '{env}' found")
    
    try:
        with tarfile.open(env_path, mode="r:gz") as tar:
            buffer = tar.extractfile(tar.getmember(path))
            file = io.BytesIO(buffer.read())
    except KeyError:
        raise HTTPExceptions.NOT_FOUND.with_content(
            f"The file '{path}' could not be found in environment '{env}'"
        )
    
    return file
Extract and returns the file at <path> inside <env>, returns None of either the environment
    or the file could not be found.
Extract and returns the file at  inside , returns None of either the environment
or the file could not be found.
Extract and returns the file at inside returns None of either the environment or the file could not be found .
def extract(env: str, path: str) -> Optional[BinaryIO]:
    env_path = get_env(env)
    if env_path is None:
        raise HTTPExceptions.NOT_FOUND.with_content(f"No environment with UUID '{env}' found")
    try:
        with tarfile.open(env_path, mode="r:gz") as tar:
            buffer = tar.extractfile(tar.getmember(path))
            file = io.BytesIO(buffer.read())
    except KeyError:
        raise HTTPExceptions.NOT_FOUND.with_content(
            f"The file '{path}' could not be found in environment '{env}'"
        )
    return file
def extract ( env : str , path : str ) -> Optional [ BinaryIO ] : env_path = get_env ( env ) if env_path is None : raise HTTPExceptions . NOT_FOUND . with_content ( f"No environment with UUID '{env}' found" ) try : with tarfile . open ( env_path , mode = "r:gz" ) as tar : buffer = tar . extractfile ( tar . getmember ( path ) ) file = io . BytesIO ( buffer . read ( ) ) except KeyError : raise HTTPExceptions . NOT_FOUND . with_content ( f"The file '{path}' could not be found in environment '{env}'" ) return file
Extract and returns the file at <path> inside <env>, returns None of either the environment
or the file could not be found.
Extract and returns the file at <path > inside <env > returns None of either the environment or the file could not be found .
"""Extract and returns the file at <path> inside <env>, returns None of either the environment
    or the file could not be found."""
env
str
path
str