Skip to content

Commit a511354

Browse files
docutils: add nodes.Text
1 parent 443d6fe commit a511354

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

stubs/docutils/@tests/stubtest_allowlist.txt

+4
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,7 @@ docutils.utils.Reporter.__getattr__
1818

1919
# the constructor appears to be mostly internal API, public API users are meant to use docutils.utils.new_reporter instead
2020
docutils.utils.Reporter.__init__
21+
22+
# these methods take a rawsource parameter that has been deprecated and is completely ignored, so we omit it from the stub
23+
docutils.nodes.Text.__new__
24+
docutils.nodes.Text.__init__

stubs/docutils/docutils/nodes.pyi

+11
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,17 @@ class Element(Node):
9494
def __iadd__(self: Self, other: Node | Iterable[Node]) -> Self: ...
9595
def __getattr__(self, __name: str) -> Any: ... # incomplete
9696

97+
class Text(Node, str):
98+
tagname: str
99+
children: tuple[()]
100+
101+
# we omit the rawsource parameter because it has been deprecated and is ignored
102+
def __new__(cls: type[Self], data: str) -> Self: ...
103+
def __init__(self, data: str) -> None: ...
104+
def shortrepr(self, maxlen: int = ...) -> str: ...
105+
def rstrip(self, chars: str | None = ...) -> str: ...
106+
def lstrip(self, chars: str | None = ...) -> str: ...
107+
97108
class Structural: ...
98109
class Root: ...
99110

0 commit comments

Comments
 (0)