Modifier abstract class

This class can be subclassed, installed as an entry point, and then used via configuration.

todo entry point install guide

class sovereign.modifiers.lib.GlobalModifier(source_data: list)

GlobalModifier is an abstract base class used to change instance data in-flight.

Parameters:source_data (list) – A list of instances obtained from any source
apply()

apply is an abstract method which must be overwritten by all inheriting classes. Apply should modify the list object self.matched in-place

join()

Joins matched and unmatched sets of data back together. This is run after the modifier has been applied.

match(data_instance)

match is an abstract method which must be overwritten by all inheriting classes. This is run prior to applying a global modifier, and results in the given data source being sorted into ‘matched’ and ‘unmatched’ groups. Match must return something truthy or falsy.

Parameters:data_instance – dict object to be matched against
Returns:True if matched, or False if unmatched
class sovereign.modifiers.lib.Modifier(instance: dict)

Modifier is an abstract base class used to change instances in-flight.

Parameters:instance (dict) – A single instance obtained from any source
apply()

apply is an abstract method which must be overwritten by all inheriting classes. Apply should modify a self.instance object in-place.

match()

match is an abstract method which must be overwritten by all inheriting classes. This is run prior to applying a modifier, to ensure that it’s being applied to the correct object. Match must return something truthy or falsy.