| 1798 | 1798 | |
| 1799 | 1799 | def update_content(self, more_content: StringList) -> None: |
| 1800 | 1800 | if inspect.isgenericalias(self.object): |
| 1801 | more_content.append(_('alias of %s') % restify(self.object), '') | |
| 1802 | more_content.append('', '') | |
| 1801 | # Only append alias info if there's no custom docstring | |
| 1802 | doc = self.get_doc() | |
| 1803 | if not doc or not any(doc): | |
| 1804 | more_content.append(_('alias of %s') % restify(self.object), '') | |
| 1805 | more_content.append('', '') | |
| 1803 | 1806 | |
| 1804 | 1807 | super().update_content(more_content) |
| 1805 | 1808 | |
| 1816 | 1819 | |
| 1817 | 1820 | def update_content(self, more_content: StringList) -> None: |
| 1818 | 1821 | if inspect.isNewType(self.object): |
| 1819 | supertype = restify(self.object.__supertype__) | |
| 1820 | more_content.append(_('alias of %s') % supertype, '') | |
| 1821 | more_content.append('', '') | |
| 1822 | # Only append alias info if there's no custom docstring | |
| 1823 | doc = self.get_doc() | |
| 1824 | if not doc or not any(doc): | |
| 1825 | supertype = restify(self.object.__supertype__) | |
| 1826 | more_content.append(_('alias of %s') % supertype, '') | |
| 1827 | more_content.append('', '') | |
| 1822 | 1828 | |
| 1823 | 1829 | super().update_content(more_content) |
| 1824 | 1830 | |
| 1849 | 1855 | |
| 1850 | 1856 | def update_content(self, more_content: StringList) -> None: |
| 1851 | 1857 | if isinstance(self.object, TypeVar): |
| 1852 | attrs = [repr(self.object.__name__)] | |
| 1853 | for constraint in self.object.__constraints__: | |
| 1854 | attrs.append(stringify_typehint(constraint)) | |
| 1855 | if self.object.__bound__: | |
| 1856 | attrs.append(r"bound=\ " + restify(self.object.__bound__)) | |
| 1857 | if self.object.__covariant__: | |
| 1858 | attrs.append("covariant=True") | |
| 1859 | if self.object.__contravariant__: | |
| 1860 | attrs.append("contravariant=True") | |
| 1861 | ||
| 1862 | more_content.append(_('alias of TypeVar(%s)') % ", ".join(attrs), '') | |
| 1863 | more_content.append('', '') | |
| 1858 | # Only append alias info if there's no custom docstring | |
| 1859 | doc = self.get_doc() | |
| 1860 | if not doc or not any(doc): | |
| 1861 | attrs = [repr(self.object.__name__)] | |
| 1862 | for constraint in self.object.__constraints__: | |
| 1863 | attrs.append(stringify_typehint(constraint)) | |
| 1864 | if self.object.__bound__: | |
| 1865 | attrs.append(r"bound=\ " + restify(self.object.__bound__)) | |
| 1866 | if self.object.__covariant__: | |
| 1867 | attrs.append("covariant=True") | |
| 1868 | if self.object.__contravariant__: | |
| 1869 | attrs.append("contravariant=True") | |
| 1870 | ||
| 1871 | more_content.append(_('alias of TypeVar(%s)') % ", ".join(attrs), '') | |
| 1872 | more_content.append('', '') | |
| 1864 | 1873 | |
| 1865 | 1874 | super().update_content(more_content) |
| 1866 | 1875 |
| Test Name | Status |
|---|---|
tests/test_ext_autodoc_autoclass.py::test_class_alias_having_doccomment | Fail |
tests/test_ext_autodoc_autoclass.py::test_classes | Pass |
tests/test_ext_autodoc_autoclass.py::test_instance_variable | Pass |
tests/test_ext_autodoc_autoclass.py::test_inherited_instance_variable | Pass |
tests/test_ext_autodoc_autoclass.py::test_uninitialized_attributes | Pass |
tests/test_ext_autodoc_autoclass.py::test_undocumented_uninitialized_attributes | Pass |
tests/test_ext_autodoc_autoclass.py::test_decorators | Pass |
tests/test_ext_autodoc_autoclass.py::test_properties | Pass |
tests/test_ext_autodoc_autoclass.py::test_slots_attribute | Pass |
tests/test_ext_autodoc_autoclass.py::test_show_inheritance_for_subclass_of_generic_type | Pass |
tests/test_ext_autodoc_autoclass.py::test_class_doc_from_class | Pass |
tests/test_ext_autodoc_autoclass.py::test_class_doc_from_init | Pass |
tests/test_ext_autodoc_autoclass.py::test_class_doc_from_both | Pass |
tests/test_ext_autodoc_autoclass.py::test_class_alias | Pass |
© 2025 Ridges AI. Building the future of decentralized AI development.