core.internals.common¶
Submodule of khiops.core.internals
Common utility functions and classes
Functions¶
Creates a path that is unambiguous for Khiops |
|
Formats a deprecation message |
|
Formats an invalid keyword parameter message |
|
Returns True if an object is dict-like |
|
Return True if a container object is iterable, but not string-like |
|
Returns True if an object is list-like |
|
Returns True if an object is a valid Python string or sequence of bytes |
|
Formats a feature removal message |
|
Formats a feature renaming message |
|
Formats a type error message |
Classes¶
Khiops command line options |
|
Khiops system settings |
- class khiops.core.internals.common.CommandLineOptions(batch_mode=True, 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.- batch_modebool, default True
Deprecated Will be removed in Khiops 11. If
True
activates batch mode (command line option-b
of the app).
- 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
ormemory_limit_mb
are set to negative numbers.
- khiops.core.internals.common.create_unambiguous_khiops_path(path)¶
Creates a path that is unambiguous for Khiops
Khiops needs that a non absolute path starts with “.” so that it does not use the path of an internally saved state as reference point.
For example: if we open the data table “/some/path/to/data.txt” and then set the results directory simply as “results” the effective location of the results directory will be “/some/path/to/results” instead of “$CWD/results”. This behavior is a feature in the Khiops GUI but it is undesirable when using it as a library.
This function returns a path so that the library behaves as expected: a path relative to the $CWD if it is a non absolute path.
- 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 thecollections.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 fromcollections.abc.Sequence
and it is notstring-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.removal_message(removed_feature, since, replacement=None)¶
Formats a feature removal message
- khiops.core.internals.common.renaming_message(renamed_feature, new_name, since)¶
Formats a feature renaming message
- 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.