Flake8 fixes (#2549)

* Fix over-indented continuation lines

* Fix under-indented continuation lines

* Fix whitespace around default operator problems

* Limit line lengths

* Fix inconsistent files
This commit is contained in:
Sebastian Rittau
2018-10-24 16:20:53 +02:00
committed by Jelle Zijlstra
parent f362cf47fa
commit 006a79220f
83 changed files with 567 additions and 547 deletions

View File

@@ -31,8 +31,7 @@ if sys.version_info >= (3, 6):
else:
def b2a_base64(data: _Bytes) -> bytes: ...
def a2b_qp(string: _Ascii, header: bool = ...) -> bytes: ...
def b2a_qp(data: _Bytes, quotetabs: bool = ..., istext: bool = ...,
header: bool = ...) -> bytes: ...
def b2a_qp(data: _Bytes, quotetabs: bool = ..., istext: bool = ..., header: bool = ...) -> bytes: ...
def a2b_hqx(string: _Ascii) -> bytes: ...
def rledecode_hqx(data: _Bytes) -> bytes: ...
def rlecode_hqx(data: _Bytes) -> bytes: ...

View File

@@ -51,7 +51,7 @@ def IS_CHARACTER_JUNK(line: _StrType) -> bool: ...
def unified_diff(a: Sequence[_StrType], b: Sequence[_StrType], fromfile: _StrType = ...,
tofile: _StrType = ..., fromfiledate: _StrType = ..., tofiledate: _StrType = ...,
n: int = ..., lineterm: _StrType = ...) -> Iterator[_StrType]: ...
def context_diff(a: Sequence[_StrType], b: Sequence[_StrType], fromfile: _StrType =...,
def context_diff(a: Sequence[_StrType], b: Sequence[_StrType], fromfile: _StrType = ...,
tofile: _StrType = ..., fromfiledate: _StrType = ..., tofiledate: _StrType = ...,
n: int = ..., lineterm: _StrType = ...) -> Iterator[_StrType]: ...
def ndiff(a: Sequence[_StrType], b: Sequence[_StrType],

View File

@@ -173,12 +173,12 @@ class Formatter:
if sys.version_info >= (3,):
def __init__(self, fmt: Optional[str] = ...,
datefmt: Optional[str] =...,
datefmt: Optional[str] = ...,
style: str = ...) -> None: ...
else:
def __init__(self,
fmt: Optional[str] = ...,
datefmt: Optional[str] =...) -> None: ...
datefmt: Optional[str] = ...) -> None: ...
def format(self, record: LogRecord) -> str: ...
def formatTime(self, record: LogRecord, datefmt: str = ...) -> str: ...

View File

@@ -129,7 +129,7 @@ class SysLogHandler(Handler):
LOG_LOCAL6 = ... # type: int
LOG_LOCAL7 = ... # type: int
def __init__(self, address: Union[Tuple[str, int], str] = ...,
facility: int = ..., socktype: _SocketKind = ...) -> None: ...
facility: int = ..., socktype: _SocketKind = ...) -> None: ...
def encodePriority(self, facility: Union[int, str],
priority: Union[int, str]) -> int: ...
def mapPriority(self, levelName: int) -> str: ...
@@ -150,14 +150,14 @@ class SMTPHandler(Handler):
def __init__(self, mailhost: Union[str, Tuple[str, int]], fromaddr: str,
toaddrs: List[str], subject: str,
credentials: Optional[Tuple[str, str]] = ...,
secure: Union[Tuple[str], Tuple[str, str], None] =...,
secure: Union[Tuple[str], Tuple[str, str], None] = ...,
timeout: float = ...) -> None: ...
else:
def __init__(self,
mailhost: Union[str, Tuple[str, int]], fromaddr: str,
toaddrs: List[str], subject: str,
credentials: Optional[Tuple[str, str]] = ...,
secure: Union[Tuple[str], Tuple[str, str], None] =...) -> None: ...
secure: Union[Tuple[str], Tuple[str, str], None] = ...) -> None: ...
def getSubject(self, record: LogRecord) -> str: ...
@@ -167,7 +167,7 @@ class BufferingHandler(Handler):
class MemoryHandler(BufferingHandler):
def __init__(self, capacity: int, flushLevel: int = ...,
target: Optional[Handler] =...) -> None: ...
target: Optional[Handler] = ...) -> None: ...
def setTarget(self, target: Handler) -> None: ...

