Filter

Inheritance diagram of musify.processors.filter

Processors that filter down objects and data types based on some given configuration.

Classes:

FilterDefinedList([values])

FilterComparers([comparers, match_all])

FilterIncludeExclude(include, exclude, *_, **__)

class musify.processors.filter.FilterDefinedList(values=(), *_, **__)

Bases: Filter, Collection, Generic

Attributes:

ready

Does this filter have valid settings and can process values

values

The values to include when processing for this filter

Methods:

process([values])

Returns all values that match this filter's settings

as_dict()

Return a dictionary representation of the key attributes of this object.

property ready

Does this filter have valid settings and can process values

values: Collection[T]

The values to include when processing for this filter

process(values=None, *_, **__)

Returns all values that match this filter’s settings

Return type:

Collection[T]

as_dict()

Return a dictionary representation of the key attributes of this object.

Return type:

dict[str, Any]

The results of this function are used to produce the following:
  • A JSON representation of the object when calling json()

  • The string representation of the object when calling str() on the object

  • The representation of the object when calling repr() on the object

class musify.processors.filter.FilterComparers(comparers=(), match_all=True, *_, **__)

Bases: Filter, Generic

Attributes:

ready

Does this filter have valid settings and can process values

comparers

The comparers to use when processing for this filter When a mapping with other FilterComparers is given, will apply this sub-filter to all parent filters when processing

match_all

When true, only include those items that match on all comparers

Methods:

process(values[, reference])

Apply this filter's settings to the given values

as_dict()

Return a dictionary representation of the key attributes of this object.

property ready

Does this filter have valid settings and can process values

comparers: Mapping[Comparer, tuple[bool, Self]]

The comparers to use when processing for this filter When a mapping with other FilterComparers is given, will apply this sub-filter to all parent filters when processing

match_all: bool

When true, only include those items that match on all comparers

process(values, reference=None, *_, **__)

Apply this filter’s settings to the given values

Return type:

Collection[T]

as_dict()

Return a dictionary representation of the key attributes of this object.

Return type:

dict[str, Any]

The results of this function are used to produce the following:
  • A JSON representation of the object when calling json()

  • The string representation of the object when calling str() on the object

  • The representation of the object when calling repr() on the object

class musify.processors.filter.FilterIncludeExclude(include, exclude, *_, **__)

Bases: FilterComposite, Generic

Attributes:

include

The filter that, when processed, returns items to include

exclude

The filter that, when processed, returns items to exclude

Methods:

process(values, *_, **__)

Filter down values that match this filter's settings from

as_dict()

Return a dictionary representation of the key attributes of this object.

include: U

The filter that, when processed, returns items to include

exclude: V

The filter that, when processed, returns items to exclude

process(values, *_, **__)

Filter down values that match this filter’s settings from

Return type:

list[T]

as_dict()

Return a dictionary representation of the key attributes of this object.

Return type:

dict[str, Any]

The results of this function are used to produce the following:
  • A JSON representation of the object when calling json()

  • The string representation of the object when calling str() on the object

  • The representation of the object when calling repr() on the object