Skip to content

Commit

Permalink
Merge pull request #506 from manics/remove-callable
Browse files Browse the repository at this point in the history
Remove utils.Callable
  • Loading branch information
yuvipanda authored Oct 25, 2024
2 parents 3d0eac5 + a340983 commit 11fcf89
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 29 deletions.
9 changes: 1 addition & 8 deletions jupyter_server_proxy/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
)
Expand Down
21 changes: 0 additions & 21 deletions jupyter_server_proxy/utils.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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)

0 comments on commit 11fcf89

Please sign in to comment.