Skip to content

Commit 11fcf89

Browse files
authored
Merge pull request #506 from manics/remove-callable
Remove utils.Callable
2 parents 3d0eac5 + a340983 commit 11fcf89

File tree

2 files changed

+1
-29
lines changed

2 files changed

+1
-29
lines changed

jupyter_server_proxy/config.py

+1-8
Original file line numberDiff line numberDiff line change
@@ -12,19 +12,12 @@
1212
from importlib.metadata import entry_points
1313

1414
from jupyter_server.utils import url_path_join as ujoin
15-
from traitlets import Dict, List, Tuple, Union, default, observe
15+
from traitlets import Callable, Dict, List, Tuple, Union, default, observe
1616
from traitlets.config import Configurable
1717

1818
from .handlers import AddSlashHandler, NamedLocalProxyHandler, SuperviseAndProxyHandler
1919
from .rawsocket import RawSocketHandler, SuperviseAndRawSocketHandler
2020

21-
try:
22-
# Traitlets >= 4.3.3
23-
from traitlets import Callable
24-
except ImportError:
25-
from .utils import Callable
26-
27-
2821
LauncherEntry = namedtuple(
2922
"LauncherEntry", ["enabled", "icon_path", "title", "path_info", "category"]
3023
)

jupyter_server_proxy/utils.py

-21
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
from traitlets import TraitType
2-
3-
41
def call_with_asked_args(callback, args):
52
"""
63
Call callback with only the args it wants from args
@@ -31,21 +28,3 @@ def call_with_asked_args(callback, args):
3128
)
3229
)
3330
return callback(*asked_arg_values)
34-
35-
36-
# copy-pasted from the ipython/traitlets source code, see
37-
# https://github.com/ipython/traitlets/blob/a1425327460c4a3ae970aeaef17e0c22da4c53c6/traitlets/traitlets.py#L3232-L3246
38-
class Callable(TraitType):
39-
"""A trait which is callable.
40-
Notes
41-
-----
42-
Classes are callable, as are instances
43-
with a __call__() method."""
44-
45-
info_text = "a callable"
46-
47-
def validate(self, obj, value):
48-
if callable(value):
49-
return value
50-
else:
51-
self.error(obj, value)

0 commit comments

Comments
 (0)