From 5c27ca2348b8a6afc311a8b3b4fd0a8986aeb163 Mon Sep 17 00:00:00 2001 From: David Date: Mon, 31 Aug 2015 07:36:04 +0200 Subject: [PATCH] Add stub for contextlib.closing --- stdlib/3/contextlib.pyi | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/stdlib/3/contextlib.pyi b/stdlib/3/contextlib.pyi index cebbfb132..af9f0ab2a 100644 --- a/stdlib/3/contextlib.pyi +++ b/stdlib/3/contextlib.pyi @@ -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: ...