mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-09 05:24:52 +08:00
16 lines
343 B
Python
16 lines
343 B
Python
# Stubs for contextlib
|
|
|
|
# NOTE: These are incomplete!
|
|
|
|
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: ...
|