Skip to content

Commit

Permalink
quickfix for edge case when used as a library
Browse files Browse the repository at this point in the history
  • Loading branch information
bryanvaz committed Oct 18, 2024
1 parent 1ef9db6 commit 4dfb47f
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 4 deletions.
2 changes: 1 addition & 1 deletion papermill/clientwrap.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ def __init__(self, nb_man, km=None, log_cell=None, raise_on_iopub_timeout=True,
"""
super().__init__(nb_man.nb, km=km, raise_on_iopub_timeout=raise_on_iopub_timeout, **kw)
self.nb_man = nb_man
self.log_cell = log_cell if log_cell is not None else kw['log']
self.log_cell = log_cell if log_cell is not None else self.log

def execute(self, **kwargs):
"""
Expand Down
4 changes: 2 additions & 2 deletions papermill/log.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
not auto insert newline characters.
"""

class CustomStreamHandler(logging.StreamHandler):
class NbOutputStreamHandler(logging.StreamHandler):
def emit(self, record):
try:
msg = self.format(record)
Expand All @@ -23,7 +23,7 @@ def emit(self, record):

def _reconfigure_notebook_logger(l: logging.Logger):
l.handlers = []
custom_handler = CustomStreamHandler()
custom_handler = NbOutputStreamHandler()
l.addHandler(custom_handler)
formatter = logging.Formatter('%(message)s')
custom_handler.setFormatter(formatter)
Expand Down
1 change: 0 additions & 1 deletion papermill/tests/test_clientwrap.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import unittest
from unittest.mock import call, patch
import logging

import nbformat

Expand Down

0 comments on commit 4dfb47f

Please sign in to comment.