converter.mapping.file

Module Contents

Classes

FileMappingSpec

A file representing a conversion mapping between 2 formats.

FileMapping

A mapping of all file mapping on the system in the search directories.

Functions

get_logger()

Attributes

RawTransformConfig

RawColumnConversionConfig

RawDirectionalConfig

RawMappingConfig

converter.mapping.file.get_logger()
converter.mapping.file.RawTransformConfig
converter.mapping.file.RawColumnConversionConfig
converter.mapping.file.RawDirectionalConfig
converter.mapping.file.RawMappingConfig
exception converter.mapping.file.InvalidMappingFile(reason: str, path: str)

Bases: converter.errors.ConverterError

Error raised when a mapping file fails validation

Parameters
  • reason – String representing the reason for the failure.

  • path – Path to the failing file.

class converter.mapping.file.FileMappingSpec(path: str, config: RawMappingConfig, all_found_configs: Dict[str, Union[FileMappingSpec, RawMappingConfig]], search_paths: List[str])

Bases: converter.mapping.base.MappingSpec

A file representing a conversion mapping between 2 formats.

This class will also load any base configs represented by the config.

The final result is added to all_found_configs so that further mappings can use this to lookup parents rather than processing the raw config again.

Parameters
  • path – Absolute path to the mapping file.

  • raw_config – The raw config data from the mapping file.

  • bases – A list of MappingFile objects to use as the base files

  • input_format – The input format resolved from the parent and current configs.

  • output_format – The output format resolved from the parent and current configs.

  • forward – The configuration for changing from the input format to output format (the current config is merged with the parents)

  • reverse – The configuration for changing from the output format to input format (the current config is merged with the parents)

class converter.mapping.file.FileMapping(config, search_paths: List[str] = None, standard_search_path: str = os.path.join(os.path.dirname(__file__), '..', '_data', 'mappings'), search_working_dir=True, **options)

Bases: converter.mapping.base.BaseMapping

A mapping of all file mapping on the system in the search directories.

Parameters
  • config – The global config for the system

  • search_paths – All the paths in the system to check for configs

property raw_configs(self) Dict[str, RawMappingConfig]

Gets the raw configs from teh system. If they have not yet been loaded they are loaded here.

property mapping_specs(self) Reversible[FileMappingSpec]

Gets all the hydrated mapping configs keyed by their absolute paths. If they have not already been loaded they are loaded here.