def _get_data(self, obj):

        if not exists(self.index_path):
            raise OSError('Index data not found at %s' % self.index_path)

        indexed_data = read_index(self.index_path)

        name = obj.name
        type_name = obj.type_name
        module_name = obj.module

        dummy_data = {'source': '', 'path': ''}


        if isinstance(obj, Type):
            objects = indexed_data.get('objects', {})
            data = objects.get(name, dummy_data)

        elif isinstance(obj, Module):
            modules = indexed_data.get('modules', {})
            data = modules.get(name, dummy_data)

        elif isinstance(obj, BuiltinFunction):
            module = indexed_data.get('modules', {}).get(module_name, {})
            # fixme: if we fail to get method_maps for the module, we could
            # look in all the maps.
            method_maps = module.get('method_maps', [])
            method_names = indexed_data.get('method_names', {})
            for mmap in method_maps:
                name_mapping = method_names[mmap]
                if name in name_mapping:
                    method_name = name_mapping[name]
                    break
            else:
                method_name = ''
            data = indexed_data.get('methods', {}).get(method_name, dummy_data)

        elif isinstance(obj, BuiltinMethod) or isinstance(obj, MethodDescriptor):
            type_ = indexed_data.get('objects', {}).get(type_name, {})
            # fixme: if we fail to get source for method from references, we
            # could look in all the maps.
            references = type_.get('references', [])
            method_names = indexed_data.get('method_names', {})
            for mmap in references:
                if mmap in method_names:
                    name_mapping = method_names[mmap]
                    if name in name_mapping:
                        method_name = name_mapping[name]
                        break
            else:
                method_name = ''
            data = indexed_data.get('methods', {}).get(method_name, dummy_data)

        else:
            raise RuntimeError('Cannot get source for %s' % obj)

        return data
Get the data for the given object.
dataset/ETHPy150Open punchagan/cinspect/cinspect/index/reader.py/Reader._get_data