Show More
@@ -489,6 +489,7 b' def test_extension():' | |||
|
489 | 489 | assert 'arq' not in _ip.user_ns |
|
490 | 490 | finally: |
|
491 | 491 | _ip.ipython_dir = orig_ipython_dir |
|
492 | tmpdir.cleanup() | |
|
492 | 493 | |
|
493 | 494 | def test_notebook_export_json(): |
|
494 | 495 | with TemporaryDirectory() as td: |
@@ -67,7 +67,8 b' class PickleShareDB(collections.MutableMapping):' | |||
|
67 | 67 | return self.cache[fil][0] |
|
68 | 68 | try: |
|
69 | 69 | # The cached item has expired, need to read |
|
70 |
|
|
|
70 | with fil.open("rb") as f: | |
|
71 | obj = pickle.loads(f.read()) | |
|
71 | 72 | except: |
|
72 | 73 | raise KeyError(key) |
|
73 | 74 | |
@@ -82,7 +83,8 b' class PickleShareDB(collections.MutableMapping):' | |||
|
82 | 83 | parent.makedirs() |
|
83 | 84 | # We specify protocol 2, so that we can mostly go between Python 2 |
|
84 | 85 | # and Python 3. We can upgrade to protocol 3 when Python 2 is obsolete. |
|
85 | pickled = pickle.dump(value,fil.open('wb'), protocol=2) | |
|
86 | with fil.open('wb') as f: | |
|
87 | pickled = pickle.dump(value, f, protocol=2) | |
|
86 | 88 | try: |
|
87 | 89 | self.cache[fil] = (value,fil.mtime) |
|
88 | 90 | except OSError as e: |
@@ -73,7 +73,8 b' if sys.version_info[0] >= 3:' | |||
|
73 | 73 | |
|
74 | 74 | def execfile(fname, glob, loc=None): |
|
75 | 75 | loc = loc if (loc is not None) else glob |
|
76 | exec compile(open(fname, 'rb').read(), fname, 'exec') in glob, loc | |
|
76 | with open(fname, 'rb') as f: | |
|
77 | exec compile(f.read(), fname, 'exec') in glob, loc | |
|
77 | 78 | |
|
78 | 79 | # Refactor print statements in doctests. |
|
79 | 80 | _print_statement_re = re.compile(r"\bprint (?P<expr>.*)$", re.MULTILINE) |
General Comments 0
You need to be logged in to leave comments.
Login now