pyk.ktool.claim_index module

class ClaimIndex(claims: 'Mapping[str, KClaim]', main_module_name: 'str | None' = None)[source]

Bases: Mapping[str, KClaim]

claims: FrozenDict[str, KClaim]
static from_module_list(module_list: KFlatModuleList) ClaimIndex[source]
labels(*, include: Iterable[str] | None = None, exclude: Iterable[str] | None = None, with_depends: bool = True, ordered: bool = False) list[str][source]

Return a list of labels from the index.

Parameters:
  • include – Labels to include in the result. If None, all labels are included.

  • exclude – Labels to exclude from the result. If None, no labels are excluded. Takes precedence over include.

  • with_depends – If True, the result is transitively closed w.r.t. the dependency relation. Labels in exclude are pruned, and their dependencies are not considered on the given path.

  • ordered – If True, the result is topologically sorted w.r.t. the dependency relation.

Returns:

A list of labels from the index.

Raises:

ValueError – If an item in include or exclude cannot be resolved to a valid label.

main_module_name: str | None
resolve(label: str) str[source]
resolve_all(labels: Iterable[str]) list[str][source]