Skip to content
Merged
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: 3 additions & 12 deletions asgiref/current_thread_executor.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import threading
from collections import deque
from concurrent.futures import Executor, Future
from typing import TYPE_CHECKING, Any, Callable, TypeVar
from typing import Any, Callable, TypeVar

if sys.version_info >= (3, 10):
from typing import ParamSpec
Expand Down Expand Up @@ -90,9 +90,10 @@ def done(future: "Future[Any]") -> None:
work_item.run()
del work_item

def _submit(
def submit(
self,
fn: Callable[_P, _R],
/,
*args: _P.args,
**kwargs: _P.kwargs,
) -> "Future[_R]":
Expand Down Expand Up @@ -120,13 +121,3 @@ def _submit(

# Return the future
return f

# Python 3.9+ has a new signature for submit with a "/" after `fn`, to enforce
# it to be a positional argument. If we ignore[override] mypy on 3.9+ will be
# happy but 3.8 will say that the ignore comment is unused, even when
# defining them differently based on sys.version_info.
# We should be able to remove this when we drop support for 3.8.
if not TYPE_CHECKING:

def submit(self, fn, *args, **kwargs):
return self._submit(fn, *args, **kwargs)