core.internals.common

Submodule of khiops.core.internals

Common utility functions and classes

Functions

deprecation_message

Formats a deprecation message

invalid_keys_message

Formats an invalid keyword parameter message

is_dict_like

Returns True if an object is dict-like

is_iterable

Return True if a container object is iterable, but not string-like

is_list_like

Returns True if an object is list-like

is_string_like

Returns True if an object is a valid Python string or sequence of bytes

type_error_message

Formats a type error message

Classes

CommandLineOptions

Khiops command line options

SystemSettings

Khiops system settings

class khiops.core.internals.common.CommandLineOptions(log_file_path='', task_file_path='', output_scenario_path='')

Bases: object

Khiops command line options

Attributes:
log_file_pathstr, default “”

Path of the log file for the Khiops process (command line option -e of the desktop app). If equal to “” then it writes no log file.

output_scenario_pathstr, default “”

Path of the output Khiops scenario file (command line option -o of the desktop app). If the empty string is specified no output scenario file is generated.

task_file_pathstr, default “”

Path of the task file for the Khiops process (command line option -p of the desktop app). If equal to “” then it writes no task file.

check()

Checks the types of the command line options

Raises:
TypeError

If any of the command line options does not have the proper type.

class khiops.core.internals.common.SystemSettings(max_cores=None, memory_limit_mb=None, temp_dir='', scenario_prologue='')

Bases: object

Khiops system settings

Note

These settings are not available in the CommandLineOptions.

check()

Checks the types of the system settings

Raises:
TypeError

If any of the system settings does not have the proper type.

ValueError

If max_cores or memory_limit_mb are set to negative numbers.

khiops.core.internals.common.deprecation_message(deprecated_feature, deadline_version, replacement=None, quote=True)

Formats a deprecation message

khiops.core.internals.common.invalid_keys_message(kwargs)

Formats an invalid keyword parameter message

khiops.core.internals.common.is_dict_like(test_object)

Returns True if an object is dict-like

An object is dict-like if and only if inherits from the collections.abc.Mapping.

khiops.core.internals.common.is_iterable(test_object)

Return True if a container object is iterable, but not string-like

khiops.core.internals.common.is_list_like(list_like)

Returns True if an object is list-like

An object is list-like if and only if inherits from collections.abc.Sequence and it is not string-like

khiops.core.internals.common.is_string_like(test_object)

Returns True if an object is a valid Python string or sequence of bytes

khiops.core.internals.common.type_error_message(variable_name, variable, *target_types)

Formats a type error message

Parameters:
variable_namestr

Name of the variable for whom the type error is signaled.

variableany

Actual variable for whom the type error is signaled.

target_typeslist

Expected types for variable, either as a type or as a string.

Returns:
str

The type error message.