Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
61 changes: 60 additions & 1 deletion third_party/3/lxml/etree.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# Any use of `Any` below means I couldn't figure out the type.

import typing
from typing import Any, Dict, List, Tuple, Union
from typing import Any, Dict, List, MutableMapping, Tuple, Union
from typing import SupportsBytes


Expand All @@ -21,6 +21,11 @@ class _Element:
def addprevious(self, element: '_Element') -> None:
pass

attrib = ... # type: MutableMapping[str, str]

class ElementBase(_Element):
pass

class _ElementTree:
def write(self,
file: Union[AnyStr, typing.IO],
Expand Down Expand Up @@ -100,3 +105,57 @@ def parse(source: Union[AnyStr, typing.IO],
parser: XMLParser = ...,
base_url: AnyStr = ...) -> _ElementTree:
pass


def fromstring(text: AnyStr,
parser: XMLParser = ...,
*,
base_url: AnyStr = ...) -> _Element: ...

def tostring(element_or_tree: Union[_Element, _ElementTree],
encoding: Union[str, type] = ...,
method: str = ...,
xml_declaration: bool = ...,
pretty_print: bool = ...,
with_tail: bool = ...,
standalone: bool = ...,
doctype: str = ...,
exclusive: bool = ...,
with_comments: bool = ...,
inclusive_ns_prefixes: Any = ...) -> AnyStr: ...


class _ErrorLog:
pass


class Error(Exception):
pass

class LxmlError(Error):
def __init__(self, message: Any, error_log: _ErrorLog = ...) -> None: ...
error_log = ... # type: _ErrorLog

class DocumentInvalid(LxmlError):
pass

class LxmlSyntaxError(LxmlError, SyntaxError):
pass

class ParseError(LxmlSyntaxError):
pass

class XMLSyntaxError(ParseError):
pass


class _Validator:
pass

class DTD(_Validator):
def __init__(self,
file: Union[AnyStr, typing.IO] = ...,
*,
external_id: Any = ...) -> None: ...

def assertValid(self, etree: _Element) -> None: ...
13 changes: 13 additions & 0 deletions third_party/3/lxml/objectify.pyi
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Hand-written stub, incomplete

from typing import AnyStr

from lxml.etree import ElementBase, XMLParser

class ObjectifiedElement(ElementBase):
pass

def fromstring(text: AnyStr,
parser: XMLParser = ...,
*,
base_url: AnyStr = ...) -> ObjectifiedElement: ...