|
24 | 24 | from IPython import get_ipython
|
25 | 25 | from IPython.core.profiledir import ProfileDir, ProfileDirError
|
26 | 26 | from IPython.paths import get_ipython_dir
|
| 27 | +from jupyter_client import session |
27 | 28 | from jupyter_client.localinterfaces import is_public_ip, localhost, public_ips
|
28 | 29 | from tornado.ioloop import IOLoop
|
29 | 30 | from traitlets.log import get_logger
|
@@ -599,21 +600,13 @@ def _v(version_s):
|
599 | 600 | return tuple(int(s) for s in re.findall(r"\d+", version_s))
|
600 | 601 |
|
601 | 602 |
|
602 |
| -def _patch_jupyter_client_dates(): |
603 |
| - """Monkeypatch jupyter_client.extract_dates to be nondestructive wrt timezone info""" |
604 |
| - import jupyter_client |
605 |
| - |
606 |
| - if _v(jupyter_client.__version__) < _v('5.0'): |
607 |
| - from jupyter_client import session |
608 |
| - |
609 |
| - if hasattr(session, '_save_extract_dates'): |
610 |
| - return |
611 |
| - session._save_extract_dates = session.extract_dates |
612 |
| - session.extract_dates = extract_dates |
613 |
| - |
| 603 | +@lru_cache() |
| 604 | +def _disable_session_extract_dates(): |
| 605 | + """Monkeypatch jupyter_client.extract_dates to be a no-op |
614 | 606 |
|
615 |
| -# FIXME: remove patch when we require jupyter_client 5.0 |
616 |
| -_patch_jupyter_client_dates() |
| 607 | + avoids performance problem parsing unused timestamp strings |
| 608 | + """ |
| 609 | + session.extract_dates = lambda obj: obj |
617 | 610 |
|
618 | 611 |
|
619 | 612 | def progress(*args, widget=None, **kwargs):
|
|
0 commit comments