Core

Decorators

Decorators allow the user to modify the input and out from the processors.

item_generator.extraction_methods.preprocessors allow modification of the input arguments.

item_generator.extraction_methods.postprocessors modify the output dictionary.

item_generator.core.decorators.accepts_postprocessors(func)

Allows postprocessors to work on the output from the main processor. Uses the key post_processors from the processor description.

Parameters
  • filepath – Path to the file

  • source_media – The source media type

  • source_dict – The output dict from the wrapped processor

  • post_processors – List of post processors to run

  • kwargs – Additional kwargs passed to post processor

item_generator.core.decorators.accepts_preprocessors(func)

Allows preprocessors to work on the input arguments. Uses the key pre_processors from the processor description.

Parameters
  • filepath – path to the file

  • source_media – the source media

  • pre_processors – list of pre_processors to run

  • kwargs – additional kwargs passed to the wrapped processor

Configuration

item_descriptions:
    root_directory: /path/to/root/descriptions
class item_generator.core.facet_extractor.FacetExtractor(conf: dict)
process_file(filepath, source_media, **kwargs)

Method to outline the processing pipeline for an individual file :param filepath: :param source_media: :return:

run_processors(filepath: str, description: asset_scanner.core.item_describer.ItemDescription, source_media: asset_scanner.types.source_media.StorageType = StorageType.POSIX, **kwargs: dict) dict

Extract the raw facets from the file based on the listed processors

Parameters
  • filepath – Path to the file

  • description – ItemDescription

  • source_media – The source media type (POSIX, Object, Tape)

Returns

result from the processing