Skip to content

API

Path module-attribute

Path = Path_

ensure_cache_dir

ensure_cache_dir() -> Path_

Make sure cache directory exists

Returns:

Type Description
Path_

Path to cache_dir

Source code in ogc/fs.py
def ensure_cache_dir() -> Path_:
    """Make sure cache directory exists

    Returns:
        Path to cache_dir
    """
    cache_dir = Path(__file__).cwd() / ".ogc-cache"

    if not cache_dir.exists():
        os.makedirs(str(cache_dir))
    return cache_dir

expand_path

expand_path(p: str) -> Path_

Returns expanded path

Parameters:

Name Type Description Default
p str

tilde path string to expand

required

Returns:

Type Description
Path_

Path object expanded

Source code in ogc/fs.py
def expand_path(p: str) -> Path_:
    """Returns expanded path

    Args:
        p: tilde path string to expand

    Returns:
        Path object expanded
    """
    return Path_(p).expanduser()