View File

@@ -180,16 +180,17 @@ class OptionParser(OptionContainer):
usage = ... # type: Optional[_Text]
values = ... # type: Optional[Values]
version = ... # type: _Text
def __init__(self, usage: Optional[_Text] = ...,
option_list: Iterable[Option] = ...,
option_class: Option = ...,
version: Optional[_Text] = ...,
conflict_handler: _Text = ...,
description: Optional[_Text] = ...,
formatter: Optional[HelpFormatter] = ...,
add_help_option: bool = ...,
prog: Optional[_Text] = ...,
epilog: Optional[_Text] = ...) -> None: ...
def __init__(self,
usage: Optional[_Text] = ...,
option_list: Iterable[Option] = ...,
option_class: Option = ...,
version: Optional[_Text] = ...,
conflict_handler: _Text = ...,
description: Optional[_Text] = ...,
formatter: Optional[HelpFormatter] = ...,
add_help_option: bool = ...,
prog: Optional[_Text] = ...,
epilog: Optional[_Text] = ...) -> None: ...
def _add_help_option(self) -> None: ...
def _add_version_option(self) -> None: ...
def _create_option_list(self) -> None: ...

View File

@@ -28,7 +28,7 @@ if sys.version_info >= (3, 4):
def loads(data: bytes, *, fmt: Optional[PlistFormat] = ...,
use_builtin_types: bool = ..., dict_type: Type[_D] = ...) -> _D: ...
def dump(value: Mapping[str, Any], fp: IO[bytes], *,
fmt: PlistFormat =..., sort_keys: bool = ...,
fmt: PlistFormat = ..., sort_keys: bool = ...,
skipkeys: bool = ...) -> None: ...
def dumps(value: Mapping[str, Any], *, fmt: PlistFormat = ...,
skipkeys: bool = ..., sort_keys: bool = ...) -> bytes: ...

View File

@@ -509,11 +509,9 @@ class socket:
proto: int
if sys.version_info < (3,):
def __init__(self, family: int = ..., type: int = ...,
proto: int = ...) -> None: ...
def __init__(self, family: int = ..., type: int = ..., proto: int = ...) -> None: ...
else:
def __init__(self, family: int = ..., type: int = ...,
proto: int = ..., fileno: Optional[int] = ...) -> None: ...
def __init__(self, family: int = ..., type: int = ..., proto: int = ..., fileno: Optional[int] = ...) -> None: ...
if sys.version_info >= (3, 2):
def __enter__(self: _SelfT) -> _SelfT: ...
@@ -556,7 +554,7 @@ class socket:
def recv_into(self, buffer: _WriteBuffer, nbytes: int,
flags: int = ...) -> int: ...
def send(self, data: bytes, flags: int = ...) -> int: ...
def sendall(self, data: bytes, flags: int =...) -> None:
def sendall(self, data: bytes, flags: int = ...) -> None:
... # return type: None on success
@overload
def sendto(self, data: bytes, address: Union[tuple, str]) -> int: ...

View File

@@ -165,9 +165,7 @@ if sys.version_info < (3,) or sys.version_info >= (3, 4):
ALERT_DESCRIPTION_USER_CANCELLED: int
if sys.version_info < (3,) or sys.version_info >= (3, 4):
_PurposeType = NamedTuple('_PurposeType',
[('nid', int), ('shortname', str),
('longname', str), ('oid', str)])
_PurposeType = NamedTuple('_PurposeType', [('nid', int), ('shortname', str), ('longname', str), ('oid', str)])
class Purpose:
SERVER_AUTH: _PurposeType
CLIENT_AUTH: _PurposeType

