Skip to content

Commit a82efbe

Browse files
committed
refactor: use get_ipython_execution_count in execution_history
1 parent 430de34 commit a82efbe

1 file changed

Lines changed: 9 additions & 13 deletions

File tree

packages/bigframes/bigframes/session/__init__.py

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -524,19 +524,15 @@ def execution_history(
524524
]
525525

526526
elif not all_cells:
527-
try:
528-
import IPython
529-
530-
ipy = IPython.get_ipython()
531-
if ipy is not None and hasattr(ipy, "execution_count"):
532-
current_count = ipy.execution_count
533-
jobs = [
534-
job
535-
for job in jobs
536-
if job.get("cell_execution_count") == current_count
537-
]
538-
except (ImportError, NameError):
539-
pass
527+
from bigframes.core.utils import get_ipython_execution_count
528+
529+
current_count = get_ipython_execution_count()
530+
if current_count is not None:
531+
jobs = [
532+
job
533+
for job in jobs
534+
if job.get("cell_execution_count") == current_count
535+
]
540536

541537
return _ExecutionHistory(jobs)
542538

0 commit comments

Comments
 (0)