cli
"Command Line Interface for openml
to configure its settings.
configure(args)
¶
Calls the right submenu(s) to edit args.field
in the configuration file.
Source code in openml/cli.py
configure_field(field, value, check_with_message, intro_message, input_message, sanitize=None)
¶
Configure field
with value
. If value
is None ask the user for input.
value
and user input are first corrected/auto-completed with convert_value
if provided,
then validated with check_with_message
function.
If the user input a wrong value in interactive mode, the user gets to input a new value.
The new valid value is saved in the openml configuration file.
In case an invalid value
is supplied directly (non-interactive), no changes are made.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
field
|
str
|
Field to set. |
required |
value
|
None | str
|
Value to field to. If |
required |
check_with_message
|
Callable[[str], str]
|
Function which validates |
required |
intro_message
|
str
|
Message that is printed once if user input is requested (e.g. instructions). |
required |
input_message
|
str
|
Message that comes with the input prompt. |
required |
sanitize
|
Callable[[str], str] | None
|
A function to convert user input to 'more acceptable' input, e.g. for auto-complete. If no correction of user input is possible, return the original value. If no function is provided, don't attempt to correct/auto-complete input. |
None
|
Source code in openml/cli.py
wait_until_valid_input(prompt, check, sanitize)
¶
Asks prompt
until an input is received which returns True for check
.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
prompt
|
str
|
message to display |
required |
check
|
Callable[[str], str]
|
function to call with the given input, that provides an error message if the input is not valid otherwise, and False-like otherwise. |
required |
sanitize
|
Callable[[str], str] | None
|
A function which attempts to sanitize the user input (e.g. auto-complete). |
required |
Returns:
Type | Description |
---|---|
valid input
|
|