extraction_methods.core package
Submodules
extraction_methods.core.extraction_method module
Extraction Method Models
- class extraction_methods.core.extraction_method.Backend(*args: Any, **kwargs: Any)
- Bases: - SetInput,- ABC- Class to act as a base for Backends. Defines the basic method signature and ensure compliance by all subclasses. - abstract run(body: dict[str, Any]) Iterator[dict[str, Any]]
- Run the backend. - Parameters:
- body (dict) – current generated properties 
- Returns:
- updated body dict 
- Return type:
- dict 
 
 
- class extraction_methods.core.extraction_method.ExtractionMethod(*args: Any, **kwargs: Any)
- Bases: - SetInput,- ABC- Class to act as a base for all extracion methods. Defines the basic method signature and ensure compliance by all subclasses. - abstract run(body: dict[str, Any]) dict[str, Any]
- Run the method. - Parameters:
- body (dict) – current generated properties 
- Returns:
- updated body dict 
- Return type:
- dict 
 
 
- class extraction_methods.core.extraction_method.SetEntryPointsMixin(*args: Any, **kwargs: Any)
- Bases: - object- Mixin to set - entry_pointsattribute.- entry_point_group: str
 - entry_points: dict[str, EntryPoint] = {}
 
- class extraction_methods.core.extraction_method.SetInput(*args: Any, **kwargs: Any)
- Bases: - object- Class to set input attribute from kwargs. - dummy_input_class
- alias of - DummyInput
 
- extraction_methods.core.extraction_method.update_input(func: Callable[[Any, dict[str, Any]], Any]) Callable[[Any, dict[str, Any]], Any]
- Wrapper to update inputs with body values before run. - Parameters:
- func (Callable) – function that wrapper is to be run on 
- Returns:
- function that wrapper is to be run on 
- Return type:
- Callable 
 
extraction_methods.core.types module
Extraction Method Types
- class extraction_methods.core.types.Backend(*, name: str, inputs: dict[str, Any] = {})
- Bases: - BaseModel- Model for Backend configuration. - inputs: dict[str, Any]
 - model_config: ClassVar[ConfigDict] = {}
- Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict]. 
 - model_fields: ClassVar[dict[str, FieldInfo]] = {'inputs': FieldInfo(annotation=dict[str, Any], required=False, default={}, description='Inputs for backend.'), 'name': FieldInfo(annotation=str, required=True, description='Name of backend.')}
- Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo]. - This replaces Model.__fields__ from Pydantic V1. 
 - name: str
 
- class extraction_methods.core.types.DummyInput(*, exists_key: str = '$', exists_delimiter: str = '.', **extra_data: Any)
- Bases: - Input- Dummy input used before attributes are updated. - model_config: ClassVar[ConfigDict] = {'extra': 'allow'}
- Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict]. 
 - model_fields: ClassVar[dict[str, FieldInfo]] = {'exists_delimiter': FieldInfo(annotation=str, required=False, default='.', description='Delimiter for nested exists terms.'), 'exists_key': FieldInfo(annotation=str, required=False, default='$', description='Key to signify a previously extracted terms.')}
- Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo]. - This replaces Model.__fields__ from Pydantic V1. 
 - update_attr(value: Any, body: dict[str, Any]) Any
- Update attribute using the - exists key.- Parameters:
- value (Any) – current attribute value 
- body (dict) – current generated properties 
 
- Returns:
- updated attribute 
- Return type:
- Any 
 
 - update_attrs(body: dict[str, Any]) None
- Update instance attributes with body. - Parameters:
- body (dict) – current generated properties 
 
 - update_dict_attr(input_dict: dict[str, Any], body: dict[str, Any]) dict[str, Any]
- Update nested dictionary attributes. - Parameters:
- input_dict (dict) – attribute dictionary to update 
- body (dict) – current generated properties 
 
- Returns:
- updated dictionary attribute 
- Return type:
- dict 
 
 - update_list_attr(input_list: list[Any], body: dict[str, Any]) list[Any]
- Update list of attributes. - Parameters:
- input_list (list) – attribute list to update 
- body (list) – current generated properties 
 
- Returns:
- updated list attribute 
- Return type:
- list 
 
 
- class extraction_methods.core.types.Input(*, exists_key: str = '$', exists_delimiter: str = '.')
- Bases: - BaseModel- Model for method input. - exists_delimiter: str
 - exists_key: str
 - model_config: ClassVar[ConfigDict] = {}
- Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict]. 
 - model_fields: ClassVar[dict[str, FieldInfo]] = {'exists_delimiter': FieldInfo(annotation=str, required=False, default='.', description='Delimiter for nested exists terms.'), 'exists_key': FieldInfo(annotation=str, required=False, default='$', description='Key to signify a previously extracted terms.')}
- Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo]. - This replaces Model.__fields__ from Pydantic V1. 
 
- class extraction_methods.core.types.KeyOutputKey(*, key: str, output_key: str = '')
- Bases: - BaseModel- Model for - keyand- output keypairs.- key: str
 - model_config: ClassVar[ConfigDict] = {}
- Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict]. 
 - model_fields: ClassVar[dict[str, FieldInfo]] = {'key': FieldInfo(annotation=str, required=True), 'output_key': FieldInfo(annotation=str, required=False, default='')}
- Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo]. - This replaces Model.__fields__ from Pydantic V1. 
 - output_key: str
 - set_default_key() Self
- Set the default for key