onyo.lib.filters module

class onyo.lib.filters.Filter(_arg)[source]

Bases: object

Translate a string regular expression to a match function.

Intended for use with string patterns passed from Onyo’s CLI.

This can be used along with builtin filter() to remove non-matching items. For example:

repo = Repo()
f = Filter('foo=bar')
assets[:] = filter(f.match, repo.assets)
__init__(_arg)
key: str
match(item)[source]

Does item match this Filter.

Parameters:

item (Item) – Item to match against.

Raises:

OnyoInvalidFilterError – No valid operator was found.

Return type:

bool

operator: str
value: str