Skip to content

Commit

Permalink
Merge pull request #100 from theOehrly/cleanup
Browse files Browse the repository at this point in the history
Type hint mixin base class, fix some more minor style and typing issues
  • Loading branch information
Chilipp authored Oct 21, 2024
2 parents 5ef1b47 + 16bcd1c commit 0286ca8
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions autodocsumm/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
__status__ = "Production"

from itertools import chain
from typing import TYPE_CHECKING

from sphinx.util import logging
import re
Expand All @@ -53,7 +54,7 @@
from sphinx.ext.autodoc import (
ClassDocumenter, ModuleDocumenter, ALL, PycodeError,
ModuleAnalyzer, AttributeDocumenter, DataDocumenter, Options,
prepare_docstring)
Documenter, prepare_docstring)
import sphinx.ext.autodoc as ad

signature = Signature = None
Expand Down Expand Up @@ -82,6 +83,12 @@ def force_decode(string: str, encoding: str) -> str:
__version__ = _version.get_versions()['version']


if TYPE_CHECKING: # pragma: no cover
DOCUMENTER_MIXIN_BASE = Documenter
else:
DOCUMENTER_MIXIN_BASE = object


logger = logging.getLogger(__name__)

#: Options of the :class:`sphinx.ext.autodoc.ModuleDocumenter` that have an
Expand Down Expand Up @@ -125,7 +132,7 @@ def _get_arg(param, pos, default, *args, **kwargs):
return default


class AutosummaryDocumenter(object):
class AutosummaryDocumenter(DOCUMENTER_MIXIN_BASE):
"""Abstract class for for extending Documenter methods
This classed is used as a base class for Documenters in order to provide
Expand All @@ -137,6 +144,8 @@ class AutosummaryDocumenter(object):
#: Grouper functions
grouper_funcs = []

member_sections: dict

def __init__(self):
raise NotImplementedError

Expand Down Expand Up @@ -287,7 +296,6 @@ def get_grouped_documenters(self, all_members=False):
else:
return documenters


def add_autosummary(self, relative_ref_paths=False):
"""Add the autosammary table of this documenter.
Expand Down

0 comments on commit 0286ca8

Please sign in to comment.