Skip to content

Commit

Permalink
Remove utils.Callable
Browse files Browse the repository at this point in the history
This was for compatibility with older versions of Traitlets, but we already require 5.1.0
https://github.com/jupyterhub/jupyter-server-proxy/blob/3d0eac577ae9ad768252b1a091ae6113ebc5f3ba/pyproject.toml#L50
  • Loading branch information
manics committed Oct 24, 2024
1 parent 3d0eac5 commit a340983
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 a340983

Please sign in to comment.