diff --git a/jupyter_server_proxy/config.py b/jupyter_server_proxy/config.py index 65ff88be..649e9a04 100644 --- a/jupyter_server_proxy/config.py +++ b/jupyter_server_proxy/config.py @@ -12,19 +12,12 @@ from importlib.metadata import entry_points from jupyter_server.utils import url_path_join as ujoin -from traitlets import Dict, List, Tuple, Union, default, observe +from traitlets import Callable, Dict, List, Tuple, Union, default, observe from traitlets.config import Configurable from .handlers import AddSlashHandler, NamedLocalProxyHandler, SuperviseAndProxyHandler from .rawsocket import RawSocketHandler, SuperviseAndRawSocketHandler -try: - # Traitlets >= 4.3.3 - from traitlets import Callable -except ImportError: - from .utils import Callable - - LauncherEntry = namedtuple( "LauncherEntry", ["enabled", "icon_path", "title", "path_info", "category"] ) diff --git a/jupyter_server_proxy/utils.py b/jupyter_server_proxy/utils.py index e3ea7bea..ce4d6e28 100644 --- a/jupyter_server_proxy/utils.py +++ b/jupyter_server_proxy/utils.py @@ -1,6 +1,3 @@ -from traitlets import TraitType - - def call_with_asked_args(callback, args): """ Call callback with only the args it wants from args @@ -31,21 +28,3 @@ def call_with_asked_args(callback, args): ) ) return callback(*asked_arg_values) - - -# copy-pasted from the ipython/traitlets source code, see -# https://github.com/ipython/traitlets/blob/a1425327460c4a3ae970aeaef17e0c22da4c53c6/traitlets/traitlets.py#L3232-L3246 -class Callable(TraitType): - """A trait which is callable. - Notes - ----- - Classes are callable, as are instances - with a __call__() method.""" - - info_text = "a callable" - - def validate(self, obj, value): - if callable(value): - return value - else: - self.error(obj, value)