Package pywbem :: Module cim_obj :: Class CIMInstance
[frames] | no frames]

Class CIMInstance

source code

                   object --+    
                            |    
cim_types._CIMComparisonMixin --+
                                |
                               CIMInstance

A CIM instance, optionally including its instance path.

This object can be used like a dictionary to retrieve the property values.

Instance Methods
 
__init__(self, classname, properties={}, qualifiers={}, path=None, property_list=None)
Initialize the CIMInstance object.
source code
None
update(D, E, **F)
Update D from E and F: for k in E: D[k] = E[k] (if E has keys else: for (k, v) in E: D[k] = v) then: for k in F: D[k] = F[k]
source code
 
update_existing(self, *args, **kwargs)
Update property values iff the property previously exists.
source code
 
copy(self)
Return copy of the CIMInstance object
source code
 
__repr__(self)
Return string for CIMInstance in name=value form.
source code
 
__contains__(self, key)
Test if argument key is one of the properteis
source code
 
__getitem__(self, key)
Return the property with key
source code
 
__delitem__(self, key) source code
 
__len__(self)
Return number of properties
source code
 
has_key(self, key)
Return boolean True if there is a key property
source code
 
keys(self)
return keys for properties in instance
source code
 
values(self) source code
 
items(self)
return key and value for property.items
source code
 
iterkeys(self) source code
 
itervalues(self)
Iterate through properties returning value
source code
 
iteritems(self)
Iterate through properties returing key, value tuples
source code
 
__setitem__(self, key, value) source code
 
get(self, key, default=None)
Get the value of a specific property, or the specified default value if a property with that name does not exist.
source code
 
tocimxml(self)
Return string with CIM/XML representing this CIMInstance.
source code
 
tomof(self, indent=7)
Return string representing the MOF definition of this CIMInstance.
source code

Inherited from cim_types._CIMComparisonMixin: __eq__, __ge__, __gt__, __le__, __lt__, __ne__

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __setattr__, __sizeof__, __str__, __subclasshook__

Instance Variables
  ...
All parameters of __init__ are set as instance variables.
Properties

Inherited from object: __class__

Method Details

__init__(self, classname, properties={}, qualifiers={}, path=None, property_list=None)
(Constructor)

source code 
Initialize the CIMInstance object.
Parameters:
  • classname (Unicode string or UTF-8 encoded byte string) - Name of the creation class of the instance.
  • properties (dict or NocaseDict) - Optional: Dictionary of properties, specifying property values of the instance. The dictionary must contain one item for each property, where:

    • its key is the property name.
    • its value is a CIMProperty object representing the property value.
  • qualifiers (dict or NocaseDict) - Optional: Dictionary of qualifier values of the instance. Note that CIM-XML has deprecated the presence of qualifier values on CIM instances.
  • path (CIMInstanceName) - Optional: Instance path of the instance.

    If None, the instance is not addressable or the instance path is unknown or not needed.

    Default: None.

  • property_list (list of Unicode strings or UTF-8 encoded byte strings) - Optional: List of property names for use by some operations on this object.
Raises:
  • TypeError
  • ValueError
Overrides: object.__init__

update_existing(self, *args, **kwargs)

source code 

Update property values iff the property previously exists.

Update D from E and F: for k in E: D[k] = E[k] (if E has keys else: for (k, v) in E: D[k] = v) then: for k in F: D[k] = F[k]

Like update, but properties that are not already present in the instance are skipped.

__repr__(self)
(Representation operator)

source code 
Return string for CIMInstance in name=value form. Note that it does not show all the properties and qualifiers because they're just too big.
Overrides: object.__repr__