Register
Login
Resources
Docs Blog Datasets Glossary Case Studies Tutorials & Webinars
Product
Data Engine LLMs Platform Enterprise
Pricing Explore
Connect to our Discord channel

html.mako 15 KB

You have to be logged in to leave a comment. Sign In
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
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
  1. <%
  2. import os
  3. import pdoc
  4. from pdoc.html_helpers import extract_toc, glimpse, to_html as _to_html, format_git_link
  5. def link(dobj: pdoc.Doc, name=None):
  6. name = name or dobj.qualname + ('()' if isinstance(dobj, pdoc.Function) else '')
  7. if isinstance(dobj, pdoc.External) and not external_links:
  8. return name
  9. url = dobj.url(relative_to=module, link_prefix=link_prefix,
  10. top_ancestor=not show_inherited_members)
  11. return f'<a title="{dobj.refname}" href="{url}">{name}</a>'
  12. def to_html(text):
  13. return _to_html(text, docformat=docformat, module=module, link=link, latex_math=latex_math)
  14. def get_annotation(bound_method, sep=':'):
  15. annot = show_type_annotations and bound_method(link=link) or ''
  16. if annot:
  17. annot = ' ' + sep + '\N{NBSP}' + annot
  18. return annot
  19. %>
  20. <%def name="ident(name)"><span class="ident">${name}</span></%def>
  21. <%def name="show_source(d)">
  22. % if (show_source_code or git_link_template) and d.source and d.obj is not getattr(d.inherits, 'obj', None):
  23. <% git_link = format_git_link(git_link_template, d) %>
  24. % if show_source_code:
  25. <details class="source">
  26. <summary>
  27. <span>Expand source code</span>
  28. % if git_link:
  29. <a href="${git_link}" class="git-link">Browse git</a>
  30. %endif
  31. </summary>
  32. <pre><code class="python">${d.source | h}</code></pre>
  33. </details>
  34. % elif git_link:
  35. <div class="git-link-div"><a href="${git_link}" class="git-link">Browse git</a></div>
  36. %endif
  37. %endif
  38. </%def>
  39. <%def name="show_desc(d, short=False)">
  40. <%
  41. inherits = ' inherited' if d.inherits else ''
  42. docstring = glimpse(d.docstring) if short or inherits else d.docstring
  43. %>
  44. % if d.inherits:
  45. <p class="inheritance">
  46. <em>Inherited from:</em>
  47. % if hasattr(d.inherits, 'cls'):
  48. <code>${link(d.inherits.cls)}</code>.<code>${link(d.inherits, d.name)}</code>
  49. % else:
  50. <code>${link(d.inherits)}</code>
  51. % endif
  52. </p>
  53. % endif
  54. <div class="desc${inherits}">${docstring | to_html}</div>
  55. % if not isinstance(d, pdoc.Module):
  56. ${show_source(d)}
  57. % endif
  58. </%def>
  59. <%def name="show_module_list(modules)">
  60. <h1>Python module list</h1>
  61. % if not modules:
  62. <p>No modules found.</p>
  63. % else:
  64. <dl id="http-server-module-list">
  65. % for name, desc in modules:
  66. <div class="flex">
  67. <dt><a href="${link_prefix}${name}">${name}</a></dt>
  68. <dd>${desc | glimpse, to_html}</dd>
  69. </div>
  70. % endfor
  71. </dl>
  72. % endif
  73. </%def>
  74. <%def name="show_column_list(items)">
  75. <%
  76. two_column = len(items) >= 6 and all(len(i.name) < 20 for i in items)
  77. %>
  78. <ul class="${'two-column' if two_column else ''}">
  79. % for item in items:
  80. <li><code>${link(item, item.name)}</code></li>
  81. % endfor
  82. </ul>
  83. </%def>
  84. <%def name="show_module(module)">
  85. <%
  86. variables = module.variables(sort=sort_identifiers)
  87. classes = module.classes(sort=sort_identifiers)
  88. functions = module.functions(sort=sort_identifiers)
  89. submodules = module.submodules()
  90. %>
  91. <%def name="show_func(f)">
  92. <dt id="${f.refname}"><code class="name flex">
  93. <%
  94. params = ', '.join(f.params(annotate=show_type_annotations, link=link))
  95. return_type = get_annotation(f.return_annotation, '\N{non-breaking hyphen}>')
  96. %>
  97. <span>${f.funcdef()} ${ident(f.name)}</span>(<span>${params})${return_type}</span>
  98. </code></dt>
  99. <dd>${show_desc(f)}</dd>
  100. </%def>
  101. <section id="section-intro">
  102. ${module.docstring | to_html}
  103. ${show_source(module)}
  104. </section>
  105. <section>
  106. % if submodules:
  107. <h2 class="section-title" id="header-submodules">Sub-modules</h2>
  108. <dl>
  109. % for m in submodules:
  110. <dt><code class="name">${link(m)}</code></dt>
  111. <dd>${show_desc(m, short=True)}</dd>
  112. % endfor
  113. </dl>
  114. % endif
  115. </section>
  116. <section>
  117. % if variables:
  118. <h2 class="section-title" id="header-variables">Global variables</h2>
  119. <dl>
  120. % for v in variables:
  121. <% return_type = get_annotation(v.type_annotation) %>
  122. <dt id="${v.refname}"><code class="name">var ${ident(v.name)}${return_type}</code></dt>
  123. <dd>${show_desc(v)}</dd>
  124. % endfor
  125. </dl>
  126. % endif
  127. </section>
  128. <section>
  129. % if functions:
  130. <h2 class="section-title" id="header-functions">Functions</h2>
  131. <dl>
  132. % for f in functions:
  133. ${show_func(f)}
  134. % endfor
  135. </dl>
  136. % endif
  137. </section>
  138. <section>
  139. % if classes:
  140. <h2 class="section-title" id="header-classes">Classes</h2>
  141. <dl>
  142. % for c in classes:
  143. <%
  144. class_vars = c.class_variables(show_inherited_members, sort=sort_identifiers)
  145. smethods = c.functions(show_inherited_members, sort=sort_identifiers)
  146. inst_vars = c.instance_variables(show_inherited_members, sort=sort_identifiers)
  147. methods = c.methods(show_inherited_members, sort=sort_identifiers)
  148. mro = c.mro()
  149. subclasses = c.subclasses()
  150. params = ', '.join(c.params(annotate=show_type_annotations, link=link))
  151. %>
  152. <dt id="${c.refname}"><code class="flex name class">
  153. <span>class ${ident(c.name)}</span>
  154. % if params:
  155. <span>(</span><span>${params})</span>
  156. % endif
  157. </code></dt>
  158. <dd>${show_desc(c)}
  159. % if mro:
  160. <h3>Ancestors</h3>
  161. <ul class="hlist">
  162. % for cls in mro:
  163. <li>${link(cls)}</li>
  164. % endfor
  165. </ul>
  166. %endif
  167. % if subclasses:
  168. <h3>Subclasses</h3>
  169. <ul class="hlist">
  170. % for sub in subclasses:
  171. <li>${link(sub)}</li>
  172. % endfor
  173. </ul>
  174. % endif
  175. % if class_vars:
  176. <h3>Class variables</h3>
  177. <dl>
  178. % for v in class_vars:
  179. <% return_type = get_annotation(v.type_annotation) %>
  180. <dt id="${v.refname}"><code class="name">var ${ident(v.name)}${return_type}</code></dt>
  181. <dd>${show_desc(v)}</dd>
  182. % endfor
  183. </dl>
  184. % endif
  185. % if smethods:
  186. <h3>Static methods</h3>
  187. <dl>
  188. % for f in smethods:
  189. ${show_func(f)}
  190. % endfor
  191. </dl>
  192. % endif
  193. % if inst_vars:
  194. <h3>Instance variables</h3>
  195. <dl>
  196. % for v in inst_vars:
  197. <% return_type = get_annotation(v.type_annotation) %>
  198. <dt id="${v.refname}"><code class="name">var ${ident(v.name)}${return_type}</code></dt>
  199. <dd>${show_desc(v)}</dd>
  200. % endfor
  201. </dl>
  202. % endif
  203. % if methods:
  204. <h3>Methods</h3>
  205. <dl>
  206. % for f in methods:
  207. ${show_func(f)}
  208. % endfor
  209. </dl>
  210. % endif
  211. % if not show_inherited_members:
  212. <%
  213. members = c.inherited_members()
  214. %>
  215. % if members:
  216. <h3>Inherited members</h3>
  217. <ul class="hlist">
  218. % for cls, mems in members:
  219. <li><code><b>${link(cls)}</b></code>:
  220. <ul class="hlist">
  221. % for m in mems:
  222. <li><code>${link(m, name=m.name)}</code></li>
  223. % endfor
  224. </ul>
  225. </li>
  226. % endfor
  227. </ul>
  228. % endif
  229. % endif
  230. </dd>
  231. % endfor
  232. </dl>
  233. % endif
  234. </section>
  235. </%def>
  236. <%def name="module_index(module)">
  237. <%
  238. variables = module.variables(sort=sort_identifiers)
  239. classes = module.classes(sort=sort_identifiers)
  240. functions = module.functions(sort=sort_identifiers)
  241. submodules = module.submodules()
  242. supermodule = module.supermodule
  243. %>
  244. <nav id="sidebar">
  245. <%include file="logo.mako"/>
  246. % if google_search_query:
  247. <div class="gcse-search" style="height: 70px"
  248. data-as_oq="${' '.join(google_search_query.strip().split()) | h }"
  249. data-gaCategoryParameter="${module.refname | h}">
  250. </div>
  251. % endif
  252. % if lunr_search is not None:
  253. <%include file="_lunr_search.inc.mako"/>
  254. % endif
  255. <h1>Index 🔍</h1>
  256. ${extract_toc(module.docstring) if extract_module_toc_into_sidebar else ''}
  257. <ul id="index">
  258. % if supermodule:
  259. <li><h3>Super-module</h3>
  260. <ul>
  261. <li><code>${link(supermodule)}</code></li>
  262. </ul>
  263. </li>
  264. % endif
  265. % if submodules:
  266. ## Note put custom stuff here!
  267. ## <hr>
  268. <li><h3>Our favorite models</h3>
  269. <ul>
  270. <li><a href="https://csinva.io/imodels/shrinkage.html">Hierarchical shrinkage: post-hoc regularization for tree-based methods</a></li>
  271. <li><a href="https://csinva.io/imodels/figs.html">FIGS: Fast interpretable greedy-tree sums</a></li>
  272. </ul>
  273. </li>
  274. <li><h3><a href="#header-submodules">Sub-modules</a></h3>
  275. <ul>
  276. % for m in submodules:
  277. <li><code>${link(m)}</code></li>
  278. % endfor
  279. </ul>
  280. </li>
  281. % endif
  282. % if variables:
  283. <li><h3><a href="#header-variables">Global variables</a></h3>
  284. ${show_column_list(variables)}
  285. </li>
  286. % endif
  287. % if functions:
  288. <li><h3><a href="#header-functions">Functions</a></h3>
  289. ${show_column_list(functions)}
  290. </li>
  291. % endif
  292. % if classes:
  293. <li><h3><a href="#header-classes">Classes</a></h3>
  294. <ul>
  295. % for c in classes:
  296. <li>
  297. <h4><code>${link(c)}</code></h4>
  298. <%
  299. members = c.functions(sort=sort_identifiers) + c.methods(sort=sort_identifiers)
  300. if list_class_variables_in_index:
  301. members += (c.instance_variables(sort=sort_identifiers) +
  302. c.class_variables(sort=sort_identifiers))
  303. if not show_inherited_members:
  304. members = [i for i in members if not i.inherits]
  305. if sort_identifiers:
  306. members = sorted(members)
  307. %>
  308. % if members:
  309. ${show_column_list(members)}
  310. % endif
  311. </li>
  312. % endfor
  313. </ul>
  314. </li>
  315. % endif
  316. </ul>
  317. <p><img align="center" width=100% src="https://csinva.io/imodels/img/anim.gif"> </img></p>
  318. <!-- add wave animation -->
  319. ## <div class="ocean">
  320. ## <div class="wave">
  321. ## </div>
  322. ## <div class="wave">
  323. ## </div>
  324. ## </div>
  325. </nav>
  326. </%def>
  327. <!doctype html>
  328. <html lang="${html_lang}">
  329. <head>
  330. <meta charset="utf-8">
  331. <meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1" />
  332. <meta name="generator" content="pdoc ${pdoc.__version__}" />
  333. <%
  334. module_list = 'modules' in context.keys() # Whether we're showing module list in server mode
  335. %>
  336. ## % if module_list:
  337. ## <title>Python module list</title>
  338. ## <meta name="description" content="A list of documented Python modules." />
  339. ## % else:
  340. ## <title>${module.name} API documentation</title>
  341. ## <meta name="description" content="${module.docstring | glimpse, trim, h}" />
  342. ## % endif
  343. <link rel="preload stylesheet" as="style" href="https://cdnjs.cloudflare.com/ajax/libs/10up-sanitize.css/11.0.1/sanitize.min.css" integrity="sha256-PK9q560IAAa6WVRRh76LtCaI8pjTJ2z11v0miyNNjrs=" crossorigin>
  344. <link rel="preload stylesheet" as="style" href="https://cdnjs.cloudflare.com/ajax/libs/10up-sanitize.css/11.0.1/typography.min.css" integrity="sha256-7l/o7C8jubJiy74VsKTidCy1yBkRtiUGbVkYBylBqUg=" crossorigin>
  345. % if syntax_highlighting:
  346. <link rel="stylesheet preload" as="style" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/10.1.1/styles/${hljs_style}.min.css" crossorigin>
  347. %endif
  348. <%namespace name="css" file="css.mako" />
  349. <style>${css.mobile()}</style>
  350. <style media="screen and (min-width: 700px)">${css.desktop()}</style>
  351. <style media="print">${css.print()}</style>
  352. % if google_analytics:
  353. <script>
  354. window.ga=window.ga||function(){(ga.q=ga.q||[]).push(arguments)};ga.l=+new Date;
  355. ga('create', '${google_analytics}', 'auto'); ga('send', 'pageview');
  356. </script><script async src='https://www.google-analytics.com/analytics.js'></script>
  357. % endif
  358. % if google_search_query:
  359. <link rel="preconnect" href="https://www.google.com">
  360. <script async src="https://cse.google.com/cse.js?cx=017837193012385208679:pey8ky8gdqw"></script>
  361. <style>
  362. .gsc-control-cse {padding:0 !important;margin-top:1em}
  363. body.gsc-overflow-hidden #sidebar {overflow: visible;}
  364. </style>
  365. % endif
  366. % if latex_math:
  367. <script async src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.7/latest.js?config=TeX-AMS_CHTML" integrity="sha256-kZafAc6mZvK3W3v1pHOcUix30OHQN6pU/NO2oFkqZVw=" crossorigin></script>
  368. % endif
  369. % if syntax_highlighting:
  370. <script defer src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/10.1.1/highlight.min.js" integrity="sha256-Uv3H6lx7dJmRfRvH8TH6kJD1TSK1aFcwgx+mdg3epi8=" crossorigin></script>
  371. <script>window.addEventListener('DOMContentLoaded', () => hljs.initHighlighting())</script>
  372. % endif
  373. <%include file="head.mako"/>
  374. </head>
  375. <body>
  376. <main>
  377. % if module_list:
  378. <article id="content">
  379. ${show_module_list(modules)}
  380. </article>
  381. % else:
  382. <article id="content">
  383. ${show_module(module)}
  384. </article>
  385. ${module_index(module)}
  386. % endif
  387. </main>
  388. <footer id="footer">
  389. ## <%include file="credits.mako"/>
  390. ## <p>Generated by <a href="https://pdoc3.github.io/pdoc" title="pdoc: Python API documentation generator"><cite>pdoc</cite> ${pdoc.__version__}</a>.</p>
  391. </footer>
  392. % if http_server and module: ## Auto-reload on file change in dev mode
  393. <script>
  394. setInterval(() =>
  395. fetch(window.location.href, {
  396. method: "HEAD",
  397. cache: "no-store",
  398. headers: {"If-None-Match": "${os.stat(module.obj.__file__).st_mtime}"},
  399. }).then(response => response.ok && window.location.reload()), 700);
  400. </script>
  401. % endif
  402. </body>
  403. </html>
  404. <!-- add github corner -->
  405. <a href="https://github.com/csinva/imodels" class="github-corner" aria-label="View source on GitHub"><svg width="120" height="120" viewBox="0 0 250 250" style="fill:#70B7FD; color:#fff; position: absolute; top: 0; border: 0; right: 0;" aria-hidden="true"><path d="M0,0 L115,115 L130,115 L142,142 L250,250 L250,0 Z"></path><path d="m128.3,109.0 c113.8,99.7 119.0,89.6 119.0,89.6 c122.0,82.7 120.5,78.6 120.5,78.6 c119.2,72.0 123.4,76.3 123.4,76.3 c127.3,80.9 125.5,87.3 125.5,87.3 c122.9,97.6 130.6,101.9 134.4,103.2" fill="currentcolor" style="transform-origin: 130px 106px;" class="octo-arm"></path><path d="M115.0,115.0 C114.9,115.1 118.7,116.5 119.8,115.4 L133.7,101.6 C136.9,99.2 139.9,98.4 142.2,98.6 C133.8,88.0 127.5,74.4 143.8,58.0 C148.5,53.4 154.0,51.2 159.7,51.0 C160.3,49.4 163.2,43.6 171.4,40.1 C171.4,40.1 176.1,42.5 178.8,56.2 C183.1,58.6 187.2,61.8 190.9,65.4 C194.5,69.0 197.7,73.2 200.1,77.6 C213.8,80.2 216.3,84.9 216.3,84.9 C212.7,93.1 206.9,96.0 205.4,96.6 C205.1,102.4 203.0,107.8 198.3,112.5 C181.9,128.9 168.3,122.5 157.7,114.1 C157.9,116.9 156.7,120.9 152.7,124.9 L141.0,136.5 C139.8,137.7 141.6,141.9 141.8,141.8 Z" fill="currentColor" class="octo-body"></path></svg></a><style>.github-corner:hover .octo-arm{animation:octocat-wave 560ms ease-in-out}@keyframes octocat-wave{0%,100%{transform:rotate(0)}20%,60%{transform:rotate(-25deg)}40%,80%{transform:rotate(10deg)}}@media (max-width:500px){.github-corner:hover .octo-arm{animation:none}.github-corner .octo-arm{animation:octocat-wave 560ms ease-in-out}}</style>
  406. <!-- add wave animation stylesheet -->
  407. ## <link href="wave.css" rel="stylesheet">
  408. <link rel="stylesheet" href="github.css">
Tip!

Press p or to see the previous file or, n or to see the next file

Comments

Loading...