Searches a JSON-like dict for keys in search_keys.
| Parameters: |
-
dcc_data
(dict | list)
–
Serialized DCC data. This can either be a dictionary (extracted directly from the XML) or a sequence of the
DCC elements. Any sequence is then converted to a dictionary, where the keys are the numerical index
corresponding to the position of each element in the sequence.
-
search_keys
(Sequence[DccElementKey])
–
Element keys to search within the json dictionary to be extracted.
-
recursive
(bool, default:
False
)
–
Whether the data to collect is recursive.
-
attribute_matchers
(Mapping | None, default:
None
)
–
Rules that define how each XML descriptor should be interpreter by the collector. Each rule must
be defined as:
- Compiled regex patterns (re.Pattern objects)
- String patterns (will be compiled to regex)
- Callable functions that return bool when given a value
E.G.:
{
"@refType": [re.compile("basic_([0-9])IndexTable"), "some_pattern"],
"@tableDimension": [lambda x: isinstance(x, int) and x > 0],
"@status": [lambda x: x in ["active", "pending"]],
}
-
compile_attributes
((bool, True), default:
True
)
–
Flag to determine if the attributes defined at attribute_matchers should be compiled. Any first call to this
function should always set this value to True (its default value).The key should be set to False at any
recursive call, as compilation checks are recursive and expensive.
|
| Returns: |
-
results( list[tuple[list[str], DccType]]
) –
Sequence of items as (path, value), where:
- path is the hierarchical path (as a list of items) from root to the value
- value is the decoded DCC data as the corresponding instance (depending on the
|