fix: Restore type hints for low-level api
This commit is contained in:
parent
2292af5796
commit
19234aa0db
1 changed files with 2 additions and 1 deletions
|
@ -109,12 +109,13 @@ if TYPE_CHECKING:
|
|||
|
||||
CtypesFuncPointer: TypeAlias = ctypes._FuncPointer # type: ignore
|
||||
|
||||
F = TypeVar("F", bound=Callable[..., Any])
|
||||
|
||||
def ctypes_function_for_shared_library(lib: ctypes.CDLL):
|
||||
def ctypes_function(
|
||||
name: str, argtypes: List[Any], restype: Any, enabled: bool = True
|
||||
):
|
||||
def decorator(f: Callable[..., Any]):
|
||||
def decorator(f: F) -> F:
|
||||
if enabled:
|
||||
func = getattr(lib, name)
|
||||
func.argtypes = argtypes
|
||||
|
|
Loading…
Reference in a new issue