##// END OF EJS Templates
Merge pull request #10562 from ipython/auto-backport-of-pr-10558...
Thomas Kluyver -
r23654:b9171aac merge
parent child Browse files
Show More
@@ -2535,13 +2535,12 b' class InteractiveShell(SingletonConfigurable):'
2535 """generator for sequence of code blocks to run"""
2535 """generator for sequence of code blocks to run"""
2536 if fname.endswith('.ipynb'):
2536 if fname.endswith('.ipynb'):
2537 from nbformat import read
2537 from nbformat import read
2538 with io_open(fname) as f:
2538 nb = read(fname, as_version=4)
2539 nb = read(f, as_version=4)
2539 if not nb.cells:
2540 if not nb.cells:
2540 return
2541 return
2541 for cell in nb.cells:
2542 for cell in nb.cells:
2542 if cell.cell_type == 'code':
2543 if cell.cell_type == 'code':
2543 yield cell.source
2544 yield cell.source
2545 else:
2544 else:
2546 with open(fname) as f:
2545 with open(fname) as f:
2547 yield f.read()
2546 yield f.read()
General Comments 0
You need to be logged in to leave comments. Login now