Skip to content

Commit

Permalink
fix: rm inspect
Browse files Browse the repository at this point in the history
  • Loading branch information
phi-friday committed Jul 30, 2024
1 parent 14e92ab commit 0adffe5
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/timeout_executor/executor.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
from collections import deque
from contextlib import suppress
from functools import partial
from inspect import isclass
from itertools import chain
from pathlib import Path
from types import FunctionType
Expand Down Expand Up @@ -266,7 +265,15 @@ async def delay_func(


def func_name(func: Callable[..., Any]) -> str:
if isinstance(func, FunctionType) or isclass(func):
if isinstance(func, FunctionType) or is_class(func):
return func.__module__ + "." + func.__qualname__
_class = type(func)
return _class.__module__ + "." + _class.__qualname__


def is_class(obj: Any) -> bool:
if isinstance(obj, type):
return True

meta = type(obj)
return issubclass(meta, type)

0 comments on commit 0adffe5

Please sign in to comment.