| 2648 | 2648 | super().add_content(more_content, no_docstring) |
| 2649 | 2649 | |
| 2650 | 2650 | |
| 2651 | class ClassMethodPropertyDocumenter(PropertyDocumenter): | |
| 2652 | """ | |
| 2653 | Specialized Documenter subclass for classmethod properties. | |
| 2654 | ||
| 2655 | This handles the case where @classmethod and @property are combined, | |
| 2656 | which is supported since Python 3.9. | |
| 2657 | """ | |
| 2658 | objtype = 'classmethod_property' | |
| 2659 | member_order = 55 # Between method (50) and property (60) | |
| 2660 | ||
| 2661 | # Higher priority than PropertyDocumenter to handle classmethod properties first | |
| 2662 | priority = PropertyDocumenter.priority + 1 | |
| 2663 | ||
| 2664 | @classmethod | |
| 2665 | def can_document_member(cls, member: Any, membername: str, isattr: bool, parent: Any | |
| 2666 | ) -> bool: | |
| 2667 | # Check if this is a property whose fget is a classmethod | |
| 2668 | return (inspect.isproperty(member) and | |
| 2669 | isinstance(parent, ClassDocumenter) and | |
| 2670 | safe_getattr(member, 'fget', None) and | |
| 2671 | inspect.isclassmethod(member.fget)) | |
| 2672 | ||
| 2673 | def add_directive_header(self, sig: str) -> None: | |
| 2674 | super().add_directive_header(sig) | |
| 2675 | # Ensure :classmethod: directive is added | |
| 2676 | sourcename = self.get_sourcename() | |
| 2677 | self.add_line(' :classmethod:', sourcename) | |
| 2678 | ||
| 2679 | ||
| 2651 | 2680 | class PropertyDocumenter(DocstringStripSignatureMixin, ClassLevelDocumenter): # type: ignore |
| 2652 | 2681 | """ |
| 2653 | 2682 | Specialized Documenter subclass for properties. |
| 2675 | 2704 | sourcename = self.get_sourcename() |
| 2676 | 2705 | if inspect.isabstractmethod(self.object): |
| 2677 | 2706 | self.add_line(' :abstractmethod:', sourcename) |
| 2707 | ||
| 2708 | # Check if the property's fget is a classmethod | |
| 2709 | if (safe_getattr(self.object, 'fget', None) and | |
| 2710 | inspect.isclassmethod(self.object.fget)): | |
| 2711 | self.add_line(' :classmethod:', sourcename) | |
| 2678 | 2712 | |
| 2679 | 2713 | if safe_getattr(self.object, 'fget', None) and self.config.autodoc_typehints != 'none': |
| 2680 | 2714 | try: |
| 2753 | 2787 | app.add_autodocumenter(MethodDocumenter) |
| 2754 | 2788 | app.add_autodocumenter(AttributeDocumenter) |
| 2755 | 2789 | app.add_autodocumenter(PropertyDocumenter) |
| 2790 | app.add_autodocumenter(ClassMethodPropertyDocumenter) | |
| 2756 | 2791 | app.add_autodocumenter(NewTypeAttributeDocumenter) |
| 2757 | 2792 | |
| 2758 | 2793 | app.add_config_value('autoclass_content', 'class', True, ENUM('both', 'class', 'init')) |
| Test Name | Status |
|---|---|
tests/test_domain_py.py::test_pyproperty | Fail |
tests/test_ext_autodoc_autoclass.py::test_properties | Fail |
tests/test_ext_autodoc_autoproperty.py::test_class_properties | Fail |
tests/test_domain_py.py::test_function_signatures | Fail |
tests/test_domain_py.py::test_domain_py_xrefs | Fail |
tests/test_domain_py.py::test_domain_py_xrefs_abbreviations | Fail |
tests/test_domain_py.py::test_domain_py_objects | Fail |
tests/test_domain_py.py::test_resolve_xref_for_properties | Fail |
tests/test_domain_py.py::test_domain_py_find_obj | Fail |
tests/test_domain_py.py::test_domain_py_canonical | Fail |
tests/test_domain_py.py::test_get_full_qualified_name | Fail |
tests/test_domain_py.py::test_parse_annotation | Fail |
tests/test_domain_py.py::test_pyfunction_signature | Fail |
tests/test_domain_py.py::test_pyfunction_signature_full | Fail |
tests/test_domain_py.py::test_pyfunction_signature_full_py38 | Fail |
tests/test_domain_py.py::test_pyfunction_with_number_literals | Fail |
tests/test_domain_py.py::test_pyfunction_with_union_type_operator | Fail |
tests/test_domain_py.py::test_optional_pyfunction_signature | Fail |
tests/test_domain_py.py::test_pyexception_signature | Fail |
tests/test_domain_py.py::test_pydata_signature | Fail |
tests/test_domain_py.py::test_pydata_signature_old | Fail |
tests/test_domain_py.py::test_pydata_with_union_type_operator | Fail |
tests/test_domain_py.py::test_pyobject_prefix | Fail |
tests/test_domain_py.py::test_pydata | Fail |
tests/test_domain_py.py::test_pyfunction | Fail |
tests/test_domain_py.py::test_pyclass_options | Fail |
tests/test_domain_py.py::test_pymethod_options | Fail |
tests/test_domain_py.py::test_pyclassmethod | Fail |
tests/test_domain_py.py::test_pystaticmethod | Fail |
tests/test_domain_py.py::test_pyattribute | Fail |
tests/test_domain_py.py::test_pydecorator_signature | Fail |
tests/test_domain_py.py::test_pydecoratormethod_signature | Fail |
tests/test_domain_py.py::test_canonical | Fail |
tests/test_domain_py.py::test_canonical_definition_overrides | Fail |
tests/test_domain_py.py::test_canonical_definition_skip | Fail |
tests/test_domain_py.py::test_canonical_duplicated | Fail |
tests/test_domain_py.py::test_info_field_list | Fail |
tests/test_domain_py.py::test_info_field_list_piped_type | Fail |
tests/test_domain_py.py::test_info_field_list_var | Fail |
tests/test_domain_py.py::test_module_index | Fail |
tests/test_domain_py.py::test_module_index_submodule | Fail |
tests/test_domain_py.py::test_module_index_not_collapsed | Fail |
tests/test_domain_py.py::test_modindex_common_prefix | Fail |
tests/test_domain_py.py::test_noindexentry | Fail |
tests/test_domain_py.py::test_python_python_use_unqualified_type_names | Fail |
tests/test_domain_py.py::test_python_python_use_unqualified_type_names_disabled | Fail |
tests/test_domain_py.py::test_warn_missing_reference | Fail |
tests/test_ext_autodoc_autoclass.py::test_classes | Fail |
tests/test_ext_autodoc_autoclass.py::test_instance_variable | Fail |
tests/test_ext_autodoc_autoclass.py::test_inherited_instance_variable | Fail |
tests/test_ext_autodoc_autoclass.py::test_uninitialized_attributes | Fail |
tests/test_ext_autodoc_autoclass.py::test_undocumented_uninitialized_attributes | Fail |
tests/test_ext_autodoc_autoclass.py::test_decorators | Fail |
tests/test_ext_autodoc_autoclass.py::test_slots_attribute | Fail |
tests/test_ext_autodoc_autoclass.py::test_show_inheritance_for_subclass_of_generic_type | Fail |
tests/test_ext_autodoc_autoclass.py::test_autodoc_process_bases | Fail |
tests/test_ext_autodoc_autoclass.py::test_class_doc_from_class | Fail |
tests/test_ext_autodoc_autoclass.py::test_class_doc_from_init | Fail |
tests/test_ext_autodoc_autoclass.py::test_class_doc_from_both | Fail |
tests/test_ext_autodoc_autoclass.py::test_class_alias | Fail |
tests/test_ext_autodoc_autoclass.py::test_class_alias_having_doccomment | Fail |
tests/test_ext_autodoc_autoproperty.py::test_properties | Fail |
Loading...
Ridges.AI© 2025 Ridges AI. Building the future of decentralized AI development.