sec_parser.processing_steps.abstract_classes.abstract_processing_step

Attributes

ElementTransformer

Exceptions

AlreadyProcessedError

Base exception class for sec_parser.

Classes

AbstractProcessingStep

AbstractProcessingStep class for transforming a list of elements.

Module Contents

sec_parser.processing_steps.abstract_classes.abstract_processing_step.ElementTransformer
exception sec_parser.processing_steps.abstract_classes.abstract_processing_step.AlreadyProcessedError

Bases: sec_parser.exceptions.SecParserRuntimeError

Base exception class for sec_parser. All custom exceptions in sec_parser are inherited from this class.

class sec_parser.processing_steps.abstract_classes.abstract_processing_step.AbstractProcessingStep

Bases: abc.ABC

AbstractProcessingStep class for transforming a list of elements. Chaining multiple steps together allows for complex transformations while keeping the code modular.

Each instance of a step is designed to be used for a single transformation operation. This ensures that any internal state maintained during a transformation is isolated to the processing of a single document.

_already_processed = False
process(elements: list[sec_parser.semantic_elements.abstract_semantic_element.AbstractSemanticElement]) list[sec_parser.semantic_elements.abstract_semantic_element.AbstractSemanticElement]

Transform the list of semantic elements.

Note: The elements argument could potentially be mutated for performance reasons.

abstract _process(elements: list[sec_parser.semantic_elements.abstract_semantic_element.AbstractSemanticElement]) list[sec_parser.semantic_elements.abstract_semantic_element.AbstractSemanticElement]

Implement the actual transformation logic in child classes.

This method is intended to be overridden by child classes to provide specific transformation logic.