Cython has moved to github.
cython-devel
view tests/run/embedsignatures.pyx @ 1157:075511424c24
Automatic embedding of signatures in docstring (#2)
| author | LisandroDalcin |
|---|---|
| date | Fri Sep 19 16:28:36 2008 +0200 (3 years ago) |
| parents | |
| children | d115fd6ed2df |
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, int c, float d, e)'
53 """
55 cdef class Ext:
57 def a(self):
58 pass
60 def b(self, a, b, c):
61 pass
63 def c(self, a, b, c=1):
64 pass
66 def d(self, a, b, *, c = 88):
67 pass
69 def e(self, a, b, c = 88, **kwds):
70 pass
72 def f(self, a, b, *, c, d = 42):
73 pass
75 def g(self, a, b, *, c, d = 42, e = 17, f, **kwds):
76 pass
78 def h(self, a, b, *args, c, d = 42, e = 17, f, **kwds):
79 pass
81 def k(self, a, b, c=1, *args, d = 42, e = 17, f, **kwds):
82 pass
84 cpdef int get_int(self):
85 return 0
87 cpdef float get_float(self):
88 return 0.0
90 cpdef Ext clone(self):
91 return Ext()
93 def foo():
94 pass
96 def types(Ext a, int b, unsigned short c, float d, e):
97 pass
99 def with_doc_1(a, b, c):
100 """Existing string"""
101 pass
103 def with_doc_2(a, b, c):
104 """
105 Existing string
106 """
107 pass
