Filter
Processors that filter down objects and data types based on some given configuration.
Classes:
|
|
|
|
|
- class musify.processors.filter.FilterDefinedList(values=(), *_, **__)
Bases:
Filter
,Collection
,Generic
Attributes:
Does this filter have valid settings and can process values
The values to include when processing for this filter
Methods:
process
([values])Returns all
values
that match this filter's settingsas_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
[TypeVar
(T
, bound=str
|Path
|MusifyObject
)] 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:
Does this filter have valid settings and can process values
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 processingWhen 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:
The filter that, when processed, returns items to include
The filter that, when processed, returns items to exclude
Methods:
process
(values, *_, **__)Filter down
values
that match this filter's settings fromas_dict
()Return a dictionary representation of the key attributes of this object.
- 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