spine.io.parse.base
Shared parser base classes and input-data plumbing.
Classes
|
Abstract parent class of all parser classes. |
- class spine.io.parse.base.ParserBase(dtype: str, **kwargs: Any)[source]
Abstract parent class of all parser classes.
Provides basic functionality shared by all parsers: 1. Defines a
__call__()function shared by all classes- name
Name of the parser
- Type:
str
- aliases
Aliases of the parser (allowed but disfavored names)
- Type:
List[str]
- data_map
Maps function parameter names onto a file data product name
- Type:
dict[str, str]
- tree_keys
List of file data product name
- Type:
List[str]
- Attributes:
- name
- overlay
- returns
Methods
__call__(trees)Parse one event entry into a canonical SPINE parser product.
get_input_data(trees)Build the parser-call input dictionary from loaded tree products.
- name: ClassVar[str | None] = None
- aliases: ClassVar[tuple[str, ...]] = ()
- returns: ClassVar[str | None] = None
- overlay: ClassVar[str | None] = None
- get_input_data(trees: dict[str, Any]) dict[str, Any][source]
Build the parser-call input dictionary from loaded tree products.
- Parameters:
trees (dict) – Mapping from data-product names to loaded event objects.
- Returns:
Mapping from parser argument names to the objects that should be passed to
process()or__call__().- Return type:
dict