@@ -54,6 +54,7 @@ _XPathObject = Union[
5454 ]
5555 ],
5656]
57+ _AnyParser = Union ["XMLParser" , "HTMLParser" ]
5758_ListAnyStr = Union [List [str ], List [bytes ]]
5859_DictAnyStr = Union [Dict [str , str ], Dict [bytes , bytes ]]
5960_Dict_Tuple2AnyStr_Any = Union [Dict [Tuple [str , str ], Any ], Tuple [bytes , bytes ], Any ]
@@ -222,7 +223,7 @@ class _Element(Iterable["_Element"], Sized):
222223class ElementBase (_Element ): ...
223224
224225class _ElementTree :
225- parser = ... # type: XMLParser
226+ parser = ... # type: _AnyParser
226227 docinfo = ... # type: DocInfo
227228 def find (
228229 self , path : str , namespaces : Optional [_NSMapArg ] = ...
@@ -244,7 +245,7 @@ class _ElementTree:
244245 def parse (
245246 self ,
246247 source : _FileSource ,
247- parser : Optional [XMLParser ] = ...,
248+ parser : Optional [_AnyParser ] = ...,
248249 base_url : Optional [_AnyStr ] = ...,
249250 ) -> _Element : ...
250251 def write (
@@ -475,7 +476,7 @@ def SubElement(
475476def ElementTree (
476477 element : _Element = ...,
477478 file : _FileSource = ...,
478- parser : XMLParser = ...,
479+ parser : _AnyParser = ...,
479480) -> _ElementTree : ...
480481def ProcessingInstruction (
481482 target : _AnyStr , text : _AnyStr = ...
@@ -500,7 +501,7 @@ def cleanup_namespaces(
500501) -> None : ...
501502def parse (
502503 source : _FileSource ,
503- parser : Union [ XMLParser , HTMLParser ] = ...,
504+ parser : _AnyParser = ...,
504505 base_url : _AnyStr = ...,
505506) -> Union [_ElementTree , Any ]: ...
506507@overload
@@ -513,7 +514,7 @@ def fromstring(
513514@overload
514515def fromstring (
515516 text : _AnyStr ,
516- parser : Union [ XMLParser , HTMLParser ] = ...,
517+ parser : _AnyParser = ...,
517518 * ,
518519 base_url : _AnyStr = ...,
519520) -> Union [_Element , Any ]: ...
0 commit comments