code-battles 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.md +7 -0
- package/README.md +39 -0
- package/dist/cjs/index.js +18532 -0
- package/dist/cjs/styles.css +5 -0
- package/dist/cjs/types/CodeBattles.d.ts +10 -0
- package/dist/cjs/types/components/App.d.ts +7 -0
- package/dist/cjs/types/components/AutoScrollButton.d.ts +3 -0
- package/dist/cjs/types/components/LogViewer.d.ts +6 -0
- package/dist/cjs/types/components/Login.d.ts +3 -0
- package/dist/cjs/types/components/ShowLogsButtons.d.ts +8 -0
- package/dist/cjs/types/components/TimerAndVolume.d.ts +3 -0
- package/dist/cjs/types/components/TopPane.d.ts +3 -0
- package/dist/cjs/types/components/blocks/AdminBlock.d.ts +3 -0
- package/dist/cjs/types/components/blocks/Block.d.ts +8 -0
- package/dist/cjs/types/components/blocks/BotSelector.d.ts +10 -0
- package/dist/cjs/types/components/blocks/PickBotBlock.d.ts +3 -0
- package/dist/cjs/types/components/blocks/RunSimulationBlock.d.ts +3 -0
- package/dist/cjs/types/components/blocks/TournamentBlock.d.ts +8 -0
- package/dist/cjs/types/components/blocks/UploadBlock.d.ts +3 -0
- package/dist/cjs/types/components/index.d.ts +3 -0
- package/dist/cjs/types/components/pages/HomePage.d.ts +6 -0
- package/dist/cjs/types/components/pages/NotFoundPage.d.ts +3 -0
- package/dist/cjs/types/components/pages/RoundPage.d.ts +3 -0
- package/dist/cjs/types/components/pages/SettingsPage.d.ts +3 -0
- package/dist/cjs/types/components/pages/SimulationPage.d.ts +3 -0
- package/dist/cjs/types/components/pages/ViewAPIPage.d.ts +3 -0
- package/dist/cjs/types/configuration.d.ts +35 -0
- package/dist/cjs/types/hooks.d.ts +17 -0
- package/dist/cjs/types/index.d.ts +10 -0
- package/dist/cjs/types/initialize.d.ts +5 -0
- package/dist/cjs/types/particles.d.ts +2 -0
- package/dist/cjs/types/utilities.d.ts +14 -0
- package/dist/code_battles/__init__.py +13 -0
- package/dist/code_battles/battles.py +531 -0
- package/dist/code_battles/js.pyi +114 -0
- package/dist/code_battles/pyodide/ffi/__init__.pyi +2 -0
- package/dist/code_battles/pyscript/ffi/__init__.pyi +3 -0
- package/dist/code_battles/utilities.py +200 -0
- package/dist/esm/index.js +18528 -0
- package/dist/esm/styles.css +5 -0
- package/dist/esm/types/CodeBattles.d.ts +10 -0
- package/dist/esm/types/components/App.d.ts +7 -0
- package/dist/esm/types/components/AutoScrollButton.d.ts +3 -0
- package/dist/esm/types/components/LogViewer.d.ts +6 -0
- package/dist/esm/types/components/Login.d.ts +3 -0
- package/dist/esm/types/components/ShowLogsButtons.d.ts +8 -0
- package/dist/esm/types/components/TimerAndVolume.d.ts +3 -0
- package/dist/esm/types/components/TopPane.d.ts +3 -0
- package/dist/esm/types/components/blocks/AdminBlock.d.ts +3 -0
- package/dist/esm/types/components/blocks/Block.d.ts +8 -0
- package/dist/esm/types/components/blocks/BotSelector.d.ts +10 -0
- package/dist/esm/types/components/blocks/PickBotBlock.d.ts +3 -0
- package/dist/esm/types/components/blocks/RunSimulationBlock.d.ts +3 -0
- package/dist/esm/types/components/blocks/TournamentBlock.d.ts +8 -0
- package/dist/esm/types/components/blocks/UploadBlock.d.ts +3 -0
- package/dist/esm/types/components/index.d.ts +3 -0
- package/dist/esm/types/components/pages/HomePage.d.ts +6 -0
- package/dist/esm/types/components/pages/NotFoundPage.d.ts +3 -0
- package/dist/esm/types/components/pages/RoundPage.d.ts +3 -0
- package/dist/esm/types/components/pages/SettingsPage.d.ts +3 -0
- package/dist/esm/types/components/pages/SimulationPage.d.ts +3 -0
- package/dist/esm/types/components/pages/ViewAPIPage.d.ts +3 -0
- package/dist/esm/types/configuration.d.ts +35 -0
- package/dist/esm/types/hooks.d.ts +17 -0
- package/dist/esm/types/index.d.ts +10 -0
- package/dist/esm/types/initialize.d.ts +5 -0
- package/dist/esm/types/particles.d.ts +2 -0
- package/dist/esm/types/utilities.d.ts +14 -0
- package/dist/index.d.ts +44 -0
- package/dist/pdoc-template/custom.css +22 -0
- package/dist/pdoc-template/module.html.jinja2 +306 -0
- package/dist/pdoc-template/syntax-highlighting.css +248 -0
- package/dist/pyscript/codemirror-BEtcgaoQ.js +2 -0
- package/dist/pyscript/codemirror-BEtcgaoQ.js.map +1 -0
- package/dist/pyscript/codemirror_commands-DDxffOmd.js +2 -0
- package/dist/pyscript/codemirror_commands-DDxffOmd.js.map +1 -0
- package/dist/pyscript/codemirror_lang-python-CnWnFqxD.js +2 -0
- package/dist/pyscript/codemirror_lang-python-CnWnFqxD.js.map +1 -0
- package/dist/pyscript/codemirror_language-CjmvX4ix.js +2 -0
- package/dist/pyscript/codemirror_language-CjmvX4ix.js.map +1 -0
- package/dist/pyscript/codemirror_state-D1qTXrff.js +2 -0
- package/dist/pyscript/codemirror_state-D1qTXrff.js.map +1 -0
- package/dist/pyscript/codemirror_view-DVb8uYMr.js +2 -0
- package/dist/pyscript/codemirror_view-DVb8uYMr.js.map +1 -0
- package/dist/pyscript/core-CZGzC87D.js +2 -0
- package/dist/pyscript/core-CZGzC87D.js.map +1 -0
- package/dist/pyscript/core.css +1 -0
- package/dist/pyscript/core.js +2 -0
- package/dist/pyscript/core.js.map +1 -0
- package/dist/pyscript/deprecations-manager-B8Tn4H-t.js +2 -0
- package/dist/pyscript/deprecations-manager-B8Tn4H-t.js.map +1 -0
- package/dist/pyscript/error-Dmba-E9f.js +2 -0
- package/dist/pyscript/error-Dmba-E9f.js.map +1 -0
- package/dist/pyscript/index-S1Do43bx.js +2 -0
- package/dist/pyscript/index-S1Do43bx.js.map +1 -0
- package/dist/pyscript/mpy-BnYOGs9W.js +2 -0
- package/dist/pyscript/mpy-BnYOGs9W.js.map +1 -0
- package/dist/pyscript/py-D2NmpN63.js +2 -0
- package/dist/pyscript/py-D2NmpN63.js.map +1 -0
- package/dist/pyscript/py-editor-Czy2e-Jt.js +2 -0
- package/dist/pyscript/py-editor-Czy2e-Jt.js.map +1 -0
- package/dist/pyscript/py-terminal-w87wZryi.js +2 -0
- package/dist/pyscript/py-terminal-w87wZryi.js.map +1 -0
- package/dist/pyscript/storage.js +2 -0
- package/dist/pyscript/storage.js.map +1 -0
- package/dist/pyscript/toml-CvAfdf9_.js +3 -0
- package/dist/pyscript/toml-CvAfdf9_.js.map +1 -0
- package/dist/pyscript/toml-DiUM0_qs.js +3 -0
- package/dist/pyscript/toml-DiUM0_qs.js.map +1 -0
- package/dist/pyscript/xterm-BY7uk_OU.js +2 -0
- package/dist/pyscript/xterm-BY7uk_OU.js.map +1 -0
- package/dist/pyscript/xterm-readline-CZfBw7ic.js +2 -0
- package/dist/pyscript/xterm-readline-CZfBw7ic.js.map +1 -0
- package/dist/pyscript/xterm.css +7 -0
- package/dist/pyscript/xterm_addon-fit--gyF3PcZ.js +2 -0
- package/dist/pyscript/xterm_addon-fit--gyF3PcZ.js.map +1 -0
- package/dist/pyscript/xterm_addon-web-links-Cnej-nJ6.js +2 -0
- package/dist/pyscript/xterm_addon-web-links-Cnej-nJ6.js.map +1 -0
- package/dist/pyscript/zip-DrwYHuF9.js +2 -0
- package/dist/pyscript/zip-DrwYHuF9.js.map +1 -0
- package/dist/webfonts/fa-brands-400.ttf +0 -0
- package/dist/webfonts/fa-brands-400.woff2 +0 -0
- package/dist/webfonts/fa-regular-400.ttf +0 -0
- package/dist/webfonts/fa-regular-400.woff2 +0 -0
- package/dist/webfonts/fa-solid-900.ttf +0 -0
- package/dist/webfonts/fa-solid-900.woff2 +0 -0
- package/dist/webfonts/fa-v4compatibility.ttf +0 -0
- package/dist/webfonts/fa-v4compatibility.woff2 +0 -0
- package/package.json +70 -0
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { DayOfWeek } from '@mantine/dates';
|
|
3
|
+
import { Auth } from 'firebase/auth';
|
|
4
|
+
import { Firestore } from 'firebase/firestore';
|
|
5
|
+
|
|
6
|
+
interface CodeBattlesRequiredConfiguration {
|
|
7
|
+
firebase: any;
|
|
8
|
+
maps: string[];
|
|
9
|
+
}
|
|
10
|
+
interface CodeBattlesDatesConfiguration {
|
|
11
|
+
locale?: string;
|
|
12
|
+
firstDayOfWeek?: DayOfWeek;
|
|
13
|
+
weekendDays?: DayOfWeek[];
|
|
14
|
+
timezone?: string;
|
|
15
|
+
}
|
|
16
|
+
interface CodeBattlesOptionalConfiguration {
|
|
17
|
+
primaryColor: string;
|
|
18
|
+
admin: string;
|
|
19
|
+
title: string;
|
|
20
|
+
firestore: Firestore;
|
|
21
|
+
authentication: Auth;
|
|
22
|
+
runningCountOptions?: number[];
|
|
23
|
+
dates?: CodeBattlesDatesConfiguration;
|
|
24
|
+
}
|
|
25
|
+
interface CodeBattlesConfiguration extends CodeBattlesRequiredConfiguration, Partial<CodeBattlesOptionalConfiguration> {
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
interface Props$1 {
|
|
29
|
+
blocks?: React.ReactNode;
|
|
30
|
+
routes: Record<string, React.ReactNode>;
|
|
31
|
+
configuration: CodeBattlesConfiguration;
|
|
32
|
+
}
|
|
33
|
+
declare const CodeBattles: React.FC<Props$1>;
|
|
34
|
+
|
|
35
|
+
interface Props extends React.PropsWithChildren {
|
|
36
|
+
title: string;
|
|
37
|
+
logo: string;
|
|
38
|
+
inline?: boolean;
|
|
39
|
+
}
|
|
40
|
+
declare const Block: React.FC<Props>;
|
|
41
|
+
|
|
42
|
+
declare const initialize: () => void;
|
|
43
|
+
|
|
44
|
+
export { Block, CodeBattles, type CodeBattlesConfiguration, initialize };
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
@media (prefers-color-scheme: dark) {
|
|
2
|
+
:root {
|
|
3
|
+
--pdoc-background: #212529;
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
.pdoc {
|
|
7
|
+
--text: #f7f7f7;
|
|
8
|
+
--muted: #9d9d9d;
|
|
9
|
+
--link: #58a6ff;
|
|
10
|
+
--link-hover: #3989ff;
|
|
11
|
+
--code: #333;
|
|
12
|
+
--active: #555;
|
|
13
|
+
|
|
14
|
+
--accent: #343434;
|
|
15
|
+
--accent2: #555;
|
|
16
|
+
|
|
17
|
+
--nav-hover: rgba(0, 0, 0, 0.1);
|
|
18
|
+
--name: #77c1ff;
|
|
19
|
+
--def: #0cdd0c;
|
|
20
|
+
--annotation: #00c037;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
@@ -0,0 +1,306 @@
|
|
|
1
|
+
{% extends "frame.html.jinja2" %}
|
|
2
|
+
{% block title %}{{ module.modulename }} API documentation{% endblock %}
|
|
3
|
+
{% block nav %}
|
|
4
|
+
{% block module_list_link %}
|
|
5
|
+
{% set parentmodule = ".".join(module.modulename.split(".")[:-1]) %}
|
|
6
|
+
{% if parentmodule and parentmodule in all_modules %}
|
|
7
|
+
<a class="pdoc-button module-list-button" href="../{{ parentmodule.split(".")[-1] }}.html">
|
|
8
|
+
{% include "resources/box-arrow-in-left.svg" %}
|
|
9
|
+
|
|
10
|
+
{{- parentmodule -}}
|
|
11
|
+
</a>
|
|
12
|
+
{% elif not root_module_name %}
|
|
13
|
+
<a class="pdoc-button module-list-button" href="{{ "../" * module.modulename.count(".") }}index.html">
|
|
14
|
+
{% include "resources/box-arrow-in-left.svg" %}
|
|
15
|
+
|
|
16
|
+
Module Index
|
|
17
|
+
</a>
|
|
18
|
+
{% endif %}
|
|
19
|
+
{% endblock %}
|
|
20
|
+
|
|
21
|
+
{% block nav_title %}
|
|
22
|
+
{% if logo %}
|
|
23
|
+
{% if logo_link %}<a href="{{ logo_link }}">{% endif %}
|
|
24
|
+
<img src="{{ logo }}" class="logo" alt="project logo"/>
|
|
25
|
+
{% if logo_link %}</a>{% endif %}
|
|
26
|
+
{% endif %}
|
|
27
|
+
{% endblock %}
|
|
28
|
+
|
|
29
|
+
{% block search_box %}
|
|
30
|
+
{% if search and all_modules|length > 1 %}
|
|
31
|
+
{# we set a pattern here so that we can use the :valid CSS selector #}
|
|
32
|
+
<input type="search" placeholder="Search..." role="searchbox" aria-label="search"
|
|
33
|
+
pattern=".+" required>
|
|
34
|
+
{% endif %}
|
|
35
|
+
{% endblock %}
|
|
36
|
+
|
|
37
|
+
{% block nav_index %}
|
|
38
|
+
{% set index = module.docstring | to_markdown | to_html | attr("toc_html") %}
|
|
39
|
+
{% if index %}
|
|
40
|
+
<h2>Contents</h2>
|
|
41
|
+
{{ index | safe }}
|
|
42
|
+
{% endif %}
|
|
43
|
+
{% endblock %}
|
|
44
|
+
|
|
45
|
+
{% block nav_submodules %}
|
|
46
|
+
{% if module.submodules %}
|
|
47
|
+
<h2>Submodules</h2>
|
|
48
|
+
<ul>
|
|
49
|
+
{% for submodule in module.submodules if is_public(submodule) | trim %}
|
|
50
|
+
<li>{{ submodule.taken_from | link(text=submodule.name) }}</li>
|
|
51
|
+
{% endfor %}
|
|
52
|
+
</ul>
|
|
53
|
+
{% endif %}
|
|
54
|
+
{% endblock %}
|
|
55
|
+
|
|
56
|
+
{% block nav_members %}
|
|
57
|
+
{% if module.members %}
|
|
58
|
+
<h2>API Documentation</h2>
|
|
59
|
+
{{ nav_members(module.members.values()) }}
|
|
60
|
+
{% endif %}
|
|
61
|
+
{% endblock %}
|
|
62
|
+
|
|
63
|
+
{% block nav_footer %}
|
|
64
|
+
{% if footer_text %}
|
|
65
|
+
<footer>{{ footer_text }}</footer>
|
|
66
|
+
{% endif %}
|
|
67
|
+
{% endblock %}
|
|
68
|
+
|
|
69
|
+
{% block attribution %}
|
|
70
|
+
<a class="attribution" title="pdoc: Python API documentation generator" href="https://pdoc.dev" target="_blank">
|
|
71
|
+
built with <span class="visually-hidden">pdoc</span><img
|
|
72
|
+
alt="pdoc logo"
|
|
73
|
+
src="data:image/svg+xml,
|
|
74
|
+
{%- filter urlencode %}{% include "resources/pdoc-logo.svg" %}{% endfilter %}"/>
|
|
75
|
+
</a>
|
|
76
|
+
{% endblock %}
|
|
77
|
+
{% endblock nav %}
|
|
78
|
+
{% block content %}
|
|
79
|
+
<main class="pdoc">
|
|
80
|
+
{% block module_info %}
|
|
81
|
+
<section class="module-info">
|
|
82
|
+
{% block edit_button %}
|
|
83
|
+
{% if edit_url %}
|
|
84
|
+
{% if "github.com" in edit_url %}
|
|
85
|
+
{% set edit_text = "Edit on GitHub" %}
|
|
86
|
+
{% elif "gitlab" in edit_url %}
|
|
87
|
+
{% set edit_text = "Edit on GitLab" %}
|
|
88
|
+
{% else %}
|
|
89
|
+
{% set edit_text = "Edit Source" %}
|
|
90
|
+
{% endif %}
|
|
91
|
+
<a class="pdoc-button git-button" href="{{ edit_url }}">{{ edit_text }}</a>
|
|
92
|
+
{% endif %}
|
|
93
|
+
{% endblock %}
|
|
94
|
+
<h1 class="modulename">Code Battles API</h1>
|
|
95
|
+
{{ docstring(module) }}
|
|
96
|
+
{{ view_source_state(module) }}
|
|
97
|
+
{{ view_source_button(module) }}
|
|
98
|
+
{{ view_source_code(module) }}
|
|
99
|
+
</section>
|
|
100
|
+
{% endblock %}
|
|
101
|
+
{% block module_contents %}
|
|
102
|
+
{% for m in module.flattened_own_members if is_public(m) | trim %}
|
|
103
|
+
<section id="{{ m.qualname or m.name }}">
|
|
104
|
+
{{ member(m) }}
|
|
105
|
+
{% if m.kind == "class" %}
|
|
106
|
+
{% for m in m.own_members if m.kind != "class" and is_public(m) | trim %}
|
|
107
|
+
<div id="{{ m.qualname }}" class="classattr">
|
|
108
|
+
{{ member(m) }}
|
|
109
|
+
</div>
|
|
110
|
+
{% endfor %}
|
|
111
|
+
{% set inherited_members = inherited(m) | trim %}
|
|
112
|
+
{% if inherited_members %}
|
|
113
|
+
<div class="inherited">
|
|
114
|
+
<h5>Inherited Members</h5>
|
|
115
|
+
<dl>
|
|
116
|
+
{{ inherited_members }}
|
|
117
|
+
</dl>
|
|
118
|
+
</div>
|
|
119
|
+
{% endif %}
|
|
120
|
+
{% endif %}
|
|
121
|
+
</section>
|
|
122
|
+
{% endfor %}
|
|
123
|
+
{% endblock %}
|
|
124
|
+
</main>
|
|
125
|
+
{% if mtime %}
|
|
126
|
+
{% include "livereload.html.jinja2" %}
|
|
127
|
+
{% endif %}
|
|
128
|
+
{% block search_js %}
|
|
129
|
+
{% if search and all_modules|length > 1 %}
|
|
130
|
+
{% include "search.html.jinja2" %}
|
|
131
|
+
{% endif %}
|
|
132
|
+
{% endblock %}
|
|
133
|
+
{% endblock content %}
|
|
134
|
+
{#
|
|
135
|
+
End of content, beginning of helper macros.
|
|
136
|
+
See https://pdoc.dev/docs/pdoc/render_helpers.html#DefaultMacroExtension for an explanation of defaultmacro.
|
|
137
|
+
#}
|
|
138
|
+
{% defaultmacro bases(cls) %}
|
|
139
|
+
{%- if cls.bases -%}
|
|
140
|
+
<wbr>(
|
|
141
|
+
{%- for base in cls.bases -%}
|
|
142
|
+
<span class="base">{{ base[:2] | link(text=base[2]) }}</span>
|
|
143
|
+
{%- if loop.nextitem %}, {% endif %}
|
|
144
|
+
{%- endfor -%}
|
|
145
|
+
)
|
|
146
|
+
{%- endif -%}
|
|
147
|
+
{% enddefaultmacro %}
|
|
148
|
+
{% defaultmacro default_value(var) -%}
|
|
149
|
+
{%- if var.default_value_str %}
|
|
150
|
+
=
|
|
151
|
+
{% if var.default_value_str | length > 100 -%}
|
|
152
|
+
<input id="{{ var.qualname }}-view-value" class="view-value-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1">
|
|
153
|
+
<label class="view-value-button pdoc-button" for="{{ var.qualname }}-view-value"></label>
|
|
154
|
+
{%- endif -%}
|
|
155
|
+
<span class="default_value">{{ var.default_value_str | escape | linkify }}</span>
|
|
156
|
+
{%- endif -%}
|
|
157
|
+
{% enddefaultmacro %}
|
|
158
|
+
{% defaultmacro annotation(var) %}
|
|
159
|
+
{%- if var.annotation_str -%}
|
|
160
|
+
<span class="annotation">{{ var.annotation_str | escape | linkify }}</span>
|
|
161
|
+
{%- endif -%}
|
|
162
|
+
{% enddefaultmacro %}
|
|
163
|
+
{% defaultmacro decorators(doc) %}
|
|
164
|
+
{% for d in doc.decorators if not d.startswith("@_") %}
|
|
165
|
+
<div class="decorator">{{ d }}</div>
|
|
166
|
+
{% endfor %}
|
|
167
|
+
{% enddefaultmacro %}
|
|
168
|
+
{% defaultmacro function(fn) -%}
|
|
169
|
+
{{ decorators(fn) }}
|
|
170
|
+
{% if fn.name == "__init__" %}
|
|
171
|
+
<span class="name">{{ ".".join(fn.qualname.split(".")[:-1]) }}</span>
|
|
172
|
+
{{- fn.signature_without_self | format_signature(colon=False) | linkify }}
|
|
173
|
+
{% else %}
|
|
174
|
+
<span class="def">{{ fn.funcdef }}</span>
|
|
175
|
+
<span class="name">{{ fn.name }}</span>
|
|
176
|
+
{{- fn.signature | format_signature(colon=True) | linkify }}
|
|
177
|
+
{% endif %}
|
|
178
|
+
{% enddefaultmacro %}
|
|
179
|
+
{% defaultmacro variable(var) -%}
|
|
180
|
+
<span class="name">{{ var.name }}</span>{{ annotation(var) }}{{ default_value(var) }}
|
|
181
|
+
{% enddefaultmacro %}
|
|
182
|
+
{% defaultmacro submodule(mod) -%}
|
|
183
|
+
<span class="name">{{ mod.taken_from | link }}</span>
|
|
184
|
+
{% enddefaultmacro %}
|
|
185
|
+
{% defaultmacro class(cls) -%}
|
|
186
|
+
{{ decorators(cls) }}
|
|
187
|
+
<span class="def">class</span>
|
|
188
|
+
<span class="name">{{ cls.qualname }}</span>
|
|
189
|
+
{{- bases(cls) -}}:
|
|
190
|
+
{% enddefaultmacro %}
|
|
191
|
+
{% defaultmacro member(doc) %}
|
|
192
|
+
{{- view_source_state(doc) -}}
|
|
193
|
+
<div class="attr {{ doc.kind }}">
|
|
194
|
+
{% if doc.kind == "class" %}
|
|
195
|
+
{{ class(doc) }}
|
|
196
|
+
{% elif doc.kind == "function" %}
|
|
197
|
+
{{ function(doc) }}
|
|
198
|
+
{% elif doc.kind == "module" %}
|
|
199
|
+
{{ submodule(doc) }}
|
|
200
|
+
{% else %}
|
|
201
|
+
{{ variable(doc) }}
|
|
202
|
+
{% endif %}
|
|
203
|
+
{{ view_source_button(doc) }}
|
|
204
|
+
</div>
|
|
205
|
+
<a class="headerlink" href="#{{ doc.qualname or doc.name }}"></a>
|
|
206
|
+
{{ view_source_code(doc) }}
|
|
207
|
+
{{ docstring(doc) }}
|
|
208
|
+
{% enddefaultmacro %}
|
|
209
|
+
{% defaultmacro docstring(var) %}
|
|
210
|
+
{% if var.docstring %}
|
|
211
|
+
<div class="docstring">{{ var.docstring | to_markdown | to_html | linkify(namespace=var.qualname) }}</div>
|
|
212
|
+
{% endif %}
|
|
213
|
+
{% enddefaultmacro %}
|
|
214
|
+
{% defaultmacro nav_members(members) %}
|
|
215
|
+
<ul class="memberlist">
|
|
216
|
+
{% for m in members if is_public(m) | trim %}
|
|
217
|
+
<li>
|
|
218
|
+
{% if m.kind == "class" %}
|
|
219
|
+
<a class="class" href="#{{ m.qualname }}">{{ m.qualname }}</a>
|
|
220
|
+
{% if m.own_members %}
|
|
221
|
+
{{ nav_members(m.own_members) | indent(12) }}
|
|
222
|
+
{% endif %}
|
|
223
|
+
{% elif m.kind == "module" %}
|
|
224
|
+
<a class="module" href="#{{ m.name }}">{{ m.name }}</a>
|
|
225
|
+
{% elif m.name == "__init__" %}
|
|
226
|
+
<a class="function" href="#{{ m.qualname }}">{{ m.qualname.split(".")[-2] }}</a>
|
|
227
|
+
{% else %}
|
|
228
|
+
<a class="{{ m.kind }}" href="#{{ m.qualname }}">{{ m.name }}</a>
|
|
229
|
+
{% endif %}
|
|
230
|
+
</li>
|
|
231
|
+
{% endfor %}
|
|
232
|
+
</ul>
|
|
233
|
+
{% enddefaultmacro %}
|
|
234
|
+
{% defaultmacro is_public(doc) %}
|
|
235
|
+
{#
|
|
236
|
+
This macro is a bit unconventional in that its output is not rendered, but treated as a boolean:
|
|
237
|
+
Returning no text is interpreted as false, returning any other text is iterpreted as true.
|
|
238
|
+
Implementing this as a macro makes it very easy to override with a custom template, see
|
|
239
|
+
https://github.com/mitmproxy/pdoc/tree/main/examples/custom-template.
|
|
240
|
+
#}
|
|
241
|
+
{% if doc.name == "__init__" and (doc.docstring or (doc.kind == "function" and doc.signature_without_self.parameters)) %}
|
|
242
|
+
{# show constructors that have a docstring or at least one extra argument #}
|
|
243
|
+
true
|
|
244
|
+
{% elif doc.name == "__doc__" %}
|
|
245
|
+
{# We don't want to document __doc__ itself, https://github.com/mitmproxy/pdoc/issues/235 #}
|
|
246
|
+
{% elif doc.kind == "module" and doc.fullname not in all_modules %}
|
|
247
|
+
{# Skip modules that were manually excluded, https://github.com/mitmproxy/pdoc/issues/334 #}
|
|
248
|
+
{% elif (doc.qualname or doc.name) is in(module.obj.__all__ or []) %}
|
|
249
|
+
{# members starting with an underscore are still public if mentioned in __all__ #}
|
|
250
|
+
true
|
|
251
|
+
{% elif not doc.name.startswith("_") and (doc.kind != "variable" or doc.is_enum_member or doc.docstring) %}
|
|
252
|
+
{# members not starting with an underscore are considered public by default #}
|
|
253
|
+
true
|
|
254
|
+
{% endif %}
|
|
255
|
+
{% enddefaultmacro %}
|
|
256
|
+
{# fmt: off #}
|
|
257
|
+
{% defaultmacro inherited(cls) %}
|
|
258
|
+
{% for base, members in cls.inherited_members.items() %}
|
|
259
|
+
{% set m = None %}{# workaround for https://github.com/pallets/jinja/issues/1427 #}
|
|
260
|
+
{% set member_html %}
|
|
261
|
+
{% for m in members if is_public(m) | trim %}
|
|
262
|
+
<dd id="{{ m.qualname }}" class="{{ m.kind }}">
|
|
263
|
+
{{- m.taken_from | link(text=m.name.replace("__init__",base[1])) -}}
|
|
264
|
+
</dd>
|
|
265
|
+
{% endfor %}
|
|
266
|
+
{% endset %}
|
|
267
|
+
{# we may not have any public members, in which case we don't want to print anything. #}
|
|
268
|
+
{% if member_html %}
|
|
269
|
+
<div><dt>{{ base | link }}</dt>
|
|
270
|
+
{{ member_html }}
|
|
271
|
+
</div>
|
|
272
|
+
{% endif %}
|
|
273
|
+
{% endfor %}
|
|
274
|
+
{% enddefaultmacro %}
|
|
275
|
+
{# fmt: on #}
|
|
276
|
+
{% defaultmacro view_source_state(doc) %}
|
|
277
|
+
{% if show_source and doc.source %}
|
|
278
|
+
<input id="{{ doc.qualname or "mod-" + doc.name }}-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1">
|
|
279
|
+
{% endif %}
|
|
280
|
+
{% enddefaultmacro %}
|
|
281
|
+
{% defaultmacro view_source_button(doc) %}
|
|
282
|
+
{% if show_source and doc.source %}
|
|
283
|
+
<label class="view-source-button" for="{{ doc.qualname or "mod-" + doc.name }}-view-source"><span>View Source</span></label>
|
|
284
|
+
{% endif %}
|
|
285
|
+
{% enddefaultmacro %}
|
|
286
|
+
{% defaultmacro view_source_code(doc) %}
|
|
287
|
+
{% if show_source and doc.source %}
|
|
288
|
+
{{ doc | highlight }}
|
|
289
|
+
{% endif %}
|
|
290
|
+
{% enddefaultmacro %}
|
|
291
|
+
{% defaultmacro module_name() %}
|
|
292
|
+
<h1 class="modulename">
|
|
293
|
+
{% set parts = module.modulename.split(".") %}
|
|
294
|
+
{% for part in parts %}
|
|
295
|
+
{%- set fullname = ".".join(parts[:loop.index]) -%}
|
|
296
|
+
{%- if fullname in all_modules and fullname != module.modulename -%}
|
|
297
|
+
<a href="./{{ "../" * loop.revindex0 }}{{ part }}.html">{{ part }}</a>
|
|
298
|
+
{%- else -%}
|
|
299
|
+
{{ part }}
|
|
300
|
+
{%- endif -%}
|
|
301
|
+
{%- if loop.nextitem -%}
|
|
302
|
+
<wbr>.
|
|
303
|
+
{%- endif -%}
|
|
304
|
+
{% endfor %}
|
|
305
|
+
</h1>
|
|
306
|
+
{% enddefaultmacro %}
|
|
@@ -0,0 +1,248 @@
|
|
|
1
|
+
@media (prefers-color-scheme: dark) {
|
|
2
|
+
/* monokai color scheme, see pdoc/template/README.md */
|
|
3
|
+
pre {
|
|
4
|
+
line-height: 124%;
|
|
5
|
+
}
|
|
6
|
+
span.linenos {
|
|
7
|
+
color: inherit;
|
|
8
|
+
background-color: transparent;
|
|
9
|
+
padding-left: 5px;
|
|
10
|
+
padding-right: 20px;
|
|
11
|
+
}
|
|
12
|
+
.pdoc-code .hll {
|
|
13
|
+
background-color: #49483e;
|
|
14
|
+
}
|
|
15
|
+
.pdoc-code {
|
|
16
|
+
background: #272822;
|
|
17
|
+
color: #f8f8f2;
|
|
18
|
+
}
|
|
19
|
+
.pdoc-code .c {
|
|
20
|
+
color: #75715e;
|
|
21
|
+
} /* Comment */
|
|
22
|
+
.pdoc-code .err {
|
|
23
|
+
color: #960050;
|
|
24
|
+
background-color: #1e0010;
|
|
25
|
+
} /* Error */
|
|
26
|
+
.pdoc-code .esc {
|
|
27
|
+
color: #f8f8f2;
|
|
28
|
+
} /* Escape */
|
|
29
|
+
.pdoc-code .g {
|
|
30
|
+
color: #f8f8f2;
|
|
31
|
+
} /* Generic */
|
|
32
|
+
.pdoc-code .k {
|
|
33
|
+
color: #66d9ef;
|
|
34
|
+
} /* Keyword */
|
|
35
|
+
.pdoc-code .l {
|
|
36
|
+
color: #ae81ff;
|
|
37
|
+
} /* Literal */
|
|
38
|
+
.pdoc-code .n {
|
|
39
|
+
color: #f8f8f2;
|
|
40
|
+
} /* Name */
|
|
41
|
+
.pdoc-code .o {
|
|
42
|
+
color: #f92672;
|
|
43
|
+
} /* Operator */
|
|
44
|
+
.pdoc-code .x {
|
|
45
|
+
color: #f8f8f2;
|
|
46
|
+
} /* Other */
|
|
47
|
+
.pdoc-code .p {
|
|
48
|
+
color: #f8f8f2;
|
|
49
|
+
} /* Punctuation */
|
|
50
|
+
.pdoc-code .ch {
|
|
51
|
+
color: #75715e;
|
|
52
|
+
} /* Comment.Hashbang */
|
|
53
|
+
.pdoc-code .cm {
|
|
54
|
+
color: #75715e;
|
|
55
|
+
} /* Comment.Multiline */
|
|
56
|
+
.pdoc-code .cp {
|
|
57
|
+
color: #75715e;
|
|
58
|
+
} /* Comment.Preproc */
|
|
59
|
+
.pdoc-code .cpf {
|
|
60
|
+
color: #75715e;
|
|
61
|
+
} /* Comment.PreprocFile */
|
|
62
|
+
.pdoc-code .c1 {
|
|
63
|
+
color: #75715e;
|
|
64
|
+
} /* Comment.Single */
|
|
65
|
+
.pdoc-code .cs {
|
|
66
|
+
color: #75715e;
|
|
67
|
+
} /* Comment.Special */
|
|
68
|
+
.pdoc-code .gd {
|
|
69
|
+
color: #f92672;
|
|
70
|
+
} /* Generic.Deleted */
|
|
71
|
+
.pdoc-code .ge {
|
|
72
|
+
color: #f8f8f2;
|
|
73
|
+
font-style: italic;
|
|
74
|
+
} /* Generic.Emph */
|
|
75
|
+
.pdoc-code .gr {
|
|
76
|
+
color: #f8f8f2;
|
|
77
|
+
} /* Generic.Error */
|
|
78
|
+
.pdoc-code .gh {
|
|
79
|
+
color: #f8f8f2;
|
|
80
|
+
} /* Generic.Heading */
|
|
81
|
+
.pdoc-code .gi {
|
|
82
|
+
color: #a6e22e;
|
|
83
|
+
} /* Generic.Inserted */
|
|
84
|
+
.pdoc-code .go {
|
|
85
|
+
color: #66d9ef;
|
|
86
|
+
} /* Generic.Output */
|
|
87
|
+
.pdoc-code .gp {
|
|
88
|
+
color: #f92672;
|
|
89
|
+
font-weight: bold;
|
|
90
|
+
} /* Generic.Prompt */
|
|
91
|
+
.pdoc-code .gs {
|
|
92
|
+
color: #f8f8f2;
|
|
93
|
+
font-weight: bold;
|
|
94
|
+
} /* Generic.Strong */
|
|
95
|
+
.pdoc-code .gu {
|
|
96
|
+
color: #75715e;
|
|
97
|
+
} /* Generic.Subheading */
|
|
98
|
+
.pdoc-code .gt {
|
|
99
|
+
color: #f8f8f2;
|
|
100
|
+
} /* Generic.Traceback */
|
|
101
|
+
.pdoc-code .kc {
|
|
102
|
+
color: #66d9ef;
|
|
103
|
+
} /* Keyword.Constant */
|
|
104
|
+
.pdoc-code .kd {
|
|
105
|
+
color: #66d9ef;
|
|
106
|
+
} /* Keyword.Declaration */
|
|
107
|
+
.pdoc-code .kn {
|
|
108
|
+
color: #f92672;
|
|
109
|
+
} /* Keyword.Namespace */
|
|
110
|
+
.pdoc-code .kp {
|
|
111
|
+
color: #66d9ef;
|
|
112
|
+
} /* Keyword.Pseudo */
|
|
113
|
+
.pdoc-code .kr {
|
|
114
|
+
color: #66d9ef;
|
|
115
|
+
} /* Keyword.Reserved */
|
|
116
|
+
.pdoc-code .kt {
|
|
117
|
+
color: #66d9ef;
|
|
118
|
+
} /* Keyword.Type */
|
|
119
|
+
.pdoc-code .ld {
|
|
120
|
+
color: #e6db74;
|
|
121
|
+
} /* Literal.Date */
|
|
122
|
+
.pdoc-code .m {
|
|
123
|
+
color: #ae81ff;
|
|
124
|
+
} /* Literal.Number */
|
|
125
|
+
.pdoc-code .s {
|
|
126
|
+
color: #e6db74;
|
|
127
|
+
} /* Literal.String */
|
|
128
|
+
.pdoc-code .na {
|
|
129
|
+
color: #a6e22e;
|
|
130
|
+
} /* Name.Attribute */
|
|
131
|
+
.pdoc-code .nb {
|
|
132
|
+
color: #f8f8f2;
|
|
133
|
+
} /* Name.Builtin */
|
|
134
|
+
.pdoc-code .nc {
|
|
135
|
+
color: #a6e22e;
|
|
136
|
+
} /* Name.Class */
|
|
137
|
+
.pdoc-code .no {
|
|
138
|
+
color: #66d9ef;
|
|
139
|
+
} /* Name.Constant */
|
|
140
|
+
.pdoc-code .nd {
|
|
141
|
+
color: #a6e22e;
|
|
142
|
+
} /* Name.Decorator */
|
|
143
|
+
.pdoc-code .ni {
|
|
144
|
+
color: #f8f8f2;
|
|
145
|
+
} /* Name.Entity */
|
|
146
|
+
.pdoc-code .ne {
|
|
147
|
+
color: #a6e22e;
|
|
148
|
+
} /* Name.Exception */
|
|
149
|
+
.pdoc-code .nf {
|
|
150
|
+
color: #a6e22e;
|
|
151
|
+
} /* Name.Function */
|
|
152
|
+
.pdoc-code .nl {
|
|
153
|
+
color: #f8f8f2;
|
|
154
|
+
} /* Name.Label */
|
|
155
|
+
.pdoc-code .nn {
|
|
156
|
+
color: #f8f8f2;
|
|
157
|
+
} /* Name.Namespace */
|
|
158
|
+
.pdoc-code .nx {
|
|
159
|
+
color: #a6e22e;
|
|
160
|
+
} /* Name.Other */
|
|
161
|
+
.pdoc-code .py {
|
|
162
|
+
color: #f8f8f2;
|
|
163
|
+
} /* Name.Property */
|
|
164
|
+
.pdoc-code .nt {
|
|
165
|
+
color: #f92672;
|
|
166
|
+
} /* Name.Tag */
|
|
167
|
+
.pdoc-code .nv {
|
|
168
|
+
color: #f8f8f2;
|
|
169
|
+
} /* Name.Variable */
|
|
170
|
+
.pdoc-code .ow {
|
|
171
|
+
color: #f92672;
|
|
172
|
+
} /* Operator.Word */
|
|
173
|
+
.pdoc-code .w {
|
|
174
|
+
color: #f8f8f2;
|
|
175
|
+
} /* Text.Whitespace */
|
|
176
|
+
.pdoc-code .mb {
|
|
177
|
+
color: #ae81ff;
|
|
178
|
+
} /* Literal.Number.Bin */
|
|
179
|
+
.pdoc-code .mf {
|
|
180
|
+
color: #ae81ff;
|
|
181
|
+
} /* Literal.Number.Float */
|
|
182
|
+
.pdoc-code .mh {
|
|
183
|
+
color: #ae81ff;
|
|
184
|
+
} /* Literal.Number.Hex */
|
|
185
|
+
.pdoc-code .mi {
|
|
186
|
+
color: #ae81ff;
|
|
187
|
+
} /* Literal.Number.Integer */
|
|
188
|
+
.pdoc-code .mo {
|
|
189
|
+
color: #ae81ff;
|
|
190
|
+
} /* Literal.Number.Oct */
|
|
191
|
+
.pdoc-code .sa {
|
|
192
|
+
color: #e6db74;
|
|
193
|
+
} /* Literal.String.Affix */
|
|
194
|
+
.pdoc-code .sb {
|
|
195
|
+
color: #e6db74;
|
|
196
|
+
} /* Literal.String.Backtick */
|
|
197
|
+
.pdoc-code .sc {
|
|
198
|
+
color: #e6db74;
|
|
199
|
+
} /* Literal.String.Char */
|
|
200
|
+
.pdoc-code .dl {
|
|
201
|
+
color: #e6db74;
|
|
202
|
+
} /* Literal.String.Delimiter */
|
|
203
|
+
.pdoc-code .sd {
|
|
204
|
+
color: #e6db74;
|
|
205
|
+
} /* Literal.String.Doc */
|
|
206
|
+
.pdoc-code .s2 {
|
|
207
|
+
color: #e6db74;
|
|
208
|
+
} /* Literal.String.Double */
|
|
209
|
+
.pdoc-code .se {
|
|
210
|
+
color: #ae81ff;
|
|
211
|
+
} /* Literal.String.Escape */
|
|
212
|
+
.pdoc-code .sh {
|
|
213
|
+
color: #e6db74;
|
|
214
|
+
} /* Literal.String.Heredoc */
|
|
215
|
+
.pdoc-code .si {
|
|
216
|
+
color: #e6db74;
|
|
217
|
+
} /* Literal.String.Interpol */
|
|
218
|
+
.pdoc-code .sx {
|
|
219
|
+
color: #e6db74;
|
|
220
|
+
} /* Literal.String.Other */
|
|
221
|
+
.pdoc-code .sr {
|
|
222
|
+
color: #e6db74;
|
|
223
|
+
} /* Literal.String.Regex */
|
|
224
|
+
.pdoc-code .s1 {
|
|
225
|
+
color: #e6db74;
|
|
226
|
+
} /* Literal.String.Single */
|
|
227
|
+
.pdoc-code .ss {
|
|
228
|
+
color: #e6db74;
|
|
229
|
+
} /* Literal.String.Symbol */
|
|
230
|
+
.pdoc-code .bp {
|
|
231
|
+
color: #f8f8f2;
|
|
232
|
+
} /* Name.Builtin.Pseudo */
|
|
233
|
+
.pdoc-code .fm {
|
|
234
|
+
color: #a6e22e;
|
|
235
|
+
} /* Name.Function.Magic */
|
|
236
|
+
.pdoc-code .vc {
|
|
237
|
+
color: #f8f8f2;
|
|
238
|
+
} /* Name.Variable.Class */
|
|
239
|
+
.pdoc-code .vg {
|
|
240
|
+
color: #f8f8f2;
|
|
241
|
+
} /* Name.Variable.Global */
|
|
242
|
+
.pdoc-code .vi {
|
|
243
|
+
color: #f8f8f2;
|
|
244
|
+
} /* Name.Variable.Instance */
|
|
245
|
+
.pdoc-code .vm {
|
|
246
|
+
color: #f8f8f2;
|
|
247
|
+
} /* Name.Variable.Magic */
|
|
248
|
+
}
|