Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(1)

Side by Side Diff: Lib/contextlib.py

Issue 10639: reindent.py converts newlines to platform default
Patch Set: Created 8 years, 8 months ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « Lib/concurrent/futures/process.py ('k') | Lib/copy.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 """Utilities for with-statement contexts. See PEP 343.""" 1 """Utilities for with-statement contexts. See PEP 343."""
2 2
3 import sys 3 import sys
4 from functools import wraps 4 from functools import wraps
5 from warnings import warn
5 6
6 __all__ = ["contextmanager", "closing", "ContextDecorator"] 7 __all__ = ["contextmanager", "closing", "ContextDecorator"]
7 8
8 9
9 class ContextDecorator(object): 10 class ContextDecorator(object):
10 "A base class or mixin that enables context managers to work as decorators." 11 "A base class or mixin that enables context managers to work as decorators."
11 12
12 def _recreate_cm(self): 13 def _recreate_cm(self):
13 """Return a recreated instance of self. 14 """Return a recreated instance of self.
14 15
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
131 finally: 132 finally:
132 f.close() 133 f.close()
133 134
134 """ 135 """
135 def __init__(self, thing): 136 def __init__(self, thing):
136 self.thing = thing 137 self.thing = thing
137 def __enter__(self): 138 def __enter__(self):
138 return self.thing 139 return self.thing
139 def __exit__(self, *exc_info): 140 def __exit__(self, *exc_info):
140 self.thing.close() 141 self.thing.close()
OLDNEW
« no previous file with comments | « Lib/concurrent/futures/process.py ('k') | Lib/copy.py » ('j') | no next file with comments »

RSS Feeds Recent Issues | This issue
This is Rietveld 894c83f36cb7+