core – Abstract Base Classes.¶
- class data_extractor.core.SimpleExtractorMeta¶
Simple Extractor Meta Class.
- class data_extractor.core.ComplexExtractorMeta(name: str, bases: Tuple[type], attr_dict: Dict[str, Any])¶
Complex Extractor Meta Class.
- class data_extractor.core.AbstractSimpleExtractor(expr: str)¶
Abstract Simple Extractor Class.
Its metaclass is
data_extractor.core.SimpleExtractorMeta- Parameters:
expr (str) – Extractor selector expression.
- abstract extract(element: Any) Any¶
Extract data or subelement from element.
- Parameters:
element (Any) – The target data node element.
- Returns:
Data or subelement.
- Return type:
Any
- Raises:
ExprError – Extractor Expression Error.
- extract_first(element: Any, default: Any = sentinel) Any¶
Extract the first data or subelement from extract method call result.
- Parameters:
element (Any) – The target data node element.
default (Any, optional) – Default value when not found. Default:
data_extractor.utils.sentinel.
- Returns:
Data or subelement.
- Return type:
Any
- Raises:
ExtractError – Thrown by extractor extracting wrong data.
- class data_extractor.core.AbstractComplexExtractor¶
Abstract Complex Extractor Clase.
Its metaclass is
data_extractor.core.ComplexExtractorMeta- abstract extract(element: Any) Any¶
Extract the wanted data.
- Parameters:
element (Any) – The target data node element.
- Returns:
Data or subelement.
- Return type:
Any
- Raises:
ExtractError – Thrown by extractor extracting wrong data.