repo
stringlengths
7
55
path
stringlengths
4
127
func_name
stringlengths
1
88
original_string
stringlengths
75
19.8k
language
stringclasses
1 value
code
stringlengths
75
19.8k
code_tokens
listlengths
20
707
docstring
stringlengths
3
17.3k
docstring_tokens
listlengths
3
222
sha
stringlengths
40
40
url
stringlengths
87
242
partition
stringclasses
1 value
idx
int64
0
252k
pywbem/pywbem
pywbem/tupleparse.py
TupleParser.parse_iparamvalue
def parse_iparamvalue(self, tup_tree): """ Parse expected IPARAMVALUE element. I.e. :: <!ELEMENT IPARAMVALUE (VALUE | VALUE.ARRAY | VALUE.REFERENCE | INSTANCENAME | CLASSNAME | QUALIFIER.DECLARATION | ...
python
def parse_iparamvalue(self, tup_tree): """ Parse expected IPARAMVALUE element. I.e. :: <!ELEMENT IPARAMVALUE (VALUE | VALUE.ARRAY | VALUE.REFERENCE | INSTANCENAME | CLASSNAME | QUALIFIER.DECLARATION | ...
[ "def", "parse_iparamvalue", "(", "self", ",", "tup_tree", ")", ":", "self", ".", "check_node", "(", "tup_tree", ",", "'IPARAMVALUE'", ",", "(", "'NAME'", ",", ")", ")", "child", "=", "self", ".", "optional_child", "(", "tup_tree", ",", "(", "'VALUE'", ",...
Parse expected IPARAMVALUE element. I.e. :: <!ELEMENT IPARAMVALUE (VALUE | VALUE.ARRAY | VALUE.REFERENCE | INSTANCENAME | CLASSNAME | QUALIFIER.DECLARATION | CLASS | INSTANCE | VALUE.NAMEDINSTAN...
[ "Parse", "expected", "IPARAMVALUE", "element", ".", "I", ".", "e", "." ]
e54ecb82c2211e289a268567443d60fdd489f1e4
https://github.com/pywbem/pywbem/blob/e54ecb82c2211e289a268567443d60fdd489f1e4/pywbem/tupleparse.py#L2030-L2061
train
28,300
pywbem/pywbem
pywbem/tupleparse.py
TupleParser.parse_embeddedObject
def parse_embeddedObject(self, val): # pylint: disable=invalid-name """ Parse and embedded instance or class and return the CIMInstance or CIMClass. Parameters: val (string): The string value that contains the embedded object in CIM-XML format....
python
def parse_embeddedObject(self, val): # pylint: disable=invalid-name """ Parse and embedded instance or class and return the CIMInstance or CIMClass. Parameters: val (string): The string value that contains the embedded object in CIM-XML format....
[ "def", "parse_embeddedObject", "(", "self", ",", "val", ")", ":", "# pylint: disable=invalid-name", "if", "type", "(", "val", ")", "==", "list", ":", "# pylint: disable=unidiomatic-typecheck", "return", "[", "self", ".", "parse_embeddedObject", "(", "obj", ")", "f...
Parse and embedded instance or class and return the CIMInstance or CIMClass. Parameters: val (string): The string value that contains the embedded object in CIM-XML format. One level of XML entity references have already been unescaped. Exampl...
[ "Parse", "and", "embedded", "instance", "or", "class", "and", "return", "the", "CIMInstance", "or", "CIMClass", "." ]
e54ecb82c2211e289a268567443d60fdd489f1e4
https://github.com/pywbem/pywbem/blob/e54ecb82c2211e289a268567443d60fdd489f1e4/pywbem/tupleparse.py#L2091-L2157
train
28,301
pywbem/pywbem
pywbem/tupleparse.py
TupleParser.unpack_value
def unpack_value(self, tup_tree): """ Find VALUE or VALUE.ARRAY under tup_tree and convert to a Python value. Looks at the TYPE of the node to work out how to decode it. Handles nodes with no value (e.g. when representing NULL by omitting VALUE) """ valtype = at...
python
def unpack_value(self, tup_tree): """ Find VALUE or VALUE.ARRAY under tup_tree and convert to a Python value. Looks at the TYPE of the node to work out how to decode it. Handles nodes with no value (e.g. when representing NULL by omitting VALUE) """ valtype = at...
[ "def", "unpack_value", "(", "self", ",", "tup_tree", ")", ":", "valtype", "=", "attrs", "(", "tup_tree", ")", "[", "'TYPE'", "]", "raw_val", "=", "self", ".", "list_of_matching", "(", "tup_tree", ",", "(", "'VALUE'", ",", "'VALUE.ARRAY'", ")", ")", "if",...
Find VALUE or VALUE.ARRAY under tup_tree and convert to a Python value. Looks at the TYPE of the node to work out how to decode it. Handles nodes with no value (e.g. when representing NULL by omitting VALUE)
[ "Find", "VALUE", "or", "VALUE", ".", "ARRAY", "under", "tup_tree", "and", "convert", "to", "a", "Python", "value", "." ]
e54ecb82c2211e289a268567443d60fdd489f1e4
https://github.com/pywbem/pywbem/blob/e54ecb82c2211e289a268567443d60fdd489f1e4/pywbem/tupleparse.py#L2159-L2188
train
28,302
pywbem/pywbem
pywbem/tupleparse.py
TupleParser.unpack_boolean
def unpack_boolean(self, data): """ Unpack a string value of CIM type 'boolean' and return its CIM data type object, or None. data (unicode string): CIM-XML string value, or None (in which case None is returned). """ if data is None: return None ...
python
def unpack_boolean(self, data): """ Unpack a string value of CIM type 'boolean' and return its CIM data type object, or None. data (unicode string): CIM-XML string value, or None (in which case None is returned). """ if data is None: return None ...
[ "def", "unpack_boolean", "(", "self", ",", "data", ")", ":", "if", "data", "is", "None", ":", "return", "None", "# CIM-XML says \"These values MUST be treated as case-insensitive\"", "# (even though the XML definition requires them to be lowercase.)", "data_", "=", "data", "....
Unpack a string value of CIM type 'boolean' and return its CIM data type object, or None. data (unicode string): CIM-XML string value, or None (in which case None is returned).
[ "Unpack", "a", "string", "value", "of", "CIM", "type", "boolean", "and", "return", "its", "CIM", "data", "type", "object", "or", "None", "." ]
e54ecb82c2211e289a268567443d60fdd489f1e4
https://github.com/pywbem/pywbem/blob/e54ecb82c2211e289a268567443d60fdd489f1e4/pywbem/tupleparse.py#L2222-L2254
train
28,303
pywbem/pywbem
pywbem/tupleparse.py
TupleParser.unpack_numeric
def unpack_numeric(self, data, cimtype): """ Unpack a string value of a numeric CIM type and return its CIM data type object, or None. data (unicode string): CIM-XML string value, or None (in which case None is returned). cimtype (string): CIM data type name (e.g. 'ui...
python
def unpack_numeric(self, data, cimtype): """ Unpack a string value of a numeric CIM type and return its CIM data type object, or None. data (unicode string): CIM-XML string value, or None (in which case None is returned). cimtype (string): CIM data type name (e.g. 'ui...
[ "def", "unpack_numeric", "(", "self", ",", "data", ",", "cimtype", ")", ":", "if", "data", "is", "None", ":", "return", "None", "# DSP0201 defines numeric values to be whitespace-tolerant", "data", "=", "data", ".", "strip", "(", ")", "# Decode the CIM-XML string re...
Unpack a string value of a numeric CIM type and return its CIM data type object, or None. data (unicode string): CIM-XML string value, or None (in which case None is returned). cimtype (string): CIM data type name (e.g. 'uint8'), or None (in which case the value is returned...
[ "Unpack", "a", "string", "value", "of", "a", "numeric", "CIM", "type", "and", "return", "its", "CIM", "data", "type", "object", "or", "None", "." ]
e54ecb82c2211e289a268567443d60fdd489f1e4
https://github.com/pywbem/pywbem/blob/e54ecb82c2211e289a268567443d60fdd489f1e4/pywbem/tupleparse.py#L2256-L2310
train
28,304
pywbem/pywbem
pywbem/tupleparse.py
TupleParser.unpack_datetime
def unpack_datetime(self, data): """ Unpack a CIM-XML string value of CIM type 'datetime' and return it as a CIMDateTime object, or None. data (unicode string): CIM-XML string value, or None (in which case None is returned). """ if data is None: re...
python
def unpack_datetime(self, data): """ Unpack a CIM-XML string value of CIM type 'datetime' and return it as a CIMDateTime object, or None. data (unicode string): CIM-XML string value, or None (in which case None is returned). """ if data is None: re...
[ "def", "unpack_datetime", "(", "self", ",", "data", ")", ":", "if", "data", "is", "None", ":", "return", "None", "try", ":", "value", "=", "CIMDateTime", "(", "data", ")", "except", "ValueError", "as", "exc", ":", "raise", "CIMXMLParseError", "(", "_form...
Unpack a CIM-XML string value of CIM type 'datetime' and return it as a CIMDateTime object, or None. data (unicode string): CIM-XML string value, or None (in which case None is returned).
[ "Unpack", "a", "CIM", "-", "XML", "string", "value", "of", "CIM", "type", "datetime", "and", "return", "it", "as", "a", "CIMDateTime", "object", "or", "None", "." ]
e54ecb82c2211e289a268567443d60fdd489f1e4
https://github.com/pywbem/pywbem/blob/e54ecb82c2211e289a268567443d60fdd489f1e4/pywbem/tupleparse.py#L2312-L2330
train
28,305
pywbem/pywbem
pywbem/tupleparse.py
TupleParser.unpack_char16
def unpack_char16(self, data): """ Unpack a CIM-XML string value of CIM type 'char16' and return it as a unicode string object, or None. data (unicode string): CIM-XML string value, or None (in which case None is returned). """ if data is None: ret...
python
def unpack_char16(self, data): """ Unpack a CIM-XML string value of CIM type 'char16' and return it as a unicode string object, or None. data (unicode string): CIM-XML string value, or None (in which case None is returned). """ if data is None: ret...
[ "def", "unpack_char16", "(", "self", ",", "data", ")", ":", "if", "data", "is", "None", ":", "return", "None", "len_data", "=", "len", "(", "data", ")", "if", "len_data", "==", "0", ":", "raise", "CIMXMLParseError", "(", "\"Char16 value is empty\"", ",", ...
Unpack a CIM-XML string value of CIM type 'char16' and return it as a unicode string object, or None. data (unicode string): CIM-XML string value, or None (in which case None is returned).
[ "Unpack", "a", "CIM", "-", "XML", "string", "value", "of", "CIM", "type", "char16", "and", "return", "it", "as", "a", "unicode", "string", "object", "or", "None", "." ]
e54ecb82c2211e289a268567443d60fdd489f1e4
https://github.com/pywbem/pywbem/blob/e54ecb82c2211e289a268567443d60fdd489f1e4/pywbem/tupleparse.py#L2332-L2367
train
28,306
pywbem/pywbem
examples/enuminstances.py
execute_request
def execute_request(server_url, creds, namespace, classname): """ Open a connection with the server_url and creds, and enumerate instances defined by the functions namespace and classname arguments. Displays either the error return or the mof for instances returned. """ prin...
python
def execute_request(server_url, creds, namespace, classname): """ Open a connection with the server_url and creds, and enumerate instances defined by the functions namespace and classname arguments. Displays either the error return or the mof for instances returned. """ prin...
[ "def", "execute_request", "(", "server_url", ",", "creds", ",", "namespace", ",", "classname", ")", ":", "print", "(", "'Requesting url=%s, ns=%s, class=%s'", "%", "(", "server_url", ",", "namespace", ",", "classname", ")", ")", "try", ":", "# Create a connection"...
Open a connection with the server_url and creds, and enumerate instances defined by the functions namespace and classname arguments. Displays either the error return or the mof for instances returned.
[ "Open", "a", "connection", "with", "the", "server_url", "and", "creds", "and", "enumerate", "instances", "defined", "by", "the", "functions", "namespace", "and", "classname", "arguments", ".", "Displays", "either", "the", "error", "return", "or", "the", "mof", ...
e54ecb82c2211e289a268567443d60fdd489f1e4
https://github.com/pywbem/pywbem/blob/e54ecb82c2211e289a268567443d60fdd489f1e4/examples/enuminstances.py#L36-L72
train
28,307
pywbem/pywbem
attic/cim_provider.py
get_keys_from_class
def get_keys_from_class(cc): """Return list of the key property names for a class """ return [prop.name for prop in cc.properties.values() \ if 'key' in prop.qualifiers]
python
def get_keys_from_class(cc): """Return list of the key property names for a class """ return [prop.name for prop in cc.properties.values() \ if 'key' in prop.qualifiers]
[ "def", "get_keys_from_class", "(", "cc", ")", ":", "return", "[", "prop", ".", "name", "for", "prop", "in", "cc", ".", "properties", ".", "values", "(", ")", "if", "'key'", "in", "prop", ".", "qualifiers", "]" ]
Return list of the key property names for a class
[ "Return", "list", "of", "the", "key", "property", "names", "for", "a", "class" ]
e54ecb82c2211e289a268567443d60fdd489f1e4
https://github.com/pywbem/pywbem/blob/e54ecb82c2211e289a268567443d60fdd489f1e4/attic/cim_provider.py#L1037-L1040
train
28,308
pywbem/pywbem
attic/cim_provider.py
build_instance_name
def build_instance_name(inst, obj=None): """Return an instance name from an instance, and set instance.path """ if obj is None: for _ in inst.properties.values(): inst.path.keybindings.__setitem__(_.name, _.value) return inst.path if not isinstance(obj, list): return buil...
python
def build_instance_name(inst, obj=None): """Return an instance name from an instance, and set instance.path """ if obj is None: for _ in inst.properties.values(): inst.path.keybindings.__setitem__(_.name, _.value) return inst.path if not isinstance(obj, list): return buil...
[ "def", "build_instance_name", "(", "inst", ",", "obj", "=", "None", ")", ":", "if", "obj", "is", "None", ":", "for", "_", "in", "inst", ".", "properties", ".", "values", "(", ")", ":", "inst", ".", "path", ".", "keybindings", ".", "__setitem__", "(",...
Return an instance name from an instance, and set instance.path
[ "Return", "an", "instance", "name", "from", "an", "instance", "and", "set", "instance", ".", "path" ]
e54ecb82c2211e289a268567443d60fdd489f1e4
https://github.com/pywbem/pywbem/blob/e54ecb82c2211e289a268567443d60fdd489f1e4/attic/cim_provider.py#L1042-L1061
train
28,309
pywbem/pywbem
attic/cim_provider.py
CIMProvider.set_instance
def set_instance(self, env, instance, previous_instance, cim_class): """Return a newly created or modified instance. Keyword arguments: env -- Provider Environment (pycimmb.ProviderEnvironment) instance -- The new pywbem.CIMInstance. If modifying an existing instance, the p...
python
def set_instance(self, env, instance, previous_instance, cim_class): """Return a newly created or modified instance. Keyword arguments: env -- Provider Environment (pycimmb.ProviderEnvironment) instance -- The new pywbem.CIMInstance. If modifying an existing instance, the p...
[ "def", "set_instance", "(", "self", ",", "env", ",", "instance", ",", "previous_instance", ",", "cim_class", ")", ":", "raise", "pywbem", ".", "CIMError", "(", "pywbem", ".", "CIM_ERR_NOT_SUPPORTED", ",", "\"\"", ")" ]
Return a newly created or modified instance. Keyword arguments: env -- Provider Environment (pycimmb.ProviderEnvironment) instance -- The new pywbem.CIMInstance. If modifying an existing instance, the properties on this instance have been filtered by the PropertyList fr...
[ "Return", "a", "newly", "created", "or", "modified", "instance", "." ]
e54ecb82c2211e289a268567443d60fdd489f1e4
https://github.com/pywbem/pywbem/blob/e54ecb82c2211e289a268567443d60fdd489f1e4/attic/cim_provider.py#L328-L356
train
28,310
pywbem/pywbem
attic/cim_provider.py
CIMProvider.references
def references(self, env, object_name, model, assoc_class, result_class_name, role, result_role, keys_only): """Instrument Associations. All four association-related operations (Associators, AssociatorNames, References, ReferenceNames) are mapped to this method. This ...
python
def references(self, env, object_name, model, assoc_class, result_class_name, role, result_role, keys_only): """Instrument Associations. All four association-related operations (Associators, AssociatorNames, References, ReferenceNames) are mapped to this method. This ...
[ "def", "references", "(", "self", ",", "env", ",", "object_name", ",", "model", ",", "assoc_class", ",", "result_class_name", ",", "role", ",", "result_role", ",", "keys_only", ")", ":", "pass" ]
Instrument Associations. All four association-related operations (Associators, AssociatorNames, References, ReferenceNames) are mapped to this method. This method is a python generator Keyword arguments: env -- Provider Environment (pycimmb.ProviderEnvironment) object_n...
[ "Instrument", "Associations", "." ]
e54ecb82c2211e289a268567443d60fdd489f1e4
https://github.com/pywbem/pywbem/blob/e54ecb82c2211e289a268567443d60fdd489f1e4/attic/cim_provider.py#L381-L440
train
28,311
pywbem/pywbem
attic/cim_provider.py
CIMProvider.MI_deleteInstance
def MI_deleteInstance(self, env, instanceName): # pylint: disable=invalid-name """Delete a CIM instance Implements the WBEM operation DeleteInstance in terms of the delete_instance method. A derived class will not normally ove...
python
def MI_deleteInstance(self, env, instanceName): # pylint: disable=invalid-name """Delete a CIM instance Implements the WBEM operation DeleteInstance in terms of the delete_instance method. A derived class will not normally ove...
[ "def", "MI_deleteInstance", "(", "self", ",", "env", ",", "instanceName", ")", ":", "# pylint: disable=invalid-name", "logger", "=", "env", ".", "get_logger", "(", ")", "logger", ".", "log_debug", "(", "'CIMProvider MI_deleteInstance called...'", ")", "self", ".", ...
Delete a CIM instance Implements the WBEM operation DeleteInstance in terms of the delete_instance method. A derived class will not normally override this method.
[ "Delete", "a", "CIM", "instance" ]
e54ecb82c2211e289a268567443d60fdd489f1e4
https://github.com/pywbem/pywbem/blob/e54ecb82c2211e289a268567443d60fdd489f1e4/attic/cim_provider.py#L661-L676
train
28,312
pywbem/pywbem
pywbem/cim_types.py
cimtype
def cimtype(obj): """ Return the CIM data type name of a CIM typed object, as a string. For an array, the type is determined from the first array element (CIM arrays must be homogeneous w.r.t. the type of their elements). If the array is empty, that is not possible and :exc:`~py:exceptions.Valu...
python
def cimtype(obj): """ Return the CIM data type name of a CIM typed object, as a string. For an array, the type is determined from the first array element (CIM arrays must be homogeneous w.r.t. the type of their elements). If the array is empty, that is not possible and :exc:`~py:exceptions.Valu...
[ "def", "cimtype", "(", "obj", ")", ":", "if", "isinstance", "(", "obj", ",", "CIMType", ")", ":", "return", "obj", ".", "cimtype", "if", "isinstance", "(", "obj", ",", "bool", ")", ":", "return", "'boolean'", "if", "isinstance", "(", "obj", ",", "(",...
Return the CIM data type name of a CIM typed object, as a string. For an array, the type is determined from the first array element (CIM arrays must be homogeneous w.r.t. the type of their elements). If the array is empty, that is not possible and :exc:`~py:exceptions.ValueError` is raised. Note t...
[ "Return", "the", "CIM", "data", "type", "name", "of", "a", "CIM", "typed", "object", "as", "a", "string", "." ]
e54ecb82c2211e289a268567443d60fdd489f1e4
https://github.com/pywbem/pywbem/blob/e54ecb82c2211e289a268567443d60fdd489f1e4/pywbem/cim_types.py#L997-L1071
train
28,313
pywbem/pywbem
pywbem/cim_types.py
type_from_name
def type_from_name(type_name): """ Return the Python type object for a given CIM data type name. For example, type name ``"uint8"`` will return type object :class:`~pywbem.Uint8`. For CIM data type names ``"string"`` and ``"char16"``, the :term:`unicode string` type is returned (Unicode string...
python
def type_from_name(type_name): """ Return the Python type object for a given CIM data type name. For example, type name ``"uint8"`` will return type object :class:`~pywbem.Uint8`. For CIM data type names ``"string"`` and ``"char16"``, the :term:`unicode string` type is returned (Unicode string...
[ "def", "type_from_name", "(", "type_name", ")", ":", "if", "type_name", "==", "'reference'", ":", "# Defer import due to circular import dependencies:", "from", ".", "cim_obj", "import", "CIMInstanceName", "return", "CIMInstanceName", "try", ":", "type_obj", "=", "_TYPE...
Return the Python type object for a given CIM data type name. For example, type name ``"uint8"`` will return type object :class:`~pywbem.Uint8`. For CIM data type names ``"string"`` and ``"char16"``, the :term:`unicode string` type is returned (Unicode strings are the preferred representation for ...
[ "Return", "the", "Python", "type", "object", "for", "a", "given", "CIM", "data", "type", "name", "." ]
e54ecb82c2211e289a268567443d60fdd489f1e4
https://github.com/pywbem/pywbem/blob/e54ecb82c2211e289a268567443d60fdd489f1e4/pywbem/cim_types.py#L1093-L1145
train
28,314
pywbem/pywbem
pywbem/cim_types.py
atomic_to_cim_xml
def atomic_to_cim_xml(obj): """ Convert an "atomic" scalar value to a CIM-XML string and return that string. The returned CIM-XML string is ready for use as the text of a CIM-XML 'VALUE' element. Parameters: obj (:term:`CIM data type`, :term:`number`, :class:`py:datetime`): The ...
python
def atomic_to_cim_xml(obj): """ Convert an "atomic" scalar value to a CIM-XML string and return that string. The returned CIM-XML string is ready for use as the text of a CIM-XML 'VALUE' element. Parameters: obj (:term:`CIM data type`, :term:`number`, :class:`py:datetime`): The ...
[ "def", "atomic_to_cim_xml", "(", "obj", ")", ":", "if", "obj", "is", "None", ":", "# pylint: disable=no-else-return", "return", "obj", "elif", "isinstance", "(", "obj", ",", "six", ".", "text_type", ")", ":", "return", "obj", "elif", "isinstance", "(", "obj"...
Convert an "atomic" scalar value to a CIM-XML string and return that string. The returned CIM-XML string is ready for use as the text of a CIM-XML 'VALUE' element. Parameters: obj (:term:`CIM data type`, :term:`number`, :class:`py:datetime`): The "atomic" input value. May be `None`. ...
[ "Convert", "an", "atomic", "scalar", "value", "to", "a", "CIM", "-", "XML", "string", "and", "return", "that", "string", "." ]
e54ecb82c2211e289a268567443d60fdd489f1e4
https://github.com/pywbem/pywbem/blob/e54ecb82c2211e289a268567443d60fdd489f1e4/pywbem/cim_types.py#L1148-L1215
train
28,315
pywbem/pywbem
pywbem/cim_types.py
_CIMComparisonMixin.__ordering_deprecated
def __ordering_deprecated(self): """Deprecated warning for pywbem CIM Objects""" msg = _format("Ordering comparisons involving {0} objects are " "deprecated.", self.__class__.__name__) if DEBUG_WARNING_ORIGIN: msg += "\nTraceback:\n" + ''.join(traceback.format_s...
python
def __ordering_deprecated(self): """Deprecated warning for pywbem CIM Objects""" msg = _format("Ordering comparisons involving {0} objects are " "deprecated.", self.__class__.__name__) if DEBUG_WARNING_ORIGIN: msg += "\nTraceback:\n" + ''.join(traceback.format_s...
[ "def", "__ordering_deprecated", "(", "self", ")", ":", "msg", "=", "_format", "(", "\"Ordering comparisons involving {0} objects are \"", "\"deprecated.\"", ",", "self", ".", "__class__", ".", "__name__", ")", "if", "DEBUG_WARNING_ORIGIN", ":", "msg", "+=", "\"\\nTrac...
Deprecated warning for pywbem CIM Objects
[ "Deprecated", "warning", "for", "pywbem", "CIM", "Objects" ]
e54ecb82c2211e289a268567443d60fdd489f1e4
https://github.com/pywbem/pywbem/blob/e54ecb82c2211e289a268567443d60fdd489f1e4/pywbem/cim_types.py#L131-L137
train
28,316
pywbem/pywbem
pywbem/cim_types.py
CIMDateTime._to_int
def _to_int(value_str, min_value, rep_digit, field_name, dtarg): """ Convert value_str into an integer, replacing right-consecutive asterisks with rep_digit, and an all-asterisk value with min_value. field_name and dtarg are passed only for informational purposes. """ if...
python
def _to_int(value_str, min_value, rep_digit, field_name, dtarg): """ Convert value_str into an integer, replacing right-consecutive asterisks with rep_digit, and an all-asterisk value with min_value. field_name and dtarg are passed only for informational purposes. """ if...
[ "def", "_to_int", "(", "value_str", ",", "min_value", ",", "rep_digit", ",", "field_name", ",", "dtarg", ")", ":", "if", "'*'", "in", "value_str", ":", "first", "=", "value_str", ".", "index", "(", "'*'", ")", "after", "=", "value_str", ".", "rindex", ...
Convert value_str into an integer, replacing right-consecutive asterisks with rep_digit, and an all-asterisk value with min_value. field_name and dtarg are passed only for informational purposes.
[ "Convert", "value_str", "into", "an", "integer", "replacing", "right", "-", "consecutive", "asterisks", "with", "rep_digit", "and", "an", "all", "-", "asterisk", "value", "with", "min_value", "." ]
e54ecb82c2211e289a268567443d60fdd489f1e4
https://github.com/pywbem/pywbem/blob/e54ecb82c2211e289a268567443d60fdd489f1e4/pywbem/cim_types.py#L457-L491
train
28,317
pywbem/pywbem
attic/irecv/pycimlistener.py
ServerContextFactory.getContext
def getContext(self): """Create an SSL context with a dodgy certificate.""" ctx = SSL.Context(SSL.SSLv23_METHOD) ctx.use_certificate_file('server.pem') ctx.use_privatekey_file('server.pem') return ctx
python
def getContext(self): """Create an SSL context with a dodgy certificate.""" ctx = SSL.Context(SSL.SSLv23_METHOD) ctx.use_certificate_file('server.pem') ctx.use_privatekey_file('server.pem') return ctx
[ "def", "getContext", "(", "self", ")", ":", "ctx", "=", "SSL", ".", "Context", "(", "SSL", ".", "SSLv23_METHOD", ")", "ctx", ".", "use_certificate_file", "(", "'server.pem'", ")", "ctx", ".", "use_privatekey_file", "(", "'server.pem'", ")", "return", "ctx" ]
Create an SSL context with a dodgy certificate.
[ "Create", "an", "SSL", "context", "with", "a", "dodgy", "certificate", "." ]
e54ecb82c2211e289a268567443d60fdd489f1e4
https://github.com/pywbem/pywbem/blob/e54ecb82c2211e289a268567443d60fdd489f1e4/attic/irecv/pycimlistener.py#L56-L61
train
28,318
pywbem/pywbem
examples/pullenuminstances.py
execute_request
def execute_request(conn, classname, max_open, max_pull): """ Enumerate instances defined by the function's classname argument using the OpenEnumerateInstances and PullInstancesWithPath. * classname - Classname for the enumeration. * max_open - defines the maximum number of...
python
def execute_request(conn, classname, max_open, max_pull): """ Enumerate instances defined by the function's classname argument using the OpenEnumerateInstances and PullInstancesWithPath. * classname - Classname for the enumeration. * max_open - defines the maximum number of...
[ "def", "execute_request", "(", "conn", ",", "classname", ",", "max_open", ",", "max_pull", ")", ":", "start", "=", "ElapsedTimer", "(", ")", "result", "=", "conn", ".", "OpenEnumerateInstances", "(", "classname", ",", "MaxObjectCount", "=", "max_open", ")", ...
Enumerate instances defined by the function's classname argument using the OpenEnumerateInstances and PullInstancesWithPath. * classname - Classname for the enumeration. * max_open - defines the maximum number of instances for the server to return for the open *max_p...
[ "Enumerate", "instances", "defined", "by", "the", "function", "s", "classname", "argument", "using", "the", "OpenEnumerateInstances", "and", "PullInstancesWithPath", "." ]
e54ecb82c2211e289a268567443d60fdd489f1e4
https://github.com/pywbem/pywbem/blob/e54ecb82c2211e289a268567443d60fdd489f1e4/examples/pullenuminstances.py#L60-L108
train
28,319
pywbem/pywbem
pywbem/cim_xml.py
_pcdata_nodes
def _pcdata_nodes(pcdata): """Return a list of minidom nodes with the properly escaped ``pcdata`` inside. The following special XML characters are escaped: * left angle bracket (<) * Right angle bracket (>) * Ampersand (&) By default, XML-based escaping is used for these characters. ...
python
def _pcdata_nodes(pcdata): """Return a list of minidom nodes with the properly escaped ``pcdata`` inside. The following special XML characters are escaped: * left angle bracket (<) * Right angle bracket (>) * Ampersand (&) By default, XML-based escaping is used for these characters. ...
[ "def", "_pcdata_nodes", "(", "pcdata", ")", ":", "nodelist", "=", "[", "]", "if", "_CDATA_ESCAPING", "and", "isinstance", "(", "pcdata", ",", "six", ".", "string_types", ")", "and", "(", "pcdata", ".", "find", "(", "\"<\"", ")", ">=", "0", "or", "pcdat...
Return a list of minidom nodes with the properly escaped ``pcdata`` inside. The following special XML characters are escaped: * left angle bracket (<) * Right angle bracket (>) * Ampersand (&) By default, XML-based escaping is used for these characters. XML-based escaping will cause ...
[ "Return", "a", "list", "of", "minidom", "nodes", "with", "the", "properly", "escaped", "pcdata", "inside", "." ]
e54ecb82c2211e289a268567443d60fdd489f1e4
https://github.com/pywbem/pywbem/blob/e54ecb82c2211e289a268567443d60fdd489f1e4/pywbem/cim_xml.py#L89-L167
train
28,320
pywbem/pywbem
pywbem_mock/_wbemconnection_mock.py
_uprint
def _uprint(dest, text): """ Write text to dest, adding a newline character. Text may be a unicode string, or a byte string in UTF-8 encoding. It must not be None. If dest is None, the text is encoded to a codepage suitable for the current stdout and is written to stdout. Otherwise, dest ...
python
def _uprint(dest, text): """ Write text to dest, adding a newline character. Text may be a unicode string, or a byte string in UTF-8 encoding. It must not be None. If dest is None, the text is encoded to a codepage suitable for the current stdout and is written to stdout. Otherwise, dest ...
[ "def", "_uprint", "(", "dest", ",", "text", ")", ":", "if", "isinstance", "(", "text", ",", "six", ".", "text_type", ")", ":", "text", "=", "text", "+", "u'\\n'", "elif", "isinstance", "(", "text", ",", "six", ".", "binary_type", ")", ":", "text", ...
Write text to dest, adding a newline character. Text may be a unicode string, or a byte string in UTF-8 encoding. It must not be None. If dest is None, the text is encoded to a codepage suitable for the current stdout and is written to stdout. Otherwise, dest must be a file path, and the text is ...
[ "Write", "text", "to", "dest", "adding", "a", "newline", "character", "." ]
e54ecb82c2211e289a268567443d60fdd489f1e4
https://github.com/pywbem/pywbem/blob/e54ecb82c2211e289a268567443d60fdd489f1e4/pywbem_mock/_wbemconnection_mock.py#L94-L140
train
28,321
pywbem/pywbem
pywbem_mock/_wbemconnection_mock.py
_pretty_xml
def _pretty_xml(xml_string): """ Common function to produce pretty xml string from an input xml_string. This function is NOT intended to be used in major code paths since it uses the minidom to produce the prettified xml and that uses a lot of memory """ result_dom = minidom.parseString(xm...
python
def _pretty_xml(xml_string): """ Common function to produce pretty xml string from an input xml_string. This function is NOT intended to be used in major code paths since it uses the minidom to produce the prettified xml and that uses a lot of memory """ result_dom = minidom.parseString(xm...
[ "def", "_pretty_xml", "(", "xml_string", ")", ":", "result_dom", "=", "minidom", ".", "parseString", "(", "xml_string", ")", "pretty_result", "=", "result_dom", ".", "toprettyxml", "(", "indent", "=", "' '", ")", "# remove extra empty lines", "return", "re", "....
Common function to produce pretty xml string from an input xml_string. This function is NOT intended to be used in major code paths since it uses the minidom to produce the prettified xml and that uses a lot of memory
[ "Common", "function", "to", "produce", "pretty", "xml", "string", "from", "an", "input", "xml_string", "." ]
e54ecb82c2211e289a268567443d60fdd489f1e4
https://github.com/pywbem/pywbem/blob/e54ecb82c2211e289a268567443d60fdd489f1e4/pywbem_mock/_wbemconnection_mock.py#L221-L234
train
28,322
pywbem/pywbem
pywbem_mock/_wbemconnection_mock.py
FakedWBEMConnection.add_namespace
def add_namespace(self, namespace): """ Add a CIM namespace to the mock repository. The namespace must not yet exist in the mock repository. Note that the default connection namespace is automatically added to the mock repository upon creation of this object. Parameter...
python
def add_namespace(self, namespace): """ Add a CIM namespace to the mock repository. The namespace must not yet exist in the mock repository. Note that the default connection namespace is automatically added to the mock repository upon creation of this object. Parameter...
[ "def", "add_namespace", "(", "self", ",", "namespace", ")", ":", "if", "namespace", "is", "None", ":", "raise", "ValueError", "(", "\"Namespace argument must not be None\"", ")", "# Normalize the namespace name", "namespace", "=", "namespace", ".", "strip", "(", "'/...
Add a CIM namespace to the mock repository. The namespace must not yet exist in the mock repository. Note that the default connection namespace is automatically added to the mock repository upon creation of this object. Parameters: namespace (:term:`string`): Th...
[ "Add", "a", "CIM", "namespace", "to", "the", "mock", "repository", "." ]
e54ecb82c2211e289a268567443d60fdd489f1e4
https://github.com/pywbem/pywbem/blob/e54ecb82c2211e289a268567443d60fdd489f1e4/pywbem_mock/_wbemconnection_mock.py#L416-L451
train
28,323
pywbem/pywbem
pywbem_mock/_wbemconnection_mock.py
FakedWBEMConnection._remove_namespace
def _remove_namespace(self, namespace): """ Remove a CIM namespace from the mock repository. The namespace must exist in the mock repository and must be empty. The default connection namespace cannot be removed. Parameters: namespace (:term:`string`): Th...
python
def _remove_namespace(self, namespace): """ Remove a CIM namespace from the mock repository. The namespace must exist in the mock repository and must be empty. The default connection namespace cannot be removed. Parameters: namespace (:term:`string`): Th...
[ "def", "_remove_namespace", "(", "self", ",", "namespace", ")", ":", "if", "namespace", "is", "None", ":", "raise", "ValueError", "(", "\"Namespace argument must not be None\"", ")", "# Normalize the namespace name", "namespace", "=", "namespace", ".", "strip", "(", ...
Remove a CIM namespace from the mock repository. The namespace must exist in the mock repository and must be empty. The default connection namespace cannot be removed. Parameters: namespace (:term:`string`): The name of the CIM namespace in the mock repository. Must not...
[ "Remove", "a", "CIM", "namespace", "from", "the", "mock", "repository", "." ]
e54ecb82c2211e289a268567443d60fdd489f1e4
https://github.com/pywbem/pywbem/blob/e54ecb82c2211e289a268567443d60fdd489f1e4/pywbem_mock/_wbemconnection_mock.py#L453-L503
train
28,324
pywbem/pywbem
pywbem_mock/_wbemconnection_mock.py
FakedWBEMConnection.compile_mof_string
def compile_mof_string(self, mof_str, namespace=None, search_paths=None, verbose=None): """ Compile the MOF definitions in the specified string and add the resulting CIM objects to the specified CIM namespace of the mock repository. If the namespace do...
python
def compile_mof_string(self, mof_str, namespace=None, search_paths=None, verbose=None): """ Compile the MOF definitions in the specified string and add the resulting CIM objects to the specified CIM namespace of the mock repository. If the namespace do...
[ "def", "compile_mof_string", "(", "self", ",", "mof_str", ",", "namespace", "=", "None", ",", "search_paths", "=", "None", ",", "verbose", "=", "None", ")", ":", "namespace", "=", "namespace", "or", "self", ".", "default_namespace", "# if not self._validate_name...
Compile the MOF definitions in the specified string and add the resulting CIM objects to the specified CIM namespace of the mock repository. If the namespace does not exist, :exc:`~pywbem.CIMError` with status CIM_ERR_INVALID_NAMESPACE is raised. This method supports all MOF pr...
[ "Compile", "the", "MOF", "definitions", "in", "the", "specified", "string", "and", "add", "the", "resulting", "CIM", "objects", "to", "the", "specified", "CIM", "namespace", "of", "the", "mock", "repository", "." ]
e54ecb82c2211e289a268567443d60fdd489f1e4
https://github.com/pywbem/pywbem/blob/e54ecb82c2211e289a268567443d60fdd489f1e4/pywbem_mock/_wbemconnection_mock.py#L569-L633
train
28,325
pywbem/pywbem
pywbem_mock/_wbemconnection_mock.py
FakedWBEMConnection.compile_dmtf_schema
def compile_dmtf_schema(self, schema_version, schema_root_dir, class_names, use_experimental=False, namespace=None, verbose=False): """ Compile the classes defined by `class_names` and their dependent classes from the DMTF CIM schema versio...
python
def compile_dmtf_schema(self, schema_version, schema_root_dir, class_names, use_experimental=False, namespace=None, verbose=False): """ Compile the classes defined by `class_names` and their dependent classes from the DMTF CIM schema versio...
[ "def", "compile_dmtf_schema", "(", "self", ",", "schema_version", ",", "schema_root_dir", ",", "class_names", ",", "use_experimental", "=", "False", ",", "namespace", "=", "None", ",", "verbose", "=", "False", ")", ":", "schema", "=", "DMTFCIMSchema", "(", "sc...
Compile the classes defined by `class_names` and their dependent classes from the DMTF CIM schema version defined by `schema_version` and keep the downloaded DMTF CIM schema in the directory defined by `schema_dir`. This method uses the :class:`~pywbem_mock.DMTFCIMSchema` class to ...
[ "Compile", "the", "classes", "defined", "by", "class_names", "and", "their", "dependent", "classes", "from", "the", "DMTF", "CIM", "schema", "version", "defined", "by", "schema_version", "and", "keep", "the", "downloaded", "DMTF", "CIM", "schema", "in", "the", ...
e54ecb82c2211e289a268567443d60fdd489f1e4
https://github.com/pywbem/pywbem/blob/e54ecb82c2211e289a268567443d60fdd489f1e4/pywbem_mock/_wbemconnection_mock.py#L635-L731
train
28,326
pywbem/pywbem
pywbem_mock/_wbemconnection_mock.py
FakedWBEMConnection.add_method_callback
def add_method_callback(self, classname, methodname, method_callback, namespace=None,): """ Register a callback function for a CIM method that will be called when the CIM method is invoked via `InvokeMethod`. If the namespace does not exist, :exc:`~pywbem.CIM...
python
def add_method_callback(self, classname, methodname, method_callback, namespace=None,): """ Register a callback function for a CIM method that will be called when the CIM method is invoked via `InvokeMethod`. If the namespace does not exist, :exc:`~pywbem.CIM...
[ "def", "add_method_callback", "(", "self", ",", "classname", ",", "methodname", ",", "method_callback", ",", "namespace", "=", "None", ",", ")", ":", "if", "namespace", "is", "None", ":", "namespace", "=", "self", ".", "default_namespace", "# Validate namespace"...
Register a callback function for a CIM method that will be called when the CIM method is invoked via `InvokeMethod`. If the namespace does not exist, :exc:`~pywbem.CIMError` with status CIM_ERR_INVALID_NAMESPACE is raised. Parameters: classname (:term:`string`): ...
[ "Register", "a", "callback", "function", "for", "a", "CIM", "method", "that", "will", "be", "called", "when", "the", "CIM", "method", "is", "invoked", "via", "InvokeMethod", "." ]
e54ecb82c2211e289a268567443d60fdd489f1e4
https://github.com/pywbem/pywbem/blob/e54ecb82c2211e289a268567443d60fdd489f1e4/pywbem_mock/_wbemconnection_mock.py#L846-L905
train
28,327
pywbem/pywbem
pywbem_mock/_wbemconnection_mock.py
FakedWBEMConnection.display_repository
def display_repository(self, namespaces=None, dest=None, summary=False, output_format='mof'): """ Display the namespaces and objects in the mock repository in one of multiple formats to a destination. Parameters: namespaces (:term:`string` or list o...
python
def display_repository(self, namespaces=None, dest=None, summary=False, output_format='mof'): """ Display the namespaces and objects in the mock repository in one of multiple formats to a destination. Parameters: namespaces (:term:`string` or list o...
[ "def", "display_repository", "(", "self", ",", "namespaces", "=", "None", ",", "dest", "=", "None", ",", "summary", "=", "False", ",", "output_format", "=", "'mof'", ")", ":", "if", "output_format", "==", "'mof'", ":", "cmt_begin", "=", "'# '", "cmt_end", ...
Display the namespaces and objects in the mock repository in one of multiple formats to a destination. Parameters: namespaces (:term:`string` or list of :term:`string`): Limits display output to the specified CIM namespace or namespaces. If `None`, all namespaces of t...
[ "Display", "the", "namespaces", "and", "objects", "in", "the", "mock", "repository", "in", "one", "of", "multiple", "formats", "to", "a", "destination", "." ]
e54ecb82c2211e289a268567443d60fdd489f1e4
https://github.com/pywbem/pywbem/blob/e54ecb82c2211e289a268567443d60fdd489f1e4/pywbem_mock/_wbemconnection_mock.py#L907-L981
train
28,328
pywbem/pywbem
pywbem_mock/_wbemconnection_mock.py
FakedWBEMConnection._get_inst_repo
def _get_inst_repo(self, namespace=None): """ Test support method that returns instances from the repository with no processing. It uses the default namespace if input parameter for namespace is None """ if namespace is None: namespace = self.default_namespac...
python
def _get_inst_repo(self, namespace=None): """ Test support method that returns instances from the repository with no processing. It uses the default namespace if input parameter for namespace is None """ if namespace is None: namespace = self.default_namespac...
[ "def", "_get_inst_repo", "(", "self", ",", "namespace", "=", "None", ")", ":", "if", "namespace", "is", "None", ":", "namespace", "=", "self", ".", "default_namespace", "return", "self", ".", "instances", "[", "namespace", "]" ]
Test support method that returns instances from the repository with no processing. It uses the default namespace if input parameter for namespace is None
[ "Test", "support", "method", "that", "returns", "instances", "from", "the", "repository", "with", "no", "processing", ".", "It", "uses", "the", "default", "namespace", "if", "input", "parameter", "for", "namespace", "is", "None" ]
e54ecb82c2211e289a268567443d60fdd489f1e4
https://github.com/pywbem/pywbem/blob/e54ecb82c2211e289a268567443d60fdd489f1e4/pywbem_mock/_wbemconnection_mock.py#L1065-L1073
train
28,329
pywbem/pywbem
pywbem_mock/_wbemconnection_mock.py
FakedWBEMConnection._class_exists
def _class_exists(self, classname, namespace): """ Test if class defined by classname parameter exists in repository defined by namespace parameter. Returns `True` if class exists and `False` if it does not exist. Exception if the namespace does not exist """ cl...
python
def _class_exists(self, classname, namespace): """ Test if class defined by classname parameter exists in repository defined by namespace parameter. Returns `True` if class exists and `False` if it does not exist. Exception if the namespace does not exist """ cl...
[ "def", "_class_exists", "(", "self", ",", "classname", ",", "namespace", ")", ":", "class_repo", "=", "self", ".", "_get_class_repo", "(", "namespace", ")", "return", "classname", "in", "class_repo" ]
Test if class defined by classname parameter exists in repository defined by namespace parameter. Returns `True` if class exists and `False` if it does not exist. Exception if the namespace does not exist
[ "Test", "if", "class", "defined", "by", "classname", "parameter", "exists", "in", "repository", "defined", "by", "namespace", "parameter", "." ]
e54ecb82c2211e289a268567443d60fdd489f1e4
https://github.com/pywbem/pywbem/blob/e54ecb82c2211e289a268567443d60fdd489f1e4/pywbem_mock/_wbemconnection_mock.py#L1130-L1140
train
28,330
pywbem/pywbem
pywbem_mock/_wbemconnection_mock.py
FakedWBEMConnection._remove_qualifiers
def _remove_qualifiers(obj): """ Remove all qualifiers from the input objectwhere the object may be an CIMInstance or CIMClass. Removes qualifiers from the object and from properties, methods, and parameters This is used to process the IncludeQualifier parameter for classes ...
python
def _remove_qualifiers(obj): """ Remove all qualifiers from the input objectwhere the object may be an CIMInstance or CIMClass. Removes qualifiers from the object and from properties, methods, and parameters This is used to process the IncludeQualifier parameter for classes ...
[ "def", "_remove_qualifiers", "(", "obj", ")", ":", "assert", "isinstance", "(", "obj", ",", "(", "CIMInstance", ",", "CIMClass", ")", ")", "obj", ".", "qualifiers", "=", "NocaseDict", "(", ")", "for", "prop", "in", "obj", ".", "properties", ":", "obj", ...
Remove all qualifiers from the input objectwhere the object may be an CIMInstance or CIMClass. Removes qualifiers from the object and from properties, methods, and parameters This is used to process the IncludeQualifier parameter for classes and instances
[ "Remove", "all", "qualifiers", "from", "the", "input", "objectwhere", "the", "object", "may", "be", "an", "CIMInstance", "or", "CIMClass", ".", "Removes", "qualifiers", "from", "the", "object", "and", "from", "properties", "methods", "and", "parameters" ]
e54ecb82c2211e289a268567443d60fdd489f1e4
https://github.com/pywbem/pywbem/blob/e54ecb82c2211e289a268567443d60fdd489f1e4/pywbem_mock/_wbemconnection_mock.py#L1150-L1168
train
28,331
pywbem/pywbem
pywbem_mock/_wbemconnection_mock.py
FakedWBEMConnection._remove_classorigin
def _remove_classorigin(obj): """ Remove all ClassOrigin attributes from the input object. The object may be a CIMInstance or CIMClass. Used to process the IncludeClassOrigin parameter of requests """ assert isinstance(obj, (CIMInstance, CIMClass)) for prop in ob...
python
def _remove_classorigin(obj): """ Remove all ClassOrigin attributes from the input object. The object may be a CIMInstance or CIMClass. Used to process the IncludeClassOrigin parameter of requests """ assert isinstance(obj, (CIMInstance, CIMClass)) for prop in ob...
[ "def", "_remove_classorigin", "(", "obj", ")", ":", "assert", "isinstance", "(", "obj", ",", "(", "CIMInstance", ",", "CIMClass", ")", ")", "for", "prop", "in", "obj", ".", "properties", ":", "obj", ".", "properties", "[", "prop", "]", ".", "class_origin...
Remove all ClassOrigin attributes from the input object. The object may be a CIMInstance or CIMClass. Used to process the IncludeClassOrigin parameter of requests
[ "Remove", "all", "ClassOrigin", "attributes", "from", "the", "input", "object", ".", "The", "object", "may", "be", "a", "CIMInstance", "or", "CIMClass", "." ]
e54ecb82c2211e289a268567443d60fdd489f1e4
https://github.com/pywbem/pywbem/blob/e54ecb82c2211e289a268567443d60fdd489f1e4/pywbem_mock/_wbemconnection_mock.py#L1171-L1183
train
28,332
pywbem/pywbem
pywbem_mock/_wbemconnection_mock.py
FakedWBEMConnection._validate_namespace
def _validate_namespace(self, namespace): """ Validate whether a CIM namespace exists in the mock repository. Parameters: namespace (:term:`string`): The name of the CIM namespace in the mock repository. Must not be `None`. Raises: :exc:`~p...
python
def _validate_namespace(self, namespace): """ Validate whether a CIM namespace exists in the mock repository. Parameters: namespace (:term:`string`): The name of the CIM namespace in the mock repository. Must not be `None`. Raises: :exc:`~p...
[ "def", "_validate_namespace", "(", "self", ",", "namespace", ")", ":", "if", "namespace", "not", "in", "self", ".", "namespaces", ":", "raise", "CIMError", "(", "CIM_ERR_INVALID_NAMESPACE", ",", "_format", "(", "\"Namespace does not exist in mock repository: {0!A}\"", ...
Validate whether a CIM namespace exists in the mock repository. Parameters: namespace (:term:`string`): The name of the CIM namespace in the mock repository. Must not be `None`. Raises: :exc:`~pywbem.CIMError`: CIM_ERR_INVALID_NAMESPACE: Namespace does ...
[ "Validate", "whether", "a", "CIM", "namespace", "exists", "in", "the", "mock", "repository", "." ]
e54ecb82c2211e289a268567443d60fdd489f1e4
https://github.com/pywbem/pywbem/blob/e54ecb82c2211e289a268567443d60fdd489f1e4/pywbem_mock/_wbemconnection_mock.py#L1185-L1204
train
28,333
pywbem/pywbem
pywbem_mock/_wbemconnection_mock.py
FakedWBEMConnection._get_class_repo
def _get_class_repo(self, namespace): """ Returns the class repository for the specified CIM namespace within the mock repository. This is the original instance variable, so any modifications will change the mock repository. Validates that the namespace exists in the mock reposi...
python
def _get_class_repo(self, namespace): """ Returns the class repository for the specified CIM namespace within the mock repository. This is the original instance variable, so any modifications will change the mock repository. Validates that the namespace exists in the mock reposi...
[ "def", "_get_class_repo", "(", "self", ",", "namespace", ")", ":", "self", ".", "_validate_namespace", "(", "namespace", ")", "if", "namespace", "not", "in", "self", ".", "classes", ":", "self", ".", "classes", "[", "namespace", "]", "=", "NocaseDict", "("...
Returns the class repository for the specified CIM namespace within the mock repository. This is the original instance variable, so any modifications will change the mock repository. Validates that the namespace exists in the mock repository. If the class repository does not contain th...
[ "Returns", "the", "class", "repository", "for", "the", "specified", "CIM", "namespace", "within", "the", "mock", "repository", ".", "This", "is", "the", "original", "instance", "variable", "so", "any", "modifications", "will", "change", "the", "mock", "repositor...
e54ecb82c2211e289a268567443d60fdd489f1e4
https://github.com/pywbem/pywbem/blob/e54ecb82c2211e289a268567443d60fdd489f1e4/pywbem_mock/_wbemconnection_mock.py#L1206-L1233
train
28,334
pywbem/pywbem
pywbem_mock/_wbemconnection_mock.py
FakedWBEMConnection._get_instance_repo
def _get_instance_repo(self, namespace): """ Returns the instance repository for the specified CIM namespace within the mock repository. This is the original instance variable, so any modifications will change the mock repository. Validates that the namespace exists in the mock ...
python
def _get_instance_repo(self, namespace): """ Returns the instance repository for the specified CIM namespace within the mock repository. This is the original instance variable, so any modifications will change the mock repository. Validates that the namespace exists in the mock ...
[ "def", "_get_instance_repo", "(", "self", ",", "namespace", ")", ":", "self", ".", "_validate_namespace", "(", "namespace", ")", "if", "namespace", "not", "in", "self", ".", "instances", ":", "self", ".", "instances", "[", "namespace", "]", "=", "[", "]", ...
Returns the instance repository for the specified CIM namespace within the mock repository. This is the original instance variable, so any modifications will change the mock repository. Validates that the namespace exists in the mock repository. If the instance repository does not cont...
[ "Returns", "the", "instance", "repository", "for", "the", "specified", "CIM", "namespace", "within", "the", "mock", "repository", ".", "This", "is", "the", "original", "instance", "variable", "so", "any", "modifications", "will", "change", "the", "mock", "reposi...
e54ecb82c2211e289a268567443d60fdd489f1e4
https://github.com/pywbem/pywbem/blob/e54ecb82c2211e289a268567443d60fdd489f1e4/pywbem_mock/_wbemconnection_mock.py#L1235-L1262
train
28,335
pywbem/pywbem
pywbem_mock/_wbemconnection_mock.py
FakedWBEMConnection._get_qualifier_repo
def _get_qualifier_repo(self, namespace): """ Returns the qualifier repository for the specified CIM namespace within the mock repository. This is the original instance variable, so any modifications will change the mock repository. Validates that the namespace exists in the moc...
python
def _get_qualifier_repo(self, namespace): """ Returns the qualifier repository for the specified CIM namespace within the mock repository. This is the original instance variable, so any modifications will change the mock repository. Validates that the namespace exists in the moc...
[ "def", "_get_qualifier_repo", "(", "self", ",", "namespace", ")", ":", "self", ".", "_validate_namespace", "(", "namespace", ")", "if", "namespace", "not", "in", "self", ".", "qualifiers", ":", "self", ".", "qualifiers", "[", "namespace", "]", "=", "NocaseDi...
Returns the qualifier repository for the specified CIM namespace within the mock repository. This is the original instance variable, so any modifications will change the mock repository. Validates that the namespace exists in the mock repository. If the qualifier repository does not co...
[ "Returns", "the", "qualifier", "repository", "for", "the", "specified", "CIM", "namespace", "within", "the", "mock", "repository", ".", "This", "is", "the", "original", "instance", "variable", "so", "any", "modifications", "will", "change", "the", "mock", "repos...
e54ecb82c2211e289a268567443d60fdd489f1e4
https://github.com/pywbem/pywbem/blob/e54ecb82c2211e289a268567443d60fdd489f1e4/pywbem_mock/_wbemconnection_mock.py#L1264-L1291
train
28,336
pywbem/pywbem
pywbem_mock/_wbemconnection_mock.py
FakedWBEMConnection._get_method_repo
def _get_method_repo(self, namespace=None): """ Returns the method repository for the specified CIM namespace within the mock repository. This is the original instance variable, so any modifications will change the mock repository. Validates that the namespace exists in the mock...
python
def _get_method_repo(self, namespace=None): """ Returns the method repository for the specified CIM namespace within the mock repository. This is the original instance variable, so any modifications will change the mock repository. Validates that the namespace exists in the mock...
[ "def", "_get_method_repo", "(", "self", ",", "namespace", "=", "None", ")", ":", "self", ".", "_validate_namespace", "(", "namespace", ")", "if", "namespace", "not", "in", "self", ".", "methods", ":", "self", ".", "methods", "[", "namespace", "]", "=", "...
Returns the method repository for the specified CIM namespace within the mock repository. This is the original instance variable, so any modifications will change the mock repository. Validates that the namespace exists in the mock repository. If the method repository does not contain ...
[ "Returns", "the", "method", "repository", "for", "the", "specified", "CIM", "namespace", "within", "the", "mock", "repository", ".", "This", "is", "the", "original", "instance", "variable", "so", "any", "modifications", "will", "change", "the", "mock", "reposito...
e54ecb82c2211e289a268567443d60fdd489f1e4
https://github.com/pywbem/pywbem/blob/e54ecb82c2211e289a268567443d60fdd489f1e4/pywbem_mock/_wbemconnection_mock.py#L1293-L1320
train
28,337
pywbem/pywbem
pywbem_mock/_wbemconnection_mock.py
FakedWBEMConnection._get_superclassnames
def _get_superclassnames(self, cn, namespace): """ Get list of superclasses names from the class repository for the defined classname in the namespace. Returns in order of descending class hiearchy. """ class_repo = self._get_class_repo(namespace) superclass_name...
python
def _get_superclassnames(self, cn, namespace): """ Get list of superclasses names from the class repository for the defined classname in the namespace. Returns in order of descending class hiearchy. """ class_repo = self._get_class_repo(namespace) superclass_name...
[ "def", "_get_superclassnames", "(", "self", ",", "cn", ",", "namespace", ")", ":", "class_repo", "=", "self", ".", "_get_class_repo", "(", "namespace", ")", "superclass_names", "=", "[", "]", "if", "cn", "is", "not", "None", ":", "cnwork", "=", "cn", "wh...
Get list of superclasses names from the class repository for the defined classname in the namespace. Returns in order of descending class hiearchy.
[ "Get", "list", "of", "superclasses", "names", "from", "the", "class", "repository", "for", "the", "defined", "classname", "in", "the", "namespace", "." ]
e54ecb82c2211e289a268567443d60fdd489f1e4
https://github.com/pywbem/pywbem/blob/e54ecb82c2211e289a268567443d60fdd489f1e4/pywbem_mock/_wbemconnection_mock.py#L1379-L1396
train
28,338
pywbem/pywbem
pywbem_mock/_wbemconnection_mock.py
FakedWBEMConnection._get_subclass_names
def _get_subclass_names(self, classname, namespace, deep_inheritance): """ Get class names that are subclasses of the classname input parameter from the repository. If DeepInheritance is False, get only classes in the repository for the defined namespace for whic...
python
def _get_subclass_names(self, classname, namespace, deep_inheritance): """ Get class names that are subclasses of the classname input parameter from the repository. If DeepInheritance is False, get only classes in the repository for the defined namespace for whic...
[ "def", "_get_subclass_names", "(", "self", ",", "classname", ",", "namespace", ",", "deep_inheritance", ")", ":", "assert", "classname", "is", "None", "or", "isinstance", "(", "classname", ",", "(", "six", ".", "string_types", ",", "CIMClassName", ")", ")", ...
Get class names that are subclasses of the classname input parameter from the repository. If DeepInheritance is False, get only classes in the repository for the defined namespace for which this class is a direct super class. If deep_inheritance is `True`, g...
[ "Get", "class", "names", "that", "are", "subclasses", "of", "the", "classname", "input", "parameter", "from", "the", "repository", "." ]
e54ecb82c2211e289a268567443d60fdd489f1e4
https://github.com/pywbem/pywbem/blob/e54ecb82c2211e289a268567443d60fdd489f1e4/pywbem_mock/_wbemconnection_mock.py#L1398-L1444
train
28,339
pywbem/pywbem
pywbem_mock/_wbemconnection_mock.py
FakedWBEMConnection._get_class
def _get_class(self, classname, namespace, local_only=None, include_qualifiers=None, include_classorigin=None, property_list=None): # pylint: disable=invalid-name """ Get class from repository. Gets the class defined by classname from the repository...
python
def _get_class(self, classname, namespace, local_only=None, include_qualifiers=None, include_classorigin=None, property_list=None): # pylint: disable=invalid-name """ Get class from repository. Gets the class defined by classname from the repository...
[ "def", "_get_class", "(", "self", ",", "classname", ",", "namespace", ",", "local_only", "=", "None", ",", "include_qualifiers", "=", "None", ",", "include_classorigin", "=", "None", ",", "property_list", "=", "None", ")", ":", "# pylint: disable=invalid-name", ...
Get class from repository. Gets the class defined by classname from the repository, creates a copy, expands the copied class to include superclass properties if not localonly, and filters the class based on propertylist and includeClassOrigin. It also sets the propagated attribute. ...
[ "Get", "class", "from", "repository", ".", "Gets", "the", "class", "defined", "by", "classname", "from", "the", "repository", "creates", "a", "copy", "expands", "the", "copied", "class", "to", "include", "superclass", "properties", "if", "not", "localonly", "a...
e54ecb82c2211e289a268567443d60fdd489f1e4
https://github.com/pywbem/pywbem/blob/e54ecb82c2211e289a268567443d60fdd489f1e4/pywbem_mock/_wbemconnection_mock.py#L1446-L1519
train
28,340
pywbem/pywbem
pywbem_mock/_wbemconnection_mock.py
FakedWBEMConnection._get_association_classes
def _get_association_classes(self, namespace): """ Return iterator of associator classes from the class repo Returns the classes that have associations qualifier. Does NOT copy so these are what is in repository. User functions MUST NOT modify these classes. Returns: Re...
python
def _get_association_classes(self, namespace): """ Return iterator of associator classes from the class repo Returns the classes that have associations qualifier. Does NOT copy so these are what is in repository. User functions MUST NOT modify these classes. Returns: Re...
[ "def", "_get_association_classes", "(", "self", ",", "namespace", ")", ":", "class_repo", "=", "self", ".", "_get_class_repo", "(", "namespace", ")", "# associator_classes = []", "for", "cl", "in", "six", ".", "itervalues", "(", "class_repo", ")", ":", "if", "...
Return iterator of associator classes from the class repo Returns the classes that have associations qualifier. Does NOT copy so these are what is in repository. User functions MUST NOT modify these classes. Returns: Returns generator where each yield returns a single ...
[ "Return", "iterator", "of", "associator", "classes", "from", "the", "class", "repo" ]
e54ecb82c2211e289a268567443d60fdd489f1e4
https://github.com/pywbem/pywbem/blob/e54ecb82c2211e289a268567443d60fdd489f1e4/pywbem_mock/_wbemconnection_mock.py#L1521-L1538
train
28,341
pywbem/pywbem
pywbem_mock/_wbemconnection_mock.py
FakedWBEMConnection._find_instance
def _find_instance(iname, instance_repo): """ Find an instance in the instance repo by iname and return the index of that instance. Parameters: iname: CIMInstancename to find instance_repo: the instance repo to search Return (None, None if not found. Other...
python
def _find_instance(iname, instance_repo): """ Find an instance in the instance repo by iname and return the index of that instance. Parameters: iname: CIMInstancename to find instance_repo: the instance repo to search Return (None, None if not found. Other...
[ "def", "_find_instance", "(", "iname", ",", "instance_repo", ")", ":", "rtn_inst", "=", "None", "rtn_index", "=", "None", "for", "index", ",", "inst", "in", "enumerate", "(", "instance_repo", ")", ":", "if", "iname", "==", "inst", ".", "path", ":", "if",...
Find an instance in the instance repo by iname and return the index of that instance. Parameters: iname: CIMInstancename to find instance_repo: the instance repo to search Return (None, None if not found. Otherwise return tuple of index, instance R...
[ "Find", "an", "instance", "in", "the", "instance", "repo", "by", "iname", "and", "return", "the", "index", "of", "that", "instance", "." ]
e54ecb82c2211e289a268567443d60fdd489f1e4
https://github.com/pywbem/pywbem/blob/e54ecb82c2211e289a268567443d60fdd489f1e4/pywbem_mock/_wbemconnection_mock.py#L1541-L1573
train
28,342
pywbem/pywbem
pywbem_mock/_wbemconnection_mock.py
FakedWBEMConnection._get_instance
def _get_instance(self, iname, namespace, property_list, local_only, include_class_origin, include_qualifiers): """ Local method implements getinstance. This is generally used by other instance methods that need to get an instance from the repository. It at...
python
def _get_instance(self, iname, namespace, property_list, local_only, include_class_origin, include_qualifiers): """ Local method implements getinstance. This is generally used by other instance methods that need to get an instance from the repository. It at...
[ "def", "_get_instance", "(", "self", ",", "iname", ",", "namespace", ",", "property_list", ",", "local_only", ",", "include_class_origin", ",", "include_qualifiers", ")", ":", "instance_repo", "=", "self", ".", "_get_instance_repo", "(", "namespace", ")", "rtn_tup...
Local method implements getinstance. This is generally used by other instance methods that need to get an instance from the repository. It attempts to get the instance, copies it, and filters it for input parameters like localonly, includequalifiers, and propertylist. R...
[ "Local", "method", "implements", "getinstance", ".", "This", "is", "generally", "used", "by", "other", "instance", "methods", "that", "need", "to", "get", "an", "instance", "from", "the", "repository", "." ]
e54ecb82c2211e289a268567443d60fdd489f1e4
https://github.com/pywbem/pywbem/blob/e54ecb82c2211e289a268567443d60fdd489f1e4/pywbem_mock/_wbemconnection_mock.py#L1575-L1641
train
28,343
pywbem/pywbem
pywbem_mock/_wbemconnection_mock.py
FakedWBEMConnection._get_subclass_list_for_enums
def _get_subclass_list_for_enums(self, classname, namespace): """ Get class list (i.e names of subclasses for classname for the enumerateinstance methods. If conn.lite returns only classname but no subclasses. Returns NocaseDict where only the keys are important, This allows...
python
def _get_subclass_list_for_enums(self, classname, namespace): """ Get class list (i.e names of subclasses for classname for the enumerateinstance methods. If conn.lite returns only classname but no subclasses. Returns NocaseDict where only the keys are important, This allows...
[ "def", "_get_subclass_list_for_enums", "(", "self", ",", "classname", ",", "namespace", ")", ":", "if", "self", ".", "_repo_lite", ":", "return", "NocaseDict", "(", "{", "classname", ":", "classname", "}", ")", "if", "not", "self", ".", "_class_exists", "(",...
Get class list (i.e names of subclasses for classname for the enumerateinstance methods. If conn.lite returns only classname but no subclasses. Returns NocaseDict where only the keys are important, This allows case insensitive matches of the names with Python "for cln in...
[ "Get", "class", "list", "(", "i", ".", "e", "names", "of", "subclasses", "for", "classname", "for", "the", "enumerateinstance", "methods", ".", "If", "conn", ".", "lite", "returns", "only", "classname", "but", "no", "subclasses", "." ]
e54ecb82c2211e289a268567443d60fdd489f1e4
https://github.com/pywbem/pywbem/blob/e54ecb82c2211e289a268567443d60fdd489f1e4/pywbem_mock/_wbemconnection_mock.py#L1643-L1668
train
28,344
pywbem/pywbem
pywbem_mock/_wbemconnection_mock.py
FakedWBEMConnection._filter_properties
def _filter_properties(obj, property_list): """ Remove properties from an instance or class that aren't in the plist parameter obj(:class:`~pywbem.CIMClass` or :class:`~pywbem.CIMInstance): The class or instance from which properties are to be filtered property_list...
python
def _filter_properties(obj, property_list): """ Remove properties from an instance or class that aren't in the plist parameter obj(:class:`~pywbem.CIMClass` or :class:`~pywbem.CIMInstance): The class or instance from which properties are to be filtered property_list...
[ "def", "_filter_properties", "(", "obj", ",", "property_list", ")", ":", "if", "property_list", "is", "not", "None", ":", "property_list", "=", "[", "p", ".", "lower", "(", ")", "for", "p", "in", "property_list", "]", "for", "pname", "in", "obj", ".", ...
Remove properties from an instance or class that aren't in the plist parameter obj(:class:`~pywbem.CIMClass` or :class:`~pywbem.CIMInstance): The class or instance from which properties are to be filtered property_list(list of :term:`string`): List of properties which a...
[ "Remove", "properties", "from", "an", "instance", "or", "class", "that", "aren", "t", "in", "the", "plist", "parameter" ]
e54ecb82c2211e289a268567443d60fdd489f1e4
https://github.com/pywbem/pywbem/blob/e54ecb82c2211e289a268567443d60fdd489f1e4/pywbem_mock/_wbemconnection_mock.py#L1671-L1689
train
28,345
pywbem/pywbem
pywbem_mock/_wbemconnection_mock.py
FakedWBEMConnection._appendpath_unique
def _appendpath_unique(list_, path): """Append path to list if not already in list""" for p in list_: if p == path: return list_.append(path)
python
def _appendpath_unique(list_, path): """Append path to list if not already in list""" for p in list_: if p == path: return list_.append(path)
[ "def", "_appendpath_unique", "(", "list_", ",", "path", ")", ":", "for", "p", "in", "list_", ":", "if", "p", "==", "path", ":", "return", "list_", ".", "append", "(", "path", ")" ]
Append path to list if not already in list
[ "Append", "path", "to", "list", "if", "not", "already", "in", "list" ]
e54ecb82c2211e289a268567443d60fdd489f1e4
https://github.com/pywbem/pywbem/blob/e54ecb82c2211e289a268567443d60fdd489f1e4/pywbem_mock/_wbemconnection_mock.py#L2583-L2588
train
28,346
pywbem/pywbem
pywbem_mock/_wbemconnection_mock.py
FakedWBEMConnection._return_assoc_tuple
def _return_assoc_tuple(self, objects): """ Create the property tuple for _imethod return of references, referencenames, associators, and associatornames methods. This is different than the get/enum imethod return tuples. It creates an OBJECTPATH for each object in the return li...
python
def _return_assoc_tuple(self, objects): """ Create the property tuple for _imethod return of references, referencenames, associators, and associatornames methods. This is different than the get/enum imethod return tuples. It creates an OBJECTPATH for each object in the return li...
[ "def", "_return_assoc_tuple", "(", "self", ",", "objects", ")", ":", "if", "objects", ":", "result", "=", "[", "(", "u'OBJECTPATH'", ",", "{", "}", ",", "obj", ")", "for", "obj", "in", "objects", "]", "return", "self", ".", "_make_tuple", "(", "result"...
Create the property tuple for _imethod return of references, referencenames, associators, and associatornames methods. This is different than the get/enum imethod return tuples. It creates an OBJECTPATH for each object in the return list. _imethod call returns None when there are zero ...
[ "Create", "the", "property", "tuple", "for", "_imethod", "return", "of", "references", "referencenames", "associators", "and", "associatornames", "methods", "." ]
e54ecb82c2211e289a268567443d60fdd489f1e4
https://github.com/pywbem/pywbem/blob/e54ecb82c2211e289a268567443d60fdd489f1e4/pywbem_mock/_wbemconnection_mock.py#L2590-L2605
train
28,347
pywbem/pywbem
pywbem_mock/_wbemconnection_mock.py
FakedWBEMConnection._return_assoc_class_tuples
def _return_assoc_class_tuples(self, rtn_classnames, namespace, iq, ico, pl): """ Creates the correct tuples of for associator and references class level responses from a list of classnames. This is special because the class level references and associ...
python
def _return_assoc_class_tuples(self, rtn_classnames, namespace, iq, ico, pl): """ Creates the correct tuples of for associator and references class level responses from a list of classnames. This is special because the class level references and associ...
[ "def", "_return_assoc_class_tuples", "(", "self", ",", "rtn_classnames", ",", "namespace", ",", "iq", ",", "ico", ",", "pl", ")", ":", "rtn_tups", "=", "[", "]", "for", "cn", "in", "rtn_classnames", ":", "rtn_tups", ".", "append", "(", "(", "CIMClassName",...
Creates the correct tuples of for associator and references class level responses from a list of classnames. This is special because the class level references and associators return a tuple of CIMClassName and CIMClass for every entry.
[ "Creates", "the", "correct", "tuples", "of", "for", "associator", "and", "references", "class", "level", "responses", "from", "a", "list", "of", "classnames", ".", "This", "is", "special", "because", "the", "class", "level", "references", "and", "associators", ...
e54ecb82c2211e289a268567443d60fdd489f1e4
https://github.com/pywbem/pywbem/blob/e54ecb82c2211e289a268567443d60fdd489f1e4/pywbem_mock/_wbemconnection_mock.py#L2607-L2624
train
28,348
pywbem/pywbem
pywbem_mock/_wbemconnection_mock.py
FakedWBEMConnection._classnamedict
def _classnamedict(self, classname, namespace): """Get from _classnamelist and cvt to NocaseDict""" clns = self._classnamelist(classname, namespace) rtn_dict = NocaseDict() for cln in clns: rtn_dict[cln] = cln return rtn_dict
python
def _classnamedict(self, classname, namespace): """Get from _classnamelist and cvt to NocaseDict""" clns = self._classnamelist(classname, namespace) rtn_dict = NocaseDict() for cln in clns: rtn_dict[cln] = cln return rtn_dict
[ "def", "_classnamedict", "(", "self", ",", "classname", ",", "namespace", ")", ":", "clns", "=", "self", ".", "_classnamelist", "(", "classname", ",", "namespace", ")", "rtn_dict", "=", "NocaseDict", "(", ")", "for", "cln", "in", "clns", ":", "rtn_dict", ...
Get from _classnamelist and cvt to NocaseDict
[ "Get", "from", "_classnamelist", "and", "cvt", "to", "NocaseDict" ]
e54ecb82c2211e289a268567443d60fdd489f1e4
https://github.com/pywbem/pywbem/blob/e54ecb82c2211e289a268567443d60fdd489f1e4/pywbem_mock/_wbemconnection_mock.py#L2642-L2648
train
28,349
pywbem/pywbem
pywbem_mock/_wbemconnection_mock.py
FakedWBEMConnection._ref_prop_matches
def _ref_prop_matches(prop, target_classname, ref_classname, resultclass_names, role): """ Test filters for a reference property Returns `True` if matches the criteria. Returns `False` if it does not match. The match criteria are: - target_cl...
python
def _ref_prop_matches(prop, target_classname, ref_classname, resultclass_names, role): """ Test filters for a reference property Returns `True` if matches the criteria. Returns `False` if it does not match. The match criteria are: - target_cl...
[ "def", "_ref_prop_matches", "(", "prop", ",", "target_classname", ",", "ref_classname", ",", "resultclass_names", ",", "role", ")", ":", "assert", "prop", ".", "type", "==", "'reference'", "if", "prop", ".", "reference_class", ".", "lower", "(", ")", "==", "...
Test filters for a reference property Returns `True` if matches the criteria. Returns `False` if it does not match. The match criteria are: - target_classname == prop_reference_class - if result_classes are not None, ref_classname is in result_classes - If role is...
[ "Test", "filters", "for", "a", "reference", "property", "Returns", "True", "if", "matches", "the", "criteria", "." ]
e54ecb82c2211e289a268567443d60fdd489f1e4
https://github.com/pywbem/pywbem/blob/e54ecb82c2211e289a268567443d60fdd489f1e4/pywbem_mock/_wbemconnection_mock.py#L2651-L2671
train
28,350
pywbem/pywbem
pywbem_mock/_wbemconnection_mock.py
FakedWBEMConnection._assoc_prop_matches
def _assoc_prop_matches(prop, ref_classname, assoc_classes, result_classes, result_role): """ Test filters of a reference property and its associated entity Returns `True` if matches the criteria. Returns `False` if it does not match. Matches if ref_c...
python
def _assoc_prop_matches(prop, ref_classname, assoc_classes, result_classes, result_role): """ Test filters of a reference property and its associated entity Returns `True` if matches the criteria. Returns `False` if it does not match. Matches if ref_c...
[ "def", "_assoc_prop_matches", "(", "prop", ",", "ref_classname", ",", "assoc_classes", ",", "result_classes", ",", "result_role", ")", ":", "assert", "prop", ".", "type", "==", "'reference'", "if", "assoc_classes", "and", "ref_classname", "not", "in", "assoc_class...
Test filters of a reference property and its associated entity Returns `True` if matches the criteria. Returns `False` if it does not match. Matches if ref_classname in assoc_classes, and result_role matches property name
[ "Test", "filters", "of", "a", "reference", "property", "and", "its", "associated", "entity", "Returns", "True", "if", "matches", "the", "criteria", ".", "Returns", "False", "if", "it", "does", "not", "match", "." ]
e54ecb82c2211e289a268567443d60fdd489f1e4
https://github.com/pywbem/pywbem/blob/e54ecb82c2211e289a268567443d60fdd489f1e4/pywbem_mock/_wbemconnection_mock.py#L2674-L2692
train
28,351
pywbem/pywbem
pywbem_mock/_wbemconnection_mock.py
FakedWBEMConnection._get_reference_classnames
def _get_reference_classnames(self, classname, namespace, resultclass_name, role): """ Get list of classnames that are references for which this classname is a target filtered by the result_class and role parameters if they are none. This is a co...
python
def _get_reference_classnames(self, classname, namespace, resultclass_name, role): """ Get list of classnames that are references for which this classname is a target filtered by the result_class and role parameters if they are none. This is a co...
[ "def", "_get_reference_classnames", "(", "self", ",", "classname", ",", "namespace", ",", "resultclass_name", ",", "role", ")", ":", "self", ".", "_validate_namespace", "(", "namespace", ")", "result_classes", "=", "self", ".", "_classnamedict", "(", "resultclass_...
Get list of classnames that are references for which this classname is a target filtered by the result_class and role parameters if they are none. This is a common method used by all of the other reference and associator methods to create a list of reference classnames Returns: ...
[ "Get", "list", "of", "classnames", "that", "are", "references", "for", "which", "this", "classname", "is", "a", "target", "filtered", "by", "the", "result_class", "and", "role", "parameters", "if", "they", "are", "none", ".", "This", "is", "a", "common", "...
e54ecb82c2211e289a268567443d60fdd489f1e4
https://github.com/pywbem/pywbem/blob/e54ecb82c2211e289a268567443d60fdd489f1e4/pywbem_mock/_wbemconnection_mock.py#L2694-L2722
train
28,352
pywbem/pywbem
pywbem_mock/_wbemconnection_mock.py
FakedWBEMConnection._get_associated_classnames
def _get_associated_classnames(self, classname, namespace, assoc_class, result_class, result_role, role): """ Get list of classnames that are associated classes for which this classname is a target filtered by the assoc_class, role, result_class, and re...
python
def _get_associated_classnames(self, classname, namespace, assoc_class, result_class, result_role, role): """ Get list of classnames that are associated classes for which this classname is a target filtered by the assoc_class, role, result_class, and re...
[ "def", "_get_associated_classnames", "(", "self", ",", "classname", ",", "namespace", ",", "assoc_class", ",", "result_class", ",", "result_role", ",", "role", ")", ":", "class_repo", "=", "self", ".", "_get_class_repo", "(", "namespace", ")", "result_classes", ...
Get list of classnames that are associated classes for which this classname is a target filtered by the assoc_class, role, result_class, and result_role parameters if they are none. This is a common method used by all of the other reference and associator methods to create a list of ref...
[ "Get", "list", "of", "classnames", "that", "are", "associated", "classes", "for", "which", "this", "classname", "is", "a", "target", "filtered", "by", "the", "assoc_class", "role", "result_class", "and", "result_role", "parameters", "if", "they", "are", "none", ...
e54ecb82c2211e289a268567443d60fdd489f1e4
https://github.com/pywbem/pywbem/blob/e54ecb82c2211e289a268567443d60fdd489f1e4/pywbem_mock/_wbemconnection_mock.py#L2766-L2804
train
28,353
pywbem/pywbem
pywbem_mock/_wbemconnection_mock.py
FakedWBEMConnection._make_pull_imethod_resp
def _make_pull_imethod_resp(objs, eos, context_id): """ Create the correct imethod response for the open and pull methods """ eos_tup = (u'EndOfSequence', None, eos) enum_ctxt_tup = (u'EnumerationContext', None, context_id) return [("IRETURNVALUE", {}, objs), enum_ctxt_t...
python
def _make_pull_imethod_resp(objs, eos, context_id): """ Create the correct imethod response for the open and pull methods """ eos_tup = (u'EndOfSequence', None, eos) enum_ctxt_tup = (u'EnumerationContext', None, context_id) return [("IRETURNVALUE", {}, objs), enum_ctxt_t...
[ "def", "_make_pull_imethod_resp", "(", "objs", ",", "eos", ",", "context_id", ")", ":", "eos_tup", "=", "(", "u'EndOfSequence'", ",", "None", ",", "eos", ")", "enum_ctxt_tup", "=", "(", "u'EnumerationContext'", ",", "None", ",", "context_id", ")", "return", ...
Create the correct imethod response for the open and pull methods
[ "Create", "the", "correct", "imethod", "response", "for", "the", "open", "and", "pull", "methods" ]
e54ecb82c2211e289a268567443d60fdd489f1e4
https://github.com/pywbem/pywbem/blob/e54ecb82c2211e289a268567443d60fdd489f1e4/pywbem_mock/_wbemconnection_mock.py#L3025-L3032
train
28,354
pywbem/pywbem
pywbem_mock/_wbemconnection_mock.py
FakedWBEMConnection._open_response
def _open_response(self, objects, namespace, pull_type, **params): """ Build an open... response once the objects have been extracted from the repository. """ max_obj_cnt = params['MaxObjectCount'] if max_obj_cnt is None: max_obj_cnt = _DEFAULT_MAX_OBJECT_COUN...
python
def _open_response(self, objects, namespace, pull_type, **params): """ Build an open... response once the objects have been extracted from the repository. """ max_obj_cnt = params['MaxObjectCount'] if max_obj_cnt is None: max_obj_cnt = _DEFAULT_MAX_OBJECT_COUN...
[ "def", "_open_response", "(", "self", ",", "objects", ",", "namespace", ",", "pull_type", ",", "*", "*", "params", ")", ":", "max_obj_cnt", "=", "params", "[", "'MaxObjectCount'", "]", "if", "max_obj_cnt", "is", "None", ":", "max_obj_cnt", "=", "_DEFAULT_MAX...
Build an open... response once the objects have been extracted from the repository.
[ "Build", "an", "open", "...", "response", "once", "the", "objects", "have", "been", "extracted", "from", "the", "repository", "." ]
e54ecb82c2211e289a268567443d60fdd489f1e4
https://github.com/pywbem/pywbem/blob/e54ecb82c2211e289a268567443d60fdd489f1e4/pywbem_mock/_wbemconnection_mock.py#L3034-L3066
train
28,355
pywbem/pywbem
pywbem_mock/_wbemconnection_mock.py
FakedWBEMConnection._pull_response
def _pull_response(self, namespace, req_type, **params): """ Common method for all of the Pull methods. Since all of the pull methods operate independent of the type of data, this single function severs as common code This method validates the namespace, gets data on the enumera...
python
def _pull_response(self, namespace, req_type, **params): """ Common method for all of the Pull methods. Since all of the pull methods operate independent of the type of data, this single function severs as common code This method validates the namespace, gets data on the enumera...
[ "def", "_pull_response", "(", "self", ",", "namespace", ",", "req_type", ",", "*", "*", "params", ")", ":", "self", ".", "_validate_namespace", "(", "namespace", ")", "context_id", "=", "params", "[", "'EnumerationContext'", "]", "try", ":", "context_data", ...
Common method for all of the Pull methods. Since all of the pull methods operate independent of the type of data, this single function severs as common code This method validates the namespace, gets data on the enumeration sequence from the enumeration_contexts table, validates the pull...
[ "Common", "method", "for", "all", "of", "the", "Pull", "methods", ".", "Since", "all", "of", "the", "pull", "methods", "operate", "independent", "of", "the", "type", "of", "data", "this", "single", "function", "severs", "as", "common", "code" ]
e54ecb82c2211e289a268567443d60fdd489f1e4
https://github.com/pywbem/pywbem/blob/e54ecb82c2211e289a268567443d60fdd489f1e4/pywbem_mock/_wbemconnection_mock.py#L3068-L3120
train
28,356
pywbem/pywbem
pywbem_mock/_wbemconnection_mock.py
FakedWBEMConnection._validate_open_params
def _validate_open_params(**params): """ Validate the fql parameters and if invalid, generate exception """ if not params['FilterQueryLanguage'] and params['FilterQuery']: raise CIMError( CIM_ERR_INVALID_PARAMETER, "FilterQuery without FilterQu...
python
def _validate_open_params(**params): """ Validate the fql parameters and if invalid, generate exception """ if not params['FilterQueryLanguage'] and params['FilterQuery']: raise CIMError( CIM_ERR_INVALID_PARAMETER, "FilterQuery without FilterQu...
[ "def", "_validate_open_params", "(", "*", "*", "params", ")", ":", "if", "not", "params", "[", "'FilterQueryLanguage'", "]", "and", "params", "[", "'FilterQuery'", "]", ":", "raise", "CIMError", "(", "CIM_ERR_INVALID_PARAMETER", ",", "\"FilterQuery without FilterQue...
Validate the fql parameters and if invalid, generate exception
[ "Validate", "the", "fql", "parameters", "and", "if", "invalid", "generate", "exception" ]
e54ecb82c2211e289a268567443d60fdd489f1e4
https://github.com/pywbem/pywbem/blob/e54ecb82c2211e289a268567443d60fdd489f1e4/pywbem_mock/_wbemconnection_mock.py#L3123-L3145
train
28,357
pywbem/pywbem
pywbem_mock/_wbemconnection_mock.py
FakedWBEMConnection._fake_openassociatorinstances
def _fake_openassociatorinstances(self, namespace, **params): """ Implements WBEM server responder for WBEMConnection.OpenAssociatorInstances with data from the instance repository. """ self._validate_namespace(namespace) self._validate_open_params(**params) ...
python
def _fake_openassociatorinstances(self, namespace, **params): """ Implements WBEM server responder for WBEMConnection.OpenAssociatorInstances with data from the instance repository. """ self._validate_namespace(namespace) self._validate_open_params(**params) ...
[ "def", "_fake_openassociatorinstances", "(", "self", ",", "namespace", ",", "*", "*", "params", ")", ":", "self", ".", "_validate_namespace", "(", "namespace", ")", "self", ".", "_validate_open_params", "(", "*", "*", "params", ")", "params", "[", "'ObjectName...
Implements WBEM server responder for WBEMConnection.OpenAssociatorInstances with data from the instance repository.
[ "Implements", "WBEM", "server", "responder", "for", "WBEMConnection", ".", "OpenAssociatorInstances", "with", "data", "from", "the", "instance", "repository", "." ]
e54ecb82c2211e289a268567443d60fdd489f1e4
https://github.com/pywbem/pywbem/blob/e54ecb82c2211e289a268567443d60fdd489f1e4/pywbem_mock/_wbemconnection_mock.py#L3232-L3248
train
28,358
pywbem/pywbem
pywbem/_listener.py
ListenerRequestHandler.send_http_error
def send_http_error(self, http_code, cim_error=None, cim_error_details=None, headers=None): """ Send an HTTP response back to the WBEM server that indicates an error at the HTTP level. """ self.send_response(http_code, http_client.responses.get(http_code, ...
python
def send_http_error(self, http_code, cim_error=None, cim_error_details=None, headers=None): """ Send an HTTP response back to the WBEM server that indicates an error at the HTTP level. """ self.send_response(http_code, http_client.responses.get(http_code, ...
[ "def", "send_http_error", "(", "self", ",", "http_code", ",", "cim_error", "=", "None", ",", "cim_error_details", "=", "None", ",", "headers", "=", "None", ")", ":", "self", ".", "send_response", "(", "http_code", ",", "http_client", ".", "responses", ".", ...
Send an HTTP response back to the WBEM server that indicates an error at the HTTP level.
[ "Send", "an", "HTTP", "response", "back", "to", "the", "WBEM", "server", "that", "indicates", "an", "error", "at", "the", "HTTP", "level", "." ]
e54ecb82c2211e289a268567443d60fdd489f1e4
https://github.com/pywbem/pywbem/blob/e54ecb82c2211e289a268567443d60fdd489f1e4/pywbem/_listener.py#L407-L426
train
28,359
pywbem/pywbem
pywbem/_listener.py
ListenerRequestHandler.send_error_response
def send_error_response(self, msgid, methodname, status_code, status_desc, error_insts=None): """Send a CIM-XML response message back to the WBEM server that indicates error.""" resp_xml = cim_xml.CIM( cim_xml.MESSAGE( cim_xml.SIMPLEEXPRSP...
python
def send_error_response(self, msgid, methodname, status_code, status_desc, error_insts=None): """Send a CIM-XML response message back to the WBEM server that indicates error.""" resp_xml = cim_xml.CIM( cim_xml.MESSAGE( cim_xml.SIMPLEEXPRSP...
[ "def", "send_error_response", "(", "self", ",", "msgid", ",", "methodname", ",", "status_code", ",", "status_desc", ",", "error_insts", "=", "None", ")", ":", "resp_xml", "=", "cim_xml", ".", "CIM", "(", "cim_xml", ".", "MESSAGE", "(", "cim_xml", ".", "SIM...
Send a CIM-XML response message back to the WBEM server that indicates error.
[ "Send", "a", "CIM", "-", "XML", "response", "message", "back", "to", "the", "WBEM", "server", "that", "indicates", "error", "." ]
e54ecb82c2211e289a268567443d60fdd489f1e4
https://github.com/pywbem/pywbem/blob/e54ecb82c2211e289a268567443d60fdd489f1e4/pywbem/_listener.py#L428-L463
train
28,360
pywbem/pywbem
pywbem/_listener.py
ListenerRequestHandler.send_success_response
def send_success_response(self, msgid, methodname): """Send a CIM-XML response message back to the WBEM server that indicates success.""" resp_xml = cim_xml.CIM( cim_xml.MESSAGE( cim_xml.SIMPLEEXPRSP( cim_xml.EXPMETHODRESPONSE( ...
python
def send_success_response(self, msgid, methodname): """Send a CIM-XML response message back to the WBEM server that indicates success.""" resp_xml = cim_xml.CIM( cim_xml.MESSAGE( cim_xml.SIMPLEEXPRSP( cim_xml.EXPMETHODRESPONSE( ...
[ "def", "send_success_response", "(", "self", ",", "msgid", ",", "methodname", ")", ":", "resp_xml", "=", "cim_xml", ".", "CIM", "(", "cim_xml", ".", "MESSAGE", "(", "cim_xml", ".", "SIMPLEEXPRSP", "(", "cim_xml", ".", "EXPMETHODRESPONSE", "(", "methodname", ...
Send a CIM-XML response message back to the WBEM server that indicates success.
[ "Send", "a", "CIM", "-", "XML", "response", "message", "back", "to", "the", "WBEM", "server", "that", "indicates", "success", "." ]
e54ecb82c2211e289a268567443d60fdd489f1e4
https://github.com/pywbem/pywbem/blob/e54ecb82c2211e289a268567443d60fdd489f1e4/pywbem/_listener.py#L465-L489
train
28,361
pywbem/pywbem
pywbem/_listener.py
ListenerRequestHandler.log
def log(self, format_, args, level=logging.INFO): """ This function is called for anything that needs to get logged. It logs to the logger of this listener. It is not defined in the standard handler class; our version has an additional `level` argument that allows to control the...
python
def log(self, format_, args, level=logging.INFO): """ This function is called for anything that needs to get logged. It logs to the logger of this listener. It is not defined in the standard handler class; our version has an additional `level` argument that allows to control the...
[ "def", "log", "(", "self", ",", "format_", ",", "args", ",", "level", "=", "logging", ".", "INFO", ")", ":", "self", ".", "server", ".", "listener", ".", "logger", ".", "log", "(", "level", ",", "format_", ",", "*", "args", ")" ]
This function is called for anything that needs to get logged. It logs to the logger of this listener. It is not defined in the standard handler class; our version has an additional `level` argument that allows to control the logging level in the standard Python logging support. ...
[ "This", "function", "is", "called", "for", "anything", "that", "needs", "to", "get", "logged", ".", "It", "logs", "to", "the", "logger", "of", "this", "listener", "." ]
e54ecb82c2211e289a268567443d60fdd489f1e4
https://github.com/pywbem/pywbem/blob/e54ecb82c2211e289a268567443d60fdd489f1e4/pywbem/_listener.py#L547-L559
train
28,362
pywbem/pywbem
pywbem/_listener.py
WBEMListener.start
def start(self): """ Start the WBEM listener threads, if they are not yet running. A thread serving CIM-XML over HTTP is started if an HTTP port was specified for the listener. A thread serving CIM-XML over HTTPS is started if an HTTPS port was specified for the listener...
python
def start(self): """ Start the WBEM listener threads, if they are not yet running. A thread serving CIM-XML over HTTP is started if an HTTP port was specified for the listener. A thread serving CIM-XML over HTTPS is started if an HTTPS port was specified for the listener...
[ "def", "start", "(", "self", ")", ":", "if", "self", ".", "_http_port", ":", "if", "not", "self", ".", "_http_server", ":", "try", ":", "server", "=", "ThreadedHTTPServer", "(", "(", "self", ".", "_host", ",", "self", ".", "_http_port", ")", ",", "Li...
Start the WBEM listener threads, if they are not yet running. A thread serving CIM-XML over HTTP is started if an HTTP port was specified for the listener. A thread serving CIM-XML over HTTPS is started if an HTTPS port was specified for the listener. These server threads will ...
[ "Start", "the", "WBEM", "listener", "threads", "if", "they", "are", "not", "yet", "running", "." ]
e54ecb82c2211e289a268567443d60fdd489f1e4
https://github.com/pywbem/pywbem/blob/e54ecb82c2211e289a268567443d60fdd489f1e4/pywbem/_listener.py#L839-L927
train
28,363
pywbem/pywbem
pywbem/_listener.py
WBEMListener.stop
def stop(self): """ Stop the WBEM listener threads, if they are running. """ # Stopping the server will cause its `serve_forever()` method # to return, which will cause the server thread to terminate. # TODO: Describe how the processing threads terminate. if sel...
python
def stop(self): """ Stop the WBEM listener threads, if they are running. """ # Stopping the server will cause its `serve_forever()` method # to return, which will cause the server thread to terminate. # TODO: Describe how the processing threads terminate. if sel...
[ "def", "stop", "(", "self", ")", ":", "# Stopping the server will cause its `serve_forever()` method", "# to return, which will cause the server thread to terminate.", "# TODO: Describe how the processing threads terminate.", "if", "self", ".", "_http_server", ":", "self", ".", "_htt...
Stop the WBEM listener threads, if they are running.
[ "Stop", "the", "WBEM", "listener", "threads", "if", "they", "are", "running", "." ]
e54ecb82c2211e289a268567443d60fdd489f1e4
https://github.com/pywbem/pywbem/blob/e54ecb82c2211e289a268567443d60fdd489f1e4/pywbem/_listener.py#L929-L948
train
28,364
pywbem/pywbem
pywbem/_listener.py
WBEMListener.deliver_indication
def deliver_indication(self, indication, host): """ This function is called by the listener threads for each received indication. It is not supposed to be called by the user. It delivers the indication to all callback functions that have been added to the listener. If a...
python
def deliver_indication(self, indication, host): """ This function is called by the listener threads for each received indication. It is not supposed to be called by the user. It delivers the indication to all callback functions that have been added to the listener. If a...
[ "def", "deliver_indication", "(", "self", ",", "indication", ",", "host", ")", ":", "for", "callback", "in", "self", ".", "_callbacks", ":", "try", ":", "callback", "(", "indication", ",", "host", ")", "except", "Exception", "as", "exc", ":", "# pylint: di...
This function is called by the listener threads for each received indication. It is not supposed to be called by the user. It delivers the indication to all callback functions that have been added to the listener. If a callback function raises any exception this is logged as an error ...
[ "This", "function", "is", "called", "by", "the", "listener", "threads", "for", "each", "received", "indication", ".", "It", "is", "not", "supposed", "to", "be", "called", "by", "the", "user", "." ]
e54ecb82c2211e289a268567443d60fdd489f1e4
https://github.com/pywbem/pywbem/blob/e54ecb82c2211e289a268567443d60fdd489f1e4/pywbem/_listener.py#L950-L976
train
28,365
pywbem/pywbem
pywbem/_listener.py
WBEMListener.add_callback
def add_callback(self, callback): """ Add a callback function to the listener. The callback function will be called for each indication this listener receives from any WBEM server. If the callback function is already known to the listener, it will not be added. ...
python
def add_callback(self, callback): """ Add a callback function to the listener. The callback function will be called for each indication this listener receives from any WBEM server. If the callback function is already known to the listener, it will not be added. ...
[ "def", "add_callback", "(", "self", ",", "callback", ")", ":", "if", "callback", "not", "in", "self", ".", "_callbacks", ":", "self", ".", "_callbacks", ".", "append", "(", "callback", ")" ]
Add a callback function to the listener. The callback function will be called for each indication this listener receives from any WBEM server. If the callback function is already known to the listener, it will not be added. Parameters: callback (:func:`~pywbem.callb...
[ "Add", "a", "callback", "function", "to", "the", "listener", "." ]
e54ecb82c2211e289a268567443d60fdd489f1e4
https://github.com/pywbem/pywbem/blob/e54ecb82c2211e289a268567443d60fdd489f1e4/pywbem/_listener.py#L978-L995
train
28,366
pywbem/pywbem
pywbem/cim_obj.py
cmpname
def cmpname(name1, name2): """ Compare two CIM names for equality and ordering. The comparison is performed case-insensitively. One or both of the items may be `None`, and `None` is considered the lowest possible value. The implementation delegates to the '==' and '<' operators of the nam...
python
def cmpname(name1, name2): """ Compare two CIM names for equality and ordering. The comparison is performed case-insensitively. One or both of the items may be `None`, and `None` is considered the lowest possible value. The implementation delegates to the '==' and '<' operators of the nam...
[ "def", "cmpname", "(", "name1", ",", "name2", ")", ":", "if", "name1", "is", "None", "and", "name2", "is", "None", ":", "return", "0", "if", "name1", "is", "None", ":", "return", "-", "1", "if", "name2", "is", "None", ":", "return", "1", "lower_nam...
Compare two CIM names for equality and ordering. The comparison is performed case-insensitively. One or both of the items may be `None`, and `None` is considered the lowest possible value. The implementation delegates to the '==' and '<' operators of the name datatypes. If name1 == name2, 0 ...
[ "Compare", "two", "CIM", "names", "for", "equality", "and", "ordering", "." ]
e54ecb82c2211e289a268567443d60fdd489f1e4
https://github.com/pywbem/pywbem/blob/e54ecb82c2211e289a268567443d60fdd489f1e4/pywbem/cim_obj.py#L341-L367
train
28,367
pywbem/pywbem
pywbem/cim_obj.py
_qualifiers_tomof
def _qualifiers_tomof(qualifiers, indent, maxline=MAX_MOF_LINE): """ Return a MOF string with the qualifier values, including the surrounding square brackets. The qualifiers are ordered by their name. Return empty string if no qualifiers. Normally multiline output and may fold qualifiers into mult...
python
def _qualifiers_tomof(qualifiers, indent, maxline=MAX_MOF_LINE): """ Return a MOF string with the qualifier values, including the surrounding square brackets. The qualifiers are ordered by their name. Return empty string if no qualifiers. Normally multiline output and may fold qualifiers into mult...
[ "def", "_qualifiers_tomof", "(", "qualifiers", ",", "indent", ",", "maxline", "=", "MAX_MOF_LINE", ")", ":", "if", "not", "qualifiers", ":", "return", "u''", "mof", "=", "[", "]", "mof", ".", "append", "(", "_indent_str", "(", "indent", ")", ")", "mof", ...
Return a MOF string with the qualifier values, including the surrounding square brackets. The qualifiers are ordered by their name. Return empty string if no qualifiers. Normally multiline output and may fold qualifiers into multiple lines. The order of qualifiers is preserved. Parameters: ...
[ "Return", "a", "MOF", "string", "with", "the", "qualifier", "values", "including", "the", "surrounding", "square", "brackets", ".", "The", "qualifiers", "are", "ordered", "by", "their", "name", "." ]
e54ecb82c2211e289a268567443d60fdd489f1e4
https://github.com/pywbem/pywbem/blob/e54ecb82c2211e289a268567443d60fdd489f1e4/pywbem/cim_obj.py#L415-L455
train
28,368
pywbem/pywbem
pywbem/cim_obj.py
_mof_escaped
def _mof_escaped(strvalue): # Note: This is a raw docstring because it shows many backslashes, and # that avoids having to double them. r""" Return a MOF-escaped string from the input string. Parameters: strvalue (:term:`unicode string`): The string value. Must not be `None`. Special...
python
def _mof_escaped(strvalue): # Note: This is a raw docstring because it shows many backslashes, and # that avoids having to double them. r""" Return a MOF-escaped string from the input string. Parameters: strvalue (:term:`unicode string`): The string value. Must not be `None`. Special...
[ "def", "_mof_escaped", "(", "strvalue", ")", ":", "# Note: This is a raw docstring because it shows many backslashes, and", "# that avoids having to double them.", "escaped_str", "=", "strvalue", "# Escape backslash (\\)", "escaped_str", "=", "escaped_str", ".", "replace", "(", "...
r""" Return a MOF-escaped string from the input string. Parameters: strvalue (:term:`unicode string`): The string value. Must not be `None`. Special characters must not be backslash-escaped. Details on backslash-escaping: `DSP0004` defines that the character repertoire for MOF string c...
[ "r", "Return", "a", "MOF", "-", "escaped", "string", "from", "the", "input", "string", "." ]
e54ecb82c2211e289a268567443d60fdd489f1e4
https://github.com/pywbem/pywbem/blob/e54ecb82c2211e289a268567443d60fdd489f1e4/pywbem/cim_obj.py#L466-L577
train
28,369
pywbem/pywbem
pywbem/cim_obj.py
_scalar_value_tomof
def _scalar_value_tomof( value, type, indent=0, maxline=MAX_MOF_LINE, line_pos=0, end_space=0, avoid_splits=False): # pylint: disable=line-too-long,redefined-builtin """ Return a MOF string representing a scalar CIM-typed value. `None` is returned as 'NULL'. Parameters: valu...
python
def _scalar_value_tomof( value, type, indent=0, maxline=MAX_MOF_LINE, line_pos=0, end_space=0, avoid_splits=False): # pylint: disable=line-too-long,redefined-builtin """ Return a MOF string representing a scalar CIM-typed value. `None` is returned as 'NULL'. Parameters: valu...
[ "def", "_scalar_value_tomof", "(", "value", ",", "type", ",", "indent", "=", "0", ",", "maxline", "=", "MAX_MOF_LINE", ",", "line_pos", "=", "0", ",", "end_space", "=", "0", ",", "avoid_splits", "=", "False", ")", ":", "# pylint: disable=line-too-long,redefine...
Return a MOF string representing a scalar CIM-typed value. `None` is returned as 'NULL'. Parameters: value (:term:`CIM data type`, :term:`number`, :class:`~pywbem.CIMInstance`, :class:`~pywbem.CIMClass`): The scalar CIM-typed value. May be `None`. Must not be an array/list/tuple. Must ...
[ "Return", "a", "MOF", "string", "representing", "a", "scalar", "CIM", "-", "typed", "value", "." ]
e54ecb82c2211e289a268567443d60fdd489f1e4
https://github.com/pywbem/pywbem/blob/e54ecb82c2211e289a268567443d60fdd489f1e4/pywbem/cim_obj.py#L771-L849
train
28,370
pywbem/pywbem
pywbem/cim_obj.py
_infer_type
def _infer_type(value, element_kind, element_name): """ Infer the CIM type name of the value, based upon its Python type. """ if value is None: raise ValueError( _format("Cannot infer CIM type of {0} {1!A} from its value when " "the value is None", element_kind, ...
python
def _infer_type(value, element_kind, element_name): """ Infer the CIM type name of the value, based upon its Python type. """ if value is None: raise ValueError( _format("Cannot infer CIM type of {0} {1!A} from its value when " "the value is None", element_kind, ...
[ "def", "_infer_type", "(", "value", ",", "element_kind", ",", "element_name", ")", ":", "if", "value", "is", "None", ":", "raise", "ValueError", "(", "_format", "(", "\"Cannot infer CIM type of {0} {1!A} from its value when \"", "\"the value is None\"", ",", "element_ki...
Infer the CIM type name of the value, based upon its Python type.
[ "Infer", "the", "CIM", "type", "name", "of", "the", "value", "based", "upon", "its", "Python", "type", "." ]
e54ecb82c2211e289a268567443d60fdd489f1e4
https://github.com/pywbem/pywbem/blob/e54ecb82c2211e289a268567443d60fdd489f1e4/pywbem/cim_obj.py#L8153-L8168
train
28,371
pywbem/pywbem
pywbem/cim_obj.py
_check_array_parms
def _check_array_parms(is_array, array_size, value, element_kind, element_name): # pylint: disable=unused-argument # The array_size argument is unused. """ Check whether array-related parameters are ok. """ # The following case has been disabled because it cannot happen g...
python
def _check_array_parms(is_array, array_size, value, element_kind, element_name): # pylint: disable=unused-argument # The array_size argument is unused. """ Check whether array-related parameters are ok. """ # The following case has been disabled because it cannot happen g...
[ "def", "_check_array_parms", "(", "is_array", ",", "array_size", ",", "value", ",", "element_kind", ",", "element_name", ")", ":", "# pylint: disable=unused-argument", "# The array_size argument is unused.", "# The following case has been disabled because it cannot happen given", "...
Check whether array-related parameters are ok.
[ "Check", "whether", "array", "-", "related", "parameters", "are", "ok", "." ]
e54ecb82c2211e289a268567443d60fdd489f1e4
https://github.com/pywbem/pywbem/blob/e54ecb82c2211e289a268567443d60fdd489f1e4/pywbem/cim_obj.py#L8184-L8211
train
28,372
pywbem/pywbem
pywbem/cim_obj.py
_check_embedded_object
def _check_embedded_object(embedded_object, type, value, element_kind, element_name): # pylint: disable=redefined-builtin """ Check whether embedded-object-related parameters are ok. """ if embedded_object not in ('instance', 'object'): raise ValueError( ...
python
def _check_embedded_object(embedded_object, type, value, element_kind, element_name): # pylint: disable=redefined-builtin """ Check whether embedded-object-related parameters are ok. """ if embedded_object not in ('instance', 'object'): raise ValueError( ...
[ "def", "_check_embedded_object", "(", "embedded_object", ",", "type", ",", "value", ",", "element_kind", ",", "element_name", ")", ":", "# pylint: disable=redefined-builtin", "if", "embedded_object", "not", "in", "(", "'instance'", ",", "'object'", ")", ":", "raise"...
Check whether embedded-object-related parameters are ok.
[ "Check", "whether", "embedded", "-", "object", "-", "related", "parameters", "are", "ok", "." ]
e54ecb82c2211e289a268567443d60fdd489f1e4
https://github.com/pywbem/pywbem/blob/e54ecb82c2211e289a268567443d60fdd489f1e4/pywbem/cim_obj.py#L8244-L8283
train
28,373
pywbem/pywbem
pywbem/cim_obj.py
CIMInstanceName._kbstr_to_cimval
def _kbstr_to_cimval(key, val): """ Convert a keybinding value string as found in a WBEM URI into a CIM object or CIM data type, and return it. """ if val[0] == '"' and val[-1] == '"': # A double quoted key value. This could be any of these CIM types: # *...
python
def _kbstr_to_cimval(key, val): """ Convert a keybinding value string as found in a WBEM URI into a CIM object or CIM data type, and return it. """ if val[0] == '"' and val[-1] == '"': # A double quoted key value. This could be any of these CIM types: # *...
[ "def", "_kbstr_to_cimval", "(", "key", ",", "val", ")", ":", "if", "val", "[", "0", "]", "==", "'\"'", "and", "val", "[", "-", "1", "]", "==", "'\"'", ":", "# A double quoted key value. This could be any of these CIM types:", "# * string (see stringValue in DSP00004...
Convert a keybinding value string as found in a WBEM URI into a CIM object or CIM data type, and return it.
[ "Convert", "a", "keybinding", "value", "string", "as", "found", "in", "a", "WBEM", "URI", "into", "a", "CIM", "object", "or", "CIM", "data", "type", "and", "return", "it", "." ]
e54ecb82c2211e289a268567443d60fdd489f1e4
https://github.com/pywbem/pywbem/blob/e54ecb82c2211e289a268567443d60fdd489f1e4/pywbem/cim_obj.py#L1716-L1816
train
28,374
pywbem/pywbem
pywbem/cim_obj.py
CIMInstance.update
def update(self, *args, **kwargs): """ Update the properties of this CIM instance. Existing properties will be updated, and new properties will be added. Parameters: *args (list): Properties for updating the properties of the instance, specified as...
python
def update(self, *args, **kwargs): """ Update the properties of this CIM instance. Existing properties will be updated, and new properties will be added. Parameters: *args (list): Properties for updating the properties of the instance, specified as...
[ "def", "update", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "for", "mapping", "in", "args", ":", "if", "hasattr", "(", "mapping", ",", "'items'", ")", ":", "for", "key", ",", "value", "in", "mapping", ".", "items", "(", ")"...
Update the properties of this CIM instance. Existing properties will be updated, and new properties will be added. Parameters: *args (list): Properties for updating the properties of the instance, specified as positional arguments. Each positional argument must be...
[ "Update", "the", "properties", "of", "this", "CIM", "instance", "." ]
e54ecb82c2211e289a268567443d60fdd489f1e4
https://github.com/pywbem/pywbem/blob/e54ecb82c2211e289a268567443d60fdd489f1e4/pywbem/cim_obj.py#L2703-L2732
train
28,375
pywbem/pywbem
pywbem/cim_obj.py
CIMInstance.update_existing
def update_existing(self, *args, **kwargs): """ Update already existing properties of this CIM instance. Existing properties will be updated, and new properties will be ignored without further notice. Parameters: *args (list): Properties for updating th...
python
def update_existing(self, *args, **kwargs): """ Update already existing properties of this CIM instance. Existing properties will be updated, and new properties will be ignored without further notice. Parameters: *args (list): Properties for updating th...
[ "def", "update_existing", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "for", "mapping", "in", "args", ":", "if", "hasattr", "(", "mapping", ",", "'items'", ")", ":", "for", "key", ",", "value", "in", "mapping", ".", "items", "...
Update already existing properties of this CIM instance. Existing properties will be updated, and new properties will be ignored without further notice. Parameters: *args (list): Properties for updating the properties of the instance, specified as position...
[ "Update", "already", "existing", "properties", "of", "this", "CIM", "instance", "." ]
e54ecb82c2211e289a268567443d60fdd489f1e4
https://github.com/pywbem/pywbem/blob/e54ecb82c2211e289a268567443d60fdd489f1e4/pywbem/cim_obj.py#L2734-L2776
train
28,376
pywbem/pywbem
pywbem/cim_obj.py
CIMInstance.get
def get(self, key, default=None): """ Return the value of a particular property of this CIM instance, or a default value. *New in pywbem 0.8.* Parameters: key (:term:`string`): Name of the property (in any lexical case). default (:term:`CIM dat...
python
def get(self, key, default=None): """ Return the value of a particular property of this CIM instance, or a default value. *New in pywbem 0.8.* Parameters: key (:term:`string`): Name of the property (in any lexical case). default (:term:`CIM dat...
[ "def", "get", "(", "self", ",", "key", ",", "default", "=", "None", ")", ":", "prop", "=", "self", ".", "properties", ".", "get", "(", "key", ",", "None", ")", "return", "default", "if", "prop", "is", "None", "else", "prop", ".", "value" ]
Return the value of a particular property of this CIM instance, or a default value. *New in pywbem 0.8.* Parameters: key (:term:`string`): Name of the property (in any lexical case). default (:term:`CIM data type`): Default value that is returned i...
[ "Return", "the", "value", "of", "a", "particular", "property", "of", "this", "CIM", "instance", "or", "a", "default", "value", "." ]
e54ecb82c2211e289a268567443d60fdd489f1e4
https://github.com/pywbem/pywbem/blob/e54ecb82c2211e289a268567443d60fdd489f1e4/pywbem/cim_obj.py#L2794-L2814
train
28,377
pywbem/pywbem
pywbem/cim_obj.py
CIMInstance.items
def items(self): """ Return a copied list of the property names and values of this CIM instance. Each item in the returned list is a tuple of property name (in the original lexical case) and property value. The order of properties is preserved. """ retur...
python
def items(self): """ Return a copied list of the property names and values of this CIM instance. Each item in the returned list is a tuple of property name (in the original lexical case) and property value. The order of properties is preserved. """ retur...
[ "def", "items", "(", "self", ")", ":", "return", "[", "(", "key", ",", "v", ".", "value", ")", "for", "key", ",", "v", "in", "self", ".", "properties", ".", "items", "(", ")", "]" ]
Return a copied list of the property names and values of this CIM instance. Each item in the returned list is a tuple of property name (in the original lexical case) and property value. The order of properties is preserved.
[ "Return", "a", "copied", "list", "of", "the", "property", "names", "and", "values", "of", "this", "CIM", "instance", "." ]
e54ecb82c2211e289a268567443d60fdd489f1e4
https://github.com/pywbem/pywbem/blob/e54ecb82c2211e289a268567443d60fdd489f1e4/pywbem/cim_obj.py#L2834-L2844
train
28,378
pywbem/pywbem
pywbem/cim_obj.py
CIMInstance.iteritems
def iteritems(self): """ Iterate through the property names and values of this CIM instance. Each iteration item is a tuple of the property name (in the original lexical case) and the property value. The order of properties is preserved. """ for key, val in self...
python
def iteritems(self): """ Iterate through the property names and values of this CIM instance. Each iteration item is a tuple of the property name (in the original lexical case) and the property value. The order of properties is preserved. """ for key, val in self...
[ "def", "iteritems", "(", "self", ")", ":", "for", "key", ",", "val", "in", "self", ".", "properties", ".", "iteritems", "(", ")", ":", "yield", "(", "key", ",", "val", ".", "value", ")" ]
Iterate through the property names and values of this CIM instance. Each iteration item is a tuple of the property name (in the original lexical case) and the property value. The order of properties is preserved.
[ "Iterate", "through", "the", "property", "names", "and", "values", "of", "this", "CIM", "instance", "." ]
e54ecb82c2211e289a268567443d60fdd489f1e4
https://github.com/pywbem/pywbem/blob/e54ecb82c2211e289a268567443d60fdd489f1e4/pywbem/cim_obj.py#L2865-L2875
train
28,379
pywbem/pywbem
pywbem/cim_obj.py
CIMInstance.tomof
def tomof(self, indent=0, maxline=MAX_MOF_LINE): """ Return a MOF string with the specification of this CIM instance. The returned MOF string conforms to the ``instanceDeclaration`` ABNF rule defined in :term:`DSP0004`, with the following limitations: * Pywbem does not support ...
python
def tomof(self, indent=0, maxline=MAX_MOF_LINE): """ Return a MOF string with the specification of this CIM instance. The returned MOF string conforms to the ``instanceDeclaration`` ABNF rule defined in :term:`DSP0004`, with the following limitations: * Pywbem does not support ...
[ "def", "tomof", "(", "self", ",", "indent", "=", "0", ",", "maxline", "=", "MAX_MOF_LINE", ")", ":", "if", "indent", "!=", "0", ":", "msg", "=", "\"The 'indent' parameter of CIMInstance.tomof() is \"", "\"deprecated.\"", "if", "DEBUG_WARNING_ORIGIN", ":", "msg", ...
Return a MOF string with the specification of this CIM instance. The returned MOF string conforms to the ``instanceDeclaration`` ABNF rule defined in :term:`DSP0004`, with the following limitations: * Pywbem does not support instance aliases, so the returned MOF string does not defin...
[ "Return", "a", "MOF", "string", "with", "the", "specification", "of", "this", "CIM", "instance", "." ]
e54ecb82c2211e289a268567443d60fdd489f1e4
https://github.com/pywbem/pywbem/blob/e54ecb82c2211e289a268567443d60fdd489f1e4/pywbem/cim_obj.py#L2987-L3037
train
28,380
pywbem/pywbem
pywbem/cim_obj.py
CIMClass.tomof
def tomof(self, maxline=MAX_MOF_LINE): """ Return a MOF string with the declaration of this CIM class. The returned MOF string conforms to the ``classDeclaration`` ABNF rule defined in :term:`DSP0004`. The order of properties, methods, parameters, and qualifiers is pres...
python
def tomof(self, maxline=MAX_MOF_LINE): """ Return a MOF string with the declaration of this CIM class. The returned MOF string conforms to the ``classDeclaration`` ABNF rule defined in :term:`DSP0004`. The order of properties, methods, parameters, and qualifiers is pres...
[ "def", "tomof", "(", "self", ",", "maxline", "=", "MAX_MOF_LINE", ")", ":", "mof", "=", "[", "]", "mof", ".", "append", "(", "_qualifiers_tomof", "(", "self", ".", "qualifiers", ",", "MOF_INDENT", ",", "maxline", ")", ")", "mof", ".", "append", "(", ...
Return a MOF string with the declaration of this CIM class. The returned MOF string conforms to the ``classDeclaration`` ABNF rule defined in :term:`DSP0004`. The order of properties, methods, parameters, and qualifiers is preserved. The :attr:`~pywbem.CIMClass.path` attribute...
[ "Return", "a", "MOF", "string", "with", "the", "declaration", "of", "this", "CIM", "class", "." ]
e54ecb82c2211e289a268567443d60fdd489f1e4
https://github.com/pywbem/pywbem/blob/e54ecb82c2211e289a268567443d60fdd489f1e4/pywbem/cim_obj.py#L4240-L4286
train
28,381
pywbem/pywbem
pywbem/cim_obj.py
CIMProperty.tomof
def tomof( self, is_instance=True, indent=0, maxline=MAX_MOF_LINE, line_pos=0): """ Return a MOF string with the declaration of this CIM property for use in a CIM class, or the specification of this CIM property for use in a CIM instance. *New in pywbem 0.9.* ...
python
def tomof( self, is_instance=True, indent=0, maxline=MAX_MOF_LINE, line_pos=0): """ Return a MOF string with the declaration of this CIM property for use in a CIM class, or the specification of this CIM property for use in a CIM instance. *New in pywbem 0.9.* ...
[ "def", "tomof", "(", "self", ",", "is_instance", "=", "True", ",", "indent", "=", "0", ",", "maxline", "=", "MAX_MOF_LINE", ",", "line_pos", "=", "0", ")", ":", "mof", "=", "[", "]", "if", "is_instance", ":", "# Property value in an instance", "mof", "."...
Return a MOF string with the declaration of this CIM property for use in a CIM class, or the specification of this CIM property for use in a CIM instance. *New in pywbem 0.9.* Even though pywbem supports qualifiers on :class:`~pywbem.CIMProperty` objects that are used as proper...
[ "Return", "a", "MOF", "string", "with", "the", "declaration", "of", "this", "CIM", "property", "for", "use", "in", "a", "CIM", "class", "or", "the", "specification", "of", "this", "CIM", "property", "for", "use", "in", "a", "CIM", "instance", "." ]
e54ecb82c2211e289a268567443d60fdd489f1e4
https://github.com/pywbem/pywbem/blob/e54ecb82c2211e289a268567443d60fdd489f1e4/pywbem/cim_obj.py#L4998-L5096
train
28,382
pywbem/pywbem
pywbem/cim_obj.py
CIMMethod.tomof
def tomof(self, indent=0, maxline=MAX_MOF_LINE): """ Return a MOF string with the declaration of this CIM method for use in a CIM class declaration. The order of parameters and qualifiers is preserved. Parameters: indent (:term:`integer`): Number of spaces to indent ...
python
def tomof(self, indent=0, maxline=MAX_MOF_LINE): """ Return a MOF string with the declaration of this CIM method for use in a CIM class declaration. The order of parameters and qualifiers is preserved. Parameters: indent (:term:`integer`): Number of spaces to indent ...
[ "def", "tomof", "(", "self", ",", "indent", "=", "0", ",", "maxline", "=", "MAX_MOF_LINE", ")", ":", "mof", "=", "[", "]", "if", "self", ".", "qualifiers", ":", "mof", ".", "append", "(", "_qualifiers_tomof", "(", "self", ".", "qualifiers", ",", "ind...
Return a MOF string with the declaration of this CIM method for use in a CIM class declaration. The order of parameters and qualifiers is preserved. Parameters: indent (:term:`integer`): Number of spaces to indent each line of the returned string, counted in the line wit...
[ "Return", "a", "MOF", "string", "with", "the", "declaration", "of", "this", "CIM", "method", "for", "use", "in", "a", "CIM", "class", "declaration", "." ]
e54ecb82c2211e289a268567443d60fdd489f1e4
https://github.com/pywbem/pywbem/blob/e54ecb82c2211e289a268567443d60fdd489f1e4/pywbem/cim_obj.py#L5647-L5688
train
28,383
pywbem/pywbem
pywbem/cim_obj.py
CIMParameter.tomof
def tomof(self, indent=0, maxline=MAX_MOF_LINE): """ Return a MOF string with the declaration of this CIM parameter for use in a CIM method declaration. The object is always interpreted as a parameter declaration; so the :attr:`~pywbem.CIMParameter.value` and :attr:`~pyw...
python
def tomof(self, indent=0, maxline=MAX_MOF_LINE): """ Return a MOF string with the declaration of this CIM parameter for use in a CIM method declaration. The object is always interpreted as a parameter declaration; so the :attr:`~pywbem.CIMParameter.value` and :attr:`~pyw...
[ "def", "tomof", "(", "self", ",", "indent", "=", "0", ",", "maxline", "=", "MAX_MOF_LINE", ")", ":", "mof", "=", "[", "]", "if", "self", ".", "qualifiers", ":", "mof", ".", "append", "(", "_qualifiers_tomof", "(", "self", ".", "qualifiers", ",", "ind...
Return a MOF string with the declaration of this CIM parameter for use in a CIM method declaration. The object is always interpreted as a parameter declaration; so the :attr:`~pywbem.CIMParameter.value` and :attr:`~pywbem.CIMParameter.embedded_object` attributes are ignored. Th...
[ "Return", "a", "MOF", "string", "with", "the", "declaration", "of", "this", "CIM", "parameter", "for", "use", "in", "a", "CIM", "method", "declaration", "." ]
e54ecb82c2211e289a268567443d60fdd489f1e4
https://github.com/pywbem/pywbem/blob/e54ecb82c2211e289a268567443d60fdd489f1e4/pywbem/cim_obj.py#L6349-L6387
train
28,384
pywbem/pywbem
pywbem/cim_obj.py
CIMQualifier.tomof
def tomof(self, indent=MOF_INDENT, maxline=MAX_MOF_LINE, line_pos=0): """ Return a MOF string with the specification of this CIM qualifier as a qualifier value. The items of array values are tried to keep on the same line. If the generated line would exceed the maximum MOF line ...
python
def tomof(self, indent=MOF_INDENT, maxline=MAX_MOF_LINE, line_pos=0): """ Return a MOF string with the specification of this CIM qualifier as a qualifier value. The items of array values are tried to keep on the same line. If the generated line would exceed the maximum MOF line ...
[ "def", "tomof", "(", "self", ",", "indent", "=", "MOF_INDENT", ",", "maxline", "=", "MAX_MOF_LINE", ",", "line_pos", "=", "0", ")", ":", "mof", "=", "[", "]", "mof", ".", "append", "(", "self", ".", "name", ")", "mof", ".", "append", "(", "u' '", ...
Return a MOF string with the specification of this CIM qualifier as a qualifier value. The items of array values are tried to keep on the same line. If the generated line would exceed the maximum MOF line length, the value is split into multiple lines, on array item boundaries, and/or w...
[ "Return", "a", "MOF", "string", "with", "the", "specification", "of", "this", "CIM", "qualifier", "as", "a", "qualifier", "value", "." ]
e54ecb82c2211e289a268567443d60fdd489f1e4
https://github.com/pywbem/pywbem/blob/e54ecb82c2211e289a268567443d60fdd489f1e4/pywbem/cim_obj.py#L6936-L6990
train
28,385
pywbem/pywbem
pywbem/cim_obj.py
CIMQualifierDeclaration.tomof
def tomof(self, maxline=MAX_MOF_LINE): """ Return a MOF string with the declaration of this CIM qualifier type. The returned MOF string conforms to the ``qualifierDeclaration`` ABNF rule defined in :term:`DSP0004`. Qualifier flavors are included in the returned MOF string only ...
python
def tomof(self, maxline=MAX_MOF_LINE): """ Return a MOF string with the declaration of this CIM qualifier type. The returned MOF string conforms to the ``qualifierDeclaration`` ABNF rule defined in :term:`DSP0004`. Qualifier flavors are included in the returned MOF string only ...
[ "def", "tomof", "(", "self", ",", "maxline", "=", "MAX_MOF_LINE", ")", ":", "mof", "=", "[", "]", "mof", ".", "append", "(", "u'Qualifier '", ")", "mof", ".", "append", "(", "self", ".", "name", ")", "mof", ".", "append", "(", "u' : '", ")", "mof",...
Return a MOF string with the declaration of this CIM qualifier type. The returned MOF string conforms to the ``qualifierDeclaration`` ABNF rule defined in :term:`DSP0004`. Qualifier flavors are included in the returned MOF string only when the information is available (i.e. the value o...
[ "Return", "a", "MOF", "string", "with", "the", "declaration", "of", "this", "CIM", "qualifier", "type", "." ]
e54ecb82c2211e289a268567443d60fdd489f1e4
https://github.com/pywbem/pywbem/blob/e54ecb82c2211e289a268567443d60fdd489f1e4/pywbem/cim_obj.py#L7616-L7701
train
28,386
pywbem/pywbem
try/compat_args.py
main
def main(): """Main function calls the test functs""" print("Python version %s" % sys.version) print("Testing compatibility for function defined with *args") test_func_args(func_old_args) test_func_args(func_new) print("Testing compatibility for function defined with **kwargs") test_func_...
python
def main(): """Main function calls the test functs""" print("Python version %s" % sys.version) print("Testing compatibility for function defined with *args") test_func_args(func_old_args) test_func_args(func_new) print("Testing compatibility for function defined with **kwargs") test_func_...
[ "def", "main", "(", ")", ":", "print", "(", "\"Python version %s\"", "%", "sys", ".", "version", ")", "print", "(", "\"Testing compatibility for function defined with *args\"", ")", "test_func_args", "(", "func_old_args", ")", "test_func_args", "(", "func_new", ")", ...
Main function calls the test functs
[ "Main", "function", "calls", "the", "test", "functs" ]
e54ecb82c2211e289a268567443d60fdd489f1e4
https://github.com/pywbem/pywbem/blob/e54ecb82c2211e289a268567443d60fdd489f1e4/try/compat_args.py#L93-L108
train
28,387
pywbem/pywbem
pywbem_mock/_resolvermixin.py
ResolverMixin._validate_qualifiers
def _validate_qualifiers(qualifier_list, qual_repo, new_class, scope): """ Validate a list of qualifiers against the Qualifier decl in the repository. 1. Whether it is declared (can be obtained from the declContext). 2. Whether it has the same type as the declaration. 3....
python
def _validate_qualifiers(qualifier_list, qual_repo, new_class, scope): """ Validate a list of qualifiers against the Qualifier decl in the repository. 1. Whether it is declared (can be obtained from the declContext). 2. Whether it has the same type as the declaration. 3....
[ "def", "_validate_qualifiers", "(", "qualifier_list", ",", "qual_repo", ",", "new_class", ",", "scope", ")", ":", "for", "qname", ",", "qvalue", "in", "qualifier_list", ".", "items", "(", ")", ":", "if", "qname", "not", "in", "qual_repo", ":", "raise", "CI...
Validate a list of qualifiers against the Qualifier decl in the repository. 1. Whether it is declared (can be obtained from the declContext). 2. Whether it has the same type as the declaration. 3. Whether the qualifier is valid for the given scope. 4. Whether the qualifier can b...
[ "Validate", "a", "list", "of", "qualifiers", "against", "the", "Qualifier", "decl", "in", "the", "repository", "." ]
e54ecb82c2211e289a268567443d60fdd489f1e4
https://github.com/pywbem/pywbem/blob/e54ecb82c2211e289a268567443d60fdd489f1e4/pywbem_mock/_resolvermixin.py#L95-L126
train
28,388
pywbem/pywbem
pywbem_mock/_resolvermixin.py
ResolverMixin._init_qualifier
def _init_qualifier(qualifier, qual_repo): """ Initialize the flavors of a qualifier from the qualifier repo and initialize propagated. """ qual_dict_entry = qual_repo[qualifier.name] qualifier.propagated = False if qualifier.tosubclass is None: if qua...
python
def _init_qualifier(qualifier, qual_repo): """ Initialize the flavors of a qualifier from the qualifier repo and initialize propagated. """ qual_dict_entry = qual_repo[qualifier.name] qualifier.propagated = False if qualifier.tosubclass is None: if qua...
[ "def", "_init_qualifier", "(", "qualifier", ",", "qual_repo", ")", ":", "qual_dict_entry", "=", "qual_repo", "[", "qualifier", ".", "name", "]", "qualifier", ".", "propagated", "=", "False", "if", "qualifier", ".", "tosubclass", "is", "None", ":", "if", "qua...
Initialize the flavors of a qualifier from the qualifier repo and initialize propagated.
[ "Initialize", "the", "flavors", "of", "a", "qualifier", "from", "the", "qualifier", "repo", "and", "initialize", "propagated", "." ]
e54ecb82c2211e289a268567443d60fdd489f1e4
https://github.com/pywbem/pywbem/blob/e54ecb82c2211e289a268567443d60fdd489f1e4/pywbem_mock/_resolvermixin.py#L129-L147
train
28,389
pywbem/pywbem
pywbem_mock/_resolvermixin.py
ResolverMixin._init_qualifier_decl
def _init_qualifier_decl(qualifier_decl, qual_repo): """ Initialize the flavors of a qualifier declaration if they are not already set. """ assert qualifier_decl.name not in qual_repo if qualifier_decl.tosubclass is None: qualifier_decl.tosubclass = True ...
python
def _init_qualifier_decl(qualifier_decl, qual_repo): """ Initialize the flavors of a qualifier declaration if they are not already set. """ assert qualifier_decl.name not in qual_repo if qualifier_decl.tosubclass is None: qualifier_decl.tosubclass = True ...
[ "def", "_init_qualifier_decl", "(", "qualifier_decl", ",", "qual_repo", ")", ":", "assert", "qualifier_decl", ".", "name", "not", "in", "qual_repo", "if", "qualifier_decl", ".", "tosubclass", "is", "None", ":", "qualifier_decl", ".", "tosubclass", "=", "True", "...
Initialize the flavors of a qualifier declaration if they are not already set.
[ "Initialize", "the", "flavors", "of", "a", "qualifier", "declaration", "if", "they", "are", "not", "already", "set", "." ]
e54ecb82c2211e289a268567443d60fdd489f1e4
https://github.com/pywbem/pywbem/blob/e54ecb82c2211e289a268567443d60fdd489f1e4/pywbem_mock/_resolvermixin.py#L150-L161
train
28,390
pywbem/pywbem
pywbem_mock/_resolvermixin.py
ResolverMixin._set_new_object
def _set_new_object(self, new_obj, inherited_obj, new_class, superclass, qualifier_repo, propagated, type_str): """ Set the object attributes for a single object and resolve the qualifiers. This sets attributes for Properties, Methods, and Parameters. """ ...
python
def _set_new_object(self, new_obj, inherited_obj, new_class, superclass, qualifier_repo, propagated, type_str): """ Set the object attributes for a single object and resolve the qualifiers. This sets attributes for Properties, Methods, and Parameters. """ ...
[ "def", "_set_new_object", "(", "self", ",", "new_obj", ",", "inherited_obj", ",", "new_class", ",", "superclass", ",", "qualifier_repo", ",", "propagated", ",", "type_str", ")", ":", "assert", "isinstance", "(", "new_obj", ",", "(", "CIMMethod", ",", "CIMPrope...
Set the object attributes for a single object and resolve the qualifiers. This sets attributes for Properties, Methods, and Parameters.
[ "Set", "the", "object", "attributes", "for", "a", "single", "object", "and", "resolve", "the", "qualifiers", ".", "This", "sets", "attributes", "for", "Properties", "Methods", "and", "Parameters", "." ]
e54ecb82c2211e289a268567443d60fdd489f1e4
https://github.com/pywbem/pywbem/blob/e54ecb82c2211e289a268567443d60fdd489f1e4/pywbem_mock/_resolvermixin.py#L297-L326
train
28,391
pywbem/pywbem
pywbem_mock/_resolvermixin.py
ResolverMixin._resolve_qualifiers
def _resolve_qualifiers(self, new_quals, inherited_quals, new_class, super_class, obj_name, obj_type, qualifier_repo, propagate=False, verbose=False): """ Process the override of qualifiers from the inherited_quals dictionary to the new_qua...
python
def _resolve_qualifiers(self, new_quals, inherited_quals, new_class, super_class, obj_name, obj_type, qualifier_repo, propagate=False, verbose=False): """ Process the override of qualifiers from the inherited_quals dictionary to the new_qua...
[ "def", "_resolve_qualifiers", "(", "self", ",", "new_quals", ",", "inherited_quals", ",", "new_class", ",", "super_class", ",", "obj_name", ",", "obj_type", ",", "qualifier_repo", ",", "propagate", "=", "False", ",", "verbose", "=", "False", ")", ":", "supercl...
Process the override of qualifiers from the inherited_quals dictionary to the new_quals dict following the override rules in DSP0004.
[ "Process", "the", "override", "of", "qualifiers", "from", "the", "inherited_quals", "dictionary", "to", "the", "new_quals", "dict", "following", "the", "override", "rules", "in", "DSP0004", "." ]
e54ecb82c2211e289a268567443d60fdd489f1e4
https://github.com/pywbem/pywbem/blob/e54ecb82c2211e289a268567443d60fdd489f1e4/pywbem_mock/_resolvermixin.py#L328-L406
train
28,392
pywbem/pywbem
pywbem/cim_operations.py
_validateIterCommonParams
def _validateIterCommonParams(MaxObjectCount, OperationTimeout): """ Validate common parameters for an iter... operation. MaxObjectCount must be a positive non-zero integer or None. OperationTimeout must be positive integer or zero Raises: ValueError: if these parameters are invalid ""...
python
def _validateIterCommonParams(MaxObjectCount, OperationTimeout): """ Validate common parameters for an iter... operation. MaxObjectCount must be a positive non-zero integer or None. OperationTimeout must be positive integer or zero Raises: ValueError: if these parameters are invalid ""...
[ "def", "_validateIterCommonParams", "(", "MaxObjectCount", ",", "OperationTimeout", ")", ":", "if", "MaxObjectCount", "is", "None", "or", "MaxObjectCount", "<=", "0", ":", "raise", "ValueError", "(", "_format", "(", "\"MaxObjectCount must be > 0 but is {0}\"", ",", "M...
Validate common parameters for an iter... operation. MaxObjectCount must be a positive non-zero integer or None. OperationTimeout must be positive integer or zero Raises: ValueError: if these parameters are invalid
[ "Validate", "common", "parameters", "for", "an", "iter", "...", "operation", "." ]
e54ecb82c2211e289a268567443d60fdd489f1e4
https://github.com/pywbem/pywbem/blob/e54ecb82c2211e289a268567443d60fdd489f1e4/pywbem/cim_operations.py#L225-L244
train
28,393
pywbem/pywbem
pywbem/cim_operations.py
_validatePullParams
def _validatePullParams(MaxObjectCount, context): """ Validate the input paramaters for the PullInstances, PullInstancesWithPath, and PullInstancePaths requests. MaxObjectCount: Must be integer type and ge 0 context: Must be not None and length ge 2 """ if (not isinstance(M...
python
def _validatePullParams(MaxObjectCount, context): """ Validate the input paramaters for the PullInstances, PullInstancesWithPath, and PullInstancePaths requests. MaxObjectCount: Must be integer type and ge 0 context: Must be not None and length ge 2 """ if (not isinstance(M...
[ "def", "_validatePullParams", "(", "MaxObjectCount", ",", "context", ")", ":", "if", "(", "not", "isinstance", "(", "MaxObjectCount", ",", "six", ".", "integer_types", ")", "or", "MaxObjectCount", "<", "0", ")", ":", "raise", "ValueError", "(", "_format", "(...
Validate the input paramaters for the PullInstances, PullInstancesWithPath, and PullInstancePaths requests. MaxObjectCount: Must be integer type and ge 0 context: Must be not None and length ge 2
[ "Validate", "the", "input", "paramaters", "for", "the", "PullInstances", "PullInstancesWithPath", "and", "PullInstancePaths", "requests", "." ]
e54ecb82c2211e289a268567443d60fdd489f1e4
https://github.com/pywbem/pywbem/blob/e54ecb82c2211e289a268567443d60fdd489f1e4/pywbem/cim_operations.py#L247-L264
train
28,394
pywbem/pywbem
pywbem/cim_operations.py
is_subclass
def is_subclass(ch, ns, super_class, sub): """Determine if one class is a subclass of another class. Parameters: ch: A CIMOMHandle. Either a pycimmb.CIMOMHandle or a :class:`~pywbem.WBEMConnection` object. ns (:term:`string`): Namespace (case independent). super_cl...
python
def is_subclass(ch, ns, super_class, sub): """Determine if one class is a subclass of another class. Parameters: ch: A CIMOMHandle. Either a pycimmb.CIMOMHandle or a :class:`~pywbem.WBEMConnection` object. ns (:term:`string`): Namespace (case independent). super_cl...
[ "def", "is_subclass", "(", "ch", ",", "ns", ",", "super_class", ",", "sub", ")", ":", "lsuper", "=", "super_class", ".", "lower", "(", ")", "if", "isinstance", "(", "sub", ",", "CIMClass", ")", ":", "subname", "=", "sub", ".", "classname", "subclass", ...
Determine if one class is a subclass of another class. Parameters: ch: A CIMOMHandle. Either a pycimmb.CIMOMHandle or a :class:`~pywbem.WBEMConnection` object. ns (:term:`string`): Namespace (case independent). super_class (:term:`string`): Super class name (ca...
[ "Determine", "if", "one", "class", "is", "a", "subclass", "of", "another", "class", "." ]
e54ecb82c2211e289a268567443d60fdd489f1e4
https://github.com/pywbem/pywbem/blob/e54ecb82c2211e289a268567443d60fdd489f1e4/pywbem/cim_operations.py#L9740-L9791
train
28,395
pywbem/pywbem
pywbem/cim_operations.py
WBEMConnection._set_default_namespace
def _set_default_namespace(self, default_namespace): """Internal setter function.""" if default_namespace is not None: default_namespace = default_namespace.strip('/') else: default_namespace = DEFAULT_NAMESPACE self._default_namespace = _ensure_unicode(default_na...
python
def _set_default_namespace(self, default_namespace): """Internal setter function.""" if default_namespace is not None: default_namespace = default_namespace.strip('/') else: default_namespace = DEFAULT_NAMESPACE self._default_namespace = _ensure_unicode(default_na...
[ "def", "_set_default_namespace", "(", "self", ",", "default_namespace", ")", ":", "if", "default_namespace", "is", "not", "None", ":", "default_namespace", "=", "default_namespace", ".", "strip", "(", "'/'", ")", "else", ":", "default_namespace", "=", "DEFAULT_NAM...
Internal setter function.
[ "Internal", "setter", "function", "." ]
e54ecb82c2211e289a268567443d60fdd489f1e4
https://github.com/pywbem/pywbem/blob/e54ecb82c2211e289a268567443d60fdd489f1e4/pywbem/cim_operations.py#L760-L766
train
28,396
pywbem/pywbem
pywbem/cim_operations.py
WBEMConnection._configure_detail_level
def _configure_detail_level(cls, detail_level): """ Validate the `detail_level` parameter and return it. This accepts a string or integer for `detail_level`. """ # process detail_level if isinstance(detail_level, six.string_types): if detail_level not in LOG_...
python
def _configure_detail_level(cls, detail_level): """ Validate the `detail_level` parameter and return it. This accepts a string or integer for `detail_level`. """ # process detail_level if isinstance(detail_level, six.string_types): if detail_level not in LOG_...
[ "def", "_configure_detail_level", "(", "cls", ",", "detail_level", ")", ":", "# process detail_level", "if", "isinstance", "(", "detail_level", ",", "six", ".", "string_types", ")", ":", "if", "detail_level", "not", "in", "LOG_DETAIL_LEVELS", ":", "raise", "ValueE...
Validate the `detail_level` parameter and return it. This accepts a string or integer for `detail_level`.
[ "Validate", "the", "detail_level", "parameter", "and", "return", "it", "." ]
e54ecb82c2211e289a268567443d60fdd489f1e4
https://github.com/pywbem/pywbem/blob/e54ecb82c2211e289a268567443d60fdd489f1e4/pywbem/cim_operations.py#L1397-L1422
train
28,397
pywbem/pywbem
pywbem/cim_operations.py
WBEMConnection._configure_logger_handler
def _configure_logger_handler(cls, log_dest, log_filename): """ Return a logging handler for the specified `log_dest`, or `None` if `log_dest` is `None`. """ if log_dest is None: return None msg_format = '%(asctime)s-%(name)s-%(message)s' if log_des...
python
def _configure_logger_handler(cls, log_dest, log_filename): """ Return a logging handler for the specified `log_dest`, or `None` if `log_dest` is `None`. """ if log_dest is None: return None msg_format = '%(asctime)s-%(name)s-%(message)s' if log_des...
[ "def", "_configure_logger_handler", "(", "cls", ",", "log_dest", ",", "log_filename", ")", ":", "if", "log_dest", "is", "None", ":", "return", "None", "msg_format", "=", "'%(asctime)s-%(name)s-%(message)s'", "if", "log_dest", "==", "'stderr'", ":", "# Note: sys.stde...
Return a logging handler for the specified `log_dest`, or `None` if `log_dest` is `None`.
[ "Return", "a", "logging", "handler", "for", "the", "specified", "log_dest", "or", "None", "if", "log_dest", "is", "None", "." ]
e54ecb82c2211e289a268567443d60fdd489f1e4
https://github.com/pywbem/pywbem/blob/e54ecb82c2211e289a268567443d60fdd489f1e4/pywbem/cim_operations.py#L1425-L1451
train
28,398
pywbem/pywbem
pywbem/cim_operations.py
WBEMConnection._activate_logger
def _activate_logger(cls, logger_name, simple_name, detail_level, handler, connection, propagate): """ Configure the specified logger, and activate logging and set detail level for connections. The specified logger is always a single pywbem logger; the simple ...
python
def _activate_logger(cls, logger_name, simple_name, detail_level, handler, connection, propagate): """ Configure the specified logger, and activate logging and set detail level for connections. The specified logger is always a single pywbem logger; the simple ...
[ "def", "_activate_logger", "(", "cls", ",", "logger_name", ",", "simple_name", ",", "detail_level", ",", "handler", ",", "connection", ",", "propagate", ")", ":", "if", "handler", "is", "not", "None", ":", "assert", "isinstance", "(", "handler", ",", "loggin...
Configure the specified logger, and activate logging and set detail level for connections. The specified logger is always a single pywbem logger; the simple logger name 'all' has already been resolved by the caller into multiple calls to this method. The 'handler' parameter con...
[ "Configure", "the", "specified", "logger", "and", "activate", "logging", "and", "set", "detail", "level", "for", "connections", "." ]
e54ecb82c2211e289a268567443d60fdd489f1e4
https://github.com/pywbem/pywbem/blob/e54ecb82c2211e289a268567443d60fdd489f1e4/pywbem/cim_operations.py#L1454-L1533
train
28,399