Show More
@@ -11,6 +11,7 b'' | |||
|
11 | 11 | import re |
|
12 | 12 | import shlex |
|
13 | 13 | import sys |
|
14 | from Pathlib import Path | |
|
14 | 15 | |
|
15 | 16 | from pathlib import Path |
|
16 | 17 | from IPython.core.magic import Magics, magics_class, line_magic |
@@ -14,6 +14,7 b' import sys' | |||
|
14 | 14 | import tempfile |
|
15 | 15 | import warnings |
|
16 | 16 | from warnings import warn |
|
17 | from pathlib import Path | |
|
17 | 18 | |
|
18 | 19 | from IPython.utils.decorators import undoc |
|
19 | 20 | from .capture import CapturedIO, capture_output |
@@ -204,8 +205,8 b" def temp_pyfile(src, ext='.py'):" | |||
|
204 | 205 | (filename, open filehandle) |
|
205 | 206 | It is the caller's responsibility to close the open file and unlink it. |
|
206 | 207 | """ |
|
207 | fname = tempfile.mkstemp(ext)[1] | |
|
208 |
with open( |
|
|
208 | fname = Path(tempfile.mkstemp(ext)[1]) | |
|
209 | with fname.open('w') as f: | |
|
209 | 210 | f.write(src) |
|
210 | 211 | f.flush() |
|
211 | 212 | return fname |
@@ -9,7 +9,7 b'' | |||
|
9 | 9 | # |
|
10 | 10 | # The original mapping of latex symbols to unicode comes from the `latex_symbols.jl` files from Julia. |
|
11 | 11 | |
|
12 | import os, sys | |
|
12 | from pathlib import Path | |
|
13 | 13 | |
|
14 | 14 | # Import the Julia LaTeX symbols |
|
15 | 15 | print('Importing latex_symbols.js from Julia...') |
@@ -80,9 +80,8 b' s += """' | |||
|
80 | 80 | reverse_latex_symbol = { v:k for k,v in latex_symbols.items()} |
|
81 | 81 | """ |
|
82 | 82 | |
|
83 |
fn = |
|
|
84 | print("Writing the file: %s" % fn) | |
|
85 |
|
|
|
86 | f.write(s) | |
|
83 | fn = Path('..', 'IPython', 'core', 'latex_symbols.py') | |
|
84 | print("Writing the file: %s" % str(fn)) | |
|
85 | fn.write_text(s, encoding='utf-8') | |
|
87 | 86 | |
|
88 | 87 |
General Comments 0
You need to be logged in to leave comments.
Login now