Skip to content

modifier.py

ofrak.component.modifier

Modifier (AbstractComponent, ABC)

Modifiers are components that operate on the current state of a resource, directly manipulating the underlying binary data.

modify(self, resource, config) async

Modify the given resource.

Users should not call this method directly; rather, they should run Resource.run.

Parameters:

Name Type Description Default
resource Resource required
config ~CC

Optional config for modification. If an implementation provides a default, this default will always be used when config would otherwise be None. Note that a copy of the default config will be passed, so the default config values cannot be modified persistently by a component run.

required
Source code in ofrak/component/modifier.py
@abstractmethod
async def modify(self, resource: Resource, config: CC) -> None:
    """
    Modify the given resource.

    Users should not call this method directly; rather, they should run
    [Resource.run][ofrak.resource.Resource.run].

    :param resource:
    :param config: Optional config for modification. If an implementation provides a default,
    this default will always be used when config would otherwise be None. Note that a copy of
    the default config will be passed, so the default config values cannot be modified
    persistently by a component run.
    """
    raise NotImplementedError()