Skip to content

Commit

Permalink
refactor: remove some unneeded code
Browse files Browse the repository at this point in the history
  • Loading branch information
d-biehl committed Dec 21, 2023
1 parent cd35020 commit 65e1775
Showing 1 changed file with 4 additions and 10 deletions.
14 changes: 4 additions & 10 deletions packages/core/src/robotcode/core/async_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,15 @@
List,
MutableSet,
Optional,
Protocol,
Set,
Type,
TypeVar,
Union,
cast,
runtime_checkable,
)

from robotcode.core.utils.inspect import ensure_coroutine
from .utils.inspect import ensure_coroutine
from .utils.threading import is_threaded_callable

_T = TypeVar("_T")

Expand Down Expand Up @@ -155,11 +154,6 @@ def __init__(self, _func: _TCallable) -> None:
super().__init__(_func, AsyncEvent[_TCallable, Any])


@runtime_checkable
class HasThreaded(Protocol):
__threaded__: bool


class AsyncTaskingEventResultIteratorBase(AsyncEventResultIteratorBase[_TCallable, _TResult]):
def __init__(self, *, task_name_prefix: Optional[str] = None) -> None:
super().__init__()
Expand Down Expand Up @@ -189,8 +183,8 @@ def _done(f: asyncio.Future[_TResult]) -> None:
set(self),
):
if method is not None:
if threaded and isinstance(method, HasThreaded) and method.__threaded__: # type: ignore
future = run_coroutine_in_thread(ensure_coroutine(method), *args, **kwargs) # type: ignore
if threaded and is_threaded_callable(method):
future = run_coroutine_in_thread(ensure_coroutine(method), *args, **kwargs)
else:
future = create_sub_task(ensure_coroutine(method)(*args, **kwargs))
awaitables.append(future)
Expand Down

0 comments on commit 65e1775

Please sign in to comment.