Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extend the filter() documentation slightly #235

Merged
merged 1 commit into from
Jun 5, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 11 additions & 3 deletions fmf/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -215,13 +215,21 @@ def filter(filter, data, sensitive=True, regexp=False, name=None):
"""
Apply advanced filter on the provided data dictionary

Filter supports disjunctive normal form with '|' used for OR, '&'
for AND and '-' for negation. Individual values are prefixed with
'value:', leading/trailing white-space is stripped. For example::
Filter supports disjunctive normal form (DNF) with ``|`` used for
OR, ``&`` for AND and ``-`` for negation. Individual values are
prefixed with ``key:``, leading/trailing white-space is stripped.
For example::

tag: Tier1 | tag: Tier2 | tag: Tier3
category: Sanity, Security & tag: -destructive

Grouping boolean expressions using parentheses is not supported but
the correct DNF order of precedence of operators is respected
(negation first, AND next and then OR). For example, to express
``(tag: A | tag: B) & tag: C`` use the following filter::

tag: A & tag: C | tag: B & tag: C

Use the back slash character ``\\`` to escape the boolean
operators if you need to specify them as part of the filter
expressions::
Expand Down
Loading