コード例 #1
0
ファイル: indexers.py プロジェクト: kleintom/dxr
    def visit_ClassDef(self, node):
        # Index the class itself for the type: filter.
        start, end = self.file_to_index.get_node_start_end(node)
        if start is not None:
            self.yield_needle("py_type", node.name, start, end)

            # Index the class hierarchy for classes for the derived: and
            # bases: filters.
            class_name = self.get_class_name(node)

            bases = self.tree_analysis.get_base_classes(class_name, set([class_name]))
            for qualname in bases:
                self.yield_needle(
                    needle_type="py_derived", name=local_name(qualname), qualname=qualname, start=start, end=end
                )

            derived_classes = self.tree_analysis.get_derived_classes(class_name, set([class_name]))
            for qualname in derived_classes:
                self.yield_needle(
                    needle_type="py_bases", name=local_name(qualname), qualname=qualname, start=start, end=end
                )

            # Show a menu when hovering over this class.
            self.yield_ref(start, end, ClassRef(self.file_to_index.tree, class_name))

        super(IndexingNodeVisitor, self).visit_ClassDef(node)
コード例 #2
0
ファイル: indexers.py プロジェクト: mcphail/dxr
    def visit_ClassDef(self, node):
        # Index the class itself for the type: filter.
        start, end = self.file_to_index.get_node_start_end(node)
        self.yield_needle('py_type', node.name, start, end)

        # Index the class hierarchy for classes for the derived: and
        # bases: filters.
        class_name = self.get_class_name(node)

        bases = self.tree_analysis.get_base_classes(class_name)
        for qualname in bases:
            self.yield_needle(needle_type='py_derived',
                              name=local_name(qualname),
                              qualname=qualname,
                              start=start,
                              end=end)

        derived_classes = self.tree_analysis.get_derived_classes(class_name)
        for qualname in derived_classes:
            self.yield_needle(needle_type='py_bases',
                              name=local_name(qualname),
                              qualname=qualname,
                              start=start,
                              end=end)

        # Show a menu when hovering over this class.
        self.yield_ref(start, end,
                       class_menu(self.file_to_index.tree, class_name))

        super(IndexingNodeVisitor, self).visit_ClassDef(node)
コード例 #3
0
ファイル: indexers.py プロジェクト: abbeyj/dxr
 def needles(self):
     # Index module name. For practical purposes, this includes
     # __init__.py files for packages even though that's not
     # _technically_ a module.
     yield file_needle('py_module',
                       name=local_name(self.abs_module_name),
                       qualname=self.abs_module_name)
コード例 #4
0
ファイル: indexers.py プロジェクト: mcphail/dxr
 def needles(self):
     # Index module name. For practical purposes, this includes
     # __init__.py files for packages even though that's not
     # _technically_ a module.
     yield file_needle('py_module',
                       name=local_name(self.abs_module_name),
                       qualname=self.abs_module_name)