MCPcopy
hub / github.com/sphinx-doc/sphinx / note_object

Method note_object

sphinx/domains/python/__init__.py:780–813  ·  view source on GitHub ↗

Note a python object for cross reference. .. versionadded:: 2.1

(
        self,
        name: str,
        objtype: str,
        node_id: str,
        aliased: bool = False,
        location: Any = None,
    )

Source from the content-addressed store, hash-verified

778 return self.data.setdefault('objects', {}) # fullname -> ObjectEntry
779
780 def note_object(
781 self,
782 name: str,
783 objtype: str,
784 node_id: str,
785 aliased: bool = False,
786 location: Any = None,
787 ) -> None:
788 """Note a python object for cross reference.
789
790 .. versionadded:: 2.1
791 """
792 if name in self.objects:
793 other = self.objects[name]
794 if other.aliased and aliased is False:
795 # The original definition found. Override it!
796 pass
797 elif other.aliased is False and aliased:
798 # The original definition is already registered.
799 return
800 else:
801 # duplicated
802 logger.warning(
803 __(
804 'duplicate object description of %s, '
805 'other instance in %s, use :no-index: for one of them'
806 ),
807 name,
808 other.docname,
809 location=location,
810 )
811 self.objects[name] = ObjectEntry(
812 self.env.current_document.docname, node_id, objtype, aliased
813 )
814
815 @property
816 def modules(self) -> dict[str, ModuleEntry]:

Callers 2

runMethod · 0.45
add_target_and_indexMethod · 0.45

Calls 2

ObjectEntryClass · 0.85
warningMethod · 0.45

Tested by

no test coverage detected