Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove utils.Callable #506

Merged
merged 1 commit into from
Oct 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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)