update packages
This commit is contained in:
@@ -158,14 +158,14 @@ file to save the graphics to.")
|
||||
|
||||
(defconst org-babel-python--def-format-value "\
|
||||
def __org_babel_python_format_value(result, result_file, result_params):
|
||||
with open(result_file, 'w') as f:
|
||||
with open(result_file, 'w') as __org_babel_python_tmpfile:
|
||||
if 'graphics' in result_params:
|
||||
result.savefig(result_file)
|
||||
elif 'pp' in result_params:
|
||||
import pprint
|
||||
f.write(pprint.pformat(result))
|
||||
__org_babel_python_tmpfile.write(pprint.pformat(result))
|
||||
elif 'list' in result_params and isinstance(result, dict):
|
||||
f.write(str(['{} :: {}'.format(k, v) for k, v in result.items()]))
|
||||
__org_babel_python_tmpfile.write(str(['{} :: {}'.format(k, v) for k, v in result.items()]))
|
||||
else:
|
||||
if not set(result_params).intersection(\
|
||||
['scalar', 'verbatim', 'raw']):
|
||||
@@ -198,7 +198,7 @@ def __org_babel_python_format_value(result, result_file, result_params):
|
||||
result = result.tolist()
|
||||
else:
|
||||
result = repr(result)
|
||||
f.write(str(result))"
|
||||
__org_babel_python_tmpfile.write(str(result))"
|
||||
"Python function to format value result and save it to file.")
|
||||
|
||||
(defun org-babel-variable-assignments:python (params)
|
||||
@@ -495,8 +495,8 @@ non-nil, then save graphical results to that file instead."
|
||||
(pcase result-type
|
||||
(`output
|
||||
(let ((body (format "\
|
||||
with open('%s') as f:
|
||||
exec(compile(f.read(), f.name, 'exec'))"
|
||||
with open('%s') as __org_babel_python_tmpfile:
|
||||
exec(compile(__org_babel_python_tmpfile.read(), __org_babel_python_tmpfile.name, 'exec'))"
|
||||
(org-babel-process-file-name
|
||||
tmp-src-file 'noquote))))
|
||||
(org-babel-python-send-string session body)))
|
||||
|
||||
Reference in New Issue
Block a user