kitir/utils.py
def deepgetattr(obj, attr, default=None, raise_if_missing=False):
    """Recurses through an attribute chain to get the ultimate value."""
    if isinstance(attr, str):
        attr = attr.split('.')
    try:
        return functools.reduce(getattr, attr, obj)
    except AttributeError:
        if raise_if_missing:
            raise
        return default
Recurses through an attribute chain to get the ultimate value.
Recurses through an attribute chain to get the ultimate value.
Recurses through an attribute chain to get the ultimate value .
def deepgetattr(obj, attr, default=None, raise_if_missing=False):
    if isinstance(attr, str):
        attr = attr.split('.')
    try:
        return functools.reduce(getattr, attr, obj)
    except AttributeError:
        if raise_if_missing:
            raise
        return default
def deepgetattr ( obj , attr , default = None , raise_if_missing = False ) : if isinstance ( attr , str ) : attr = attr . split ( '.' ) try : return functools . reduce ( getattr , attr , obj ) except AttributeError : if raise_if_missing : raise return default
Recurses through an attribute chain to get the ultimate value.
Recurses through an attribute chain to get the ultimate value .
"""Recurses through an attribute chain to get the ultimate value."""
obj
attr
default
raise_if_missing