colander_data_converter.formats.threatr.mapping module
- class colander_data_converter.formats.threatr.mapping.ThreatrMapper[source]
Bases:
object
Base class for mapping between Threatr and Colander data using the mapping file.
This abstract base class provides common functionality for all Threatr to Colander mappers. It initializes the mapping loader and provides access to the mapping data that defines how different data formats should be converted between the two systems.
- Variables:
mapping_loader – Instance of
ThreatrMappingLoader
for accessing mapping data
Note
This is a base class that should be subclassed by specific mapper implementations. The mapping data is loaded once and shared across all mapper instances.
Example
>>> class CustomMapper(ThreatrMapper): ... def __init__(self): ... super().__init__() ... >>> mapper = CustomMapper() >>> hasattr(mapper, 'mapping_loader') True
- class colander_data_converter.formats.threatr.mapping.ThreatrMappingLoader[source]
Bases:
object
Loads and provides access to the Threatr to Colander mapping data.
This class is responsible for loading the mapping configuration from a JSON file that defines how Threatr entities, events, and relations should be converted to their Colander equivalents. The mapping data includes field mappings, type conversions, and relationship definitions.
Note
The mapping data is loaded once during initialization and cached for subsequent use.
- Variables:
mapping_data – The loaded mapping data
Example
>>> loader = ThreatrMappingLoader() >>> mappings = loader.mapping_data >>> isinstance(mappings, list) True