Cython has moved to github.
cython-devel
view tests/run/embedsignatures.pyx @ 1159:d115fd6ed2df
Signature embedding: Proper display of native types (#2).
| author | LisandroDalcin |
|---|---|
| date | Sat Sep 20 13:34:03 2008 +0200 (3 years ago) |
| parents | 075511424c24 |
| children | d065589d0191 |
line source
1 #cython: embedsignature=True
3 # note the r, we use \n below
4 __doc__ = ur"""
5 >>> print (Ext.a.__doc__)
6 Ext.a(self)
8 >>> print (Ext.b.__doc__)
9 Ext.b(self, a, b, c)
11 >>> print (Ext.c.__doc__)
12 Ext.c(self, a, b, c=1)
14 >>> print (Ext.d.__doc__)
15 Ext.d(self, a, b, *, c=88)
17 >>> print (Ext.e.__doc__)
18 Ext.e(self, a, b, c=88, **kwds)
20 >>> print (Ext.f.__doc__)
21 Ext.f(self, a, b, *, c, d=42)
23 >>> print (Ext.g.__doc__)
24 Ext.g(self, a, b, *, c, d=42, e=17, f, **kwds)
26 >>> print (Ext.h.__doc__)
27 Ext.h(self, a, b, *args, c, d=42, e=17, f, **kwds)
29 >>> print (Ext.k.__doc__)
30 Ext.k(self, a, b, c=1, *args, d=42, e=17, f, **kwds)
32 >>> print (Ext.get_int.__doc__)
33 Ext.get_int(self) -> int
35 >>> print (Ext.get_float.__doc__)
36 Ext.get_float(self) -> float
38 >>> print (Ext.clone.__doc__)
39 Ext.clone(self) -> Ext
41 >>> print (foo.__doc__)
42 foo()
44 >>> with_doc_1.__doc__
45 'with_doc_1(a, b, c)\nExisting string'
47 >>> with_doc_2.__doc__
48 'with_doc_2(a, b, c)\n\n Existing string\n '
50 >>> types.__doc__
51 'types(Ext a, int b, unsigned short int c, float d, e)'
53 >>> print (f_c.__doc__)
54 f_c(char c) -> char
56 >>> print (f_uc.__doc__)
57 f_uc(unsigned char c) -> unsigned char
59 >>> print (f_sc.__doc__)
60 f_sc(signed char c) -> signed char
63 >>> print (f_s.__doc__)
64 f_s(short int s) -> short int
66 >>> print (f_us.__doc__)
67 f_us(unsigned short int s) -> unsigned short int
69 >>> print (f_ss.__doc__)
70 f_ss(signed short int s) -> signed short int
73 >>> print (f_i.__doc__)
74 f_i(int i) -> int
76 >>> print (f_ui.__doc__)
77 f_ui(unsigned int i) -> unsigned int
79 >>> print (f_si.__doc__)
80 f_si(signed int i) -> signed int
83 >>> print (f_l.__doc__)
84 f_l(long int l) -> long int
86 >>> print (f_ul.__doc__)
87 f_ul(unsigned long int l) -> unsigned long int
89 >>> print (f_sl.__doc__)
90 f_sl(signed long int l) -> signed long int
93 >>> print (f_L.__doc__)
94 f_L(long long int L) -> long long int
96 >>> print (f_uL.__doc__)
97 f_uL(unsigned long long int L) -> unsigned long long int
99 >>> print (f_sL.__doc__)
100 f_sL(signed long long int L) -> signed long long int
103 >>> print (f_f.__doc__)
104 f_f(float f) -> float
106 >>> print (f_d.__doc__)
107 f_d(double d) -> double
109 >>> print (f_D.__doc__)
110 f_D(long double D) -> long double
112 """
114 cdef class Ext:
116 def a(self):
117 pass
119 def b(self, a, b, c):
120 pass
122 def c(self, a, b, c=1):
123 pass
125 def d(self, a, b, *, c = 88):
126 pass
128 def e(self, a, b, c = 88, **kwds):
129 pass
131 def f(self, a, b, *, c, d = 42):
132 pass
134 def g(self, a, b, *, c, d = 42, e = 17, f, **kwds):
135 pass
137 def h(self, a, b, *args, c, d = 42, e = 17, f, **kwds):
138 pass
140 def k(self, a, b, c=1, *args, d = 42, e = 17, f, **kwds):
141 pass
143 cpdef int get_int(self):
144 return 0
146 cpdef float get_float(self):
147 return 0.0
149 cpdef Ext clone(self):
150 return Ext()
152 def foo():
153 pass
155 def types(Ext a, int b, unsigned short c, float d, e):
156 pass
158 def with_doc_1(a, b, c):
159 """Existing string"""
160 pass
162 def with_doc_2(a, b, c):
163 """
164 Existing string
165 """
166 pass
168 cpdef char f_c(char c):
169 return c
171 cpdef unsigned char f_uc(unsigned char c):
172 return c
174 cpdef signed char f_sc(signed char c):
175 return c
178 cpdef short f_s(short s):
179 return s
181 cpdef unsigned short f_us(unsigned short s):
182 return s
184 cpdef signed short f_ss(signed short s):
185 return s
188 cpdef int f_i(int i):
189 return i
191 cpdef unsigned int f_ui(unsigned int i):
192 return i
194 cpdef signed int f_si(signed int i):
195 return i
198 cpdef long f_l(long l):
199 return l
201 cpdef unsigned long f_ul(unsigned long l):
202 return l
204 cpdef signed long f_sl(signed long l):
205 return l
208 cpdef long long f_L(long long L):
209 return L
211 cpdef unsigned long long f_uL(unsigned long long L):
212 return L
214 cpdef signed long long f_sL(signed long long L):
215 return L
218 cpdef float f_f(float f):
219 return f
221 cpdef double f_d(double d):
222 return d
224 cpdef long double f_D(long double D):
225 return D
