Return an iterable (and indexable) object containing the diagnostics.
336492
def diagnostics(self):
        
        class DiagIterator:
            def __init__(self, tu):
                self.tu = tu

            def __len__(self):
                return int(conf.lib.clang_getNumDiagnostics(self.tu))

            def __getitem__(self, key):
                diag = conf.lib.clang_getDiagnostic(self.tu, key)
                if not diag:
                    raise IndexError
                return Diagnostic(diag)

        return DiagIterator(self)
908197
def _to_dict(self):
        """"""
        _dict = {}
        if hasattr(self, 'name') and self.name is not None:
            _dict['name'] = self.name
        if hasattr(self, 'classifier_id') and self.classifier_id is not None:
            _dict['classifier_id'] = self.classifier_id
        if hasattr(self, 'classes') and self.classes is not None:
            _dict['classes'] = [x._to_dict() for x in self.classes]
        return _dict
1089431
def get_indexes(self):
        
        ret = {}
        for index in self.iter_query_indexes():
            ret[index.name] = index
        return ret
1063895
def _build_iterable_validator(iterable):
    """"""
    sub_schemas = [parse_schema(s) for s in iterable]

    def item_validator(value):
        """Validate items in an iterable."""
        for sub in sub_schemas:
            try:
                return sub(value)

            except NotValid:
                pass

        raise NotValid('%r invalidated by anything in %s.' % (value, iterable))

    def iterable_validator(data):
        """Validate an iterable."""
        if not type(data) is type(iterable):
            raise NotValid('%r is not of type %s' % (data, type(iterable)))

        return type(iterable)(item_validator(value) for value in data)

    return iterable_validator
358013
def view(self):
        """"""
        spec = []
        for k, v in six.iteritems(self._p4dict):
            if k.startswith('view'):
                match = RE_FILESPEC.search(v)
                if match:
                    spec.append(FileSpec(v[:match.end() - 1], v[match.end():]))

        return spec
489155
protected function getDiagnosticDataTable()
    {
        if (! $this->dataTable) {
            $diagnosticDatatable = new DiagnosticDataTable();
            $diagnosticDatatable->setServiceLocator($this->getServiceLocator());
            $this->dataTable = $diagnosticDatatable;
        }
        return $this->dataTable;
    }
786320
def __search_iterable(self,
                          obj,
                          item,
                          parent="root",
                          parents_ids=frozenset({})):
        """"""

        for i, thing in enumerate(obj):
            new_parent = "%s[%s]" % (parent, i)
            if self.__skip_this(thing, parent=new_parent):
                continue

            if self.case_sensitive or not isinstance(thing, strings):
                thing_cased = thing
            else:
                thing_cased = thing.lower()

            if thing_cased == item:
                self.__report(
                    report_key='matched_values', key=new_parent, value=thing)
            else:
                item_id = id(thing)
                if parents_ids and item_id in parents_ids:
                    continue
                parents_ids_added = add_to_frozen_set(parents_ids, item_id)
                self.__search(thing, item, "%s[%s]" %
                              (parent, i), parents_ids_added)
86628
def _pathology_iterator(graph):
    
    for node in itt.chain.from_iterable(graph.edges()):
        if isinstance(node, Pathology):
            yield node
346329
def all(self, as_dict=False, as_ordereddict=False):
        """"""

        # By calling list it calls the __iter__ method
        rows = list(self)

        if as_dict:
            return [r.as_dict() for r in rows]
        elif as_ordereddict:
            return [r.as_dict(ordered=True) for r in rows]

        return rows
229771
def iterate(it):
    """"""
    if is_async_iterable(it):
        return from_async_iterable.raw(it)
    if isinstance(it, Iterable):
        return from_iterable.raw(it)
    raise TypeError(
        f"{type(it).__name__!r} object is not (async) iterable")
749623
def to_dict(cls):
        
        return dict((item.name, item.number) for item in iter(cls))
795363
def to_dict(self, properties=None):
        
        if not properties:
            properties = [p for p in dir(Assay) if isinstance(getattr(Assay, p), property)]
        return {p: getattr(self, p) for p in properties}
1241787
def to_dict(self):
        """"""
        result = {
            'type': get_qualified_name(self),
            'fitted': self.fitted,
            'constant_value': self.constant_value
        }

        if not self.fitted:
            return result

        result.update(self._fit_params())
        return result
387954
def each_indexed_object(collection, index_name, **where):
    """"""
    index = _db[collection].indexes[index_name]
    for id in index.value_map.get(indexed_value(index, where), []):
        yield get_object(collection, id)
837500
def _compute_callables_count(self, iters: Dict[str, Any]):
        """"""
        count = dict.fromkeys([issue["callable"] for issue in iters["issues"]], 0)
        for issue in iters["issues"]:
            count[issue["callable"]] += 1

        return count
1275715
def inspect(self):
        """"""
        results = {}
        for fname in dir(self):
            if not fname.startswith('_'):
                value = getattr(self, fname)
                if isinstance(value, collections.Callable):
                    continue
                results[fname] = value
        return results
687701
def _from_dict(cls, _dict):
        """"""
        args = {}
        if 'classifier_id' in _dict:
            args['classifier_id'] = _dict.get('classifier_id')
        if 'url' in _dict:
            args['url'] = _dict.get('url')
        if 'collection' in _dict:
            args['collection'] = [
                CollectionItem._from_dict(x) for x in (_dict.get('collection'))
            ]
        return cls(**args)