Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

improve type annotations in 'docutils.readers.pep' #13320

Draft
wants to merge 12 commits into
base: main
Choose a base branch
from
1 change: 1 addition & 0 deletions stubs/docutils/@tests/stubtest_allowlist.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ docutils.nodes.Text.__new__
docutils.parsers.recommonmark_wrapper
docutils.parsers.rst.directives.admonitions.BaseAdmonition.node_class # must be overridden by base classes (pseudo-abstract)
docutils.parsers.rst.directives.misc.MetaBody.__getattr__
docutils.readers.standalone.Reader.document
docutils.statemachine.State.nested_sm # is initialised in __init__
docutils.statemachine.State.nested_sm_kwargs # is initialised in __init__
docutils.statemachine.ViewList.__iter__ # doesn't exist at runtime, but the class is iterable due to __getitem__
Expand Down
18 changes: 16 additions & 2 deletions stubs/docutils/docutils/readers/pep.pyi
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
from _typeshed import Incomplete
__docformat__: str

def __getattr__(name: str) -> Incomplete: ...
from typing import ClassVar, TypeVar

from docutils.parsers import Parser
from docutils.parsers.rst.states import Inliner
from docutils.readers import standalone

_S = TypeVar("_S")

class Reader(standalone.Reader[_S]):

settings_default_overrides: ClassVar[dict[str, int]]

inliner_class: ClassVar[type[Inliner]]

def __init__(self, parser: Parser | None = None, parser_name: str | None = None): ...
14 changes: 12 additions & 2 deletions stubs/docutils/docutils/readers/standalone.pyi
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
from _typeshed import Incomplete
__docformat__: str

def __getattr__(name: str) -> Incomplete: ...
from typing import ClassVar, TypeVar

from docutils import readers

_S = TypeVar("_S")

class Reader(readers.Reader[_S]):

supported: ClassVar[tuple[str]]

config_section_dependencies: ClassVar[tuple[str]]
Loading