View File

@@ -39,15 +39,15 @@ if sys.version_info < (3,):
TAR_GZIPPED = ... # type: int
def open(name: Optional[_Path] = ..., mode: str = ...,
fileobj: Optional[IO[bytes]] = ..., bufsize: int = ...,
*, format: Optional[int] = ..., tarinfo: Optional[TarInfo] = ...,
dereference: Optional[bool] = ...,
ignore_zeros: Optional[bool] = ...,
encoding: Optional[str] = ..., errors: str = ...,
pax_headers: Optional[Mapping[str, str]] = ...,
debug: Optional[int] = ...,
errorlevel: Optional[int] = ...,
compresslevel: Optional[int] = ...) -> TarFile: ...
fileobj: Optional[IO[bytes]] = ..., bufsize: int = ...,
*, format: Optional[int] = ..., tarinfo: Optional[TarInfo] = ...,
dereference: Optional[bool] = ...,
ignore_zeros: Optional[bool] = ...,
encoding: Optional[str] = ..., errors: str = ...,
pax_headers: Optional[Mapping[str, str]] = ...,
debug: Optional[int] = ...,
errorlevel: Optional[int] = ...,
compresslevel: Optional[int] = ...) -> TarFile: ...
class TarFile(Iterable[TarInfo]):

View File

@@ -12,7 +12,7 @@ default_timer = ... # type: _Timer
class Timer:
if sys.version_info >= (3, 5):
def __init__(self, stmt: _stmt = ..., setup: _stmt = ..., timer: _Timer = ...,
globals: Optional[Dict[str, Any]] =...) -> None: ...
globals: Optional[Dict[str, Any]] = ...) -> None: ...
else:
def __init__(self, stmt: _stmt = ..., setup: _stmt = ..., timer: _Timer = ...) -> None: ...
def print_exc(self, file: Optional[IO[str]] = ...) -> None: ...
@@ -23,9 +23,9 @@ class Timer:
if sys.version_info >= (3, 5):
def timeit(stmt: _stmt = ..., setup: _stmt = ..., timer: _Timer = ...,
number: int = ..., globals: Optional[Dict[str, Any]] =...) -> float: ...
number: int = ..., globals: Optional[Dict[str, Any]] = ...) -> float: ...
def repeat(stmt: _stmt = ..., setup: _stmt = ..., timer: _Timer = ...,
repeat: int = ..., number: int = ..., globals: Optional[Dict[str, Any]] =...) -> List[float]: ...
repeat: int = ..., number: int = ..., globals: Optional[Dict[str, Any]] = ...) -> List[float]: ...
else:
def timeit(stmt: _stmt = ..., setup: _stmt = ..., timer: _Timer = ...,
number: int = ...) -> float: ...

View File

