[issue30359] A standard convention for annotating a function as returning an (async) context manager?

2017-05-19 Thread Ivan Levkivskyi
Ivan Levkivskyi added the comment: Or you can use typing.ContextManager[ret_type] if you like generics (typing.AsyncContextManager will be also added soon). Also this recent discussion seems relevant https://github.com/python/peps/pull/242 and the corresponding thread on python-dev:

[issue30359] A standard convention for annotating a function as returning an (async) context manager?

2017-05-12 Thread Nick Coghlan
Nick Coghlan added the comment: Given that we have contextlib.AbstractContextManager now, perhaps it should just set "f.__annotations__['return'] = AbstractContextManager"? (assuming no other return annotation is already set) -- ___ Python tracker

[issue30359] A standard convention for annotating a function as returning an (async) context manager?

2017-05-12 Thread Barry A. Warsaw
Changes by Barry A. Warsaw : -- nosy: +barry ___ Python tracker ___ ___ Python-bugs-list

[issue30359] A standard convention for annotating a function as returning an (async) context manager?

2017-05-12 Thread Nathaniel Smith
New submission from Nathaniel Smith: sphinxcontrib-trio [1] does a few things; one of them is to enhance sphinx's autodoc support by trying to sniff out the types of functions so that it can automatically determine that something is, say, a generator, or an async classmethod. This runs into