annotate python/pydc/pydc.pyi @ 54:918dab7a6606

- added callback support (comes with some bigger refactoring) - allow CPython's Py{CObject,Capsule} to be used as 'p'ointers
author Tassilo Philipp
date Tue, 02 Feb 2021 20:42:02 +0100
parents edf5c85de5ac
children 8e905c0798c7
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
46
c21d1c2c84e1 - removed pydc.py wrapper overhead (which only called pydcext.so functions, directly, anyways)
Tassilo Philipp
parents:
diff changeset
1 import sys
54
918dab7a6606 - added callback support (comes with some bigger refactoring)
Tassilo Philipp
parents: 50
diff changeset
2 from typing import Optional, Any, TypeVar, Callable
46
c21d1c2c84e1 - removed pydc.py wrapper overhead (which only called pydcext.so functions, directly, anyways)
Tassilo Philipp
parents:
diff changeset
3
47
44045db8fa5f PyCObject/PyCapsule not usable as type annotation
Tassilo Philipp
parents: 46
diff changeset
4 # Handle type, depending on python version this is either internal type
44045db8fa5f PyCObject/PyCapsule not usable as type annotation
Tassilo Philipp
parents: 46
diff changeset
5 # PyCObject or PyCapsule, neither of one can be used as annotation
44045db8fa5f PyCObject/PyCapsule not usable as type annotation
Tassilo Philipp
parents: 46
diff changeset
6 H = TypeVar('H')
46
c21d1c2c84e1 - removed pydc.py wrapper overhead (which only called pydcext.so functions, directly, anyways)
Tassilo Philipp
parents:
diff changeset
7
c21d1c2c84e1 - removed pydc.py wrapper overhead (which only called pydcext.so functions, directly, anyways)
Tassilo Philipp
parents:
diff changeset
8 def load(libpath: Optional[str]) -> H: ...
c21d1c2c84e1 - removed pydc.py wrapper overhead (which only called pydcext.so functions, directly, anyways)
Tassilo Philipp
parents:
diff changeset
9 def find(libhandle: H, symbol: str) -> H: ...
c21d1c2c84e1 - removed pydc.py wrapper overhead (which only called pydcext.so functions, directly, anyways)
Tassilo Philipp
parents:
diff changeset
10 def free(libhandle: H) -> None: ...
c21d1c2c84e1 - removed pydc.py wrapper overhead (which only called pydcext.so functions, directly, anyways)
Tassilo Philipp
parents:
diff changeset
11 def get_path(libhandle: Optional[H]) -> str: ...
c21d1c2c84e1 - removed pydc.py wrapper overhead (which only called pydcext.so functions, directly, anyways)
Tassilo Philipp
parents:
diff changeset
12 def call(funcptr: H, signature: str, *arguments: Any) -> Any: ...
54
918dab7a6606 - added callback support (comes with some bigger refactoring)
Tassilo Philipp
parents: 50
diff changeset
13 def new_callback(c_signature: str, f: Callable) -> H: ... # note: only callbacks with positional args
918dab7a6606 - added callback support (comes with some bigger refactoring)
Tassilo Philipp
parents: 50
diff changeset
14 def free_callback(cbhandle: H) -> None: ...
46
c21d1c2c84e1 - removed pydc.py wrapper overhead (which only called pydcext.so functions, directly, anyways)
Tassilo Philipp
parents:
diff changeset
15