[docutils] Add items to docutils.node (#10102)

* Add class paragraph
* Add class TextElement
* Add Element.index(), .remove(), and .insert()
This commit is contained in:
danieleades
2023-05-03 11:45:08 +01:00
committed by GitHub
parent 0b60e7fac5
commit 6b5ca0b238

View File

@@ -1,9 +1,10 @@
import sys
import xml.dom.minidom
from _typeshed import Incomplete
from abc import abstractmethod
from collections.abc import Callable, Generator, Iterable, Iterator, Sequence
from typing import Any, ClassVar, Protocol, TypeVar, overload
from typing_extensions import Literal, Self
from typing_extensions import Literal, Self, SupportsIndex
from docutils.transforms import Transformer
@@ -79,6 +80,7 @@ class Node:
class Element(Node):
children: list[Node]
rawsource: str
def __init__(self, rawsource: str = "", *children: Node, **attributes): ...
def __len__(self) -> int: ...
def __contains__(self, key: str | Node) -> bool: ...
@@ -105,8 +107,14 @@ class Element(Node):
def deepcopy(self) -> Self: ...
def pformat(self, indent: str = " ", level: int = 0) -> str: ...
def astext(self) -> str: ...
def index(self, item: Node, start: int = 0, stop: int = sys.maxsize) -> int: ...
def remove(self, item: Node) -> None: ...
def insert(self, index: SupportsIndex, item: Node | Iterable[Node] | None) -> None: ...
def __getattr__(self, __name: str) -> Incomplete: ...
class TextElement(Element):
def __init__(self, rawsource: str = "", text: str = "", *children: Node, **attributes) -> None: ...
class Text(Node, str):
tagname: ClassVar[str]
children: tuple[()]
@@ -135,6 +143,8 @@ class document(Root, Structural, Element):
def astext(self) -> str: ...
def __getattr__(self, __name: str) -> Incomplete: ...
class paragraph(General, TextElement): ...
class NodeVisitor:
def __init__(self, document: document): ...
def __getattr__(self, __name: str) -> Incomplete: ...