From 2682c1d00ab5065098c5deaae7007743b17ae867 Mon Sep 17 00:00:00 2001 From: Rebecca Chen Date: Thu, 4 Feb 2021 16:01:55 -0800 Subject: [PATCH] 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]. --- stdlib/xml/dom/minidom.pyi | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/stdlib/xml/dom/minidom.pyi b/stdlib/xml/dom/minidom.pyi index 7a6eb192b..dc128e016 100644 --- a/stdlib/xml/dom/minidom.pyi +++ b/stdlib/xml/dom/minidom.pyi @@ -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