Add 'closing' to 2.7 contextlib stubs (same as for 3).

This commit is contained in:
Guido van Rossum
2015-11-24 21:08:02 -08:00
parent d3efa5d6bc
commit bbbccf61dc

View File

@@ -2,7 +2,14 @@
# NOTE: These are incomplete!
from typing import Any
from typing import Any, TypeVar, Generic
# TODO more precise type?
def contextmanager(func: Any) -> Any: ...
_T = TypeVar('_T')
class closing(Generic[_T]):
def __init__(self, thing: _T) -> None: ...
def __enter__(self) -> _T: ...
def __exit__(self, *exc_info) -> None: ...