LMIConsole Package

class lmi.shell.LMIConsole.LMIConsole(cwd_first_in_path=False)

Class representing an interactive console.

DEFAULT_LOCALS = {'LMIReturnValue': <class 'lmi.shell.LMIReturnValue.LMIReturnValue'>, 'LMIClass': <class 'lmi.shell.LMIClass.LMIClass'>, 'LMINamespace': <class 'lmi.shell.LMINamespace.LMINamespace'>, 'lmi_isinstance': <function lmi_isinstance at 0x7f0d97dffde8>, 'LMIConnection': <class 'lmi.shell.LMIConnection.LMIConnection'>, 'help': Type help() to see man page for lmishell, or help(object) for help about object., 'LMIInstance': <class 'lmi.shell.LMIInstance.LMIInstance'>, 'LMICIMXMLClient': <class 'lmi.shell.LMICIMXMLClient.LMICIMXMLClient'>, 'ConnectionError': <class 'lmi.shell.LMIExceptions.ConnectionError'>, 'LMIShellOptions': <class 'lmi.shell.LMIShellOptions.LMIShellOptions'>, 'LMIMethod': <class 'lmi.shell.LMIMethod.LMIMethod'>, 'CIMError': <class 'lmi.shell.LMIExceptions.CIMError'>, 'lmi_associators': <function lmi_associators at 0x7f0d97dffe60>, 'LMIShellConfig': <class 'lmi.shell.LMIShellConfig.LMIShellConfig'>, 'LMIShellClient': <class 'lmi.shell.LMIShellClient.LMIShellClient'>, 'LMIPassByRef': <class 'lmi.shell.LMIUtil.LMIPassByRef'>, '__name__': '__main__', 'LMISubscription': <class 'lmi.shell.LMISubscription.LMISubscription'>, 'LMINamespaceRoot': <class 'lmi.shell.LMINamespace.LMINamespaceRoot'>, 'LMIWSMANClient': <class 'lmi.shell.LMIWSMANClient.LMIWSMANClient'>, 'LMIInstanceName': <class 'lmi.shell.LMIInstanceName.LMIInstanceName'>, 'use_exceptions': <function lmi_set_use_exceptions at 0x7f0d97dff7d0>, 'LMIIndicationListener': <class 'lmi.shell.LMIIndicationListener.LMIIndicationListener'>}
SHELL_PS1 = '> '
SHELL_PS2 = '... '
clear_history()

Clears the current history.

interact(locals=None)

Starts the interactive mode.

Parameters:locals (dictionary) – locals
interpret(script_name, script_argv, locals=None, interactive=False)

Interprets a specified script within additional provided locals. There are LMIConsole.DEFAULT_LOCALS present.

Parameters:
  • script_name (string) – script name
  • script_argv (list) – script CLI arguments
  • locals (dictionary) – dictionary with locals
  • interactive (bool) – tells LMIShell, if the script should be treated as if it was run in interactive mode
Returns:

exit code of the script

Return type:

int

load_history()

Loads the shell’s history from the history file.

save_history()

Saves current history of commands into the history file. If the length of history exceeds a maximum history file length, the history will be truncated.

set_verify_server_certificate(verify_server_cert=True)

Turns on or off server side certificate verification, if SSL used.

Parameters:verify_server_cert (bool) – – flag which tells, whether a server side certificate needs to be verified, if SSL used
setup_completer()

Initializes tab-completer.