Use _typeshed.Self with __enter__ (#5723)

Co-authored-by: Sebastian Rittau <srittau@rittau.biz>
Co-authored-by: Akuli <akuviljanen17@gmail.com>
This commit is contained in:
Anton Grübel
2021-07-04 20:10:01 +02:00
committed by GitHub
parent 1a131a489e
commit d68701c0ec
10 changed files with 32 additions and 22 deletions

View File

@@ -1,11 +1,10 @@
import sys
import xml.dom
from typing import IO, Any, Optional, TypeVar, Union
from _typeshed import Self
from typing import IO, Any, Optional, Union
from xml.dom.xmlbuilder import DocumentLS, DOMImplementationLS
from xml.sax.xmlreader import XMLReader
_T = TypeVar("_T")
def parse(file: Union[str, IO[Any]], parser: Optional[XMLReader] = ..., bufsize: Optional[int] = ...): ...
def parseString(string: Union[str, bytes], parser: Optional[XMLReader] = ...): ...
def getDOMImplementation(features=...): ...
@@ -39,7 +38,7 @@ class Node(xml.dom.Node):
def setUserData(self, key, data, handler): ...
childNodes: Any
def unlink(self) -> None: ...
def __enter__(self: _T) -> _T: ...
def __enter__(self: Self) -> Self: ...
def __exit__(self, et, ev, tb) -> None: ...
class DocumentFragment(Node):