msticpy.config.mp_config_control module

MP Config Control Class.

class msticpy.config.mp_config_control.MpConfigControls(mp_config_def: Dict[str, Any], mp_config: Dict[str, Any])

Bases: object

Msticpy configuration and settings database.

Return an instance of MpConfigControls.

Parameters:
  • mp_config_def (Dict[str, Any]) – Msticpy config setting definitions.

  • mp_config (Dict[str, Any]) – Msticpy Settings dictionary

del_control(path: str)

Delete the control stored at path.

del_value(path: str, keep_ctrl: bool = False)

Delete setting item at path.

get_control(path: str) Any

Return the control stored at path.

get_defn(path: str) Dict[str, Any] | Tuple[str, Any]

Return the setting definition at path.

get_value(path: str) Any

Return setting value at path.

populate_ctrl_values(path: str)

Populate control at path from settings at path.

rename_path(old_path: str, new_path: str)

Rename a setting from old_path to new_path.

save_ctrl_values(path: str)

Save the values in the control at path to settings.

set_control(path: str, control)

Set the control stored at path.

set_value(path: str, value: Any)

Set setting value at path to value.

validate_all_settings(show_all: bool = False) List[ValidationResult]

Validate settings against definitions.

Parameters:

show_all (bool, optional) – Show success validations as well as failures, by default False

Returns:

List of validation results: bool - True == valid status - validation result description

Return type:

List[ValidtnResult]

validate_setting(path: str, defn_path: str | None = None, show_all: bool = False) List[ValidationResult]

Validate settings against definitions for a specific path.

Parameters:
  • path (str) – The setting path

  • defn_path (Optional[str], optional) – The definition path, by default None Unless, specified this is the same as the setting path

  • show_all (bool, optional) – Return successful as well as failed validation results , by default False

Returns:

List of validation results: bool - True == valid status - validation result description

Return type:

List[ValidtnResult]

class msticpy.config.mp_config_control.ValidationResult(result, status)

Bases: tuple

Create new instance of ValidationResult(result, status)

count(value, /)

Return number of occurrences of value.

index(value, start=0, stop=9223372036854775807, /)

Return first index of value.

Raises ValueError if the value is not present.

result

Alias for field number 0

status

Alias for field number 1

msticpy.config.mp_config_control.get_mpconfig_definitions() Dict[str, Any]

Return the current msticpyconfig definition dictionary.

Returns:

msticpyconfig definition dictionary

Return type:

Dict[str, Any]

Raises:

ValueError: – Could not load definitions from resources/mpconfig_defaults.yaml