-
Notifications
You must be signed in to change notification settings - Fork 66
Expand file tree
/
Copy pathapi-ref-object-partial.html
More file actions
137 lines (128 loc) · 4.17 KB
/
api-ref-object-partial.html
File metadata and controls
137 lines (128 loc) · 4.17 KB
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
127
128
129
130
131
132
133
134
135
136
137
{{ $context := .context }}
{{ $objData := .object }}
{{ $path := .path }}
<div class="python-ref {{ if (eq $objData.kind " function") }} python-ref-func {{ else }} python-ref-class {{ end }}">
{{ if and (eq $objData.kind "function")}}
{{ $parenthesisArgsString := partial "api-ref-function-parenthesis.html" $objData}}
{{ if not $objData.is_property }}
<p><code>{{ (index (last 1 $path) 0) }}({{- $parenthesisArgsString -}}) -> {{ partial "api-ref-link-partial.html" (dict
"paragraph" $objData.signature.return_annotation "context" $context) }}</code></p>
{{ else }}
<p><code>{{ (index (last 1 $path) 0) }} -> {{ partial "api-ref-link-partial.html" (dict "paragraph"
$objData.signature.return_annotation "context" $context) }}</code></p>
{{ end }}
{{ if $objData.docstring_parsed}}
<div class="python-ref-description">
<p> {{ partial "api-ref-link-all-partial.html" (dict "paragraph" ($objData.docstring_parsed.short_description |
safeHTML) "context" $context) }}</p>
<p> {{ partial "api-ref-link-all-partial.html" (dict "paragraph" ($objData.docstring_parsed.long_description |
safeHTML) "context" $context)}}</p>
</div>
{{ end }}
{{ if not $objData.is_property }}
<h4> Parameters </h4>
{{ if $objData.docstring_parsed }}
{{ if (index $objData.docstring_parsed "params") }}
{{ if (gt (len $objData.docstring_parsed.params) 0) }}
<table class="gd-docs-parameters-block">
<thead>
<tr>
<th>name</th>
<th>type</th>
<th>description</th>
</tr>
</thead>
<tbody>
{{range $objData.docstring_parsed.params}}
<tr>
<td> {{ .arg_name }}</td>
<td> {{ partial "api-ref-link-partial.html" (dict "paragraph" .type_name "context" $context) }}</td>
<td> {{ partial "api-ref-link-all-partial.html" (dict "paragraph" (.description | safeHTML) "context" $context)
}}
</td>
</tr>
{{end}}
</tbody>
</table>
{{ else }}
<i> None </i>
{{ end }}
{{ else if (gt (len $objData.signature.params) 0) }}
<table class="gd-docs-parameters-block">
<thead>
<tr>
<th>name</th>
<th>type</th>
<th>description</th>
</tr>
</thead>
<tbody>
{{range $objData.signature.params}}
<tr>
<td> {{ index . 0 }}</td>
<td> {{ partial "api-ref-link-partial.html" (dict "paragraph" (index . 1) "context" $context) }}</td>
<td><i> None </i></td>
</tr>
{{end}}
</tbody>
</table>
{{ else }}
<i> None </i>
{{ end }}
{{ else }}
<i> None </i>
{{ end }}
{{ end }}
<h4> Returns </h4>
{{ if $objData.docstring_parsed }}
{{ if not $objData.docstring_parsed.returns }}
<i> No docs </i>
{{ else if or $objData.docstring_parsed.returns.type_name (ne $objData.signature.return_annotation "None") }}
{{ $typeName := "" }}
{{ if $objData.docstring_parsed.returns.type_name }}
{{ $typeName = $objData.docstring_parsed.returns.type_name }}
{{ else }}
{{ $typeName = $objData.signature.return_type }}
{{ end }}
{{ $description := $objData.docstring_parsed.returns.description }}
<table class="gd-docs-parameters-block">
<thead>
<tr>
<th>type</th>
<th>description</th>
</tr>
</thead>
<tbody>
<tr>
<td>
{{ partial "api-ref-link-partial.html" (dict "paragraph" $typeName "context" $context) }}
</td>
<td>
{{ if $description }}
{{ partial "api-ref-link-all-partial.html" (dict "paragraph" ($objData.docstring_parsed.returns.description
| safeHTML) "context" $context) }}
{{ else }}
<i> None </i>
{{ end }}
</td>
</tr>
</tbody>
</table>
{{ else }}
<i> None </i>
{{ end }}
{{ else }}
<i> No docs </i>
{{ end }}
{{ else if and (eq $objData.kind "class") }}
<h1> {{index (last 2 $path) 0}}.{{ index (last 1 $path) 0 }} </h1>
{{ if $objData.docstring_parsed }}
<div class="python-ref-description">
<p> {{ partial "api-ref-link-all-partial.html" (dict "paragraph" ($objData.docstring_parsed.short_description |
safeHTML) "context" $context) }}</p>
<p> {{ partial "api-ref-link-all-partial.html" (dict "paragraph" ($objData.docstring_parsed.long_description |
safeHTML) "context" $context) }}</p>
</div>
{{ end }}
{{end}}
</div>