Package pywbem :: Module cim_obj :: Class CIMProperty

[frames] | no frames]

# Class CIMProperty

source code

    object --+
             |
            CIMProperty

A CIM property.

The property can be used in a CIM instance (as part of a CIMInstance object) or in a CIM class (as part of a CIMClass object).

For properties in CIM instances:

> - The `value` instance variable is the actual value of the property.
> - Qualifiers are not allowed.

For properties in CIM classes:

> - The `value` instance variable is the default value for the property.
> - Qualifiers are allowed.

Scalar (=non-array) properties may have a value of NULL (= `None`), any primitive CIM type, reference type, and string type with embedded instance or embedded object.

Array properties may be Null or may have elements with a value of NULL, any primitive CIM type, and string type with embedded instance or embedded object. Reference types are not allowed in property arrays in CIM, as per DMTF DSP0004.

Instance Methods

__init__(self, name, value, type=None, class_origin=None, array_size=None, propagated=None, is_array=None, reference_class=None, qualifiers=None, embedded_object=None) Initialize the CIMProperty object. | source code

copy(self) | source code

__repr__(self) repr(x) | source code

tocimxml(self) | source code

__cmp__(self, other) | source code

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, name, value, type=None, class_origin=None, array_size=None, propagated=None, is_array=None, reference_class=None, qualifiers=None, embedded_object=None)
(Constructor)

source code

Initialize the CIMProperty object.

This function infers optional arguments that are not specified (for example, it infers `type` from the Python type of `value` and other information). If the specified arguments are inconsistent, an exception is raised. If an optional argument is needed for some reason, an exception is raised.

Examples:

> - CIMProperty("MyString", "abc") -> a string property
> - CIMProperty("MyNum", 42, "uint8") -> a uint8 property
> - CIMProperty("MyNum", Uint8(42)) -> a uint8 property
> - CIMProperty("MyNumArray", [1,2,3], "uint8") -> a uint8 array property
> - CIMProperty("MyRef", CIMInstanceName(...)) -> a reference property
> - CIMProperty("MyEmbObj", CIMClass(...)) -> an embedded object property containing a class
> - `CIMProperty("MyEmbObj", CIMInstance(...), embedded_object='object')` -> an embedded object property containing an instance
> - CIMProperty("MyEmbInst", CIMInstance(...)) -> an embedded instance property
> - CIMProperty("MyString", None, "string") -> a string property that is Null
> - CIMProperty("MyNum", None, "uint8") -> a uint8 property that is Null
> - CIMProperty("MyRef", None, reference_class="MyClass") -> a reference property that is Null
> - CIMProperty("MyEmbObj", None, embedded_object='object') -> an embedded object property that is Null
> - CIMProperty("MyEmbInst", None, embedded_object='instance') -> an embedded instance property that is Null

Parameters:
  - `name` (`unicode` or UTF-8 encoded `str`) - Name of the property. Must not be `None`.
  - `value` - Value of the property (interpreted as actual value when the property object is used in an instance, and as default value when it is used in a class). For valid types for CIM values, see cim_types.
  - `type` (string) - Name of the CIM type of the property (e.g. `'uint8'`). `None` means that the argument is unspecified, causing the corresponding instance variable to be inferred. An exception is raised if it cannot be inferred.
  - `class_origin` (`unicode` or UTF-8 encoded `str`) - The CIM class origin of the property (the name of the most derived class that defines or overrides the property in the class hierarchy of the class owning the property). `None` means that class origin information is not available.
  - `array_size` (`int`) - The size of the array property, for fixed-size arrays. `None` means that the array property has variable size.
  - `propagated` (`unicode` or UTF-8 encoded `str`) - The CIM propagated attribute of the property (the effective value of the `Propagated` qualifier of the property, which is a string that specifies the name of the source property from which the property value should be propagated). `None` means that propagation information is not available.
  - `is_array` (`bool`) - A boolean indicating whether the property is an array (`True`) or a scalar (`False`). `None` means that the argument is unspecified, causing the corresponding instance variable to be inferred from the `value` parameter, and if that is `None` it defaults to `False` (scalar).
  - `reference_class` (`unicode` or UTF-8 encoded `str`) - The name of the referenced class, for reference properties. `None` means that the argument is unspecified, causing the corresponding instance variable to be inferred. An exception is raised if it cannot be inferred.
  - `qualifiers` (`dict` or NocaseDict) - A dictionary specifying CIM qualifier values. The dictionary keys must be the qualifier names. The dictionary values must be CIMQualifier objects specifying the qualifier values. `None` means that there are no qualifier values. In all cases, the `qualifiers` instance variable will be a NocaseDict object.
  - `embedded_object` (string) - A string value indicating the kind of embedded object represented by the property value. The following values are defined for this argument: `'instance'`: The property is declared with the `EmbeddedInstance` qualifier, indicating that the property value is an embedded instance of a known class name (or Null). `'object'`: The property is declared with the `EmbeddedObject` qualifier, indicating that the property value is an embedded object (instance or class) of which the class name is not known (or Null). `None` means that the argument is unspecified, causing the corresponding instance variable to be inferred. An exception is raised if it cannot be inferred.
Raises:
  - `TypeError`
  - `ValueError`
Overrides: object.__init__

### __repr__(self)
(Representation operator)

source code

repr(x)

Overrides: object.__repr__
  (inherited documentation)