analyzer.postprocessing.grouping¶
Attributes¶
Classes¶
Constructs and applies a sequence of operations to filter, group, and |
Functions¶
|
|
|
Module Contents¶
- class analyzer.postprocessing.grouping.InputTrace[source]¶
-
- record(items: list[analyzer.utils.structure_tools.ItemWithMeta])[source]¶
- class analyzer.postprocessing.grouping.SelectTrace[source]¶
-
- record(pattern: analyzer.utils.querying.BasePattern, selected: list[analyzer.utils.structure_tools.ItemWithMeta], dropped: list[analyzer.utils.structure_tools.ItemWithMeta])[source]¶
- class analyzer.postprocessing.grouping.CaptureGroupTrace[source]¶
-
- classmethod fromCaptureSet(cs: analyzer.utils.querying.CaptureSet) CaptureGroupTrace[source]¶
- class analyzer.postprocessing.grouping.GroupingTrace[source]¶
-
- groups: list[CaptureGroupTrace][source]¶
- record(pattern: analyzer.utils.querying.BasePattern, capture_sets: list[analyzer.utils.querying.CaptureSet])[source]¶
- class analyzer.postprocessing.grouping.GroupTrace[source]¶
- input: InputTrace[source]¶
- select: SelectTrace | None = None[source]¶
- grouping: GroupingTrace | None = None[source]¶
- transforms: list[TransformStepTrace][source]¶
- subgroup_traces: list[dict[str, GroupTrace] | list[GroupTrace]][source]¶
- recordInput(items: list[analyzer.utils.structure_tools.ItemWithMeta])[source]¶
- recordSelect(pattern: analyzer.utils.querying.BasePattern, selected: list[analyzer.utils.structure_tools.ItemWithMeta], dropped: list[analyzer.utils.structure_tools.ItemWithMeta])[source]¶
- recordGrouping(pattern: analyzer.utils.querying.BasePattern, capture_sets: list[analyzer.utils.querying.CaptureSet])[source]¶
- class analyzer.postprocessing.grouping.GroupBuilder[source]¶
Constructs and applies a sequence of operations to filter, group, and transform collections of items based on their metadata.
- Attributes:
- group (BasePattern | None): A pattern used to capture and group items.
If provided, items are gathered by the capture groups defined in this pattern.
- select (BasePattern | None): A pattern used to filter the initial items.
Only items whose metadata matches this pattern are kept.
- subgroups (list[GroupBuilder] | dict[str, GroupBuilder] | None): Nested
group builders to apply recursively to the resulting groups. If a dictionary, the output will be a dictionary with corresponding keys. If a list, the output will be a list of applied results.
- transforms (list[Transform] | None): A list of transformation functions
to apply to each formed group.
- group: analyzer.utils.querying.BasePattern | None = None[source]¶
- select: analyzer.utils.querying.BasePattern | None = None[source]¶
- subgroups: list[GroupBuilder] | dict[str, GroupBuilder] | None = None[source]¶
- transforms: list[analyzer.postprocessing.transforms.registry.Transform | list[analyzer.postprocessing.transforms.registry.Transform]] | None = None[source]¶
- apply(items, trace: GroupTrace | None = None)[source]¶
Applies the selection, grouping, transformations, and subgroup operations to the given items.
- Args:
- items: A list of items (typically objects with metadata) to be
processed.
- trace: If provided, populated in-place with a trace of every
decision made during the pipeline.
- Returns:
The processed groups. The exact return type depends on the structure of
subgroups:If
subgroupsis None, returns the list of transformed groups.If
subgroupsis a dict, returns a list of dictionaries containing the subgroup results.If
subgroupsis a list, returns a list of lists containing the subgroup results.
- explain(items) GroupTrace[source]¶