FilterByGroup#

class FilterByGroup(user_func, indices, pass_unparsed=False, **kwargs)#

Bases: Filter

Manage a filter applied on specific groups.

The list of indices of those groups must be supplied at initialization to avoid having to find them at each validation from a more generic key.

Parameters:
get_filter_func()#

Return filter function.

Wrap so the partial function is applied on every match specified by the indices and pass_unparsed attributes.

Return type:

Callable[[Finder, str, Matches], bool]

reset()#

Reset the filter function and name if the group indices have changed.

Return type:

None

filter_func: Callable[[Finder, str, Matches], bool]#

Function to be used as a filter.

indices: list[int]#

List of group indices to apply this filter upon.

partial_func: Callable[[Any], bool]#

Function with kwargs stored.

pass_unparsed: bool#

Whether to pass unparsed groups to the filter.

user_func: UserFuncGroup#

Initial function given by the user.