diff --git a/jupyterlab/jupyterlab_jupytext/__init__.py b/jupyterlab/jupyterlab_jupytext/__init__.py index 7b0ae4cf..d7e8b475 100644 --- a/jupyterlab/jupyterlab_jupytext/__init__.py +++ b/jupyterlab/jupyterlab_jupytext/__init__.py @@ -1,8 +1,6 @@ """Jupyter server and lab extension entry points""" -import inspect - -import jupyter_server +import asyncio from jupytext.reraise import reraise @@ -26,26 +24,20 @@ def load_jupyter_server_extension(app): # pragma: no cover # Get a list of all base classes and check if they contain AsyncContentsManager base_class = app.contents_manager_class - parent_classes = inspect.getmro(base_class) - for parent_class in parent_classes: - if ( - parent_class - == jupyter_server.services.contents.manager.AsyncContentsManager - ): - app.log.warning( - "[Jupytext Server Extension] Async contents managers like {} " - "are not supported at the moment " - "(https://github.com/mwouts/jupytext/issues/1020). " - "We will derive a contents manager from LargeFileManager instead.".format( - parent_class.__name__ - ) - ) - from jupyter_server.services.contents.largefilemanager import ( # noqa - LargeFileManager, + if asyncio.iscoroutinefunction(base_class.get): + app.log.warning( + "[Jupytext Server Extension] Async contents managers like {} " + "are not supported at the moment " + "(https://github.com/mwouts/jupytext/issues/1020). " + "We will derive a contents manager from LargeFileManager instead.".format( + base_class.__name__ ) + ) + from jupyter_server.services.contents.largefilemanager import ( # noqa + LargeFileManager, + ) - base_class = LargeFileManager - break + base_class = LargeFileManager app.log.info( "[Jupytext Server Extension] Deriving a JupytextContentsManager "