aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/tools/cython/Cython/Shadow.pyi
blob: 42827a3ac1222995c1181aaaba2fb29af5355280 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
from builtins import (int as py_int, float as py_float,
                      bool as py_bool, str as py_str, complex as py_complex)
from typing import (Union, Dict, Any, Sequence, Optional,
                    List, TypeVar, Type, Generic)

int = py_int
long = py_int
longlong = py_int
short = py_int
char = py_int
sint = py_int
slong = py_int
slonglong = py_int
sshort = py_int
schar = py_int
uint = py_int
ulong = py_int
ulonglong = py_int
ushort = py_int
uchar = py_int
size_t = py_int
Py_ssize_t = py_int
Py_UCS4 = Union[py_int, str]
Py_UNICODE = Union[py_int, str]
float = py_float
double = py_float
longdouble = py_float
complex = py_complex
floatcomplex = py_complex
doublecomplex = py_complex
longdoublecomplex = py_complex
bint = py_bool
void = Union[None]
basestring = py_str
unicode = py_str

gs: Dict[str, Any]  # Should match the return type of globals()

_T = TypeVar('_T')

class _ArrayType(object, Generic[_T]):
    is_array: bool
    subtypes: Sequence[str]
    dtype: _T
    ndim: int
    is_c_contig: bool
    is_f_contig: bool
    inner_contig: bool
    broadcasting: Any

    # broadcasting is not used, so it's not clear about its type
    def __init__(self, dtype: _T, ndim: int, is_c_contig: bool = ...,
                 is_f_contig: bool = ..., inner_contig: bool = ...,
                 broadcasting: Any = ...) -> None: ...
    def __repr__(self) -> str: ...

class CythonTypeObject(object):
    ...

class CythonType(CythonTypeObject):
    ...

class PointerType(CythonType, Generic[_T]):
    def __init__(
        self,
        value: Optional[Union[ArrayType[_T], PointerType[_T], List[_T], int]] = ...
    ) -> None: ...
    def __getitem__(self, ix: int) -> _T: ...
    def __setitem__(self, ix: int, value: _T) -> None: ...
    def __eq__(self, value: object) -> bool: ...
    def __repr__(self) -> str: ...

class ArrayType(PointerType[_T]):
    def __init__(self) -> None: ...

#class StructType(CythonType, Generic[_T]):
#    def __init__(
#        self,
#        value: List[Type[_T]] = ...
#    ) -> None: ...

def index_type(
    base_type: _T, item: Union[tuple, slice, int]) -> _ArrayType[_T]: ...

def pointer(basetype: _T) -> Type[PointerType[_T]]: ...

def array(basetype: _T, n: int) -> Type[ArrayType[_T]]: ...

#def struct(basetype: _T) -> Type[StructType[_T]]: ...

class typedef(CythonType, Generic[_T]):
    name: str

    def __init__(self, type: _T, name: Optional[str] = ...) -> None: ...
    def __call__(self, *arg: Any) -> _T: ...
    def __repr__(self) -> str: ...
    __getitem__ = index_type

#class _FusedType(CythonType, Generic[_T]):
#    def __init__(self) -> None: ...

#def fused_type(*args: Tuple[_T]) -> Type[FusedType[_T]]: ...