@@ -10,15 +10,15 @@ _default = TypeVar('_default')
def bidirectional(__chr: Text) -> Text: ...
def category(__chr: Text) -> Text: ...
def combining(__chr: Text) -> int: ...
def decimal(__chr: Text, __default: _default=...) -> Union[int, _default]: ...
def decimal(__chr: Text, __default: _default = ...) -> Union[int, _default]: ...
def decomposition(__chr: Text) -> Text: ...
def digit(__chr: Text, __default: _default=...) -> Union[int, _default]: ...
def digit(__chr: Text, __default: _default = ...) -> Union[int, _default]: ...
def east_asian_width(__chr: Text) -> Text: ...
def lookup(__name: Union[Text, bytes]) -> Text: ...
def mirrored(__chr: Text) -> int: ...
def name(__chr: Text, __default: _default=...) -> Union[Text, _default]: ...
def name(__chr: Text, __default: _default = ...) -> Union[Text, _default]: ...
def normalize(__form: Text, __unistr: Text) -> Text: ...
def numeric(__chr: Text, __default: _default=...) -> Union[float, _default]: ...
def numeric(__chr: Text, __default: _default = ...) -> Union[float, _default]: ...
class UCD(object):
# The methods below are constructed from the same array in C
@@ -27,12 +27,12 @@ class UCD(object):
def bidirectional(self, __chr: Text) -> str: ...
def category(self, __chr: Text) -> str: ...
def combining(self, __chr: Text) -> int: ...
def decimal(self, __chr: Text, __default: _default=...) -> Union[int, _default]: ...
def decimal(self, __chr: Text, __default: _default = ...) -> Union[int, _default]: ...
def decomposition(self, __chr: Text) -> str: ...
def digit(self, __chr: Text, __default: _default=...) -> Union[int, _default]: ...
def digit(self, __chr: Text, __default: _default = ...) -> Union[int, _default]: ...
def east_asian_width(self, __chr: Text) -> str: ...
def lookup(self, __name: Union[Text, bytes]) -> Text: ...
def mirrored(self, __chr: Text) -> int: ...
def name(self, __chr: Text, __default: _default=...) -> Union[Text, _default]: ...
def name(self, __chr: Text, __default: _default = ...) -> Union[Text, _default]: ...
def normalize(self, __form: Text, __unistr: Text) -> Text: ...
def numeric(self, __chr: Text, __default: _default=...) -> Union[float, _default]: ...
def numeric(self, __chr: Text, __default: _default = ...) -> Union[float, _default]: ...

View File

@@ -22,13 +22,12 @@ def simplefilter(action: str, category: Type[Warning] = ..., lineno: int = ...,
def resetwarnings() -> None: ...
_Record = NamedTuple('_Record',
[('message', str),
('category', Type[Warning]),
('filename', str),
('lineno', int),
('file', Optional[TextIO]),
('line', Optional[str])]
)
[('message', str),
('category', Type[Warning]),
('filename', str),
('lineno', int),
('file', Optional[TextIO]),
('line', Optional[str])])
class catch_warnings:
def __init__(self, *, record: bool = ...,

View File

@@ -9,9 +9,9 @@ XINCLUDE_FALLBACK = ... # type: str
class FatalIncludeError(SyntaxError): ...
def default_loader(href: Union[str, bytes, int], parse: str, encoding: Optional[str]=...) -> Union[str, Element]: ...
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: ...
def include(elem: Element, loader: Callable[..., Union[str, Element]] = ...) -> None: ...

View File

@@ -9,7 +9,7 @@ _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 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: ...
@@ -27,7 +27,7 @@ class _SelectorContext:
_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]: ...
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

