Return dotted attr (like "a.b.c") from obj, or default if any of the components are missing.
338518
def getattrdeep(obj, attr, *default):
    ''
    attrs = attr.split('.')
    if default:
        getattr_default = lambda o,a,d=default[0]: getattr(o, a, d)
    else:
        getattr_default = lambda o,a: getattr(o, a)

    for a in attrs[:-1]:
        obj = getattr_default(obj, a)

    return getattr_default(obj, attrs[-1])
78301
def convert_attrs_to_lowercase(obj: Any, attrs: Iterable[str]) -> None:
    
    for a in attrs:
        value = getattr(obj, a)
        if value is None:
            continue
        setattr(obj, a, value.lower())
1132542
def as_odict(self):
        
        if hasattr(self, 'cust_odict'):
            return self.cust_odict
        if hasattr(self, 'attr_check'):
            self.attr_check()
        odc = odict()
        for attr in self.attrorder:
            odc[attr] = getattr(self, attr)
        return odc
713212
def _getattrs(self, obj, *attrs):
        
        filtered_attrs = {}
        for attr in attrs:
            if hasattr(obj, attr):
                filtered_attrs[attr] = obj_to_string(
                    self._filter_value(getattr(obj, attr))
                )
        return filtered_attrs
1355910
def pretty_ref(obj: Any) -> str:
    """"""
    try:
        return obj.__module__ + ':' + obj.__qualname__
    except AttributeError:
        return pretty_ref(type(obj)) + '(...)'
161972
function (obj, attr) {

	var parts, i, len, name;

	parts = attr.split(".");

	len = parts.length;

    for (i = 0; i < len; ++i) {
    	name = parts[i];
        obj = obj[name];
    }

    return obj;

}
356701
def _get_template_attr(self, attr):
        '''
        '''

        attr_re = r'{0}\s+.*'.format(attr)

        attr_found = re.search(attr_re, self.template_str)
        if attr_found:
            attr_value = attr_found.group(0).replace(attr, '', 1)
            return attr_value.strip()
11041
function getAttrMap(attrs)
{
	var i;
	var map = {};
	var numAttrs = attrs.length;
	
	for (i=0; i<numAttrs; i++)
	{
		map[ attrs[i].name ] = attrs[i].value;
	}
	
	return map;
}
797330
def getmethattr(obj, meth):
  
  if hasmethod(obj, meth):
    return getattr(obj, meth)()
  elif hasvar(obj, meth):
    return getattr(obj, meth)
  return None
785022
def get_dim_name(arr, names):
    """"""
    for name in names:
        # TODO: raise warning/exception when multiple names arr attrs.
        if hasattr(arr, name):
            return name
    raise AttributeError("No attributes of the object `{0}` match the "
                         "specified names of `{1}`".format(arr, names))
226967
function(attr) {
      if (attr == null) return !!Object.keys(this.changed).length;
      return _.has(this.changed, attr);
    }
38067
def _getdefault(obj, key):
    
    try:
        return obj[key]
    except Exception as f:
        pass

    try:
        return getattr(obj, key)
    except Exception as f:
        pass


    try:
        if float(key) == round(float(key), 0):
            return obj[int(key)]
    except Exception as f:
        pass


    # TODO: FIGURE OUT WHY THIS WAS EVER HERE (AND MAKE A TEST)
    # try:
    #     return eval("obj."+text_type(key))
    # except Exception as f:
    #     pass
    return NullType(obj, key)
53843
def get_attribute(obj, value):
    
    if type(obj) == dict:
        return dict.get(obj, value)
    else:
        return getattr(obj, value)
739885
def _get_default(self, obj):
        ''' 

        '''
        if self.name in obj._property_values:
            # this shouldn't happen because we should have checked before _get_default()
            raise RuntimeError("Bokeh internal error, does not handle the case of self.name already in _property_values")

        is_themed = obj.themed_values() is not None and self.name in obj.themed_values()

        default = self.instance_default(obj)

        if is_themed:
            unstable_dict = obj._unstable_themed_values
        else:
            unstable_dict = obj._unstable_default_values

        if self.name in unstable_dict:
            return unstable_dict[self.name]

        if self.property._may_have_unstable_default():
            if isinstance(default, PropertyValueContainer):
                default._register_owner(obj, self)
            unstable_dict[self.name] = default

        return default
889370
def resolve_attr(obj, name):
    """"""
    # TODO: setup some hinting, so we can go directly to the correct
    # Maybe it's a dict ? Let's try dict lookup, it's the fastest
    try:
        return obj[name]
    except TypeError:
        pass
    except KeyError:
        raise exceptions.MissingField('Dict {0} has no attribute or key "{1}"'.format(obj, name))

    # Okay, it's not a dict, what if we try to access the value as for a regular object attribute?
    try:
        # Slight hack for better speed, since accessing dict is fast
        return obj.__dict__[name]
    except (KeyError, AttributeError):
        pass

    try:
        # Lookup using regular attribute
        return getattr(obj, name)
    except AttributeError:
        pass

    # Last possible choice, it's an iterable
    if isinstance(obj, collections.Iterable):
        return IterableAttr(obj, name)

    raise exceptions.MissingField('Object {0} has no attribute or key "{1}"'.format(obj, name))
361055
def getattrd(obj, name, default=sentinel):
    
    try:
        return functools.reduce(getattr, name.split("."), obj)
    except AttributeError as e:
        if default is not sentinel:
            return default
        raise
1258787
function dotOperatorAttributeRead (attributeName, obj) {
      var attr

      if (obj) attr = obj[attributeName]

      if (typeof attr === 'function') return attr.bind(obj)

      return attr
    }