File: _util.py

package info (click to toggle)
pystac 1.13.0-1
  • links: PTS, VCS
  • area: main
  • in suites: sid, trixie
  • size: 19,904 kB
  • sloc: python: 24,370; makefile: 124; sh: 7
file content (16 lines) | stat: -rw-r--r-- 460 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
from __future__ import annotations

import os
from typing import TYPE_CHECKING

if TYPE_CHECKING:
    PathLike = os.PathLike[str]


def get_data_path(rel_path: str | PathLike) -> str:
    """Gets the absolute path to a file based on a path relative to the
    tests/data-files directory in this repo."""
    rel_path = os.fspath(rel_path)
    return os.path.abspath(
        os.path.join(os.path.dirname(__file__), "..", "tests", "data-files", rel_path)
    )