Files
typeshed/stdlib
nimin98 20d9fcf858 Support callable contextmanagers in contextlib (#1152)
mypy could not recognize the case when we use contextmanager as a
decorator, which has been supported since Python 3.2.

In the following code snippet,

from contextlib import contextmanager

@contextmanager
def foo(arg1):
    try:
        print(arg1)
        print('1')
        yield
    finally:
        print('2')

@foo('0')
def foo2():
    print('3')

foo2()

we get mypy error as follows,
error: ContextManager[Any] not callable

The suggested changes can fix this error and properly reflect the
updated contextmanager usage pattern.
2017-04-11 14:51:03 -07:00
..
2017-04-09 19:27:25 -07:00
2017-04-09 19:27:25 -07:00
2017-04-05 08:22:28 -07:00
2017-03-20 20:07:58 -07:00