Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use pathlib in magics module's execution.py #12619

Merged
merged 3 commits into from
Oct 13, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
20 changes: 13 additions & 7 deletions IPython/core/magics/execution.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
from IPython.utils.timing import clock, clock2
from warnings import warn
from logging import error
from pathlib import Path
from io import StringIO
from pathlib import Path

Expand Down Expand Up @@ -360,17 +361,22 @@ def _run_with_profiler(self, code, opts, namespace):
text_file = opts.T[0]
if dump_file:
prof.dump_stats(dump_file)
print('\n*** Profile stats marshalled to file',\
repr(dump_file)+'.',sys_exit)
print(
f"\n*** Profile stats marshalled to file {repr(dump_file)}.{sys_exit}"
)
if text_file:
Path(text_file).write_text(output)
print('\n*** Profile printout saved to text file',\
repr(text_file)+'.',sys_exit)
pfile = Path(text_file)
pfile.touch(exist_ok=True)
pfile.write_text(output)

print(
f"\n*** Profile printout saved to text file {repr(text_file)}.{sys_exit}"
)

if 'r' in opts:
return stats
else:
return None

return None

@line_magic
def pdb(self, parameter_s=''):
Expand Down