imas_validator.rules.helpers.Select

class imas_validator.rules.helpers.Select(wrapped: IDSWrapper, query: str, *, has_value: bool = True, leaf_only: bool = True)

Bases: object

Select children of an IDS toplevel or structure, based on the given criteria.

Example

@validator("*")
def validate_time(ids):
    '''Validate that all non-empty time nodes are strictly increasing'''
    for time_node in Select(ids, '(/|^)time$'):
        assert Increasing(time_node)
__init__(wrapped: IDSWrapper, query: str, *, has_value: bool = True, leaf_only: bool = True)

Construct a Select object.

Parameters:
wrapped: IDSWrapper

IDS toplevel or structure element

query: str

Regular expression to match the paths of child elements to. See also imas.util.find_paths().

Keyword Arguments:
has_value: bool = True

When True, children without value are not included. Set to False to include all child items (including those without a set value).

leaf_only: bool = True

When True, only leaf data nodes are included in the selection. Set to False to also iterate over Structures and Arrays of Structures.

Methods

__init__(wrapped, query, *[, has_value, ...])

Construct a Select object.


Last update: 2025-06-05