Skip to content

Use stdlib override when possible #1532

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

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open
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
15 changes: 10 additions & 5 deletions jupyter_server/services/kernels/kernelmanager.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import asyncio
import os
import pathlib # noqa: TCH003
import sys
import typing as t
import warnings
from collections import defaultdict
Expand All @@ -24,7 +25,11 @@
from jupyter_core.utils import ensure_async
from jupyter_events import EventLogger
from jupyter_events.schema_registry import SchemaRegistryException
from overrides import overrides

if sys.version_info >= (3, 12):
from typing import override
else:
from overrides import overrides as override
from tornado import web
from tornado.concurrent import Future
from tornado.ioloop import IOLoop, PeriodicCallback
Expand Down Expand Up @@ -894,28 +899,28 @@ def emit(self, schema_id, data):
"""Emit an event from the kernel manager."""
self.event_logger.emit(schema_id=schema_id, data=data)

@overrides
@override
@emit_kernel_action_event(
success_msg="Kernel {kernel_id} was started.",
)
async def start_kernel(self, *args, **kwargs):
return await super().start_kernel(*args, **kwargs)

@overrides
@override
@emit_kernel_action_event(
success_msg="Kernel {kernel_id} was shutdown.",
)
async def shutdown_kernel(self, *args, **kwargs):
return await super().shutdown_kernel(*args, **kwargs)

@overrides
@override
@emit_kernel_action_event(
success_msg="Kernel {kernel_id} was restarted.",
)
async def restart_kernel(self, *args, **kwargs):
return await super().restart_kernel(*args, **kwargs)

@overrides
@override
@emit_kernel_action_event(
success_msg="Kernel {kernel_id} was interrupted.",
)
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ dependencies = [
"traitlets>=5.6.0",
"websocket-client>=1.7",
"jupyter_events>=0.11.0",
"overrides>=5.0"
"overrides>=5.0;python_version<'3.12'"
]

[project.urls]
Expand Down
Loading