mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-09 05:24:52 +08:00
Split stdlib into Python 2 and 3 versions (#5442)
All new files in stdlib/@python2 are straight copies of the corresponding files in stdlib.
This commit is contained in:
1
stdlib/@python2/xml/__init__.pyi
Normal file
1
stdlib/@python2/xml/__init__.pyi
Normal file
@@ -0,0 +1 @@
|
||||
import xml.parsers as parsers
|
||||
19
stdlib/@python2/xml/dom/NodeFilter.pyi
Normal file
19
stdlib/@python2/xml/dom/NodeFilter.pyi
Normal file
@@ -0,0 +1,19 @@
|
||||
class NodeFilter:
|
||||
FILTER_ACCEPT: int
|
||||
FILTER_REJECT: int
|
||||
FILTER_SKIP: int
|
||||
|
||||
SHOW_ALL: int
|
||||
SHOW_ELEMENT: int
|
||||
SHOW_ATTRIBUTE: int
|
||||
SHOW_TEXT: int
|
||||
SHOW_CDATA_SECTION: int
|
||||
SHOW_ENTITY_REFERENCE: int
|
||||
SHOW_ENTITY: int
|
||||
SHOW_PROCESSING_INSTRUCTION: int
|
||||
SHOW_COMMENT: int
|
||||
SHOW_DOCUMENT: int
|
||||
SHOW_DOCUMENT_TYPE: int
|
||||
SHOW_DOCUMENT_FRAGMENT: int
|
||||
SHOW_NOTATION: int
|
||||
def acceptNode(self, node) -> int: ...
|
||||
68
stdlib/@python2/xml/dom/__init__.pyi
Normal file
68
stdlib/@python2/xml/dom/__init__.pyi
Normal file
@@ -0,0 +1,68 @@
|
||||
from typing import Any
|
||||
|
||||
from .domreg import getDOMImplementation as getDOMImplementation, registerDOMImplementation as registerDOMImplementation
|
||||
|
||||
class Node:
|
||||
ELEMENT_NODE: int
|
||||
ATTRIBUTE_NODE: int
|
||||
TEXT_NODE: int
|
||||
CDATA_SECTION_NODE: int
|
||||
ENTITY_REFERENCE_NODE: int
|
||||
ENTITY_NODE: int
|
||||
PROCESSING_INSTRUCTION_NODE: int
|
||||
COMMENT_NODE: int
|
||||
DOCUMENT_NODE: int
|
||||
DOCUMENT_TYPE_NODE: int
|
||||
DOCUMENT_FRAGMENT_NODE: int
|
||||
NOTATION_NODE: int
|
||||
|
||||
# ExceptionCode
|
||||
INDEX_SIZE_ERR: int
|
||||
DOMSTRING_SIZE_ERR: int
|
||||
HIERARCHY_REQUEST_ERR: int
|
||||
WRONG_DOCUMENT_ERR: int
|
||||
INVALID_CHARACTER_ERR: int
|
||||
NO_DATA_ALLOWED_ERR: int
|
||||
NO_MODIFICATION_ALLOWED_ERR: int
|
||||
NOT_FOUND_ERR: int
|
||||
NOT_SUPPORTED_ERR: int
|
||||
INUSE_ATTRIBUTE_ERR: int
|
||||
INVALID_STATE_ERR: int
|
||||
SYNTAX_ERR: int
|
||||
INVALID_MODIFICATION_ERR: int
|
||||
NAMESPACE_ERR: int
|
||||
INVALID_ACCESS_ERR: int
|
||||
VALIDATION_ERR: int
|
||||
|
||||
class DOMException(Exception):
|
||||
code: int
|
||||
def __init__(self, *args: Any, **kw: Any) -> None: ...
|
||||
def _get_code(self) -> int: ...
|
||||
|
||||
class IndexSizeErr(DOMException): ...
|
||||
class DomstringSizeErr(DOMException): ...
|
||||
class HierarchyRequestErr(DOMException): ...
|
||||
class WrongDocumentErr(DOMException): ...
|
||||
class NoDataAllowedErr(DOMException): ...
|
||||
class NoModificationAllowedErr(DOMException): ...
|
||||
class NotFoundErr(DOMException): ...
|
||||
class NotSupportedErr(DOMException): ...
|
||||
class InuseAttributeErr(DOMException): ...
|
||||
class InvalidStateErr(DOMException): ...
|
||||
class SyntaxErr(DOMException): ...
|
||||
class InvalidModificationErr(DOMException): ...
|
||||
class NamespaceErr(DOMException): ...
|
||||
class InvalidAccessErr(DOMException): ...
|
||||
class ValidationErr(DOMException): ...
|
||||
|
||||
class UserDataHandler:
|
||||
NODE_CLONED: int
|
||||
NODE_IMPORTED: int
|
||||
NODE_DELETED: int
|
||||
NODE_RENAMED: int
|
||||
|
||||
XML_NAMESPACE: str
|
||||
XMLNS_NAMESPACE: str
|
||||
XHTML_NAMESPACE: str
|
||||
EMPTY_NAMESPACE: None
|
||||
EMPTY_PREFIX: None
|
||||
10
stdlib/@python2/xml/dom/domreg.pyi
Normal file
10
stdlib/@python2/xml/dom/domreg.pyi
Normal file
@@ -0,0 +1,10 @@
|
||||
from _typeshed.xml import DOMImplementation
|
||||
from typing import Callable, Dict, Iterable, Optional, Tuple, Union
|
||||
|
||||
well_known_implementations: Dict[str, str]
|
||||
registered: Dict[str, Callable[[], DOMImplementation]]
|
||||
|
||||
def registerDOMImplementation(name: str, factory: Callable[[], DOMImplementation]) -> None: ...
|
||||
def getDOMImplementation(
|
||||
name: Optional[str] = ..., features: Union[str, Iterable[Tuple[str, Optional[str]]]] = ...
|
||||
) -> DOMImplementation: ...
|
||||
3
stdlib/@python2/xml/dom/expatbuilder.pyi
Normal file
3
stdlib/@python2/xml/dom/expatbuilder.pyi
Normal file
@@ -0,0 +1,3 @@
|
||||
from typing import Any
|
||||
|
||||
def __getattr__(name: str) -> Any: ... # incomplete
|
||||
17
stdlib/@python2/xml/dom/minicompat.pyi
Normal file
17
stdlib/@python2/xml/dom/minicompat.pyi
Normal file
@@ -0,0 +1,17 @@
|
||||
from typing import Any, Iterable, List, Optional, Tuple, Type, TypeVar
|
||||
|
||||
_T = TypeVar("_T")
|
||||
|
||||
StringTypes: Tuple[Type[str]]
|
||||
|
||||
class NodeList(List[_T]):
|
||||
length: int
|
||||
def item(self, index: int) -> Optional[_T]: ...
|
||||
|
||||
class EmptyNodeList(Tuple[Any, ...]):
|
||||
length: int
|
||||
def item(self, index: int) -> None: ...
|
||||
def __add__(self, other: Iterable[_T]) -> NodeList[_T]: ... # type: ignore
|
||||
def __radd__(self, other: Iterable[_T]) -> NodeList[_T]: ...
|
||||
|
||||
def defproperty(klass: Type[Any], name: str, doc: str) -> None: ...
|
||||
312
stdlib/@python2/xml/dom/minidom.pyi
Normal file
312
stdlib/@python2/xml/dom/minidom.pyi
Normal file
@@ -0,0 +1,312 @@
|
||||
import sys
|
||||
import xml.dom
|
||||
from typing import IO, Any, Optional, Text as _Text, TypeVar, Union
|
||||
from xml.dom.xmlbuilder import DocumentLS, DOMImplementationLS
|
||||
from xml.sax.xmlreader import XMLReader
|
||||
|
||||
_T = TypeVar("_T")
|
||||
|
||||
def parse(file: Union[str, IO[Any]], parser: Optional[XMLReader] = ..., bufsize: Optional[int] = ...): ...
|
||||
def parseString(string: Union[bytes, _Text], parser: Optional[XMLReader] = ...): ...
|
||||
def getDOMImplementation(features=...): ...
|
||||
|
||||
class Node(xml.dom.Node):
|
||||
namespaceURI: Optional[str]
|
||||
parentNode: Any
|
||||
ownerDocument: Any
|
||||
nextSibling: Any
|
||||
previousSibling: Any
|
||||
prefix: Any
|
||||
if sys.version_info >= (3, 9):
|
||||
def toxml(self, encoding: Optional[Any] = ..., standalone: Optional[Any] = ...): ...
|
||||
def toprettyxml(
|
||||
self, indent: str = ..., newl: str = ..., encoding: Optional[Any] = ..., standalone: Optional[Any] = ...
|
||||
): ...
|
||||
else:
|
||||
def toxml(self, encoding: Optional[Any] = ...): ...
|
||||
def toprettyxml(self, indent: str = ..., newl: str = ..., encoding: Optional[Any] = ...): ...
|
||||
def hasChildNodes(self) -> bool: ...
|
||||
def insertBefore(self, newChild, refChild): ...
|
||||
def appendChild(self, node): ...
|
||||
def replaceChild(self, newChild, oldChild): ...
|
||||
def removeChild(self, oldChild): ...
|
||||
def normalize(self) -> None: ...
|
||||
def cloneNode(self, deep): ...
|
||||
def isSupported(self, feature, version): ...
|
||||
def isSameNode(self, other): ...
|
||||
def getInterface(self, feature): ...
|
||||
def getUserData(self, key): ...
|
||||
def setUserData(self, key, data, handler): ...
|
||||
childNodes: Any
|
||||
def unlink(self) -> None: ...
|
||||
def __enter__(self: _T) -> _T: ...
|
||||
def __exit__(self, et, ev, tb) -> None: ...
|
||||
|
||||
class DocumentFragment(Node):
|
||||
nodeType: Any
|
||||
nodeName: str
|
||||
nodeValue: Any
|
||||
attributes: Any
|
||||
parentNode: Any
|
||||
childNodes: Any
|
||||
def __init__(self) -> None: ...
|
||||
|
||||
class Attr(Node):
|
||||
name: str
|
||||
nodeType: Any
|
||||
attributes: Any
|
||||
specified: bool
|
||||
ownerElement: Any
|
||||
namespaceURI: Optional[str]
|
||||
childNodes: Any
|
||||
nodeName: Any
|
||||
nodeValue: str
|
||||
value: str
|
||||
prefix: Any
|
||||
def __init__(
|
||||
self, qName: str, namespaceURI: Optional[str] = ..., localName: Optional[Any] = ..., prefix: Optional[Any] = ...
|
||||
) -> None: ...
|
||||
def unlink(self) -> None: ...
|
||||
|
||||
class NamedNodeMap:
|
||||
def __init__(self, attrs, attrsNS, ownerElement) -> None: ...
|
||||
def item(self, index): ...
|
||||
def items(self): ...
|
||||
def itemsNS(self): ...
|
||||
def __contains__(self, key): ...
|
||||
def keys(self): ...
|
||||
def keysNS(self): ...
|
||||
def values(self): ...
|
||||
def get(self, name, value: Optional[Any] = ...): ...
|
||||
def __len__(self) -> int: ...
|
||||
def __eq__(self, other: Any) -> bool: ...
|
||||
def __ge__(self, other: Any) -> bool: ...
|
||||
def __gt__(self, other: Any) -> bool: ...
|
||||
def __le__(self, other: Any) -> bool: ...
|
||||
def __lt__(self, other: Any) -> bool: ...
|
||||
def __getitem__(self, attname_or_tuple): ...
|
||||
def __setitem__(self, attname, value) -> None: ...
|
||||
def getNamedItem(self, name): ...
|
||||
def getNamedItemNS(self, namespaceURI: str, localName): ...
|
||||
def removeNamedItem(self, name): ...
|
||||
def removeNamedItemNS(self, namespaceURI: str, localName): ...
|
||||
def setNamedItem(self, node): ...
|
||||
def setNamedItemNS(self, node): ...
|
||||
def __delitem__(self, attname_or_tuple) -> None: ...
|
||||
|
||||
AttributeList = NamedNodeMap
|
||||
|
||||
class TypeInfo:
|
||||
namespace: Any
|
||||
name: Any
|
||||
def __init__(self, namespace, name) -> None: ...
|
||||
|
||||
class Element(Node):
|
||||
nodeType: Any
|
||||
nodeValue: Any
|
||||
schemaType: Any
|
||||
parentNode: Any
|
||||
tagName: str
|
||||
prefix: Any
|
||||
namespaceURI: Optional[str]
|
||||
childNodes: Any
|
||||
nextSibling: Any
|
||||
def __init__(
|
||||
self, tagName, namespaceURI: Optional[str] = ..., prefix: Optional[Any] = ..., localName: Optional[Any] = ...
|
||||
) -> None: ...
|
||||
def unlink(self) -> None: ...
|
||||
def getAttribute(self, attname): ...
|
||||
def getAttributeNS(self, namespaceURI: str, localName): ...
|
||||
def setAttribute(self, attname, value) -> None: ...
|
||||
def setAttributeNS(self, namespaceURI: str, qualifiedName: str, value) -> None: ...
|
||||
def getAttributeNode(self, attrname): ...
|
||||
def getAttributeNodeNS(self, namespaceURI: str, localName): ...
|
||||
def setAttributeNode(self, attr): ...
|
||||
setAttributeNodeNS: Any
|
||||
def removeAttribute(self, name) -> None: ...
|
||||
def removeAttributeNS(self, namespaceURI: str, localName) -> None: ...
|
||||
def removeAttributeNode(self, node): ...
|
||||
removeAttributeNodeNS: Any
|
||||
def hasAttribute(self, name: str) -> bool: ...
|
||||
def hasAttributeNS(self, namespaceURI: str, localName) -> bool: ...
|
||||
def getElementsByTagName(self, name): ...
|
||||
def getElementsByTagNameNS(self, namespaceURI: str, localName): ...
|
||||
def writexml(self, writer, indent: str = ..., addindent: str = ..., newl: str = ...) -> None: ...
|
||||
def hasAttributes(self) -> bool: ...
|
||||
def setIdAttribute(self, name) -> None: ...
|
||||
def setIdAttributeNS(self, namespaceURI: str, localName) -> None: ...
|
||||
def setIdAttributeNode(self, idAttr) -> None: ...
|
||||
|
||||
class Childless:
|
||||
attributes: Any
|
||||
childNodes: Any
|
||||
firstChild: Any
|
||||
lastChild: Any
|
||||
def appendChild(self, node) -> None: ...
|
||||
def hasChildNodes(self) -> bool: ...
|
||||
def insertBefore(self, newChild, refChild) -> None: ...
|
||||
def removeChild(self, oldChild) -> None: ...
|
||||
def normalize(self) -> None: ...
|
||||
def replaceChild(self, newChild, oldChild) -> None: ...
|
||||
|
||||
class ProcessingInstruction(Childless, Node):
|
||||
nodeType: Any
|
||||
target: Any
|
||||
data: Any
|
||||
def __init__(self, target, data) -> None: ...
|
||||
nodeValue: Any
|
||||
nodeName: Any
|
||||
def writexml(self, writer, indent: str = ..., addindent: str = ..., newl: str = ...) -> None: ...
|
||||
|
||||
class CharacterData(Childless, Node):
|
||||
ownerDocument: Any
|
||||
previousSibling: Any
|
||||
def __init__(self) -> None: ...
|
||||
def __len__(self) -> int: ...
|
||||
data: str
|
||||
nodeValue: Any
|
||||
def substringData(self, offset: int, count: int) -> str: ...
|
||||
def appendData(self, arg: str) -> None: ...
|
||||
def insertData(self, offset: int, arg: str) -> None: ...
|
||||
def deleteData(self, offset: int, count: int) -> None: ...
|
||||
def replaceData(self, offset: int, count: int, arg: str) -> None: ...
|
||||
|
||||
class Text(CharacterData):
|
||||
nodeType: Any
|
||||
nodeName: str
|
||||
attributes: Any
|
||||
data: Any
|
||||
def splitText(self, offset): ...
|
||||
def writexml(self, writer, indent: str = ..., addindent: str = ..., newl: str = ...) -> None: ...
|
||||
def replaceWholeText(self, content): ...
|
||||
|
||||
class Comment(CharacterData):
|
||||
nodeType: Any
|
||||
nodeName: str
|
||||
def __init__(self, data) -> None: ...
|
||||
def writexml(self, writer, indent: str = ..., addindent: str = ..., newl: str = ...) -> None: ...
|
||||
|
||||
class CDATASection(Text):
|
||||
nodeType: Any
|
||||
nodeName: str
|
||||
def writexml(self, writer, indent: str = ..., addindent: str = ..., newl: str = ...) -> None: ...
|
||||
|
||||
class ReadOnlySequentialNamedNodeMap:
|
||||
def __init__(self, seq=...) -> None: ...
|
||||
def __len__(self): ...
|
||||
def getNamedItem(self, name): ...
|
||||
def getNamedItemNS(self, namespaceURI: str, localName): ...
|
||||
def __getitem__(self, name_or_tuple): ...
|
||||
def item(self, index): ...
|
||||
def removeNamedItem(self, name) -> None: ...
|
||||
def removeNamedItemNS(self, namespaceURI: str, localName) -> None: ...
|
||||
def setNamedItem(self, node) -> None: ...
|
||||
def setNamedItemNS(self, node) -> None: ...
|
||||
|
||||
class Identified: ...
|
||||
|
||||
class DocumentType(Identified, Childless, Node):
|
||||
nodeType: Any
|
||||
nodeValue: Any
|
||||
name: Any
|
||||
publicId: Any
|
||||
systemId: Any
|
||||
internalSubset: Any
|
||||
entities: Any
|
||||
notations: Any
|
||||
nodeName: Any
|
||||
def __init__(self, qualifiedName: str) -> None: ...
|
||||
def cloneNode(self, deep): ...
|
||||
def writexml(self, writer, indent: str = ..., addindent: str = ..., newl: str = ...) -> None: ...
|
||||
|
||||
class Entity(Identified, Node):
|
||||
attributes: Any
|
||||
nodeType: Any
|
||||
nodeValue: Any
|
||||
actualEncoding: Any
|
||||
encoding: Any
|
||||
version: Any
|
||||
nodeName: Any
|
||||
notationName: Any
|
||||
childNodes: Any
|
||||
def __init__(self, name, publicId, systemId, notation) -> None: ...
|
||||
def appendChild(self, newChild) -> None: ...
|
||||
def insertBefore(self, newChild, refChild) -> None: ...
|
||||
def removeChild(self, oldChild) -> None: ...
|
||||
def replaceChild(self, newChild, oldChild) -> None: ...
|
||||
|
||||
class Notation(Identified, Childless, Node):
|
||||
nodeType: Any
|
||||
nodeValue: Any
|
||||
nodeName: Any
|
||||
def __init__(self, name, publicId, systemId) -> None: ...
|
||||
|
||||
class DOMImplementation(DOMImplementationLS):
|
||||
def hasFeature(self, feature, version) -> bool: ...
|
||||
def createDocument(self, namespaceURI: str, qualifiedName: str, doctype): ...
|
||||
def createDocumentType(self, qualifiedName: str, publicId, systemId): ...
|
||||
def getInterface(self, feature): ...
|
||||
|
||||
class ElementInfo:
|
||||
tagName: Any
|
||||
def __init__(self, name) -> None: ...
|
||||
def getAttributeType(self, aname): ...
|
||||
def getAttributeTypeNS(self, namespaceURI: str, localName): ...
|
||||
def isElementContent(self): ...
|
||||
def isEmpty(self): ...
|
||||
def isId(self, aname): ...
|
||||
def isIdNS(self, namespaceURI: str, localName): ...
|
||||
|
||||
class Document(Node, DocumentLS):
|
||||
implementation: Any
|
||||
nodeType: Any
|
||||
nodeName: str
|
||||
nodeValue: Any
|
||||
attributes: Any
|
||||
parentNode: Any
|
||||
previousSibling: Any
|
||||
nextSibling: Any
|
||||
actualEncoding: Any
|
||||
encoding: Any
|
||||
standalone: Any
|
||||
version: Any
|
||||
strictErrorChecking: bool
|
||||
errorHandler: Any
|
||||
documentURI: Any
|
||||
doctype: Any
|
||||
childNodes: Any
|
||||
def __init__(self) -> None: ...
|
||||
def appendChild(self, node): ...
|
||||
documentElement: Any
|
||||
def removeChild(self, oldChild): ...
|
||||
def unlink(self) -> None: ...
|
||||
def cloneNode(self, deep): ...
|
||||
def createDocumentFragment(self): ...
|
||||
def createElement(self, tagName: str): ...
|
||||
def createTextNode(self, data): ...
|
||||
def createCDATASection(self, data): ...
|
||||
def createComment(self, data): ...
|
||||
def createProcessingInstruction(self, target, data): ...
|
||||
def createAttribute(self, qName) -> Attr: ...
|
||||
def createElementNS(self, namespaceURI: str, qualifiedName: str): ...
|
||||
def createAttributeNS(self, namespaceURI: str, qualifiedName: str) -> Attr: ...
|
||||
def getElementById(self, id): ...
|
||||
def getElementsByTagName(self, name: str): ...
|
||||
def getElementsByTagNameNS(self, namespaceURI: str, localName): ...
|
||||
def isSupported(self, feature, version): ...
|
||||
def importNode(self, node, deep): ...
|
||||
if sys.version_info >= (3, 9):
|
||||
def writexml(
|
||||
self,
|
||||
writer,
|
||||
indent: str = ...,
|
||||
addindent: str = ...,
|
||||
newl: str = ...,
|
||||
encoding: Optional[Any] = ...,
|
||||
standalone: Optional[Any] = ...,
|
||||
) -> None: ...
|
||||
else:
|
||||
def writexml(
|
||||
self, writer, indent: str = ..., addindent: str = ..., newl: str = ..., encoding: Optional[Any] = ...
|
||||
) -> None: ...
|
||||
def renameNode(self, n, namespaceURI: str, name): ...
|
||||
3
stdlib/@python2/xml/dom/pulldom.pyi
Normal file
3
stdlib/@python2/xml/dom/pulldom.pyi
Normal file
@@ -0,0 +1,3 @@
|
||||
from typing import Any
|
||||
|
||||
def __getattr__(name: str) -> Any: ... # incomplete
|
||||
6
stdlib/@python2/xml/dom/xmlbuilder.pyi
Normal file
6
stdlib/@python2/xml/dom/xmlbuilder.pyi
Normal file
@@ -0,0 +1,6 @@
|
||||
from typing import Any
|
||||
|
||||
def __getattr__(name: str) -> Any: ... # incomplete
|
||||
|
||||
class DocumentLS(Any): ... # type: ignore
|
||||
class DOMImplementationLS(Any): ... # type: ignore
|
||||
25
stdlib/@python2/xml/etree/ElementInclude.pyi
Normal file
25
stdlib/@python2/xml/etree/ElementInclude.pyi
Normal file
@@ -0,0 +1,25 @@
|
||||
import sys
|
||||
from typing import Callable, Optional, Union
|
||||
from xml.etree.ElementTree import Element
|
||||
|
||||
XINCLUDE: str
|
||||
XINCLUDE_INCLUDE: str
|
||||
XINCLUDE_FALLBACK: str
|
||||
|
||||
class FatalIncludeError(SyntaxError): ...
|
||||
|
||||
def default_loader(href: Union[str, bytes, int], parse: str, encoding: Optional[str] = ...) -> Union[str, Element]: ...
|
||||
|
||||
# TODO: loader is of type default_loader ie it takes a callable that has the
|
||||
# same signature as default_loader. But default_loader has a keyword argument
|
||||
# Which can't be represented using Callable...
|
||||
if sys.version_info >= (3, 9):
|
||||
def include(
|
||||
elem: Element,
|
||||
loader: Optional[Callable[..., Union[str, Element]]] = ...,
|
||||
base_url: Optional[str] = ...,
|
||||
max_depth: Optional[int] = ...,
|
||||
) -> None: ...
|
||||
|
||||
else:
|
||||
def include(elem: Element, loader: Optional[Callable[..., Union[str, Element]]] = ...) -> None: ...
|
||||
33
stdlib/@python2/xml/etree/ElementPath.pyi
Normal file
33
stdlib/@python2/xml/etree/ElementPath.pyi
Normal file
@@ -0,0 +1,33 @@
|
||||
from typing import Callable, Dict, Generator, List, Optional, Pattern, Tuple, TypeVar, Union
|
||||
from xml.etree.ElementTree import Element
|
||||
|
||||
xpath_tokenizer_re: Pattern[str]
|
||||
|
||||
_token = Tuple[str, str]
|
||||
_next = Callable[[], _token]
|
||||
_callback = Callable[[_SelectorContext, List[Element]], Generator[Element, None, None]]
|
||||
|
||||
def xpath_tokenizer(pattern: str, namespaces: Optional[Dict[str, str]] = ...) -> Generator[_token, None, None]: ...
|
||||
def get_parent_map(context: _SelectorContext) -> Dict[Element, Element]: ...
|
||||
def prepare_child(next: _next, token: _token) -> _callback: ...
|
||||
def prepare_star(next: _next, token: _token) -> _callback: ...
|
||||
def prepare_self(next: _next, token: _token) -> _callback: ...
|
||||
def prepare_descendant(next: _next, token: _token) -> _callback: ...
|
||||
def prepare_parent(next: _next, token: _token) -> _callback: ...
|
||||
def prepare_predicate(next: _next, token: _token) -> _callback: ...
|
||||
|
||||
ops: Dict[str, Callable[[_next, _token], _callback]]
|
||||
|
||||
class _SelectorContext:
|
||||
parent_map: Optional[Dict[Element, Element]]
|
||||
root: Element
|
||||
def __init__(self, root: Element) -> None: ...
|
||||
|
||||
_T = TypeVar("_T")
|
||||
|
||||
def iterfind(elem: Element, path: str, namespaces: Optional[Dict[str, str]] = ...) -> Generator[Element, None, None]: ...
|
||||
def find(elem: Element, path: str, namespaces: Optional[Dict[str, str]] = ...) -> Optional[Element]: ...
|
||||
def findall(elem: Element, path: str, namespaces: Optional[Dict[str, str]] = ...) -> List[Element]: ...
|
||||
def findtext(
|
||||
elem: Element, path: str, default: Optional[_T] = ..., namespaces: Optional[Dict[str, str]] = ...
|
||||
) -> Union[_T, str]: ...
|
||||
380
stdlib/@python2/xml/etree/ElementTree.pyi
Normal file
380
stdlib/@python2/xml/etree/ElementTree.pyi
Normal file
@@ -0,0 +1,380 @@
|
||||
import sys
|
||||
from _typeshed import AnyPath, FileDescriptor, SupportsWrite
|
||||
from typing import (
|
||||
IO,
|
||||
Any,
|
||||
Callable,
|
||||
Dict,
|
||||
Generator,
|
||||
ItemsView,
|
||||
Iterable,
|
||||
Iterator,
|
||||
KeysView,
|
||||
List,
|
||||
MutableSequence,
|
||||
Optional,
|
||||
Sequence,
|
||||
Text,
|
||||
Tuple,
|
||||
TypeVar,
|
||||
Union,
|
||||
overload,
|
||||
)
|
||||
from typing_extensions import Literal
|
||||
|
||||
VERSION: str
|
||||
|
||||
class ParseError(SyntaxError):
|
||||
code: int
|
||||
position: Tuple[int, int]
|
||||
|
||||
def iselement(element: object) -> bool: ...
|
||||
|
||||
_T = TypeVar("_T")
|
||||
|
||||
# Type for parser inputs. Parser will accept any unicode/str/bytes and coerce,
|
||||
# and this is true in py2 and py3 (even fromstringlist() in python3 can be
|
||||
# called with a heterogeneous list)
|
||||
_parser_input_type = Union[bytes, Text]
|
||||
|
||||
# Type for individual tag/attr/ns/text values in args to most functions.
|
||||
# In py2, the library accepts str or unicode everywhere and coerces
|
||||
# aggressively.
|
||||
# In py3, bytes is not coerced to str and so use of bytes is probably an error,
|
||||
# so we exclude it. (why? the parser never produces bytes when it parses XML,
|
||||
# so e.g., element.get(b'name') will always return None for parsed XML, even if
|
||||
# there is a 'name' attribute.)
|
||||
_str_argument_type = Union[str, Text]
|
||||
|
||||
# Type for return values from individual tag/attr/text values
|
||||
if sys.version_info >= (3,):
|
||||
# note: in python3, everything comes out as str, yay:
|
||||
_str_result_type = str
|
||||
else:
|
||||
# in python2, if the tag/attribute/text wasn't decode-able as ascii, it
|
||||
# comes out as a unicode string; otherwise it comes out as str. (see
|
||||
# _fixtext function in the source). Client code knows best:
|
||||
_str_result_type = Any
|
||||
|
||||
_file_or_filename = Union[AnyPath, FileDescriptor, IO[Any]]
|
||||
|
||||
if sys.version_info >= (3, 8):
|
||||
@overload
|
||||
def canonicalize(
|
||||
xml_data: Optional[_parser_input_type] = ...,
|
||||
*,
|
||||
out: None = ...,
|
||||
from_file: Optional[_file_or_filename] = ...,
|
||||
with_comments: bool = ...,
|
||||
strip_text: bool = ...,
|
||||
rewrite_prefixes: bool = ...,
|
||||
qname_aware_tags: Optional[Iterable[str]] = ...,
|
||||
qname_aware_attrs: Optional[Iterable[str]] = ...,
|
||||
exclude_attrs: Optional[Iterable[str]] = ...,
|
||||
exclude_tags: Optional[Iterable[str]] = ...,
|
||||
) -> str: ...
|
||||
@overload
|
||||
def canonicalize(
|
||||
xml_data: Optional[_parser_input_type] = ...,
|
||||
*,
|
||||
out: SupportsWrite[str],
|
||||
from_file: Optional[_file_or_filename] = ...,
|
||||
with_comments: bool = ...,
|
||||
strip_text: bool = ...,
|
||||
rewrite_prefixes: bool = ...,
|
||||
qname_aware_tags: Optional[Iterable[str]] = ...,
|
||||
qname_aware_attrs: Optional[Iterable[str]] = ...,
|
||||
exclude_attrs: Optional[Iterable[str]] = ...,
|
||||
exclude_tags: Optional[Iterable[str]] = ...,
|
||||
) -> None: ...
|
||||
|
||||
class Element(MutableSequence[Element]):
|
||||
tag: _str_result_type
|
||||
attrib: Dict[_str_result_type, _str_result_type]
|
||||
text: Optional[_str_result_type]
|
||||
tail: Optional[_str_result_type]
|
||||
def __init__(
|
||||
self,
|
||||
tag: Union[_str_argument_type, Callable[..., Element]],
|
||||
attrib: Dict[_str_argument_type, _str_argument_type] = ...,
|
||||
**extra: _str_argument_type,
|
||||
) -> None: ...
|
||||
def append(self, __subelement: Element) -> None: ...
|
||||
def clear(self) -> None: ...
|
||||
def extend(self, __elements: Iterable[Element]) -> None: ...
|
||||
def find(
|
||||
self, path: _str_argument_type, namespaces: Optional[Dict[_str_argument_type, _str_argument_type]] = ...
|
||||
) -> Optional[Element]: ...
|
||||
def findall(
|
||||
self, path: _str_argument_type, namespaces: Optional[Dict[_str_argument_type, _str_argument_type]] = ...
|
||||
) -> List[Element]: ...
|
||||
@overload
|
||||
def findtext(
|
||||
self,
|
||||
path: _str_argument_type,
|
||||
default: None = ...,
|
||||
namespaces: Optional[Dict[_str_argument_type, _str_argument_type]] = ...,
|
||||
) -> Optional[_str_result_type]: ...
|
||||
@overload
|
||||
def findtext(
|
||||
self, path: _str_argument_type, default: _T, namespaces: Optional[Dict[_str_argument_type, _str_argument_type]] = ...
|
||||
) -> Union[_T, _str_result_type]: ...
|
||||
@overload
|
||||
def get(self, key: _str_argument_type, default: None = ...) -> Optional[_str_result_type]: ...
|
||||
@overload
|
||||
def get(self, key: _str_argument_type, default: _T) -> Union[_str_result_type, _T]: ...
|
||||
if sys.version_info >= (3, 2):
|
||||
def insert(self, __index: int, __subelement: Element) -> None: ...
|
||||
else:
|
||||
def insert(self, __index: int, __element: Element) -> None: ...
|
||||
def items(self) -> ItemsView[_str_result_type, _str_result_type]: ...
|
||||
def iter(self, tag: Optional[_str_argument_type] = ...) -> Generator[Element, None, None]: ...
|
||||
def iterfind(
|
||||
self, path: _str_argument_type, namespaces: Optional[Dict[_str_argument_type, _str_argument_type]] = ...
|
||||
) -> Generator[Element, None, None]: ...
|
||||
def itertext(self) -> Generator[_str_result_type, None, None]: ...
|
||||
def keys(self) -> KeysView[_str_result_type]: ...
|
||||
def makeelement(self, __tag: _str_argument_type, __attrib: Dict[_str_argument_type, _str_argument_type]) -> Element: ...
|
||||
def remove(self, __subelement: Element) -> None: ...
|
||||
def set(self, __key: _str_argument_type, __value: _str_argument_type) -> None: ...
|
||||
def __delitem__(self, i: Union[int, slice]) -> None: ...
|
||||
@overload
|
||||
def __getitem__(self, i: int) -> Element: ...
|
||||
@overload
|
||||
def __getitem__(self, s: slice) -> MutableSequence[Element]: ...
|
||||
def __len__(self) -> int: ...
|
||||
@overload
|
||||
def __setitem__(self, i: int, o: Element) -> None: ...
|
||||
@overload
|
||||
def __setitem__(self, s: slice, o: Iterable[Element]) -> None: ...
|
||||
if sys.version_info < (3, 9):
|
||||
def getchildren(self) -> List[Element]: ...
|
||||
def getiterator(self, tag: Optional[_str_argument_type] = ...) -> List[Element]: ...
|
||||
|
||||
def SubElement(
|
||||
parent: Element,
|
||||
tag: _str_argument_type,
|
||||
attrib: Dict[_str_argument_type, _str_argument_type] = ...,
|
||||
**extra: _str_argument_type,
|
||||
) -> Element: ...
|
||||
def Comment(text: Optional[_str_argument_type] = ...) -> Element: ...
|
||||
def ProcessingInstruction(target: _str_argument_type, text: Optional[_str_argument_type] = ...) -> Element: ...
|
||||
|
||||
PI: Callable[..., Element]
|
||||
|
||||
class QName:
|
||||
text: str
|
||||
def __init__(self, text_or_uri: _str_argument_type, tag: Optional[_str_argument_type] = ...) -> None: ...
|
||||
|
||||
class ElementTree:
|
||||
def __init__(self, element: Optional[Element] = ..., file: Optional[_file_or_filename] = ...) -> None: ...
|
||||
def getroot(self) -> Element: ...
|
||||
def parse(self, source: _file_or_filename, parser: Optional[XMLParser] = ...) -> Element: ...
|
||||
def iter(self, tag: Optional[_str_argument_type] = ...) -> Generator[Element, None, None]: ...
|
||||
if sys.version_info < (3, 9):
|
||||
def getiterator(self, tag: Optional[_str_argument_type] = ...) -> List[Element]: ...
|
||||
def find(
|
||||
self, path: _str_argument_type, namespaces: Optional[Dict[_str_argument_type, _str_argument_type]] = ...
|
||||
) -> Optional[Element]: ...
|
||||
@overload
|
||||
def findtext(
|
||||
self,
|
||||
path: _str_argument_type,
|
||||
default: None = ...,
|
||||
namespaces: Optional[Dict[_str_argument_type, _str_argument_type]] = ...,
|
||||
) -> Optional[_str_result_type]: ...
|
||||
@overload
|
||||
def findtext(
|
||||
self, path: _str_argument_type, default: _T, namespaces: Optional[Dict[_str_argument_type, _str_argument_type]] = ...
|
||||
) -> Union[_T, _str_result_type]: ...
|
||||
def findall(
|
||||
self, path: _str_argument_type, namespaces: Optional[Dict[_str_argument_type, _str_argument_type]] = ...
|
||||
) -> List[Element]: ...
|
||||
def iterfind(
|
||||
self, path: _str_argument_type, namespaces: Optional[Dict[_str_argument_type, _str_argument_type]] = ...
|
||||
) -> Generator[Element, None, None]: ...
|
||||
if sys.version_info >= (3, 4):
|
||||
def write(
|
||||
self,
|
||||
file_or_filename: _file_or_filename,
|
||||
encoding: Optional[str] = ...,
|
||||
xml_declaration: Optional[bool] = ...,
|
||||
default_namespace: Optional[_str_argument_type] = ...,
|
||||
method: Optional[str] = ...,
|
||||
*,
|
||||
short_empty_elements: bool = ...,
|
||||
) -> None: ...
|
||||
else:
|
||||
def write(
|
||||
self,
|
||||
file_or_filename: _file_or_filename,
|
||||
encoding: Optional[str] = ...,
|
||||
xml_declaration: Optional[bool] = ...,
|
||||
default_namespace: Optional[_str_argument_type] = ...,
|
||||
method: Optional[str] = ...,
|
||||
) -> None: ...
|
||||
def write_c14n(self, file: _file_or_filename) -> None: ...
|
||||
|
||||
def register_namespace(prefix: _str_argument_type, uri: _str_argument_type) -> None: ...
|
||||
|
||||
if sys.version_info >= (3, 8):
|
||||
@overload
|
||||
def tostring(
|
||||
element: Element,
|
||||
encoding: None = ...,
|
||||
method: Optional[str] = ...,
|
||||
*,
|
||||
xml_declaration: Optional[bool] = ...,
|
||||
default_namespace: Optional[_str_argument_type] = ...,
|
||||
short_empty_elements: bool = ...,
|
||||
) -> bytes: ...
|
||||
@overload
|
||||
def tostring(
|
||||
element: Element,
|
||||
encoding: Literal["unicode"],
|
||||
method: Optional[str] = ...,
|
||||
*,
|
||||
xml_declaration: Optional[bool] = ...,
|
||||
default_namespace: Optional[_str_argument_type] = ...,
|
||||
short_empty_elements: bool = ...,
|
||||
) -> str: ...
|
||||
@overload
|
||||
def tostring(
|
||||
element: Element,
|
||||
encoding: str,
|
||||
method: Optional[str] = ...,
|
||||
*,
|
||||
xml_declaration: Optional[bool] = ...,
|
||||
default_namespace: Optional[_str_argument_type] = ...,
|
||||
short_empty_elements: bool = ...,
|
||||
) -> Any: ...
|
||||
@overload
|
||||
def tostringlist(
|
||||
element: Element,
|
||||
encoding: None = ...,
|
||||
method: Optional[str] = ...,
|
||||
*,
|
||||
xml_declaration: Optional[bool] = ...,
|
||||
default_namespace: Optional[_str_argument_type] = ...,
|
||||
short_empty_elements: bool = ...,
|
||||
) -> List[bytes]: ...
|
||||
@overload
|
||||
def tostringlist(
|
||||
element: Element,
|
||||
encoding: Literal["unicode"],
|
||||
method: Optional[str] = ...,
|
||||
*,
|
||||
xml_declaration: Optional[bool] = ...,
|
||||
default_namespace: Optional[_str_argument_type] = ...,
|
||||
short_empty_elements: bool = ...,
|
||||
) -> List[str]: ...
|
||||
@overload
|
||||
def tostringlist(
|
||||
element: Element,
|
||||
encoding: str,
|
||||
method: Optional[str] = ...,
|
||||
*,
|
||||
xml_declaration: Optional[bool] = ...,
|
||||
default_namespace: Optional[_str_argument_type] = ...,
|
||||
short_empty_elements: bool = ...,
|
||||
) -> List[Any]: ...
|
||||
|
||||
elif sys.version_info >= (3,):
|
||||
@overload
|
||||
def tostring(
|
||||
element: Element, encoding: None = ..., method: Optional[str] = ..., *, short_empty_elements: bool = ...
|
||||
) -> bytes: ...
|
||||
@overload
|
||||
def tostring(
|
||||
element: Element, encoding: Literal["unicode"], method: Optional[str] = ..., *, short_empty_elements: bool = ...
|
||||
) -> str: ...
|
||||
@overload
|
||||
def tostring(element: Element, encoding: str, method: Optional[str] = ..., *, short_empty_elements: bool = ...) -> Any: ...
|
||||
@overload
|
||||
def tostringlist(
|
||||
element: Element, encoding: None = ..., method: Optional[str] = ..., *, short_empty_elements: bool = ...
|
||||
) -> List[bytes]: ...
|
||||
@overload
|
||||
def tostringlist(
|
||||
element: Element, encoding: Literal["unicode"], method: Optional[str] = ..., *, short_empty_elements: bool = ...
|
||||
) -> List[str]: ...
|
||||
@overload
|
||||
def tostringlist(
|
||||
element: Element, encoding: str, method: Optional[str] = ..., *, short_empty_elements: bool = ...
|
||||
) -> List[Any]: ...
|
||||
|
||||
else:
|
||||
def tostring(element: Element, encoding: Optional[str] = ..., method: Optional[str] = ...) -> bytes: ...
|
||||
def tostringlist(element: Element, encoding: Optional[str] = ..., method: Optional[str] = ...) -> List[bytes]: ...
|
||||
|
||||
def dump(elem: Element) -> None: ...
|
||||
|
||||
if sys.version_info >= (3, 9):
|
||||
def indent(tree: Union[Element, ElementTree], space: str = ..., level: int = ...) -> None: ...
|
||||
|
||||
def parse(source: _file_or_filename, parser: Optional[XMLParser] = ...) -> ElementTree: ...
|
||||
def iterparse(
|
||||
source: _file_or_filename, events: Optional[Sequence[str]] = ..., parser: Optional[XMLParser] = ...
|
||||
) -> Iterator[Tuple[str, Any]]: ...
|
||||
|
||||
if sys.version_info >= (3, 4):
|
||||
class XMLPullParser:
|
||||
def __init__(self, events: Optional[Sequence[str]] = ..., *, _parser: Optional[XMLParser] = ...) -> None: ...
|
||||
def feed(self, data: bytes) -> None: ...
|
||||
def close(self) -> None: ...
|
||||
def read_events(self) -> Iterator[Tuple[str, Element]]: ...
|
||||
|
||||
def XML(text: _parser_input_type, parser: Optional[XMLParser] = ...) -> Element: ...
|
||||
def XMLID(text: _parser_input_type, parser: Optional[XMLParser] = ...) -> Tuple[Element, Dict[_str_result_type, Element]]: ...
|
||||
|
||||
# This is aliased to XML in the source.
|
||||
fromstring = XML
|
||||
|
||||
def fromstringlist(sequence: Sequence[_parser_input_type], parser: Optional[XMLParser] = ...) -> Element: ...
|
||||
|
||||
# This type is both not precise enough and too precise. The TreeBuilder
|
||||
# requires the elementfactory to accept tag and attrs in its args and produce
|
||||
# some kind of object that has .text and .tail properties.
|
||||
# I've chosen to constrain the ElementFactory to always produce an Element
|
||||
# because that is how almost everyone will use it.
|
||||
# Unfortunately, the type of the factory arguments is dependent on how
|
||||
# TreeBuilder is called by client code (they could pass strs, bytes or whatever);
|
||||
# but we don't want to use a too-broad type, or it would be too hard to write
|
||||
# elementfactories.
|
||||
_ElementFactory = Callable[[Any, Dict[Any, Any]], Element]
|
||||
|
||||
class TreeBuilder:
|
||||
def __init__(self, element_factory: Optional[_ElementFactory] = ...) -> None: ...
|
||||
def close(self) -> Element: ...
|
||||
def data(self, __data: _parser_input_type) -> None: ...
|
||||
def start(self, __tag: _parser_input_type, __attrs: Dict[_parser_input_type, _parser_input_type]) -> Element: ...
|
||||
def end(self, __tag: _parser_input_type) -> Element: ...
|
||||
|
||||
if sys.version_info >= (3, 8):
|
||||
class C14NWriterTarget:
|
||||
def __init__(
|
||||
self,
|
||||
write: Callable[[str], Any],
|
||||
*,
|
||||
with_comments: bool = ...,
|
||||
strip_text: bool = ...,
|
||||
rewrite_prefixes: bool = ...,
|
||||
qname_aware_tags: Optional[Iterable[str]] = ...,
|
||||
qname_aware_attrs: Optional[Iterable[str]] = ...,
|
||||
exclude_attrs: Optional[Iterable[str]] = ...,
|
||||
exclude_tags: Optional[Iterable[str]] = ...,
|
||||
) -> None: ...
|
||||
|
||||
class XMLParser:
|
||||
parser: Any
|
||||
target: Any
|
||||
# TODO-what is entity used for???
|
||||
entity: Any
|
||||
version: str
|
||||
if sys.version_info >= (3, 8):
|
||||
def __init__(self, *, target: Any = ..., encoding: Optional[str] = ...) -> None: ...
|
||||
else:
|
||||
def __init__(self, html: int = ..., target: Any = ..., encoding: Optional[str] = ...) -> None: ...
|
||||
def doctype(self, __name: str, __pubid: str, __system: str) -> None: ...
|
||||
def close(self) -> Any: ...
|
||||
def feed(self, __data: _parser_input_type) -> None: ...
|
||||
0
stdlib/@python2/xml/etree/__init__.pyi
Normal file
0
stdlib/@python2/xml/etree/__init__.pyi
Normal file
1
stdlib/@python2/xml/etree/cElementTree.pyi
Normal file
1
stdlib/@python2/xml/etree/cElementTree.pyi
Normal file
@@ -0,0 +1 @@
|
||||
from xml.etree.ElementTree import * # noqa: F403
|
||||
1
stdlib/@python2/xml/parsers/__init__.pyi
Normal file
1
stdlib/@python2/xml/parsers/__init__.pyi
Normal file
@@ -0,0 +1 @@
|
||||
import xml.parsers.expat as expat
|
||||
1
stdlib/@python2/xml/parsers/expat/__init__.pyi
Normal file
1
stdlib/@python2/xml/parsers/expat/__init__.pyi
Normal file
@@ -0,0 +1 @@
|
||||
from pyexpat import *
|
||||
1
stdlib/@python2/xml/parsers/expat/errors.pyi
Normal file
1
stdlib/@python2/xml/parsers/expat/errors.pyi
Normal file
@@ -0,0 +1 @@
|
||||
from pyexpat.errors import *
|
||||
1
stdlib/@python2/xml/parsers/expat/model.pyi
Normal file
1
stdlib/@python2/xml/parsers/expat/model.pyi
Normal file
@@ -0,0 +1 @@
|
||||
from pyexpat.model import *
|
||||
33
stdlib/@python2/xml/sax/__init__.pyi
Normal file
33
stdlib/@python2/xml/sax/__init__.pyi
Normal file
@@ -0,0 +1,33 @@
|
||||
import sys
|
||||
from typing import IO, Any, Iterable, List, NoReturn, Optional, Text, Union
|
||||
from xml.sax.handler import ContentHandler, ErrorHandler
|
||||
from xml.sax.xmlreader import Locator, XMLReader
|
||||
|
||||
class SAXException(Exception):
|
||||
def __init__(self, msg: str, exception: Optional[Exception] = ...) -> None: ...
|
||||
def getMessage(self) -> str: ...
|
||||
def getException(self) -> Exception: ...
|
||||
def __getitem__(self, ix: Any) -> NoReturn: ...
|
||||
|
||||
class SAXParseException(SAXException):
|
||||
def __init__(self, msg: str, exception: Exception, locator: Locator) -> None: ...
|
||||
def getColumnNumber(self) -> int: ...
|
||||
def getLineNumber(self) -> int: ...
|
||||
def getPublicId(self): ...
|
||||
def getSystemId(self): ...
|
||||
|
||||
class SAXNotRecognizedException(SAXException): ...
|
||||
class SAXNotSupportedException(SAXException): ...
|
||||
class SAXReaderNotAvailable(SAXNotSupportedException): ...
|
||||
|
||||
default_parser_list: List[str]
|
||||
|
||||
if sys.version_info >= (3, 8):
|
||||
def make_parser(parser_list: Iterable[str] = ...) -> XMLReader: ...
|
||||
|
||||
else:
|
||||
def make_parser(parser_list: List[str] = ...) -> XMLReader: ...
|
||||
|
||||
def parse(source: Union[str, IO[str], IO[bytes]], handler: ContentHandler, errorHandler: ErrorHandler = ...) -> None: ...
|
||||
def parseString(string: Union[bytes, Text], handler: ContentHandler, errorHandler: Optional[ErrorHandler] = ...) -> None: ...
|
||||
def _create_parser(parser_name: str) -> XMLReader: ...
|
||||
46
stdlib/@python2/xml/sax/handler.pyi
Normal file
46
stdlib/@python2/xml/sax/handler.pyi
Normal file
@@ -0,0 +1,46 @@
|
||||
from typing import Any
|
||||
|
||||
version: Any
|
||||
|
||||
class ErrorHandler:
|
||||
def error(self, exception): ...
|
||||
def fatalError(self, exception): ...
|
||||
def warning(self, exception): ...
|
||||
|
||||
class ContentHandler:
|
||||
def __init__(self) -> None: ...
|
||||
def setDocumentLocator(self, locator): ...
|
||||
def startDocument(self): ...
|
||||
def endDocument(self): ...
|
||||
def startPrefixMapping(self, prefix, uri): ...
|
||||
def endPrefixMapping(self, prefix): ...
|
||||
def startElement(self, name, attrs): ...
|
||||
def endElement(self, name): ...
|
||||
def startElementNS(self, name, qname, attrs): ...
|
||||
def endElementNS(self, name, qname): ...
|
||||
def characters(self, content): ...
|
||||
def ignorableWhitespace(self, whitespace): ...
|
||||
def processingInstruction(self, target, data): ...
|
||||
def skippedEntity(self, name): ...
|
||||
|
||||
class DTDHandler:
|
||||
def notationDecl(self, name, publicId, systemId): ...
|
||||
def unparsedEntityDecl(self, name, publicId, systemId, ndata): ...
|
||||
|
||||
class EntityResolver:
|
||||
def resolveEntity(self, publicId, systemId): ...
|
||||
|
||||
feature_namespaces: Any
|
||||
feature_namespace_prefixes: Any
|
||||
feature_string_interning: Any
|
||||
feature_validation: Any
|
||||
feature_external_ges: Any
|
||||
feature_external_pes: Any
|
||||
all_features: Any
|
||||
property_lexical_handler: Any
|
||||
property_declaration_handler: Any
|
||||
property_dom_node: Any
|
||||
property_xml_string: Any
|
||||
property_encoding: Any
|
||||
property_interning_dict: Any
|
||||
all_properties: Any
|
||||
68
stdlib/@python2/xml/sax/saxutils.pyi
Normal file
68
stdlib/@python2/xml/sax/saxutils.pyi
Normal file
@@ -0,0 +1,68 @@
|
||||
import sys
|
||||
from _typeshed import SupportsWrite
|
||||
from codecs import StreamReaderWriter, StreamWriter
|
||||
from io import RawIOBase, TextIOBase
|
||||
from typing import Mapping, Optional, Text, Union
|
||||
from xml.sax import handler, xmlreader
|
||||
|
||||
def escape(data: Text, entities: Mapping[Text, Text] = ...) -> Text: ...
|
||||
def unescape(data: Text, entities: Mapping[Text, Text] = ...) -> Text: ...
|
||||
def quoteattr(data: Text, entities: Mapping[Text, Text] = ...) -> Text: ...
|
||||
|
||||
class XMLGenerator(handler.ContentHandler):
|
||||
if sys.version_info >= (3, 0):
|
||||
def __init__(
|
||||
self,
|
||||
out: Optional[Union[TextIOBase, RawIOBase, StreamWriter, StreamReaderWriter, SupportsWrite[str]]] = ...,
|
||||
encoding: str = ...,
|
||||
short_empty_elements: bool = ...,
|
||||
) -> None: ...
|
||||
else:
|
||||
def __init__(
|
||||
self,
|
||||
out: Optional[Union[TextIOBase, RawIOBase, StreamWriter, StreamReaderWriter, SupportsWrite[str]]] = ...,
|
||||
encoding: Text = ...,
|
||||
) -> None: ...
|
||||
def startDocument(self): ...
|
||||
def endDocument(self): ...
|
||||
def startPrefixMapping(self, prefix, uri): ...
|
||||
def endPrefixMapping(self, prefix): ...
|
||||
def startElement(self, name, attrs): ...
|
||||
def endElement(self, name): ...
|
||||
def startElementNS(self, name, qname, attrs): ...
|
||||
def endElementNS(self, name, qname): ...
|
||||
def characters(self, content): ...
|
||||
def ignorableWhitespace(self, content): ...
|
||||
def processingInstruction(self, target, data): ...
|
||||
|
||||
class XMLFilterBase(xmlreader.XMLReader):
|
||||
def __init__(self, parent: Optional[xmlreader.XMLReader] = ...) -> None: ...
|
||||
def error(self, exception): ...
|
||||
def fatalError(self, exception): ...
|
||||
def warning(self, exception): ...
|
||||
def setDocumentLocator(self, locator): ...
|
||||
def startDocument(self): ...
|
||||
def endDocument(self): ...
|
||||
def startPrefixMapping(self, prefix, uri): ...
|
||||
def endPrefixMapping(self, prefix): ...
|
||||
def startElement(self, name, attrs): ...
|
||||
def endElement(self, name): ...
|
||||
def startElementNS(self, name, qname, attrs): ...
|
||||
def endElementNS(self, name, qname): ...
|
||||
def characters(self, content): ...
|
||||
def ignorableWhitespace(self, chars): ...
|
||||
def processingInstruction(self, target, data): ...
|
||||
def skippedEntity(self, name): ...
|
||||
def notationDecl(self, name, publicId, systemId): ...
|
||||
def unparsedEntityDecl(self, name, publicId, systemId, ndata): ...
|
||||
def resolveEntity(self, publicId, systemId): ...
|
||||
def parse(self, source): ...
|
||||
def setLocale(self, locale): ...
|
||||
def getFeature(self, name): ...
|
||||
def setFeature(self, name, state): ...
|
||||
def getProperty(self, name): ...
|
||||
def setProperty(self, name, value): ...
|
||||
def getParent(self): ...
|
||||
def setParent(self, parent): ...
|
||||
|
||||
def prepare_input_source(source, base=...): ...
|
||||
72
stdlib/@python2/xml/sax/xmlreader.pyi
Normal file
72
stdlib/@python2/xml/sax/xmlreader.pyi
Normal file
@@ -0,0 +1,72 @@
|
||||
from typing import Mapping, Optional, Tuple
|
||||
|
||||
class XMLReader:
|
||||
def __init__(self) -> None: ...
|
||||
def parse(self, source): ...
|
||||
def getContentHandler(self): ...
|
||||
def setContentHandler(self, handler): ...
|
||||
def getDTDHandler(self): ...
|
||||
def setDTDHandler(self, handler): ...
|
||||
def getEntityResolver(self): ...
|
||||
def setEntityResolver(self, resolver): ...
|
||||
def getErrorHandler(self): ...
|
||||
def setErrorHandler(self, handler): ...
|
||||
def setLocale(self, locale): ...
|
||||
def getFeature(self, name): ...
|
||||
def setFeature(self, name, state): ...
|
||||
def getProperty(self, name): ...
|
||||
def setProperty(self, name, value): ...
|
||||
|
||||
class IncrementalParser(XMLReader):
|
||||
def __init__(self, bufsize: int = ...) -> None: ...
|
||||
def parse(self, source): ...
|
||||
def feed(self, data): ...
|
||||
def prepareParser(self, source): ...
|
||||
def close(self): ...
|
||||
def reset(self): ...
|
||||
|
||||
class Locator:
|
||||
def getColumnNumber(self): ...
|
||||
def getLineNumber(self): ...
|
||||
def getPublicId(self): ...
|
||||
def getSystemId(self): ...
|
||||
|
||||
class InputSource:
|
||||
def __init__(self, system_id: Optional[str] = ...) -> None: ...
|
||||
def setPublicId(self, public_id): ...
|
||||
def getPublicId(self): ...
|
||||
def setSystemId(self, system_id): ...
|
||||
def getSystemId(self): ...
|
||||
def setEncoding(self, encoding): ...
|
||||
def getEncoding(self): ...
|
||||
def setByteStream(self, bytefile): ...
|
||||
def getByteStream(self): ...
|
||||
def setCharacterStream(self, charfile): ...
|
||||
def getCharacterStream(self): ...
|
||||
|
||||
class AttributesImpl:
|
||||
def __init__(self, attrs: Mapping[str, str]) -> None: ...
|
||||
def getLength(self): ...
|
||||
def getType(self, name): ...
|
||||
def getValue(self, name): ...
|
||||
def getValueByQName(self, name): ...
|
||||
def getNameByQName(self, name): ...
|
||||
def getQNameByName(self, name): ...
|
||||
def getNames(self): ...
|
||||
def getQNames(self): ...
|
||||
def __len__(self): ...
|
||||
def __getitem__(self, name): ...
|
||||
def keys(self): ...
|
||||
def __contains__(self, name): ...
|
||||
def get(self, name, alternative=...): ...
|
||||
def copy(self): ...
|
||||
def items(self): ...
|
||||
def values(self): ...
|
||||
|
||||
class AttributesNSImpl(AttributesImpl):
|
||||
def __init__(self, attrs: Mapping[Tuple[str, str], str], qnames: Mapping[Tuple[str, str], str]) -> None: ...
|
||||
def getValueByQName(self, name): ...
|
||||
def getNameByQName(self, name): ...
|
||||
def getQNameByName(self, name): ...
|
||||
def getQNames(self): ...
|
||||
def copy(self): ...
|
||||
Reference in New Issue
Block a user