@@ -46,24 +46,24 @@ class Element(MutableSequence[Element]):
attrib = ... # type: Dict[_str_result_type, _str_result_type]
text = ... # type: Optional[_str_result_type]
tail = ... # type: 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 __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 copy(self) -> Element: ...
def extend(self, elements: Iterable[Element]) -> None: ...
def find(self, path: _str_argument_type, namespaces: Dict[_str_argument_type, _str_argument_type]=...) -> Optional[Element]: ...
def findall(self, path: _str_argument_type, namespaces: Dict[_str_argument_type, _str_argument_type]=...) -> List[Element]: ...
def findtext(self, path: _str_argument_type, default: _T=..., namespaces: Dict[_str_argument_type, _str_argument_type]=...) -> Union[_T, _str_result_type]: ...
def get(self, key: _str_argument_type, default: _T=...) -> Union[_str_result_type, _T]: ...
def find(self, path: _str_argument_type, namespaces: Dict[_str_argument_type, _str_argument_type] = ...) -> Optional[Element]: ...
def findall(self, path: _str_argument_type, namespaces: Dict[_str_argument_type, _str_argument_type] = ...) -> List[Element]: ...
def findtext(self, path: _str_argument_type, default: _T = ..., namespaces: Dict[_str_argument_type, _str_argument_type] = ...) -> Union[_T, _str_result_type]: ...
def get(self, key: _str_argument_type, default: _T = ...) -> Union[_str_result_type, _T]: ...
def getchildren(self) -> List[Element]: ...
def getiterator(self, tag: _str_argument_type=...) -> List[Element]: ...
def getiterator(self, tag: _str_argument_type = ...) -> List[Element]: ...
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: _str_argument_type=...) -> Generator[Element, None, None]: ...
def iterfind(self, path: _str_argument_type, namespaces: Dict[_str_argument_type, _str_argument_type]=...) -> List[Element]: ...
def iter(self, tag: _str_argument_type = ...) -> Generator[Element, None, None]: ...
def iterfind(self, path: _str_argument_type, namespaces: Dict[_str_argument_type, _str_argument_type] = ...) -> List[Element]: ...
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: ...
@@ -82,60 +82,60 @@ class Element(MutableSequence[Element]):
def __setitem__(self, s: slice, o: Iterable[Element]) -> None: ...
def SubElement(parent: Element, tag: _str_argument_type, attrib: Dict[_str_argument_type, _str_argument_type]=..., **extra: _str_argument_type) -> Element: ...
def Comment(text: _str_argument_type=...) -> Element: ...
def ProcessingInstruction(target: _str_argument_type, text: _str_argument_type=...) -> 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: _str_argument_type = ...) -> Element: ...
def ProcessingInstruction(target: _str_argument_type, text: _str_argument_type = ...) -> Element: ...
PI = ... # type: Callable[..., Element]
class QName:
text = ... # type: str
def __init__(self, text_or_uri: _str_argument_type, tag: _str_argument_type=...) -> None: ...
def __init__(self, text_or_uri: _str_argument_type, tag: _str_argument_type = ...) -> None: ...
_file_or_filename = Union[str, bytes, int, IO[Any]]
class ElementTree:
def __init__(self, element: Element=..., file: _file_or_filename=...) -> None: ...
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: _str_argument_type=...) -> Generator[Element, None, None]: ...
def getiterator(self, tag: _str_argument_type=...) -> List[Element]: ...
def find(self, path: _str_argument_type, namespaces: Dict[_str_argument_type, _str_argument_type]=...) -> Optional[Element]: ...
def findtext(self, path: _str_argument_type, default: _T=..., namespaces: Dict[_str_argument_type, _str_argument_type]=...) -> Union[_T, _str_result_type]: ...
def findall(self, path: _str_argument_type, namespaces: Dict[_str_argument_type, _str_argument_type]=...) -> List[Element]: ...
def iterfind(self, path: _str_argument_type, namespaces: Dict[_str_argument_type, _str_argument_type]=...) -> List[Element]: ...
def parse(self, source: _file_or_filename, parser: XMLParser = ...) -> Element: ...
def iter(self, tag: _str_argument_type = ...) -> Generator[Element, None, None]: ...
def getiterator(self, tag: _str_argument_type = ...) -> List[Element]: ...
def find(self, path: _str_argument_type, namespaces: Dict[_str_argument_type, _str_argument_type] = ...) -> Optional[Element]: ...
def findtext(self, path: _str_argument_type, default: _T = ..., namespaces: Dict[_str_argument_type, _str_argument_type] = ...) -> Union[_T, _str_result_type]: ...
def findall(self, path: _str_argument_type, namespaces: Dict[_str_argument_type, _str_argument_type] = ...) -> List[Element]: ...
def iterfind(self, path: _str_argument_type, namespaces: Dict[_str_argument_type, _str_argument_type] = ...) -> List[Element]: ...
if sys.version_info >= (3, 4):
def write(self, file_or_filename: _file_or_filename, encoding: str=..., xml_declaration: Optional[bool]=..., default_namespace: _str_argument_type=..., method: str=..., *, short_empty_elements: bool=...) -> None: ...
def write(self, file_or_filename: _file_or_filename, encoding: str = ..., xml_declaration: Optional[bool] = ..., default_namespace: _str_argument_type = ..., method: str = ..., *, short_empty_elements: bool = ...) -> None: ...
else:
def write(self, file_or_filename: _file_or_filename, encoding: str=..., xml_declaration: Optional[bool]=..., default_namespace: _str_argument_type=..., method: str=...) -> None: ...
def write(self, file_or_filename: _file_or_filename, encoding: str = ..., xml_declaration: Optional[bool] = ..., default_namespace: _str_argument_type = ..., method: 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, 4):
def tostring(element: Element, encoding: str=..., method: str=..., *, short_empty_elements: bool=...) -> _tostring_result_type: ...
def tostringlist(element: Element, encoding: str=..., method: str=..., *, short_empty_elements: bool=...) -> List[_tostring_result_type]: ...
def tostring(element: Element, encoding: str = ..., method: str = ..., *, short_empty_elements: bool = ...) -> _tostring_result_type: ...
def tostringlist(element: Element, encoding: str = ..., method: str = ..., *, short_empty_elements: bool = ...) -> List[_tostring_result_type]: ...
else:
def tostring(element: Element, encoding: str=..., method: str=...) -> _tostring_result_type: ...
def tostringlist(element: Element, encoding: str=..., method: str=...) -> List[_tostring_result_type]: ...
def tostring(element: Element, encoding: str = ..., method: str = ...) -> _tostring_result_type: ...
def tostringlist(element: Element, encoding: str = ..., method: str = ...) -> List[_tostring_result_type]: ...
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, Any]]: ...
def parse(source: _file_or_filename, parser: XMLParser = ...) -> ElementTree: ...
def iterparse(source: _file_or_filename, events: Sequence[str] = ..., parser: XMLParser = ...) -> Iterator[Tuple[str, Any]]: ...
if sys.version_info >= (3, 4):
class XMLPullParser:
def __init__(self, events: Sequence[str]=..., *, _parser: XMLParser=...) -> None: ...
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]]: ...
def XML(text: _parser_input_type, parser: XMLParser=...) -> Element: ...
def XMLID(text: _parser_input_type, parser: XMLParser=...) -> Tuple[Element, Dict[_str_result_type, Element]]: ...
def XML(text: _parser_input_type, parser: XMLParser = ...) -> Element: ...
def XMLID(text: _parser_input_type, parser: 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: XMLParser=...) -> Element: ...
def fromstringlist(sequence: Sequence[_parser_input_type], parser: 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
@@ -149,7 +149,7 @@ def fromstringlist(sequence: Sequence[_parser_input_type], parser: XMLParser=...
_ElementFactory = Callable[[Any, Dict[Any, Any]], Element]
class TreeBuilder:
def __init__(self, element_factory: _ElementFactory=...) -> None: ...
def __init__(self, element_factory: _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: ...
@@ -161,7 +161,7 @@ class XMLParser:
# TODO-what is entity used for???
entity = ... # type: Any
version = ... # type: str
def __init__(self, html: int=..., target: TreeBuilder=..., encoding: str=...) -> None: ...
def __init__(self, html: int = ..., target: TreeBuilder = ..., encoding: str = ...) -> None: ...
def doctype(self, name: str, pubid: str, system: str) -> None: ...
def close(self) -> Element: ...
def feed(self, data: _parser_input_type) -> None: ...

View File

@@ -10,8 +10,7 @@ def quoteattr(data: Text, entities: Mapping[Text, Text] = ...) -> Text: ...
class XMLGenerator(handler.ContentHandler):
if sys.version_info >= (3, 0):
def __init__(self, out=..., encoding=...,
short_empty_elements: bool=...) -> None: ...
def __init__(self, out=..., encoding=..., short_empty_elements: bool = ...) -> None: ...
else:
def __init__(self, out=..., encoding=...) -> None: ...
def startDocument(self): ...