Tom Gringauz
a117167d8d
bpo-41543: contextlib.nullcontext can fill in for an async context manager (GH-21870)
...
Co-authored-by: Andrew Svetlov <andrew.svetlov@gmail.com >
2020-11-09 14:34:07 +02:00
kj
133aa2d581
[docs] fix wrongly named AsyncContextDecorator (GH-23164)
...
Also added versionchanged.
2020-11-05 18:16:27 +02:00
Kazantcev Andrey
178695b7ae
bpo-40816 Add AsyncContextDecorator class (GH-20516)
...
Co-authored-by: Yury Selivanov <yury@edgedb.com >
2020-11-05 10:52:24 +02:00
Joongi Kim
6e8dcdaaa4
bpo-41229: Update docs for explicit aclose()-required cases and add contextlib.aclosing() method (GH-21545)
...
This is a PR to:
* Add `contextlib.aclosing` which ia analogous to `contextlib.closing` but for async-generators with an explicit test case for [bpo-41229]()
* Update the docs to describe when we need explicit `aclose()` invocation.
which are motivated by the following issues, articles, and examples:
* [bpo-41229]()
* https://github.com/njsmith/async_generator
* https://vorpus.org/blog/some-thoughts-on-asynchronous-api-design-in-a-post-asyncawait-world/#cleanup-in-generators-and-async-generators
* https://www.python.org/dev/peps/pep-0533/
* https://github.com/achimnol/aiotools/blob/ef7bf0cea7af/src/aiotools/context.py#L152
Particuarly regarding [PEP-533](https://www.python.org/dev/peps/pep-0533/ ), its acceptance (`__aiterclose__()`) would make this little addition of `contextlib.aclosing()` unnecessary for most use cases, but until then this could serve as a good counterpart and analogy to `contextlib.closing()`. The same applies for `contextlib.closing` with `__iterclose__()`.
Also, still there are other use cases, e.g., when working with non-generator objects with `aclose()` methods.
2020-11-02 00:02:48 -08:00
Serhiy Storchaka
142566c028
[3.9] bpo-37116: Use PEP 570 syntax for positional-only parameters. (GH-12620)
...
Turn deprecation warnings added in 3.8 into TypeError.
2019-06-05 18:22:31 +03:00
Serhiy Storchaka
2085bd0877
bpo-37116: Use PEP 570 syntax for positional-only parameters. (GH-13700)
2019-06-01 11:00:15 +03:00
Serhiy Storchaka
2b57c43f21
bpo-35506: Remove redundant and incorrect links from keywords. (GH-11174)
2018-12-19 08:09:46 +02:00
Nathaniel J. Smith
a3c88ef12c
Clarify that AsyncExitStack works with coroutine functions (GH-9405)
...
The docs were ambiguous about whether you pass in a coroutine function
or a coroutine object, e.g. is it:
aestack.push_async_exit(some_async_func)
or
aestack.push_async_exit(some_async_func())
(It's the first one.)
2018-09-18 14:27:59 -07:00
Alexander Vasin
416cbce22d
Fixed typo with asynccontextmanager code example (GH-8845)
...
`yield conn`, instead of just `yield`.
2018-08-24 19:38:11 -07:00
Matthias Bussonnier
bde782bb59
bpo-33468: Add try-finally contextlib.contextmanager example (GH-7816)
2018-07-24 00:10:56 +03:00
Daniel Porteous
c287545d62
bpo-34067: Include a more easily understood example for nullcontext (GH-8158)
...
Include a more easily understood example for nullcontext
2018-07-09 23:49:29 +10:00
Ilya Kulakov
1aa094f740
bpo-29302: Implement contextlib.AsyncExitStack. ( #4790 )
2018-01-25 15:51:18 -05:00
Jelle Zijlstra
176baa326b
bpo-30241: implement contextlib.AbstractAsyncContextManager ( #1412 )
2017-12-13 20:19:17 -05:00
Jesse-Bakker
0784a2e5b1
bpo-10049: Add a "no-op" (null) context manager to contextlib (GH-4464)
...
Adds a simpler and faster alternative to ExitStack for handling
single optional context managers without having to change the
lexical structure of your code.
2017-11-23 10:23:28 +10:00
Jelle Zijlstra
2e624690bd
bpo-29679: Implement @contextlib.asynccontextmanager ( #360 )
2017-04-30 18:25:58 -07:00
Vinay Sajip
dd917f84e3
Closes #27904 : Improved logging statements to defer formatting until needed.
2016-08-31 08:22:29 +01:00
Brett Cannon
516f5461b0
Add a missing :term:.
2016-06-09 15:55:52 -07:00
Serhiy Storchaka
c499f30286
Issue #23921 : Standardized documentation whitespace formatting.
...
Original patch by James Edwards.
2016-05-10 12:01:56 +03:00
Serhiy Storchaka
dba903993a
Issue #23921 : Standardized documentation whitespace formatting.
...
Original patch by James Edwards.
2016-05-10 12:01:23 +03:00
Brett Cannon
9e080e0e74
Issue #25609 : Introduce contextlib.AbstractContextManager and
...
typing.ContextManager.
2016-04-08 12:15:27 -07:00
Serhiy Storchaka
e4ba872543
Remove redundant leading zeroes in PEP references.
2016-03-31 15:30:54 +03:00
Serhiy Storchaka
a84f6c3dd3
Issue #25523 : Merge a-to-an corrections from 3.4.
2015-11-02 14:39:05 +02:00
Serhiy Storchaka
d65c9496da
Issue #25523 : Further a-to-an corrections.
2015-11-02 14:10:23 +02:00
Martin Panter
84835ab1cb
Issue #25161 : Merge full stops from 3.4 into 3.5
2015-10-10 10:44:25 +00:00
Martin Panter
d21e0b52f1
Issue #25161 : Add full stops in documentation; patch by Takase Arihiro
2015-10-10 10:36:22 +00:00