Browse code
Update registry.py
Showing 1 changed files
... | ... |
@@ -5,8 +5,11 @@ class CallableGeneratorContextManager(contextlib.GeneratorContextManager): |
5 | 5 |
def __call__(self, *a, **kw): |
6 | 6 |
with self as obj: |
7 | 7 |
return obj(*a, **kw) |
8 |
-def contextmanager(func): |
|
9 |
- """@contextmanager decorator. |
|
8 |
+try: |
|
9 |
+ from contextlib import contextmanager |
|
10 |
+except: |
|
11 |
+ def contextmanager(func): |
|
12 |
+ """@contextmanager decorator. |
|
10 | 13 |
|
11 | 14 |
Typical usage: |
12 | 15 |
|