comparison python/pydc/pydc-stubs/pydc.pyi @ 47:44045db8fa5f

PyCObject/PyCapsule not usable as type annotation
author Tassilo Philipp
date Fri, 13 Nov 2020 18:04:05 +0100
parents c21d1c2c84e1
children
comparison
equal deleted inserted replaced
46:c21d1c2c84e1 47:44045db8fa5f
1 import sys 1 import sys
2 from typing import Optional, Any, TypeVar 2 from typing import Optional, Any, TypeVar
3 3
4 # Handle type is different, depending on python version 4 # Handle type, depending on python version this is either internal type
5 if sys.version_info < (2, 7) or (sys.version_info >= (3, 0) and sys.version_info < (3, 1)): 5 # PyCObject or PyCapsule, neither of one can be used as annotation
6 H = TypeVar('H', PyCObject) 6 H = TypeVar('H')
7 else:
8 H = TypeVar('H', PyCapsule)
9 7
10 def load(libpath: Optional[str]) -> H: ... 8 def load(libpath: Optional[str]) -> H: ...
11 def find(libhandle: H, symbol: str) -> H: ... 9 def find(libhandle: H, symbol: str) -> H: ...
12 def free(libhandle: H) -> None: ... 10 def free(libhandle: H) -> None: ...
13 def get_path(libhandle: Optional[H]) -> str: ... 11 def get_path(libhandle: Optional[H]) -> str: ...