5. Filters: argonodes.filters

Filters are elements to be applied on models or on Nodes to do a preliminary sorting.

Filters can be used to sort on paths directly, or in a more granular way on the elements of each Node separately.

Basic usage: filter = Filter(); model.apply(filter)

class argonodes.filters.Filter(params=None, targets=None, filenames=None, **kwargs)

Bases: object

Self-contained (set of) filter(s).

Parameters
  • params (dict, default None.) – List of

  • targets (list, default None.) – If set, the filters will only be applied in the selected paths.

  • kwargs (**dict) – All applicable filters, in the form left__op=value.

add(**kwargs)

Add filters.

Parameters

kwargs (**dict) – Filters to be added.

add_paths(paths)

Add targets.

Parameters

paths (str or list[str].) – Targeted paths.

export_filter() dict

Export filters to a dict.

Returns

Dictionary of filters.

Return type

dict.

filter(**kwargs)

Add filters.

Parameters

kwargs (**dict) – Filters to be added.

import_filter(dct)

Import filters from a dict.

Parameters

dct – Dictionary of filters.

select(paths)

Add targets.

Parameters

paths (str or list[str].) – Targeted paths.

argonodes.filters.get_filters_from_kwargs(kwargs) list

Returns a complete list of filters.

Parameters

kwargs (**dict) – All the filters, in the form left__op=value.

Returns

List of filters.

Return type

list

argonodes.filters.parse_op(string)

Parse an operation into the correct sub elements.

Parameters

string (str) – left__op.

Returns

Couple attribute, function.

Return type

tuple(str, fun)