Base

Inheritance diagram of musify.processors.base

Base classes for all processors in this module. Also contains decorators for use in implementations.

Classes:

Processor()

Generic base class for processors

InputProcessor()

Processor that gets user input as part of it processing.

dynamicprocessormethod(*args)

Decorator for methods on a class decorated with the processor() decorator

DynamicProcessor(*_, **__)

Base class for implementations with dynamicprocessormethod() methods.

Filter()

Base class for filtering down values based on some settings

FilterComposite(*filters, **__)

Composite filter which filters based on many Filter objects

class musify.processors.base.Processor

Bases: PrettyPrinter

Generic base class for processors

class musify.processors.base.InputProcessor

Bases: Processor

Processor that gets user input as part of it processing.

Contains methods for getting user input and printing formatted options text to the terminal.

Attributes:

logger

The MusifyLogger for this object

logger: MusifyLogger

The MusifyLogger for this object

class musify.processors.base.dynamicprocessormethod(*args)

Bases: object

Decorator for methods on a class decorated with the processor() decorator

This assigns the method a processor method which can be dynamically called by the processor class. Optionally, provide a list of alternative names from which this processor method can also be called.

class musify.processors.base.DynamicProcessor(*_, **__)

Bases: Processor

Base class for implementations with dynamicprocessormethod() methods.

Classes that implement this base class have a __processormethods__ class attribute which is a list of strings of all the processor methods this class contains. If a dynamicprocessormethod() has alternative method names, these names will be added to the class’ __dict__ as callable methods which point to the decorated method.

Optionally, you may also define a _processor_method_fmt class method which applies some transformation to all method names. The transformed method name is then appended to the class’ __dict__. The transformation is always applied before extending the class with any given alternative method names.

Attributes:

processor_methods

String representation of all available processor names of this object

property processor_methods: frozenset[str]

String representation of all available processor names of this object

class musify.processors.base.Filter

Bases: Processor, Generic

Base class for filtering down values based on some settings

Attributes:

ready

Does this filter have valid settings and can process values

transform

Transform the input value to the value that should be used when comparing against this filter's settings Simply returns the given value at baseline unless overridden.

Methods:

process(values, *args, **kwargs)

Apply this filter's settings to the given values

abstract property ready: bool

Does this filter have valid settings and can process values

abstract process(values, *args, **kwargs)

Apply this filter’s settings to the given values

Return type:

Collection[TypeVar(T)]

property transform: Callable[[Any], Any]

Transform the input value to the value that should be used when comparing against this filter’s settings Simply returns the given value at baseline unless overridden.

class musify.processors.base.FilterComposite(*filters, **__)

Bases: Filter, Collection[Filter], Generic

Composite filter which filters based on many Filter objects

Attributes:

ready

Does this filter have valid settings and can process values

transform

Transform the input value to the value that should be used when comparing against this filter's settings Simply returns the given value at baseline unless overridden.

filters

The filters to use when processing

property ready

Does this filter have valid settings and can process values

property transform: Callable[[Any], Any]

Transform the input value to the value that should be used when comparing against this filter’s settings Simply returns the given value at baseline unless overridden.

filters

The filters to use when processing