Merge pull request #98 from ismail-s/feature/type_check_xml

Type check xml.etree module
This commit is contained in:
Guido van Rossum
2016-03-09 12:48:56 -08:00
32 changed files with 1008 additions and 128 deletions

View File

@@ -0,0 +1,19 @@
# Stubs for xml.etree.ElementInclude (Python 3.4)
#
# NOTE: This dynamically typed stub was automatically generated by stubgen.
from typing import Union, Optional, Callable
from .ElementTree import Element
XINCLUDE = ... # type: str
XINCLUDE_INCLUDE = ... # type: str
XINCLUDE_FALLBACK = ... # type: 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...
def include(elem: Element, loader: Callable[..., Union[str, Element]]=...) -> None: ...

View File

@@ -0,0 +1,35 @@
# Stubs for xml.etree.ElementPath (Python 3.4)
#
# NOTE: This dynamically typed stub was automatically generated by stubgen.
from typing import Pattern, Dict, Generator, Tuple, List, Union, TypeVar, Callable, Optional
from .ElementTree import Element
xpath_tokenizer_re = ... # type: Pattern
_token = Tuple[str, str]
_next = Callable[[], _token]
_callback = Callable[['_SelectorContext', List[Element]], Generator[Element, None, None]]
def xpath_tokenizer(pattern: str, namespaces: 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 = ... # type: Dict[str, Callable[[_next, _token], _callback]]
class _SelectorContext:
parent_map = ... # type: Dict[Element, Element]
root = ... # type: Element
def __init__(self, root: Element) -> None: ...
_T = TypeVar('_T')
def iterfind(elem: Element, path: str, namespaces: Dict[str, str]=...) -> List[Element]: ...
def find(elem: Element, path: str, namespaces: Dict[str, str]=...) -> Optional[Element]: ...
def findall(elem: Element, path: str, namespaces: Dict[str, str]=...) -> List[Element]: ...
def findtext(elem: Element, path: str, default: _T=..., namespaces: Dict[str, str]=...) -> Union[_T, str]: ...

View File

@@ -0,0 +1,116 @@
# Stubs for xml.etree.ElementTree (Python 3.4)
#
# NOTE: This dynamically typed stub was automatically generated by stubgen.
from typing import Any, AnyStr, Union, IO, Callable, Dict, List, Tuple, Sequence, Iterator, TypeVar, Optional, Generator
import io
VERSION = ... # type: str
_Ss = TypeVar('_Ss', str, bytes)
_T = TypeVar('_T')
_str_or_bytes = Union[str, bytes]
class _SimpleElementPath:
def find(self, element: 'Element', tag: _str_or_bytes, namespaces: Any=...) -> Optional['Element']: ...
def findtext(self, element: 'Element', tag: _str_or_bytes, default: _T=..., namespaces: Any=...) -> Union[str, bytes, _T]: ...
def iterfind(self, element: 'Element', tag: _str_or_bytes, namespaces: Any=...) -> Generator['Element', None, None]: ...
def findall(self, element: 'Element', tag: _str_or_bytes, namespaces: Any=...) -> List['Element']: ...
class ParseError(SyntaxError): ...
def iselement(element: 'Element') -> bool: ...
class Element:
tag = ... # type: _str_or_bytes
attrib = ... # type: Dict[_str_or_bytes, _str_or_bytes]
text = ... # type: Optional[_str_or_bytes]
tail = ... # type: Optional[_str_or_bytes]
def __init__(self, tag: Union[AnyStr, Callable[..., 'Element']], attrib: Dict[AnyStr, AnyStr]=..., **extra: Dict[str, AnyStr]) -> None: ...
def append(self, element: 'Element') -> None: ...
def clear(self) -> None: ...
def copy(self) -> 'Element': ...
def extend(self, elements: Sequence['Element']) -> None: ...
def find(self, path: str, namespaces: Dict[str, str]=...) -> Optional['Element']: ...
def findall(self, path: str, namespaces: Dict[str, str]=...) -> List['Element']: ...
def findtext(self, path: str, default: _T=..., namespaces: Dict[str, str]=...) -> Union[_T, str]: ...
def get(self, key: AnyStr, default: _T=...) -> Union[AnyStr, _T]: ...
def getchildren(self) -> List['Element']: ...
def getiterator(self, tag: Union[str, AnyStr]=...) -> List['Element']: ...
def insert(self, index: int, element: 'Element') -> None: ...
def items(self) -> List[Tuple[AnyStr, AnyStr]]: ...
def iter(self, tag: Union[str, AnyStr]=...) -> Generator['Element', None, None]: ...
def iterfind(self, path: str, namespaces: Dict[str, str]=...) -> List['Element']: ...
def itertext(self) -> Generator[str, None, None]: ...
def keys(self) -> List[AnyStr]: ...
def makeelement(self, tag: _Ss, attrib: Dict[_Ss, _Ss]) -> 'Element': ...
def remove(self, element: 'Element') -> None: ...
def set(self, key: AnyStr, value: AnyStr) -> None: ...
def __bool__(self) -> bool: ...
def __delitem__(self, index: int) -> None: ...
def __getitem__(self, index) -> 'Element': ...
def __len__(self) -> int: ...
def __setitem__(self, index: int, element: 'Element') -> None: ...
def SubElement(parent: Element, tag: AnyStr, attrib: Dict[AnyStr, AnyStr]=..., **extra: Dict[str, AnyStr]) -> Element: ...
def Comment(text: _str_or_bytes=...) -> Element: ...
def ProcessingInstruction(target: str, text: str=...) -> Element: ...
PI = ... # type: Callable[..., Element]
class QName:
text = ... # type: str
def __init__(self, text_or_uri: str, tag: str=...) -> None: ...
_file_or_filename = Union[str, bytes, int, IO[Any]]
class ElementTree:
def __init__(self, element: Element=..., file: _file_or_filename=...) -> None: ...
def getroot(self) -> Element: ...
def parse(self, source: _file_or_filename, parser: 'XMLParser'=...) -> Element: ...
def iter(self, tag: Union[str, AnyStr]=...) -> Generator[Element, None, None]: ...
def getiterator(self, tag: Union[str, AnyStr]=...) -> List[Element]: ...
def find(self, path: str, namespaces: Dict[str, str]=...) -> Optional[Element]: ...
def findtext(self, path: str, default: _T=..., namespaces: Dict[str, str]=...) -> Union[_T, str]: ...
def findall(self, path: str, namespaces: Dict[str, str]=...) -> List[Element]: ...
def iterfind(self, path: str, namespaces: Dict[str, str]=...) -> List[Element]: ...
def write(self, file_or_filename: _file_or_filename, encoding: str=..., xml_declaration: Optional[bool]=..., default_namespace: str=..., method: str=...) -> None: ...
def write_c14n(self, file: _file_or_filename) -> None: ...
def register_namespace(prefix: str, uri: str) -> None: ...
def tostring(element: Element, encoding: str=..., method: str=...) -> str: ...
def tostringlist(element: Element, encoding: str=..., method: str=...) -> List[str]: ...
def dump(elem: Element) -> None: ...
def parse(source: _file_or_filename, parser: 'XMLParser'=...) -> ElementTree: ...
def iterparse(source: _file_or_filename, events: Sequence[str]=..., parser: 'XMLParser'=...) -> Iterator[Tuple[str, Element]]: ...
class _IterParseIterator:
root = ... # type: Any
def __init__(self, source: _file_or_filename, events: Sequence[str], parser: 'XMLParser', close_source: bool=...) -> None: ...
def next(self) -> Tuple[str, Element]: ...
def __iter__(self) -> _IterParseIterator: ...
def XML(text: AnyStr, parser: 'XMLParser'=...) -> Element: ...
def XMLID(text: AnyStr, parser: 'XMLParser'=...) -> Tuple[Element, Dict[str, Element]]: ...
# TODO-improve this type
fromstring = ... # type: Callable[..., Element]
def fromstringlist(sequence: Sequence[AnyStr], parser: 'XMLParser'=...) -> Element: ...
class TreeBuilder:
def __init__(self, element_factory: Callable[[AnyStr, Dict[AnyStr, AnyStr]], Element]=...) -> None: ...
def close(self) -> Element: ...
def data(self, data: AnyStr) -> None: ...
def start(self, tag: AnyStr, attrs: Dict[AnyStr, AnyStr]) -> Element: ...
def end(self, tag: AnyStr) -> Element: ...
class XMLParser:
parser = ... # type: Any
target = ... # type: TreeBuilder
# TODO-what is entity used for???
entity = ... # type: Any
version = ... # type: str
def __init__(self, html: int=..., target: TreeBuilder=..., encoding: str=...) -> None: ...
def doctype(self, name: str, pubid: str, system: str) -> None: ...
def close(self) -> Any: ... # TODO-most of the time, this will be Element, but it can be anything target.close() returns
def feed(self, data: AnyStr)-> None: ...

View File

View File

@@ -0,0 +1,5 @@
# Stubs for xml.etree.cElementTree (Python 3.4)
#
# NOTE: This dynamically typed stub was automatically generated by stubgen.
from xml.etree.ElementTree import *

View File

View File

@@ -0,0 +1,19 @@
# Stubs for xml.etree.ElementInclude (Python 3.4)
#
# NOTE: This dynamically typed stub was automatically generated by stubgen.
from typing import Union, Optional, Callable
from .ElementTree import Element
XINCLUDE = ... # type: str
XINCLUDE_INCLUDE = ... # type: str
XINCLUDE_FALLBACK = ... # type: 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...
def include(elem: Element, loader: Callable[..., Union[str, Element]]=...) -> None: ...

View File

@@ -0,0 +1,35 @@
# Stubs for xml.etree.ElementPath (Python 3.4)
#
# NOTE: This dynamically typed stub was automatically generated by stubgen.
from typing import Pattern, Dict, Generator, Tuple, List, Union, TypeVar, Callable, Optional
from .ElementTree import Element
xpath_tokenizer_re = ... # type: Pattern
_token = Tuple[str, str]
_next = Callable[[], _token]
_callback = Callable[['_SelectorContext', List[Element]], Generator[Element, None, None]]
def xpath_tokenizer(pattern: str, namespaces: 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 = ... # type: Dict[str, Callable[[_next, _token], _callback]]
class _SelectorContext:
parent_map = ... # type: Dict[Element, Element]
root = ... # type: Element
def __init__(self, root: Element) -> None: ...
_T = TypeVar('_T')
def iterfind(elem: Element, path: str, namespaces: Dict[str, str]=...) -> List[Element]: ...
def find(elem: Element, path: str, namespaces: Dict[str, str]=...) -> Optional[Element]: ...
def findall(elem: Element, path: str, namespaces: Dict[str, str]=...) -> List[Element]: ...
def findtext(elem: Element, path: str, default: _T=..., namespaces: Dict[str, str]=...) -> Union[_T, str]: ...

View File

@@ -0,0 +1,120 @@
# Stubs for xml.etree.ElementTree (Python 3.4)
#
# NOTE: This dynamically typed stub was automatically generated by stubgen.
from typing import Any, AnyStr, Union, IO, Callable, Dict, List, Tuple, Sequence, Iterator, TypeVar, Optional, KeysView, ItemsView, Generator
import io
VERSION = ... # type: str
_Ss = TypeVar('_Ss', str, bytes)
_T = TypeVar('_T')
_str_or_bytes = Union[str, bytes]
class _SimpleElementPath:
def find(self, element: 'Element', tag: _str_or_bytes, namespaces: Any=...) -> Optional['Element']: ...
def findtext(self, element: 'Element', tag: _str_or_bytes, default: _T=..., namespaces: Any=...) -> Union[str, bytes, _T]: ...
def iterfind(self, element: 'Element', tag: _str_or_bytes, namespaces: Any=...) -> Generator['Element', None, None]: ...
def findall(self, element: 'Element', tag: _str_or_bytes, namespaces: Any=...) -> List['Element']: ...
class ParseError(SyntaxError): ...
def iselement(element: 'Element') -> bool: ...
class Element:
tag = ... # type: _str_or_bytes
attrib = ... # type: Dict[_str_or_bytes, _str_or_bytes]
text = ... # type: Optional[_str_or_bytes]
tail = ... # type: Optional[_str_or_bytes]
def __init__(self, tag: Union[AnyStr, Callable[..., 'Element']], attrib: Dict[AnyStr, AnyStr]=..., **extra: Dict[str, AnyStr]) -> None: ...
def append(self, subelement: 'Element') -> None: ...
def clear(self) -> None: ...
def copy(self) -> 'Element': ...
def extend(self, elements: Sequence['Element']) -> None: ...
def find(self, path: str, namespaces: Dict[str, str]=...) -> Optional['Element']: ...
def findall(self, path: str, namespaces: Dict[str, str]=...) -> List['Element']: ...
def findtext(self, path: str, default: _T=..., namespaces: Dict[str, str]=...) -> Union[_T, str]: ...
def get(self, key: AnyStr, default: _T=...) -> Union[AnyStr, _T]: ...
def getchildren(self) -> List['Element']: ...
def getiterator(self, tag: Union[str, AnyStr]=...) -> List['Element']: ...
def insert(self, index: int, subelement: 'Element') -> None: ...
def items(self) -> ItemsView[AnyStr, AnyStr]: ...
def iter(self, tag: Union[str, AnyStr]=...) -> Generator['Element', None, None]: ...
def iterfind(self, path: str, namespaces: Dict[str, str]=...) -> List['Element']: ...
def itertext(self) -> Generator[str, None, None]: ...
def keys(self) -> KeysView[AnyStr]: ...
def makeelement(self, tag: _Ss, attrib: Dict[_Ss, _Ss]) -> 'Element': ...
def remove(self, subelement: 'Element') -> None: ...
def set(self, key: AnyStr, value: AnyStr) -> None: ...
def __bool__(self) -> bool: ...
def __delitem__(self, index: int) -> None: ...
def __getitem__(self, index) -> 'Element': ...
def __len__(self) -> int: ...
def __setitem__(self, index: int, element: 'Element') -> None: ...
def SubElement(parent: Element, tag: AnyStr, attrib: Dict[AnyStr, AnyStr]=..., **extra: Dict[str, AnyStr]) -> Element: ...
def Comment(text: _str_or_bytes=...) -> Element: ...
def ProcessingInstruction(target: str, text: str=...) -> Element: ...
PI = ... # type: Callable[..., Element]
class QName:
text = ... # type: str
def __init__(self, text_or_uri: str, tag: str=...) -> None: ...
_file_or_filename = Union[str, bytes, int, IO[Any]]
class ElementTree:
def __init__(self, element: Element=..., file: _file_or_filename=...) -> None: ...
def getroot(self) -> Element: ...
def parse(self, source: _file_or_filename, parser: 'XMLParser'=...) -> Element: ...
def iter(self, tag: Union[str, AnyStr]=...) -> Generator[Element, None, None]: ...
def getiterator(self, tag: Union[str, AnyStr]=...) -> List[Element]: ...
def find(self, path: str, namespaces: Dict[str, str]=...) -> Optional[Element]: ...
def findtext(self, path: str, default: _T=..., namespaces: Dict[str, str]=...) -> Union[_T, str]: ...
def findall(self, path: str, namespaces: Dict[str, str]=...) -> List[Element]: ...
def iterfind(self, path: str, namespaces: Dict[str, str]=...) -> List[Element]: ...
def write(self, file_or_filename: _file_or_filename, encoding: str=..., xml_declaration: Optional[bool]=..., default_namespace: str=..., method: str=...) -> None: ...
def write_c14n(self, file: _file_or_filename) -> None: ...
def register_namespace(prefix: str, uri: str) -> None: ...
def tostring(element: Element, encoding: str=..., method: str=...) -> str: ...
def tostringlist(element: Element, encoding: str=..., method: str=...) -> List[str]: ...
def dump(elem: Element) -> None: ...
def parse(source: _file_or_filename, parser: 'XMLParser'=...) -> ElementTree: ...
def iterparse(source: _file_or_filename, events: Sequence[str]=..., parser: 'XMLParser'=...) -> Iterator[Tuple[str, Element]]: ...
class _IterParseIterator:
root = ... # type: Any
def __init__(self, source: _file_or_filename, events: Sequence[str], parser: 'XMLParser', close_source: bool=...) -> None: ...
def __next__(self) -> Tuple[str, Element]: ...
def __iter__(self) -> _IterParseIterator: ...
def XML(text: AnyStr, parser: 'XMLParser'=...) -> Element: ...
def XMLID(text: AnyStr, parser: 'XMLParser'=...) -> Tuple[Element, Dict[str, Element]]: ...
# TODO-improve this type
fromstring = ... # type: Callable[..., Element]
def fromstringlist(sequence: Sequence[AnyStr], parser: 'XMLParser'=...) -> Element: ...
class TreeBuilder:
def __init__(self, element_factory: Callable[[AnyStr, Dict[AnyStr, AnyStr]], Element]=...) -> None: ...
def close(self) -> Element: ...
def data(self, data: AnyStr) -> None: ...
def start(self, tag: AnyStr, attrs: Dict[AnyStr, AnyStr]) -> Element: ...
def end(self, tag: AnyStr) -> Element: ...
class XMLParser:
parser = ... # type: Any
target = ... # type: TreeBuilder
# TODO-what is entity used for???
entity = ... # type: Any
version = ... # type: str
def __init__(self, html: int=..., target: TreeBuilder=..., encoding: str=...) -> None: ...
def doctype(self, name: str, pubid: str, system: str) -> None: ...
def close(self) -> Any: ... # TODO-most of the time, this will be Element, but it can be anything target.close() returns
def feed(self, data: AnyStr)-> None: ...

View File

View File

@@ -0,0 +1,5 @@
# Stubs for xml.etree.cElementTree (Python 3.4)
#
# NOTE: This dynamically typed stub was automatically generated by stubgen.
from xml.etree.ElementTree import *

View File

View File

@@ -0,0 +1,19 @@
# Stubs for xml.etree.ElementInclude (Python 3.4)
#
# NOTE: This dynamically typed stub was automatically generated by stubgen.
from typing import Union, Optional, Callable
from .ElementTree import Element
XINCLUDE = ... # type: str
XINCLUDE_INCLUDE = ... # type: str
XINCLUDE_FALLBACK = ... # type: 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...
def include(elem: Element, loader: Callable[..., Union[str, Element]]=...) -> None: ...

View File

@@ -0,0 +1,35 @@
# Stubs for xml.etree.ElementPath (Python 3.4)
#
# NOTE: This dynamically typed stub was automatically generated by stubgen.
from typing import Pattern, Dict, Generator, Tuple, List, Union, TypeVar, Callable, Optional
from .ElementTree import Element
xpath_tokenizer_re = ... # type: Pattern
_token = Tuple[str, str]
_next = Callable[[], _token]
_callback = Callable[['_SelectorContext', List[Element]], Generator[Element, None, None]]
def xpath_tokenizer(pattern: str, namespaces: 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 = ... # type: Dict[str, Callable[[_next, _token], _callback]]
class _SelectorContext:
parent_map = ... # type: Dict[Element, Element]
root = ... # type: Element
def __init__(self, root: Element) -> None: ...
_T = TypeVar('_T')
def iterfind(elem: Element, path: str, namespaces: Dict[str, str]=...) -> List[Element]: ...
def find(elem: Element, path: str, namespaces: Dict[str, str]=...) -> Optional[Element]: ...
def findall(elem: Element, path: str, namespaces: Dict[str, str]=...) -> List[Element]: ...
def findtext(elem: Element, path: str, default: _T=..., namespaces: Dict[str, str]=...) -> Union[_T, str]: ...

View File

@@ -0,0 +1,122 @@
# Stubs for xml.etree.ElementTree (Python 3.4)
#
# NOTE: This dynamically typed stub was automatically generated by stubgen.
from typing import Any, AnyStr, Union, IO, Callable, Dict, List, Tuple, Sequence, Iterator, TypeVar, Optional, KeysView, ItemsView, Generator
import io
VERSION = ... # type: str
class ParseError(SyntaxError): ...
def iselement(element: 'Element') -> bool: ...
_Ss = TypeVar('_Ss', str, bytes)
_T = TypeVar('_T')
_str_or_bytes = Union[str, bytes]
class Element:
tag = ... # type: _str_or_bytes
attrib = ... # type: Dict[_str_or_bytes, _str_or_bytes]
text = ... # type: Optional[_str_or_bytes]
tail = ... # type: Optional[_str_or_bytes]
def __init__(self, tag: Union[AnyStr, Callable[..., 'Element']], attrib: Dict[AnyStr, AnyStr]=..., **extra: Dict[str, AnyStr]) -> None: ...
def append(self, subelement: 'Element') -> None: ...
def clear(self) -> None: ...
def copy(self) -> 'Element': ...
def extend(self, elements: Sequence['Element']) -> None: ...
def find(self, path: str, namespaces: Dict[str, str]=...) -> Optional['Element']: ...
def findall(self, path: str, namespaces: Dict[str, str]=...) -> List['Element']: ...
def findtext(self, path: str, default: _T=..., namespaces: Dict[str, str]=...) -> Union[_T, str]: ...
def get(self, key: AnyStr, default: _T=...) -> Union[AnyStr, _T]: ...
def getchildren(self) -> List['Element']: ...
def getiterator(self, tag: Union[str, AnyStr]=...) -> List['Element']: ...
def insert(self, index: int, subelement: 'Element') -> None: ...
def items(self) -> ItemsView[AnyStr, AnyStr]: ...
def iter(self, tag: Union[str, AnyStr]=...) -> Generator['Element', None, None]: ...
def iterfind(self, path: str, namespaces: Dict[str, str]=...) -> List['Element']: ...
def itertext(self) -> Generator[str, None, None]: ...
def keys(self) -> KeysView[AnyStr]: ...
def makeelement(self, tag: _Ss, attrib: Dict[_Ss, _Ss]) -> 'Element': ...
def remove(self, subelement: 'Element') -> None: ...
def set(self, key: AnyStr, value: AnyStr) -> None: ...
def __bool__(self) -> bool: ...
def __delitem__(self, index: int) -> None: ...
def __getitem__(self, index) -> 'Element': ...
def __len__(self) -> int: ...
def __setitem__(self, index: int, element: 'Element') -> None: ...
def SubElement(parent: Element, tag: AnyStr, attrib: Dict[AnyStr, AnyStr]=..., **extra: Dict[str, AnyStr]) -> Element: ...
def Comment(text: _str_or_bytes=...) -> Element: ...
def ProcessingInstruction(target: str, text: str=...) -> Element: ...
PI = ... # type: Callable[..., Element]
class QName:
text = ... # type: str
def __init__(self, text_or_uri: str, tag: str=...) -> None: ...
_file_or_filename = Union[str, bytes, int, IO[Any]]
class ElementTree:
def __init__(self, element: Element=..., file: _file_or_filename=...) -> None: ...
def getroot(self) -> Element: ...
def parse(self, source: _file_or_filename, parser: 'XMLParser'=...) -> Element: ...
def iter(self, tag: Union[str, AnyStr]=...) -> Generator[Element, None, None]: ...
def getiterator(self, tag: Union[str, AnyStr]=...) -> List[Element]: ...
def find(self, path: str, namespaces: Dict[str, str]=...) -> Optional[Element]: ...
def findtext(self, path: str, default: _T=..., namespaces: Dict[str, str]=...) -> Union[_T, str]: ...
def findall(self, path: str, namespaces: Dict[str, str]=...) -> List[Element]: ...
def iterfind(self, path: str, namespaces: Dict[str, str]=...) -> List[Element]: ...
def write(self, file_or_filename: _file_or_filename, encoding: str=..., xml_declaration: Optional[bool]=..., default_namespace: str=..., method: str=...) -> None: ...
def write_c14n(self, file: _file_or_filename) -> None: ...
def register_namespace(prefix: str, uri: str) -> None: ...
def tostring(element: Element, encoding: str=..., method: str=...) -> str: ...
class _ListDataStream(io.BufferedIOBase):
lst = ... # type: List[str]
def __init__(self, lst) -> None: ...
def writable(self) -> bool: ...
def seekable(self) -> bool: ...
def write(self, b: str) -> None: ...
def tell(self) -> int: ...
def tostringlist(element: Element, encoding: str=..., method: str=...) -> List[str]: ...
def dump(elem: Element) -> None: ...
def parse(source: _file_or_filename, parser: 'XMLParser'=...) -> ElementTree: ...
def iterparse(source: _file_or_filename, events: Sequence[str]=..., parser: 'XMLParser'=...) -> Iterator[Tuple[str, Element]]: ...
class _IterParseIterator:
root = ... # type: Any
def __init__(self, source: _file_or_filename, events: Sequence[str], parser: 'XMLParser', close_source: bool=...) -> None: ...
def __next__(self) -> Tuple[str, Element]: ...
def __iter__(self) -> _IterParseIterator: ...
def XML(text: AnyStr, parser: 'XMLParser'=...) -> Element: ...
def XMLID(text: AnyStr, parser: 'XMLParser'=...) -> Tuple[Element, Dict[str, Element]]: ...
# TODO-improve this type
fromstring = ... # type: Callable[..., Element]
def fromstringlist(sequence: Sequence[AnyStr], parser: 'XMLParser'=...) -> Element: ...
class TreeBuilder:
def __init__(self, element_factory: Callable[[AnyStr, Dict[AnyStr, AnyStr]], Element]=...) -> None: ...
def close(self) -> Element: ...
def data(self, data: AnyStr) -> None: ...
def start(self, tag: AnyStr, attrs: Dict[AnyStr, AnyStr]) -> Element: ...
def end(self, tag: AnyStr) -> Element: ...
class XMLParser:
parser = ... # type: Any
target = ... # type: TreeBuilder
# TODO-what is entity used for???
entity = ... # type: Any
version = ... # type: str
def __init__(self, html: int=..., target: TreeBuilder=..., encoding: str=...) -> None: ...
def doctype(self, name: str, pubid: str, system: str) -> None: ...
def close(self) -> Any: ... # TODO-most of the time, this will be Element, but it can be anything target.close() returns
def feed(self, data: AnyStr)-> None: ...

View File

View File

@@ -0,0 +1,5 @@
# Stubs for xml.etree.cElementTree (Python 3.4)
#
# NOTE: This dynamically typed stub was automatically generated by stubgen.
from xml.etree.ElementTree import *

View File

View File

@@ -0,0 +1,19 @@
# Stubs for xml.etree.ElementInclude (Python 3.4)
#
# NOTE: This dynamically typed stub was automatically generated by stubgen.
from typing import Union, Optional, Callable
from .ElementTree import Element
XINCLUDE = ... # type: str
XINCLUDE_INCLUDE = ... # type: str
XINCLUDE_FALLBACK = ... # type: 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...
def include(elem: Element, loader: Callable[..., Union[str, Element]]=...) -> None: ...

View File

@@ -0,0 +1,35 @@
# Stubs for xml.etree.ElementPath (Python 3.4)
#
# NOTE: This dynamically typed stub was automatically generated by stubgen.
from typing import Pattern, Dict, Generator, Tuple, List, Union, TypeVar, Callable, Optional
from .ElementTree import Element
xpath_tokenizer_re = ... # type: Pattern
_token = Tuple[str, str]
_next = Callable[[], _token]
_callback = Callable[['_SelectorContext', List[Element]], Generator[Element, None, None]]
def xpath_tokenizer(pattern: str, namespaces: 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 = ... # type: Dict[str, Callable[[_next, _token], _callback]]
class _SelectorContext:
parent_map = ... # type: Dict[Element, Element]
root = ... # type: Element
def __init__(self, root: Element) -> None: ...
_T = TypeVar('_T')
def iterfind(elem: Element, path: str, namespaces: Dict[str, str]=...) -> List[Element]: ...
def find(elem: Element, path: str, namespaces: Dict[str, str]=...) -> Optional[Element]: ...
def findall(elem: Element, path: str, namespaces: Dict[str, str]=...) -> List[Element]: ...
def findtext(elem: Element, path: str, default: _T=..., namespaces: Dict[str, str]=...) -> Union[_T, str]: ...

View File

@@ -0,0 +1,127 @@
# Stubs for xml.etree.ElementTree (Python 3.4)
#
# NOTE: This dynamically typed stub was automatically generated by stubgen.
from typing import Any, AnyStr, Union, IO, Callable, Dict, List, Tuple, Sequence, Iterator, TypeVar, Optional, KeysView, ItemsView, Generator
import io
VERSION = ... # type: str
class ParseError(SyntaxError): ...
def iselement(element: 'Element') -> bool: ...
_Ss = TypeVar('_Ss', str, bytes)
_T = TypeVar('_T')
_str_or_bytes = Union[str, bytes]
class Element:
tag = ... # type: _str_or_bytes
attrib = ... # type: Dict[_str_or_bytes, _str_or_bytes]
text = ... # type: Optional[_str_or_bytes]
tail = ... # type: Optional[_str_or_bytes]
def __init__(self, tag: Union[AnyStr, Callable[..., 'Element']], attrib: Dict[AnyStr, AnyStr]=..., **extra: Dict[str, AnyStr]) -> None: ...
def append(self, subelement: 'Element') -> None: ...
def clear(self) -> None: ...
def copy(self) -> 'Element': ...
def extend(self, elements: Sequence['Element']) -> None: ...
def find(self, path: str, namespaces: Dict[str, str]=...) -> Optional['Element']: ...
def findall(self, path: str, namespaces: Dict[str, str]=...) -> List['Element']: ...
def findtext(self, path: str, default: _T=..., namespaces: Dict[str, str]=...) -> Union[_T, str]: ...
def get(self, key: AnyStr, default: _T=...) -> Union[AnyStr, _T]: ...
def getchildren(self) -> List['Element']: ...
def getiterator(self, tag: Union[str, AnyStr]=...) -> List['Element']: ...
def insert(self, index: int, subelement: 'Element') -> None: ...
def items(self) -> ItemsView[AnyStr, AnyStr]: ...
def iter(self, tag: Union[str, AnyStr]=...) -> Generator['Element', None, None]: ...
def iterfind(self, path: str, namespaces: Dict[str, str]=...) -> List['Element']: ...
def itertext(self) -> Generator[str, None, None]: ...
def keys(self) -> KeysView[AnyStr]: ...
def makeelement(self, tag: _Ss, attrib: Dict[_Ss, _Ss]) -> 'Element': ...
def remove(self, subelement: 'Element') -> None: ...
def set(self, key: AnyStr, value: AnyStr) -> None: ...
def __bool__(self) -> bool: ...
def __delitem__(self, index: int) -> None: ...
def __getitem__(self, index) -> 'Element': ...
def __len__(self) -> int: ...
def __setitem__(self, index: int, element: 'Element') -> None: ...
def SubElement(parent: Element, tag: AnyStr, attrib: Dict[AnyStr, AnyStr]=..., **extra: Dict[str, AnyStr]) -> Element: ...
def Comment(text: _str_or_bytes=...) -> Element: ...
def ProcessingInstruction(target: str, text: str=...) -> Element: ...
PI = ... # type: Callable[..., Element]
class QName:
text = ... # type: str
def __init__(self, text_or_uri: str, tag: str=...) -> None: ...
_file_or_filename = Union[str, bytes, int, IO[Any]]
class ElementTree:
def __init__(self, element: Element=..., file: _file_or_filename=...) -> None: ...
def getroot(self) -> Element: ...
def parse(self, source: _file_or_filename, parser: 'XMLParser'=...) -> Element: ...
def iter(self, tag: Union[str, AnyStr]=...) -> Generator[Element, None, None]: ...
def getiterator(self, tag: Union[str, AnyStr]=...) -> List[Element]: ...
def find(self, path: str, namespaces: Dict[str, str]=...) -> Optional[Element]: ...
def findtext(self, path: str, default: _T=..., namespaces: Dict[str, str]=...) -> Union[_T, str]: ...
def findall(self, path: str, namespaces: Dict[str, str]=...) -> List[Element]: ...
def iterfind(self, path: str, namespaces: Dict[str, str]=...) -> List[Element]: ...
def write(self, file_or_filename: _file_or_filename, encoding: str=..., xml_declaration: Optional[bool]=..., default_namespace: str=..., method: str=..., *, short_empty_elements: bool=...) -> None: ...
def write_c14n(self, file: _file_or_filename) -> None: ...
def register_namespace(prefix: str, uri: str) -> None: ...
def tostring(element: Element, encoding: str=..., method: str=..., *, short_empty_elements: bool=...) -> str: ...
class _ListDataStream(io.BufferedIOBase):
lst = ... # type: List[str]
def __init__(self, lst) -> None: ...
def writable(self) -> bool: ...
def seekable(self) -> bool: ...
def write(self, b: str) -> None: ...
def tell(self) -> int: ...
def tostringlist(element: Element, encoding: str=..., method: str=..., *, short_empty_elements: bool=...) -> List[str]: ...
def dump(elem: Element) -> None: ...
def parse(source: _file_or_filename, parser: 'XMLParser'=...) -> ElementTree: ...
def iterparse(source: _file_or_filename, events: Sequence[str]=..., parser: 'XMLParser'=...) -> Iterator[Tuple[str, Element]]: ...
class XMLPullParser:
def __init__(self, events: Sequence[str]=..., *, _parser: 'XMLParser'=...) -> None: ...
def feed(self, data: bytes) -> None: ...
def close(self) -> None: ...
def read_events(self) -> Iterator[Tuple[str, Element]]: ...
class _IterParseIterator:
root = ... # type: Any
def __init__(self, source: _file_or_filename, events: Sequence[str], parser: 'XMLParser', close_source: bool=...) -> None: ...
def __next__(self) -> Tuple[str, Element]: ...
def __iter__(self) -> _IterParseIterator: ...
def XML(text: AnyStr, parser: 'XMLParser'=...) -> Element: ...
def XMLID(text: AnyStr, parser: 'XMLParser'=...) -> Tuple[Element, Dict[str, Element]]: ...
# TODO-improve this type
fromstring = ... # type: Callable[..., Element]
def fromstringlist(sequence: Sequence[AnyStr], parser: 'XMLParser'=...) -> Element: ...
class TreeBuilder:
def __init__(self, element_factory: Callable[[AnyStr, Dict[AnyStr, AnyStr]], Element]=...) -> None: ...
def close(self) -> Element: ...
def data(self, data: AnyStr) -> None: ...
def start(self, tag: AnyStr, attrs: Dict[AnyStr, AnyStr]) -> Element: ...
def end(self, tag: AnyStr) -> Element: ...
class XMLParser:
parser = ... # type: Any
target = ... # type: TreeBuilder
# TODO-what is entity used for???
entity = ... # type: Any
version = ... # type: str
def __init__(self, html: int=..., target: TreeBuilder=..., encoding: str=...) -> None: ...
def doctype(self, name: str, pubid: str, system: str) -> None: ...
def close(self) -> Any: ... # TODO-most of the time, this will be Element, but it can be anything target.close() returns
def feed(self, data: AnyStr)-> None: ...

View File

View File

@@ -0,0 +1,5 @@
# Stubs for xml.etree.cElementTree (Python 3.4)
#
# NOTE: This dynamically typed stub was automatically generated by stubgen.
from xml.etree.ElementTree import *

View File

View File

@@ -0,0 +1,19 @@
# Stubs for xml.etree.ElementInclude (Python 3.4)
#
# NOTE: This dynamically typed stub was automatically generated by stubgen.
from typing import Union, Optional, Callable
from .ElementTree import Element
XINCLUDE = ... # type: str
XINCLUDE_INCLUDE = ... # type: str
XINCLUDE_FALLBACK = ... # type: 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...
def include(elem: Element, loader: Callable[..., Union[str, Element]]=...) -> None: ...

View File

@@ -0,0 +1,35 @@
# Stubs for xml.etree.ElementPath (Python 3.4)
#
# NOTE: This dynamically typed stub was automatically generated by stubgen.
from typing import Pattern, Dict, Generator, Tuple, List, Union, TypeVar, Callable, Optional
from .ElementTree import Element
xpath_tokenizer_re = ... # type: Pattern
_token = Tuple[str, str]
_next = Callable[[], _token]
_callback = Callable[['_SelectorContext', List[Element]], Generator[Element, None, None]]
def xpath_tokenizer(pattern: str, namespaces: 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 = ... # type: Dict[str, Callable[[_next, _token], _callback]]
class _SelectorContext:
parent_map = ... # type: Dict[Element, Element]
root = ... # type: Element
def __init__(self, root: Element) -> None: ...
_T = TypeVar('_T')
def iterfind(elem: Element, path: str, namespaces: Dict[str, str]=...) -> List[Element]: ...
def find(elem: Element, path: str, namespaces: Dict[str, str]=...) -> Optional[Element]: ...
def findall(elem: Element, path: str, namespaces: Dict[str, str]=...) -> List[Element]: ...
def findtext(elem: Element, path: str, default: _T=..., namespaces: Dict[str, str]=...) -> Union[_T, str]: ...

View File

@@ -0,0 +1,127 @@
# Stubs for xml.etree.ElementTree (Python 3.4)
#
# NOTE: This dynamically typed stub was automatically generated by stubgen.
from typing import Any, AnyStr, Union, IO, Callable, Dict, List, Tuple, Sequence, Iterator, TypeVar, Optional, KeysView, ItemsView, Generator
import io
VERSION = ... # type: str
class ParseError(SyntaxError): ...
def iselement(element: 'Element') -> bool: ...
_Ss = TypeVar('_Ss', str, bytes)
_T = TypeVar('_T')
_str_or_bytes = Union[str, bytes]
class Element:
tag = ... # type: _str_or_bytes
attrib = ... # type: Dict[_str_or_bytes, _str_or_bytes]
text = ... # type: Optional[_str_or_bytes]
tail = ... # type: Optional[_str_or_bytes]
def __init__(self, tag: Union[AnyStr, Callable[..., 'Element']], attrib: Dict[AnyStr, AnyStr]=..., **extra: Dict[str, AnyStr]) -> None: ...
def append(self, subelement: 'Element') -> None: ...
def clear(self) -> None: ...
def copy(self) -> 'Element': ...
def extend(self, elements: Sequence['Element']) -> None: ...
def find(self, path: str, namespaces: Dict[str, str]=...) -> Optional['Element']: ...
def findall(self, path: str, namespaces: Dict[str, str]=...) -> List['Element']: ...
def findtext(self, path: str, default: _T=..., namespaces: Dict[str, str]=...) -> Union[_T, str]: ...
def get(self, key: AnyStr, default: _T=...) -> Union[AnyStr, _T]: ...
def getchildren(self) -> List['Element']: ...
def getiterator(self, tag: Union[str, AnyStr]=...) -> List['Element']: ...
def insert(self, index: int, subelement: 'Element') -> None: ...
def items(self) -> ItemsView[AnyStr, AnyStr]: ...
def iter(self, tag: Union[str, AnyStr]=...) -> Generator['Element', None, None]: ...
def iterfind(self, path: str, namespaces: Dict[str, str]=...) -> List['Element']: ...
def itertext(self) -> Generator[str, None, None]: ...
def keys(self) -> KeysView[AnyStr]: ...
def makeelement(self, tag: _Ss, attrib: Dict[_Ss, _Ss]) -> 'Element': ...
def remove(self, subelement: 'Element') -> None: ...
def set(self, key: AnyStr, value: AnyStr) -> None: ...
def __bool__(self) -> bool: ...
def __delitem__(self, index: int) -> None: ...
def __getitem__(self, index) -> 'Element': ...
def __len__(self) -> int: ...
def __setitem__(self, index: int, element: 'Element') -> None: ...
def SubElement(parent: Element, tag: AnyStr, attrib: Dict[AnyStr, AnyStr]=..., **extra: Dict[str, AnyStr]) -> Element: ...
def Comment(text: _str_or_bytes=...) -> Element: ...
def ProcessingInstruction(target: str, text: str=...) -> Element: ...
PI = ... # type: Callable[..., Element]
class QName:
text = ... # type: str
def __init__(self, text_or_uri: str, tag: str=...) -> None: ...
_file_or_filename = Union[str, bytes, int, IO[Any]]
class ElementTree:
def __init__(self, element: Element=..., file: _file_or_filename=...) -> None: ...
def getroot(self) -> Element: ...
def parse(self, source: _file_or_filename, parser: 'XMLParser'=...) -> Element: ...
def iter(self, tag: Union[str, AnyStr]=...) -> Generator[Element, None, None]: ...
def getiterator(self, tag: Union[str, AnyStr]=...) -> List[Element]: ...
def find(self, path: str, namespaces: Dict[str, str]=...) -> Optional[Element]: ...
def findtext(self, path: str, default: _T=..., namespaces: Dict[str, str]=...) -> Union[_T, str]: ...
def findall(self, path: str, namespaces: Dict[str, str]=...) -> List[Element]: ...
def iterfind(self, path: str, namespaces: Dict[str, str]=...) -> List[Element]: ...
def write(self, file_or_filename: _file_or_filename, encoding: str=..., xml_declaration: Optional[bool]=..., default_namespace: str=..., method: str=..., *, short_empty_elements: bool=...) -> None: ...
def write_c14n(self, file: _file_or_filename) -> None: ...
def register_namespace(prefix: str, uri: str) -> None: ...
def tostring(element: Element, encoding: str=..., method: str=..., *, short_empty_elements: bool=...) -> str: ...
class _ListDataStream(io.BufferedIOBase):
lst = ... # type: List[str]
def __init__(self, lst) -> None: ...
def writable(self) -> bool: ...
def seekable(self) -> bool: ...
def write(self, b: str) -> None: ...
def tell(self) -> int: ...
def tostringlist(element: Element, encoding: str=..., method: str=..., *, short_empty_elements: bool=...) -> List[str]: ...
def dump(elem: Element) -> None: ...
def parse(source: _file_or_filename, parser: 'XMLParser'=...) -> ElementTree: ...
def iterparse(source: _file_or_filename, events: Sequence[str]=..., parser: 'XMLParser'=...) -> Iterator[Tuple[str, Element]]: ...
class XMLPullParser:
def __init__(self, events: Sequence[str]=..., *, _parser: 'XMLParser'=...) -> None: ...
def feed(self, data: bytes) -> None: ...
def close(self) -> None: ...
def read_events(self) -> Iterator[Tuple[str, Element]]: ...
class _IterParseIterator:
root = ... # type: Any
def __init__(self, source: _file_or_filename, events: Sequence[str], parser: 'XMLParser', close_source: bool=...) -> None: ...
def __next__(self) -> Tuple[str, Element]: ...
def __iter__(self) -> _IterParseIterator: ...
def XML(text: AnyStr, parser: 'XMLParser'=...) -> Element: ...
def XMLID(text: AnyStr, parser: 'XMLParser'=...) -> Tuple[Element, Dict[str, Element]]: ...
# TODO-improve this type
fromstring = ... # type: Callable[..., Element]
def fromstringlist(sequence: Sequence[AnyStr], parser: 'XMLParser'=...) -> Element: ...
class TreeBuilder:
def __init__(self, element_factory: Callable[[AnyStr, Dict[AnyStr, AnyStr]], Element]=...) -> None: ...
def close(self) -> Element: ...
def data(self, data: AnyStr) -> None: ...
def start(self, tag: AnyStr, attrs: Dict[AnyStr, AnyStr]) -> Element: ...
def end(self, tag: AnyStr) -> Element: ...
class XMLParser:
parser = ... # type: Any
target = ... # type: TreeBuilder
# TODO-what is entity used for???
entity = ... # type: Any
version = ... # type: str
def __init__(self, html: int=..., target: TreeBuilder=..., encoding: str=...) -> None: ...
def doctype(self, name: str, pubid: str, system: str) -> None: ...
def close(self) -> Any: ... # TODO-most of the time, this will be Element, but it can be anything target.close() returns
def feed(self, data: AnyStr)-> None: ...

View File

View File

@@ -0,0 +1,5 @@
# Stubs for xml.etree.cElementTree (Python 3.4)
#
# NOTE: This dynamically typed stub was automatically generated by stubgen.
from xml.etree.ElementTree import *

View File

@@ -2,13 +2,18 @@
#
# NOTE: This dynamically typed stub was automatically generated by stubgen.
from typing import Any
from typing import Union, Optional, Callable
from .ElementTree import _ElementInterface
XINCLUDE = ... # type: Any
XINCLUDE_INCLUDE = ... # type: Any
XINCLUDE_FALLBACK = ... # type: Any
XINCLUDE = ... # type: str
XINCLUDE_INCLUDE = ... # type: str
XINCLUDE_FALLBACK = ... # type: str
class FatalIncludeError(SyntaxError): ...
def default_loader(href, parse, encoding=...): ...
def include(elem, loader=...): ...
def default_loader(href: Union[str, bytes, int], parse: str, encoding: Optional[str]=...) -> Union[str, _ElementInterface]: ...
# 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...
def include(elem: _ElementInterface, loader: Callable[..., Union[str, _ElementInterface]]=...) -> None: ...

View File

@@ -2,27 +2,24 @@
#
# NOTE: This dynamically typed stub was automatically generated by stubgen.
from typing import Any
from typing import Tuple, List, Union, TypeVar, Callable, Optional
from .ElementTree import _ElementInterface
xpath_tokenizer_re = ... # type: Any
xpath_tokenizer_re = ... # type: Callable[..., List[Tuple[str, str]]]
def xpath_tokenizer(pattern, namespaces=...): ...
def get_parent_map(context): ...
def prepare_child(next, token): ...
def prepare_star(next, token): ...
def prepare_self(next, token): ...
def prepare_descendant(next, token): ...
def prepare_parent(next, token): ...
def prepare_predicate(next, token): ...
ops = ... # type: Any
class xpath_descendant_or_self: ...
class _SelectorContext:
parent_map = ... # type: Any
root = ... # type: Any
def __init__(self, root) -> None: ...
_T = TypeVar('_T')
def iterfind(elem, path, namespaces=...): ...
def find(elem, path, namespaces=...): ...
def findall(elem, path, namespaces=...): ...
def findtext(elem, path, default=..., namespaces=...): ...
class Path:
def __init__(self, path: str) -> None: ...
def find(self, element: _ElementInterface) -> Optional[_ElementInterface]: ...
def findtext(self, element: _ElementInterface, default: _T=...) -> Union[str, _T]: ...
def findall(self, element: _ElementInterface) -> List[_ElementInterface]: ...
def find(element: _ElementInterface, path: str) -> Optional[_ElementInterface]: ...
def findtext(element: _ElementInterface, path: str, default: _T=...) -> Union[str, _T]: ...
def findall(element: _ElementInterface, path: str) -> List[_ElementInterface]: ...

View File

@@ -2,126 +2,97 @@
#
# NOTE: This dynamically typed stub was automatically generated by stubgen.
from typing import Any
from typing import Any, AnyStr, Union, IO, Callable, Dict, List, Tuple, Sequence, Iterator, TypeVar, Optional, KeysView, ItemsView, Generator
import io
VERSION = ... # type: Any
VERSION = ... # type: str
class ParseError(SyntaxError): ...
_Ss = TypeVar('_Ss', str, bytes)
_T = TypeVar('_T')
_str_or_bytes = Union[str, bytes]
def iselement(element): ...
class _ElementInterface:
tag = ... # type: _str_or_bytes
attrib = ... # type: Dict[_str_or_bytes, _str_or_bytes]
text = ... # type: Optional[_str_or_bytes]
tail = ... # type: Optional[_str_or_bytes]
def __init__(self, tag: Union[AnyStr, Callable[..., '_ElementInterface']], attrib: Dict[AnyStr, AnyStr]) -> None: ...
def makeelement(self, tag: _Ss, attrib: Dict[_Ss, _Ss]) -> '_ElementInterface': ...
def __len__(self) -> int: ...
def __getitem__(self, index: int) -> '_ElementInterface': ...
def __setitem__(self, index: int, element: '_ElementInterface') -> None: ...
def __delitem__(self, index: int) -> None: ...
def __getslice__(self, start: int, stop: int) -> Sequence['_ElementInterface']: ...
def __setslice__(self, start: int, stop: int, elements: Sequence['_ElementInterface']) -> None: ...
def __delslice__(self, start: int, stop: int) -> None: ...
def append(self, element: '_ElementInterface') -> None: ...
def insert(self, index: int, element: '_ElementInterface') -> None: ...
def remove(self, element: '_ElementInterface') -> None: ...
def getchildren(self) -> List['_ElementInterface']: ...
def find(self, path: str) -> Optional['_ElementInterface']: ...
def findtext(self, path: str, default: _T=...) -> Union[str, _T]: ...
def findall(self, path: str) -> List['_ElementInterface']: ...
def clear(self) -> None: ...
def get(self, key: AnyStr, default: _T=...) -> Union[AnyStr, _T]: ...
def set(self, key: AnyStr, value: AnyStr) -> None: ...
def keys(self) -> KeysView[AnyStr]: ...
def items(self) -> ItemsView[AnyStr, AnyStr]: ...
def getiterator(self, tag: Union[str, AnyStr]=...) -> List['_ElementInterface']: ...
class Element:
def __init__(self, tag, attrib=..., **extra) -> None: ...
def append(self, *args, **kwargs): ...
def clear(self, *args, **kwargs): ...
def extend(self, *args, **kwargs): ...
def find(self, *args, **kwargs): ...
def findall(self, *args, **kwargs): ...
def findtext(self, match, default=..., namespaces=...): ...
def get(self, *args, **kwargs): ...
def getchildren(self): ...
def getiterator(self, tag=...): ...
def insert(self, *args, **kwargs): ...
def items(self, *args, **kwargs): ...
def iter(self, *args, **kwargs): ...
def iterfind(self, match, namespaces=...): ...
def itertext(self): ...
def keys(self): ...
def makeelement(self, tag, attrib): ...
def remove(self, *args, **kwargs): ...
def set(self, *args, **kwargs): ...
def __copy__(self): ...
def __deepcopy__(self): ...
def __delattr__(self, name): ...
def __delitem__(self, name): ...
def __getitem__(self, name): ...
def __getstate__(self): ...
def __len__(self): ...
def __setattr__(self, name, value): ...
def __setitem__(self, index, object): ...
def __setstate__(self, state): ...
def __sizeof__(self): ...
def Element(tag: Union[AnyStr, Callable[..., _ElementInterface]], attrib: Dict[AnyStr, AnyStr]=..., **extra: Dict[str, AnyStr]) -> _ElementInterface: ...
def SubElement(parent: _ElementInterface, tag: AnyStr, attrib: Dict[AnyStr, AnyStr]=..., **extra: Dict[str, AnyStr]) -> _ElementInterface: ...
def Comment(text: _str_or_bytes=...) -> _ElementInterface: ...
def ProcessingInstruction(target: str, text: str=...) -> _ElementInterface: ...
def SubElement(parent, tag, attrib=..., **extra): ...
def Comment(text=...): ...
def ProcessingInstruction(target, text=...): ...
PI = ... # type: Any
PI = ... # type: Callable[..., _ElementInterface]
class QName:
text = ... # type: Any
def __init__(self, text_or_uri, tag=...) -> None: ...
def __hash__(self): ...
def __le__(self, other): ...
def __lt__(self, other): ...
def __ge__(self, other): ...
def __gt__(self, other): ...
def __eq__(self, other): ...
def __ne__(self, other): ...
text = ... # type: str
def __init__(self, text_or_uri: str, tag: str=...) -> None: ...
_file_or_filename = Union[str, bytes, int, IO[Any]]
class ElementTree:
def __init__(self, element=..., file=...) -> None: ...
def getroot(self): ...
def parse(self, source, parser=...): ...
def iter(self, tag=...): ...
def getiterator(self, tag=...): ...
def find(self, path, namespaces=...): ...
def findtext(self, path, default=..., namespaces=...): ...
def findall(self, path, namespaces=...): ...
def iterfind(self, path, namespaces=...): ...
def write(self, file_or_filename, encoding=..., xml_declaration=..., default_namespace=..., method=..., *, short_empty_elements=...): ...
def write_c14n(self, file): ...
def __init__(self, element: _ElementInterface=..., file: _file_or_filename=...) -> None: ...
def getroot(self) -> _ElementInterface: ...
def parse(self, source: _file_or_filename, parser: 'XMLTreeBuilder'=...) -> _ElementInterface: ...
def getiterator(self, tag: Union[str, AnyStr]=...) -> List[_ElementInterface]: ...
def find(self, path: str) -> Optional[_ElementInterface]: ...
def findtext(self, path: str, default: _T=...) -> Union[_T, str]: ...
def findall(self, path: str) -> List[_ElementInterface]: ...
def write(self, file_or_filename: _file_or_filename, encoding: str=...) -> None: ...
def register_namespace(prefix, uri): ...
def tostring(element, encoding=..., method=..., *, short_empty_elements=...): ...
def iselement(element: _ElementInterface) -> bool: ...
def dump(elem: _ElementInterface) -> None: ...
def fixtag(tag: Union[str, QName], namespaces: Dict[str, str]) -> Tuple[str, Optional[str]]: ...
def parse(source: _file_or_filename, parser: 'XMLTreeBuilder'=...) -> ElementTree: ...
class _ListDataStream(io.BufferedIOBase):
lst = ... # type: Any
def __init__(self, lst) -> None: ...
def writable(self): ...
def seekable(self): ...
def write(self, b): ...
def tell(self): ...
def tostringlist(element, encoding=..., method=..., *, short_empty_elements=...): ...
def dump(elem): ...
def parse(source, parser=...): ...
def iterparse(source, events=..., parser=...): ...
class iterparse:
def __init__(self, source: _file_or_filename, events: Sequence[str]=...) -> None: ...
# TODO-figure out this type...
def __next__(self) -> Tuple[str, _ElementInterface]: ...
class XMLPullParser:
def __init__(self, events=..., *, _parser=...) -> None: ...
def feed(self, data): ...
def close(self): ...
def read_events(self): ...
def XML(text: AnyStr) -> _ElementInterface: ...
def XMLID(text: AnyStr) -> Tuple[_ElementInterface, Dict[str, _ElementInterface]]: ...
class _IterParseIterator:
root = ... # type: Any
def __init__(self, source, events, parser, close_source=...) -> None: ...
def __next__(self): ...
def __iter__(self): ...
# TODO-improve this type
fromstring = ... # type: Callable[..., _ElementInterface]
def XML(text, parser=...): ...
def XMLID(text, parser=...): ...
fromstring = ... # type: Any
def fromstringlist(sequence, parser=...): ...
def tostring(element: _ElementInterface, encoding: str=...) -> AnyStr: ...
class TreeBuilder:
def __init__(self, element_factory=...) -> None: ...
def close(self): ...
def data(self, data): ...
def start(self, tag, attrs): ...
def end(self, tag): ...
def __init__(self, element_factory: Callable[[AnyStr, Dict[AnyStr, AnyStr]], _ElementInterface]=...) -> None: ...
def close(self) -> _ElementInterface: ...
def data(self, data: AnyStr) -> None: ...
def start(self, tag: AnyStr, attrs: Dict[AnyStr, AnyStr]) -> _ElementInterface: ...
def end(self, tag: AnyStr) -> _ElementInterface: ...
class XMLParser:
target = ... # type: Any
class XMLTreeBuilder:
# TODO-what is entity used for???
entity = ... # type: Any
version = ... # type: Any
def __init__(self, html=..., target=..., encoding=...) -> None: ...
def _parse_whole(self, *args, **kwargs): ...
def _setevents(self, *args, **kwargs): ...
def close(self, *args, **kwargs): ...
def doctype(self, name, pubid, system): ...
def feed(self, data): ...
def __init__(self, html: int=..., target: TreeBuilder=...) -> None: ...
def doctype(self, name: str, pubid: str, system: str) -> None: ...
def close(self) -> Any: ... # TODO-most of the time, this will be Element, but it can be anything target.close() returns
def feed(self, data: AnyStr)-> None: ...