Let xml.dom.minidom.parse() accept files. (#5005)

The documentation says, "The parse() function can take either a filename
or an open file object."
(https://docs.python.org/3.8/library/xml.dom.minidom.html). The function
was annotated as only accepting a str, so I added IO[Any].
This commit is contained in:
Rebecca Chen
2021-02-04 16:01:55 -08:00
committed by GitHub
parent a3b3f6845b
commit 2682c1d00a

View File

@@ -1,6 +1,6 @@
from typing import Any, Optional, Text, Union
from typing import IO, Any, Optional, Text, Union
from xml.sax.xmlreader import XMLReader
def parse(file: str, parser: Optional[XMLReader] = ..., bufsize: Optional[int] = ...): ...
def parse(file: Union[str, IO[Any]], parser: Optional[XMLReader] = ..., bufsize: Optional[int] = ...): ...
def parseString(string: Union[bytes, Text], parser: Optional[XMLReader] = ...): ...
def __getattr__(name: str) -> Any: ... # incomplete