File: pathutils.py

package info (click to toggle)
scikit-build-core 0.11.1-3
  • links: PTS, VCS
  • area: main
  • in suites: sid, trixie
  • size: 2,408 kB
  • sloc: python: 13,380; ansic: 140; cpp: 134; sh: 27; fortran: 18; makefile: 7
file content (14 lines) | stat: -rw-r--r-- 359 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
from __future__ import annotations

import contextlib
import typing

if typing.TYPE_CHECKING:
    from collections.abc import Generator, Iterable
    from pathlib import Path


def contained(paths: Iterable[Path], rel: str) -> Generator[Path, None, None]:
    for p in paths:
        with contextlib.suppress(ValueError):
            yield p.relative_to(rel)