Return a string that identifies the value-mapped element.
352161
def _element_str(self):
        
        # pylint: disable=no-else-return
        if isinstance(self.element, CIMProperty):
            return _format("property {0!A} in class {1!A} (in {2!A})",
                           self.propname, self.classname, self.namespace)
        elif isinstance(self.element, CIMMethod):
            return _format("method {0!A} in class {1!A} (in {2!A})",
                           self.methodname, self.classname, self.namespace)
        assert isinstance(self.element, CIMParameter)
        return _format("parameter {0!A} of method {1!A} in class {2!A} "
                       "(in {3!A})",
                       self.parametername, self.methodname, self.classname,
                       self.namespace)
771689
def _extract_value(self, value):
        """"""
        return ModelEndpoint._value_map.get(smart_str(value).lower(), value)
844513
def name(self):
        
        if hasattr(self._element, "name"):
            return self._element.name
        else:
            return str(self._element)
1243424
def element_repr(self):
    
    # deepcopy so we don't mess with the valid XML.
    pretty_data = copy.deepcopy(self)
    indent_xml(pretty_data)
    return ElementTree.tostring(pretty_data).encode("utf-8")
662426
function(_element){
                var _id = _element.id;
                if (!!_dataset[_id]) return;
                var _map = {};
                _u._$forEach(
                    _element.attributes,
                    function(_node){
                        var _key  = _node.nodeName;
                        if (_key.indexOf(_tag)!=0) return;
                        _key = _key.replace(_tag,'')
                                   .replace(_reg,function($1,$2){
                                        return $2.toUpperCase();
                                   });
                        _map[_key] = _node.nodeValue||'';
                    }
                );
                _dataset[_id] = _map;
            }
1099336
def get_tag_value(x, key):
    """"""
    if x is None:
        return ''
    result = [y['Value'] for y in x if y['Key'] == key]
    if result:
        return result[0]
    return ''
1003274
def _str(obj):
    """"""
    values = []
    for name in obj._attribs:
        val = getattr(obj, name)
        if isinstance(val, str):
            val = repr(val)
        val = str(val) if len(str(val)) < 10 else "(...)"
        values.append((name, val))
    values = ", ".join("{}={}".format(k, v) for k, v in values)
    return "{}({})".format(obj.__class__.__name__, values)
267007
def to_representation(self, value):
        """"""
        content_type = ContentType.objects.get_for_id(value)
        return "_".join(content_type.natural_key())
1064570
def getElementById(id: str) -> Optional[Node]:
    """"""
    elm = Element._elements_with_id.get(id)
    return elm
1211844
String getElementKeyString(Element element) {
		JsonKey key = element.getAnnotation(JsonKey.class);
		JsonModel model = element.getEnclosingElement().getAnnotation(JsonModel.class);
		if (!"".equals(key.value())) {
			return key.value();
		} else if ("".equals(key.value()) && key.decamelize()) {
			return decamelize(element.toString());
		} else if ("".equals(key.value()) && model.decamelize()) {
			return decamelize(element.toString());
		} else {
			return element.toString();
		}
	}
571963
def get_value_name(self, pretty=False):
        
        if pretty:
            return "%s (%x)" % (
                self.enums.get(self._value, "n/a"),
                self._value
            )

        return self.enums.get(self._value, "n/a")
91936
def type(self):
        """"""
        if isinstance(self.value, numbers.Number):
            return "number"
        if isinstance(self.value, basestring):
            return "string"
        return "unknown"
83084
public static String getValueString(Object value, int type, MappingRules mapping) {
        String string = value.toString();
        if (type != PropertyType.STRING &&
                mapping.propertyFormat.embedType &&
                mapping.propertyFormat.scope == MappingRules.PropertyFormat.Scope.value) {
            string = "{" + PropertyType.nameFromValue(type) + "}" + string;
        }
        return string;
    }
278819
def get(identifier, value=None):
  """"""
  if value is None:
    value = identifier
  if identifier is None:
    return None
  elif isinstance(identifier, dict):
    try:
      return deserialize(identifier)
    except ValueError:
      return value
  elif isinstance(identifier, six.string_types):
    config = {'class_name': str(identifier), 'config': {}}
    try:
      return deserialize(config)
    except ValueError:
      return value
  elif callable(identifier):
    return identifier
  return value
679637
def write(self, valuedict):
        """"""
        if self.identifier in valuedict:
            value = valuedict[self.identifier]
        elif self.default is not None:
            value = self.default
        elif self.fromtag is not None and self.fromtag in valuedict:
            if self.operator == "count":
                value = len(valuedict[self.fromtag])
            else:
                msg.err("referenced 'from' attribute/operator {} not in xml dictionary.".format(self.fromtag))
                exit(1)
        else:
            msg.err("a required line {} had no value or default specified.".format(self.identifier))
            exit(1)            

        #Before we generate the result, validate the choices if they exist
        if len(self.choices) > 0:
            for single in value:
                if str(single) not in self.choices:
                    msg.warn("failed choices validation for {} in {} (line {})".format(
                        single, self.choices, self.identifier))

        result = []
        #Get the string representation of the value
        if isinstance(value, list):
            sval = " ".join([ str(val) for val in value])
        else:
            sval = str(value)

        if self.comment != "" and (self.nvalues < 0 or self.nvalues > 5):
            #We will put the comments on a separate line from the actual values.
            result.append(self.comment)
            result.append(sval)
        else:
            result.append("{} {}".format(sval, self.comment))
                    
        return result
943743
public static String getValueFromElement(Element element, String tagName) {
        NodeList elementNodeList = element.getElementsByTagName(tagName);
        if (elementNodeList == null) {
            return "";
        } else {
            Element tagElement = (Element) elementNodeList.item(0);
            if (tagElement == null) {
                return "";
            }

            NodeList tagNodeList = tagElement.getChildNodes();
            if (tagNodeList == null || tagNodeList.getLength() == 0) {
                return "";
            }
            return tagNodeList.item(0).getNodeValue();
        }
    }
800328
def get_named_by_definition(cls, element_list, string_def):
        """"""
        try:
            return next(
                (
                    st.value
                    for st in element_list
                    if st.definition == string_def
                )
            )
        except Exception:
            return None