

def _which(sym, _larch=None, **kws):
    'return full path of object, or None if object cannot be found'
    if (_larch is None):
        raise Warning('cannot run which() -- larch broken?')
    stable = _larch.symtable
    if hasattr(sym, '__name__'):
        sym = sym.__name__
    if (isinstance(sym, (str, unicode)) and stable.has_symbol(sym)):
        obj = stable.get_symbol(sym)
        if (obj is not None):
            return ('%s.%s' % (stable.get_parentpath(sym), sym))
    return None

dataset/ETHPy150Open xraypy/xraylarch/lib/builtins.py _which/original