mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-06 20:24:30 +08:00
Relax type of xml.etree.ElementTree.XMLParser target argument (#4538)
The target argument can be an arbitrary object. If it has certain methods, they are used by XMLParser, missing methods are ignored. Ideally, we'd be able to type the potentially missing methods correctly, but currently the type system is unable to do so. Fixes #4537
This commit is contained in:
@@ -363,14 +363,14 @@ if sys.version_info >= (3, 8):
|
||||
|
||||
class XMLParser:
|
||||
parser: Any
|
||||
target: TreeBuilder
|
||||
target: Any
|
||||
# TODO-what is entity used for???
|
||||
entity: Any
|
||||
version: str
|
||||
if sys.version_info >= (3, 8):
|
||||
def __init__(self, *, target: Optional[TreeBuilder] = ..., encoding: Optional[str] = ...) -> None: ...
|
||||
def __init__(self, *, target: Any = ..., encoding: Optional[str] = ...) -> None: ...
|
||||
else:
|
||||
def __init__(self, html: int = ..., target: Optional[TreeBuilder] = ..., encoding: Optional[str] = ...) -> None: ...
|
||||
def __init__(self, html: int = ..., target: Any = ..., encoding: Optional[str] = ...) -> None: ...
|
||||
def doctype(self, __name: str, __pubid: str, __system: str) -> None: ...
|
||||
def close(self) -> Element: ...
|
||||
def close(self) -> Any: ...
|
||||
def feed(self, __data: _parser_input_type) -> None: ...
|
||||
|
||||
Reference in New Issue
Block a user