8000 add docutils.nodes.General stub by danieleades · Pull Request #10099 · python/typeshed · GitHub
[go: up one dir, main page]

Skip to content

add docutils.nodes.General stub #10099

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

Merged
merged 6 commits into from
Apr 29, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions stubs/docutils/@tests/stubtest_allowlist.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ docutils.nodes.Element.__getattr__
docutils.nodes.NodeVisitor.__getattr__
docutils.nodes.document.__getattr__
docutils.nodes.document.__init__
docutils.nodes.Element.__iter__ # doesn't exist at runtime, but the class is iterable due to __getitem__
docutils.parsers.rst.Directive.__getattr__
docutils.transforms.Transform.__getattr__
docutils.transforms.Transformer.__getattr__
Expand Down
7 changes: 6 additions & 1 deletion stubs/docutils/docutils/nodes.pyi
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import xml.dom.minidom
from _typeshed import Incomplete
from abc import abstractmethod
from collections.abc import Callable, Generator, Iterable, Sequence
from collections.abc import Callable, Generator, Iterable, Iterator, Sequence
from typing import Any, ClassVar, Protocol, TypeVar, overload
from typing_extensions import Literal, Self

Expand Down Expand Up @@ -82,6 +82,9 @@ class Element(Node):
def __init__(self, rawsource: str = "", *children: Node, **attributes): ...
def __len__(self) -> int: ...
def __contains__(self, key: str | Node) -> bool: ...
# '__iter__' is added as workaround, since mypy doesn't support classes that are iterable via '__getitem__'
# see https://github.com/python/typeshed/pull/10099#issuecomment-1528789395
def __iter__(self) -> Iterator[Node]: ...
@overload
def __getitem__(self, key: str) -> Any: ...
@overload
Expand Down Expand Up @@ -120,6 +123,8 @@ class Text(Node, str):
def lstrip(self, chars: str | None = None) -> str: ...

class Structural: ...
class Body: ...
class General(Body): ...
class Root: ...

class document(Root, Structural, Element):
Expand Down
0