Cython has moved to github.
cython-devel
view tests/run/embedsignatures.pyx @ 3091:1a2e04bc1395
remove dependency on structmember.h
| author | Lisandro Dalcin <dalcinl@gmail.com> |
|---|---|
| date | Thu Mar 11 17:21:13 2010 -0300 (2 years ago) |
| parents | 344b006d7a4f |
| children |
line source
1 #cython: embedsignature=True
3 # note the r, we use \n below
4 __doc__ = ur"""
5 >>> print (Ext.__doc__)
6 Ext(a, b, c=None)
8 >>> print (Ext.attr0.__doc__)
9 attr0: 'int'
10 >>> print (Ext.attr1.__doc__)
11 attr1: object
12 >>> print (Ext.attr2.__doc__)
13 attr2: list
14 >>> print (Ext.attr3.__doc__)
15 attr3: embedsignatures.Ext
17 >>> print (Ext.a.__doc__)
18 Ext.a(self)
20 >>> print (Ext.b.__doc__)
21 Ext.b(self, a, b, c)
23 >>> print (Ext.c.__doc__)
24 Ext.c(self, a, b, c=1)
26 >>> print (Ext.d.__doc__)
27 Ext.d(self, a, b, *, c=88)
29 >>> print (Ext.e.__doc__)
30 Ext.e(self, a, b, c=88, **kwds)
32 >>> print (Ext.f.__doc__)
33 Ext.f(self, a, b, *, c, d=42)
35 >>> print (Ext.g.__doc__)
36 Ext.g(self, a, b, *, c, d=42, e=17, f, **kwds)
38 >>> print (Ext.h.__doc__)
39 Ext.h(self, a, b, *args, c, d=42, e=17, f, **kwds)
41 >>> print (Ext.k.__doc__)
42 Ext.k(self, a, b, c=1, *args, d=42, e=17, f, **kwds)
44 >>> print (Ext.l.__doc__)
45 Ext.l(self, a, b, c=1, *args, d=42, e=17, f, **kwds)
46 Existing string
48 >>> print (Ext.m.__doc__)
49 Ext.m(self, a=u'spam')
51 >>> print (Ext.get_int.__doc__)
52 Ext.get_int(self) -> int
54 >>> print (Ext.get_float.__doc__)
55 Ext.get_float(self) -> float
57 >>> print (Ext.get_str.__doc__)
58 Ext.get_str(self) -> str
59 Existing string
61 >>> print (Ext.clone.__doc__)
62 Ext.clone(self) -> Ext
64 >>> print (foo.__doc__)
65 foo()
67 >>> with_doc_1.__doc__
68 'with_doc_1(a, b, c)\nExisting string'
70 >>> with_doc_2.__doc__
71 'with_doc_2(a, b, c)\n\n Existing string\n '
73 >>> with_doc_3.__doc__
74 'with_doc_3(a, b, c)\nExisting string'
76 >>> with_doc_4.__doc__
77 'with_doc_4(int a, str b, list c) -> str\n\n Existing string\n '
79 >>> f_sd.__doc__
80 "f_sd(str s='spam')"
82 >>> cf_sd.__doc__
83 "cf_sd(str s='spam') -> str"
85 >>> types.__doc__
86 'types(Ext a, int b, unsigned short c, float d, e)'
88 >>> print (f_c.__doc__)
89 f_c(char c) -> char
91 >>> print (f_uc.__doc__)
92 f_uc(unsigned char c) -> unsigned char
94 >>> print (f_sc.__doc__)
95 f_sc(signed char c) -> signed char
98 >>> print (f_s.__doc__)
99 f_s(short s) -> short
101 >>> print (f_us.__doc__)
102 f_us(unsigned short s) -> unsigned short
104 >>> print (f_ss.__doc__)
105 f_ss(signed short s) -> signed short
108 >>> print (f_i.__doc__)
109 f_i(int i) -> int
111 >>> print (f_ui.__doc__)
112 f_ui(unsigned int i) -> unsigned int
114 >>> print (f_si.__doc__)
115 f_si(signed int i) -> signed int
118 >>> print (f_l.__doc__)
119 f_l(long l) -> long
121 >>> print (f_ul.__doc__)
122 f_ul(unsigned long l) -> unsigned long
124 >>> print (f_sl.__doc__)
125 f_sl(signed long l) -> signed long
128 >>> print (f_L.__doc__)
129 f_L(long long L) -> long long
131 >>> print (f_uL.__doc__)
132 f_uL(unsigned long long L) -> unsigned long long
134 >>> print (f_sL.__doc__)
135 f_sL(signed long long L) -> signed long long
138 >>> print (f_f.__doc__)
139 f_f(float f) -> float
141 >>> print (f_d.__doc__)
142 f_d(double d) -> double
144 >>> print (f_D.__doc__)
145 f_D(long double D) -> long double
147 >>> print (f_my_i.__doc__)
148 f_my_i(MyInt i) -> MyInt
150 >>> print (f_my_f.__doc__)
151 f_my_f(MyFloat f) -> MyFloat
153 """
155 cdef class Ext:
157 cdef public int attr0
158 cdef public attr1
159 cdef public list attr2
160 cdef public Ext attr3
162 def __init__(self, a, b, c=None):
163 pass
165 def a(self):
166 pass
168 def b(self, a, b, c):
169 pass
171 def c(self, a, b, c=1):
172 pass
174 def d(self, a, b, *, c = 88):
175 pass
177 def e(self, a, b, c = 88, **kwds):
178 pass
180 def f(self, a, b, *, c, d = 42):
181 pass
183 def g(self, a, b, *, c, d = 42, e = 17, f, **kwds):
184 pass
186 def h(self, a, b, *args, c, d = 42, e = 17, f, **kwds):
187 pass
189 def k(self, a, b, c=1, *args, d = 42, e = 17, f, **kwds):
190 pass
192 def l(self, a, b, c=1, *args, d = 42, e = 17, f, **kwds):
193 """Existing string"""
194 pass
196 def m(self, a=u'spam'):
197 pass
199 cpdef int get_int(self):
200 return 0
202 cpdef float get_float(self):
203 return 0.0
205 cpdef str get_str(self):
206 """Existing string"""
207 return "string"
209 cpdef Ext clone(self):
210 return Ext(1,2)
212 def foo():
213 pass
215 def types(Ext a, int b, unsigned short c, float d, e):
216 pass
218 def with_doc_1(a, b, c):
219 """Existing string"""
220 pass
222 def with_doc_2(a, b, c):
223 """
224 Existing string
225 """
226 pass
228 cpdef with_doc_3(a, b, c):
229 """Existing string"""
230 pass
232 cpdef str with_doc_4(int a, str b, list c):
233 """
234 Existing string
235 """
236 return b
238 def f_sd(str s='spam'):
239 return s
241 cpdef str cf_sd(str s='spam'):
242 return s
244 cpdef char f_c(char c):
245 return c
247 cpdef unsigned char f_uc(unsigned char c):
248 return c
250 cpdef signed char f_sc(signed char c):
251 return c
254 cpdef short f_s(short s):
255 return s
257 cpdef unsigned short f_us(unsigned short s):
258 return s
260 cpdef signed short f_ss(signed short s):
261 return s
264 cpdef int f_i(int i):
265 return i
267 cpdef unsigned int f_ui(unsigned int i):
268 return i
270 cpdef signed int f_si(signed int i):
271 return i
274 cpdef long f_l(long l):
275 return l
277 cpdef unsigned long f_ul(unsigned long l):
278 return l
280 cpdef signed long f_sl(signed long l):
281 return l
284 cpdef long long f_L(long long L):
285 return L
287 cpdef unsigned long long f_uL(unsigned long long L):
288 return L
290 cpdef signed long long f_sL(signed long long L):
291 return L
294 cpdef float f_f(float f):
295 return f
297 cpdef double f_d(double d):
298 return d
300 cpdef long double f_D(long double D):
301 return D
303 ctypedef int MyInt
304 cpdef MyInt f_my_i(MyInt i):
305 return i
307 ctypedef float MyFloat
308 cpdef MyFloat f_my_f(MyFloat f):
309 return f
