cars_mesh.config

Main configuration module of cars-mesh tool.

Module Contents

Functions

check_general_items(→ dict)

Check general items in configuration

check_state_machine(→ dict)

Check state machine parameters in configuration

make_relative_path_absolute(path, directory)

If path is a valid relative path with respect to directory,

read_config(→ dict)

Read and check if the config path is valid and readable

check_config(→ dict)

Global read and check if the config is readable (read_config),

save_config_file(config_file, config)

Save a json configuration file

cars_mesh.config.check_general_items(cfg: dict) dict[source]

Check general items in configuration

Parameters:

cfg (dict) – Configuration dictionary

Returns:

cfg – Configuration dictionary updated

Return type:

dict

cars_mesh.config.check_state_machine(cfg: dict) dict[source]

Check state machine parameters in configuration

Parameters:

cfg (dict) – Configuration dictionary

Returns:

cfg – Configuration dictionary updated

Return type:

dict

cars_mesh.config.make_relative_path_absolute(path, directory)[source]

If path is a valid relative path with respect to directory, returns it as an absolute path

Parameters:
  • path (string) – The relative path

  • directory (string) – The directory path should be relative to

Returns:

os.path.join(directory,path) if path is a valid relative path form directory, else path

Return type:

string

cars_mesh.config.read_config(cfg_path: str) dict[source]

Read and check if the config path is valid and readable and returns cfg if valid

Parameters:

cfg_path (str) – Path to the JSON configuration file

Returns:

cfg – Configuration dictionary

Return type:

dict

cars_mesh.config.check_config(cfg_path: str) dict[source]

Global read and check if the config is readable (read_config), with valid contents (check_general_items) and valid state machine (check_state_machine)

and returns read cfg at the end if valid

Parameters:

cfg_path (str) – Path to the JSON configuration file

Returns:

cfg – Configuration dictionary

Return type:

dict

cars_mesh.config.save_config_file(config_file: str, config: dict)[source]

Save a json configuration file

Parameters:
  • config_file (string) – path to a json file

  • config (Dict[str, Any]) – configuration json dictionary