file.categorize_files()

Split paths into source, test, and skipped buckets for a language.

Usage

Source

file.categorize_files(
    paths,
    *,
    lang="py",
)

A path that does not match the lang globs is skipped; otherwise it is classified as a test file (via File.is_test, which treats conftest.py and anything under a tests/ directory as tests) or as source.

Parameters

paths: Iterable[str | Path]

File paths to categorize; blank entries are ignored.

lang: str = "py"
Language key into LANG_GLOBS (defaults to "py"); unknown keys fall back to *.<lang>.

Returns

list[str]

A (source, test, skipped) tuple, each a sorted, de-duplicated list of

path strings.