@@ -145,8 +145,7 @@ Functions and classes provided:
145145
146146 @timeit()
147147 async def main():
148- # ... async code ...
149- ...
148+ ... # async code
150149
151150 When used as a decorator, a new generator instance is implicitly created on
152151 each function call. This allows the otherwise "one-shot" context managers
@@ -242,8 +241,7 @@ Functions and classes provided:
242241 # Do not ignore any exceptions, cm has no effect.
243242 cm = contextlib.nullcontext()
244243 with cm:
245- # Do something
246- ...
244+ ... # Do something
247245
248246 An example using *enter_result *::
249247
@@ -256,8 +254,7 @@ Functions and classes provided:
256254 cm = nullcontext(file_or_path)
257255
258256 with cm as file:
259- # Perform processing on the file
260- ...
257+ ... # Perform processing on the file
261258
262259 It can also be used as a stand-in for
263260 :ref: `asynchronous context managers <async-context-managers >`::
@@ -271,8 +268,7 @@ Functions and classes provided:
271268 cm = nullcontext(session)
272269
273270 async with cm as session:
274- # Send http requests with session
275- ...
271+ ... # Send http requests with session
276272
277273 .. versionadded :: 3.7
278274
@@ -442,15 +438,13 @@ Functions and classes provided:
442438
443439 def f():
444440 with cm():
445- # Do stuff
446- ...
441+ ... # Do stuff
447442
448443 ``ContextDecorator `` lets you instead write::
449444
450445 @cm()
451446 def f():
452- # Do stuff
453- ...
447+ ... # Do stuff
454448
455449 It makes it clear that the ``cm `` applies to the whole function, rather than
456450 just a piece of it (and saving an indentation level is nice, too).
@@ -712,12 +706,10 @@ protocol can be separated slightly in order to allow this::
712706 try:
713707 x = stack.enter_context(cm)
714708 except Exception:
715- # handle __enter__ exception
716- ...
709+ ... # handle __enter__ exception
717710 else:
718711 with stack:
719- # Handle normal case
720- ...
712+ ... # Handle normal case
721713
722714Actually needing to do this is likely to indicate that the underlying API
723715should be providing a direct resource management interface for use with
0 commit comments