File: embedsignatures_clinic.pyx

package info (click to toggle)
cython 3.0.11%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: sid, trixie
  • size: 19,092 kB
  • sloc: python: 83,539; ansic: 18,831; cpp: 1,402; xml: 1,031; javascript: 511; makefile: 403; sh: 204; sed: 11
file content (126 lines) | stat: -rw-r--r-- 2,177 bytes parent folder | download
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
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
# cython: embedsignature=True
# cython: embedsignature.format=clinic
# cython: annotation_typing=False
# cython: binding=False
# cython: c_string_type=bytearray
# tag: py3only

def f00(a, object b=42):
    "f00 docstring"
    pass

def f01(unsigned int a: int, unsigned int b: int = 42, /, c=123):
    "f01 docstring"
    pass

def f02(unsigned int a: float, *, unsigned int b: float = 42) -> tuple[int]:
    "f02 docstring"
    pass

__doc__ = ur"""
>>> print(f00.__doc__)
f00 docstring
>>> print(f00.__text_signature__)
(a, b=42)

>>> print(f01.__doc__)
f01 docstring
>>> print(f01.__text_signature__)
(a, b=42, /, c=123)

>>> print(f02.__doc__)
f02 docstring
>>> print(f02.__text_signature__)
(a, *, b=42)

"""


cdef class Foo:
    "Foo docstring"

    def __init__(self, *args: Any, **kwargs: Any) -> None:
        "init Foo"
        pass

    def m00(self, a, b=42, *args, c=123):
        "m00 docstring"
        pass

    def m01(self, a, b=42, *, c=123, **kwargs):
        "m01 docstring"
        pass

    @classmethod
    def c00(cls, a):
        "c00 docstring"
        pass

    @staticmethod
    def s00(a):
        "s00 docstring"
        pass

    cdef public long int p0
    property p1:
        "p1 docstring"
        def __get__(self):
            return 0
    property p2:
        "p2 docstring"
        def __get__(self) -> int:
            return 0
    cdef public Foo p3


__doc__ += ur"""
>>> print(Foo.__doc__)
Foo docstring
>>> print(Foo.__init__.__doc__)
init Foo
>>> print(Foo.__init__.__text_signature__)
($self, *args, **kwargs)

"""

__doc__ += ur"""
>>> print(Foo.m00.__doc__)
m00 docstring
>>> print(Foo.m00.__text_signature__)
($self, a, b=42, *args, c=123)

>>> print(Foo.m01.__doc__)
m01 docstring
>>> print(Foo.m01.__text_signature__)
($self, a, b=42, *, c=123, **kwargs)

"""

__doc__ += ur"""
>>> print(Foo.c00.__doc__)
c00 docstring
>>> print(Foo.c00.__text_signature__)
($type, a)

>>> print(Foo.s00.__doc__)
s00 docstring
>>> print(Foo.s00.__text_signature__)
(a)

"""


__doc__ += ur"""
>>> print(Foo.p0.__doc__)
None

>>> print(Foo.p1.__doc__)
p1 docstring

>>> print(Foo.p2.__doc__)
p2 docstring

>>> print(Foo.p3.__doc__)
None

"""