codenib.ops.filter
¶
Functions:
| Name | Description |
|---|---|
filter_queried_nodes |
Filter retrieval candidates while preserving their existing order. |
has_span |
Return true when a node has file and line-span coordinates. |
has_content |
Return true when a node carries non-empty code/content text. |
is_symbol_candidate |
Return true when a node type is a CodeNib symbol type. |
include_extensions |
Build a predicate that keeps nodes whose file suffix is in extensions. |
exclude_paths |
Build a predicate that drops nodes whose path matches any glob pattern. |
drop_test_files |
Return false for common test/spec file paths. |
is_test_path |
Heuristic path classifier for test/spec files. |
build_candidate_filters |
Construct a filter list from explicit retrieval-pipeline options. |
filter_queried_nodes
¶
filter_queried_nodes(
nodes: Sequence[QueriedNode],
predicates: Iterable[CandidatePredicate],
*,
limit: int | None = None
) -> list[QueriedNode]
Filter retrieval candidates while preserving their existing order.
Source code in codenib/ops/filter.py
has_span
¶
has_span(node: QueriedNode) -> bool
Return true when a node has file and line-span coordinates.
has_content
¶
has_content(node: QueriedNode) -> bool
is_symbol_candidate
¶
is_symbol_candidate(node: QueriedNode) -> bool
include_extensions
¶
Build a predicate that keeps nodes whose file suffix is in extensions.
Source code in codenib/ops/filter.py
exclude_paths
¶
Build a predicate that drops nodes whose path matches any glob pattern.
Source code in codenib/ops/filter.py
drop_test_files
¶
drop_test_files(node: QueriedNode) -> bool
is_test_path
¶
Heuristic path classifier for test/spec files.
This is intentionally only a generic filesystem heuristic. Ground-truth or benchmark-specific notions of "actionable" should stay in evaluation code, not in retrieval filtering.
Source code in codenib/ops/filter.py
build_candidate_filters
¶
build_candidate_filters(
*,
require_span: bool = False,
require_content: bool = False,
symbol_only: bool = False,
drop_tests: bool = False,
include_exts: Iterable[str] | None = None,
exclude_globs: Iterable[str] | None = None
) -> list[CandidatePredicate]
Construct a filter list from explicit retrieval-pipeline options.