mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-08 04:54:47 +08:00
[docutils] Add items to docutils.node (#10102)
* Add class paragraph * Add class TextElement * Add Element.index(), .remove(), and .insert()
This commit is contained in:
@@ -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: ...
|
||||
|
||||
Reference in New Issue
Block a user