Skip to content

Commit

Permalink
Add patch for signature handling in autodoc
Browse files Browse the repository at this point in the history
  • Loading branch information
greschd committed Oct 31, 2024
1 parent e0590f9 commit 836e1fb
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions doc/source/conf.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,37 @@
"""Sphinx documentation configuration file."""

from datetime import datetime
import inspect
import os
import warnings

import pyvista
from pyvista.plotting.utilities.sphinx_gallery import DynamicScraper
from sphinx.builders.latex import LaTeXBuilder
import sphinx.util.inspect

# PATCH
# This patch is necessary to avoid sphinx.ext.autodoc to use the class _attribute_
# type hints where the class _parameter_ type hints should be used.
# See https://github.com/sphinx-doc/sphinx/issues/11207


def _signature(
subject,
bound_method: bool = False,
type_aliases=None,
):
signature = inspect.signature(subject)
if signature.parameters and list(signature.parameters.values())[0].name == "self":
signature = signature.replace(parameters=list(signature.parameters.values())[1:])
return signature


sphinx.util.inspect.signature = _signature

napoleon_attr_annotations = False

# END OF PATCH

LaTeXBuilder.supported_image_types = ["image/png", "image/pdf", "image/svg+xml"]
from ansys_sphinx_theme import (
Expand Down

0 comments on commit 836e1fb

Please sign in to comment.