Show More
@@ -14,7 +14,6 b' import sys' | |||||
14 | import tempfile |
|
14 | import tempfile | |
15 | import warnings |
|
15 | import warnings | |
16 | from warnings import warn |
|
16 | from warnings import warn | |
17 | from pathlib import Path |
|
|||
18 |
|
17 | |||
19 | from IPython.utils.decorators import undoc |
|
18 | from IPython.utils.decorators import undoc | |
20 | from .capture import CapturedIO, capture_output |
|
19 | from .capture import CapturedIO, capture_output | |
@@ -205,11 +204,11 b" def temp_pyfile(src, ext='.py'):" | |||||
205 | (filename, open filehandle) |
|
204 | (filename, open filehandle) | |
206 | It is the caller's responsibility to close the open file and unlink it. |
|
205 | It is the caller's responsibility to close the open file and unlink it. | |
207 | """ |
|
206 | """ | |
208 |
fname = |
|
207 | fname = tempfile.mkstemp(ext)[1] | |
209 |
with |
|
208 | with open(fname,'w') as f: | |
210 | f.write(src) |
|
209 | f.write(src) | |
211 | f.flush() |
|
210 | f.flush() | |
212 |
return |
|
211 | return fname | |
213 |
|
212 | |||
214 | @undoc |
|
213 | @undoc | |
215 | def atomic_writing(*args, **kwargs): |
|
214 | def atomic_writing(*args, **kwargs): |
General Comments 0
You need to be logged in to leave comments.
Login now