LMIUtil.LMIPassByRef(val)[source]¶Helper class used for passing a value by reference. It uses the advantage of python, where all the dictionaries are passed by reference.
| Parameters: | val – value, which will be passed by reference |
|---|
Example of usage:
by_ref = LMIPassByRef(some_value)
by_ref.value == some_value
value¶| Returns: | value passed by reference. |
|---|
LMIUtil.LMIUseExceptionsHelper[source]¶Singleton helper class used for storing a bool flag, which defines, if the LMIShell should propagate exceptions or dump them.
use_exceptions¶| Returns: | whether the LMIShell should propagate the exceptions, or throw them away |
|---|---|
| Return type: | bool |
LMIUtil.lmi_associators(assoc_classes)[source]¶Helper function to speed up associator traversal. Returns a list of tuples, where each
tuple contains LMIInstance objects, which are in association.
| Parameters: | assoc_classes (list) – list of LMIClass objects, for which the
associations will be returned |
|---|---|
| Returns: | list of tuples of LMIInstance objects in association |
LMIUtil.lmi_cast_to_cim(t, value)[source]¶Casts the value to CIM type.
| Parameters: |
|
|---|---|
| Returns: | cast value in |
LMIUtil.lmi_cast_to_lmi(t, value)[source]¶Casts the value to LMI (python) type.
| Parameters: |
|
|---|---|
| Returns: | cast value in |
LMIUtil.lmi_get_use_exceptions()[source]¶| Returns: | whether the LMIShell should use the exceptions, or throw them away |
|---|---|
| Return type: | bool |
LMIUtil.lmi_isinstance(lmi_obj, lmi_class)[source]¶Function returns True if lmi_obj is an instance of a lmi_class, False
otherwise. When passed LMIInstance, LMIInstanceName as
lmi_obj and lmi_class is of LMIClass type, function can
tell, if such lmi_obj is direct instance of LMIClass, or it’s
super class.
If lmi_obj and lmi_class is not instance of mentioned classes, an
exception will be raised.
| Parameters: |
|
|---|---|
| Returns: | whether lmi_obj is instance of lmi_class |
| Return type: | bool |
| Raises: |
|
LMIUtil.lmi_raise_or_dump_exception(e=None)[source]¶Function which either raises an exception, or throws it away.
| Parameters: | e (Exception) – exception, which will be either raised or thrown away |
|---|
LMIUtil.lmi_set_use_exceptions(use=True)[source]¶Sets a global flag indicating, if the LMIShell should use the exceptions, or throw them away.
| Parameters: | use (bool) – specifies, whether the LMIShell should use the exceptions |
|---|
LMIUtil.lmi_transform_to_cim_param(t, value)[source]¶Helper function for method calls, which transforms input object into
CIMInstanceName object. Members if lists, dictionaries and tuples are
transformed as well. The function does not cast numeric types.
| Parameters: |
|
|---|---|
| Returns: | transformed LMIShell’s object into |
LMIUtil.lmi_transform_to_lmi(conn, value)[source]¶Transforms returned values from a method call into LMI wrapped objects. Returns
transformed input, where CIMInstance and CIMInstanceName are
wrapped into LMI wrapper classes and primitive types are cast to python native types.
| Parameters: |
|
|---|---|
| Returns: | transformed py: |
LMIUtil.lmi_wrap_cim_class(conn, cim_class_name, cim_namespace_name)[source]¶Helper function, which returns wrapped CIMClass into LMIClass.
| Parameters: |
|
|---|---|
| Returns: | wrapped |
LMIUtil.lmi_wrap_cim_instance(conn, cim_instance, cim_class_name, cim_namespace_name)[source]¶Helper function, which returns wrapped CIMInstance into
LMIInstance.
| Parameters: |
|
|---|---|
| Returns: | wrapped |
LMIUtil.lmi_wrap_cim_instance_name(conn, cim_instance_name)[source]¶Helper function, which returns wrapped CIMInstanceName into
LMIInstanceName.
| Parameters: |
|
|---|---|
| Returns: | wrapped |
LMIUtil.lmi_wrap_cim_method(conn, cim_method_name, lmi_instance, sync_method)[source]¶Helper function, which returns wrapped CIMMethod into
LMIMethod.
| Parameters: |
|
|---|---|
| Returns: | wrapped |
LMIUtil.lmi_wrap_cim_namespace(conn, cim_namespace_name)[source]¶Helper function, which returns wrapped CIM namespace in LMINamespace.
| Parameters: |
|
|---|---|
| Returns: | wrapped CIM namespace into |