28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
| </td>
<td>
<li> Main function <a href="#pluginconf.plugin_meta">plugin_meta()</a> unpacks meta fields
into dictionaries.
<li> Other utility code is about module listing, relative to
<a href="#pluginconf.plugin_base">plugin_base</a> anchors.
<li> <a href="https://pypi.org/project/pluginconf/">//pypi.org/project/pluginconf/</a>
<li> <a href="https://fossil.include-once.org/pluginspec/">//fossil.include-once.org/pluginspec/</a>
</td></tr></table>
</section>
<section>
<h2 class="section-title" id="header-submodules">Sub-modules</h2>
<dl>
<dt><code class="name"><a title="pluginconf.bind" href="bind.html">pluginconf.bind</a></code></dt>
<dd>
|
|
| 28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
| </td>
<td>
<li> Main function <a href="#pluginconf.plugin_meta">plugin_meta()</a> unpacks meta fields
into dictionaries.
<li> Other utility code is about module listing, relative to
<a href="#pluginconf.plugin_base">plugin_base</a> anchors.
<li> <a href="https://pypi.org/project/pluginconf/">//pypi.org/project/pluginconf/</a>
<li><a href="https://fossil.include-once.org/pluginspec/">//fossil.include-once.org/pluginspec/</a>
</td></tr></table>
</section>
<section>
<h2 class="section-title" id="header-submodules">Sub-modules</h2>
<dl>
<dt><code class="name"><a title="pluginconf.bind" href="bind.html">pluginconf.bind</a></code></dt>
<dd>
|
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
| <dt id="pluginconf.add_plugin_defaults"><code class="name flex">
<span>def <span class="ident">add_plugin_defaults</span></span>(<span>conf_options, conf_plugins, meta, module='')</span>
</code></dt>
<dd>
<div class="desc"><p>Utility function which collect defaults from plugin meta data to
a config store. Which in the case of streamtuner2 is really just a
dictionary <code>conf{}</code> and a plugin list in <code>conf.plugins{}</code>.</p>
<h2 id="parameters">Parameters</h2>
<dl>
<dt><strong><code>conf_options</code></strong> : <code>dict : input/output</code></dt>
<dd>storage for amassed options</dd>
<dt><strong><code>conf_plugins</code></strong> : <code>dict : input/output</code></dt>
<dd>enable status based on plugin state/priority:</dd>
<dt><strong><code>meta</code></strong> : <code>dict</code></dt>
<dd>input plugin meta data (invoke once per plugin)</dd>
<dt><strong><code>module</code></strong> : <code>str</code></dt>
<dd>basename of meta: blocks plugin file</dd>
</dl></div>
</dd>
<dt id="pluginconf.all_plugin_meta"><code class="name flex">
<span>def <span class="ident">all_plugin_meta</span></span>(<span>)</span>
</code></dt>
<dd>
<div class="desc"><p>This is a trivial wrapper to assemble a complete dictionary
of available/installed plugins. It associates each plugin name
with a its meta{} fields.</p>
<h2 id="returns">Returns</h2>
<dl>
<dt><strong><code>dict</code></strong> : <code>names to meta data dict</code></dt>
<dd> </dd>
</dl></div>
</dd>
<dt id="pluginconf.get_data"><code class="name flex">
<span>def <span class="ident">get_data</span></span>(<span>filename, decode=False, gzip=False, file_root=None)</span>
</code></dt>
<dd>
<div class="desc"><p>Fetches file content from install path or from within PYZ
archive. This is just an alias and convenience wrapper for
pkgutil.get_data().
Utilizes the data_root as top-level reference.</p>
<h2 id="parameters">Parameters</h2>
<dl>
<dt><strong><code>filename</code></strong> : <code> str</code></dt>
<dd>filename in pyz or bundle</dd>
<dt><strong><code>decode</code></strong> : <code>bool</code></dt>
<dd>text file decoding utf-8</dd>
<dt><strong><code>gzip</code></strong> : <code>bool</code></dt>
<dd>automatic gzdecode</dd>
<dt><strong><code>file_root</code></strong> : <code>list</code></dt>
<dd>alternative base module (application or pyz root)</dd>
</dl>
<h2 id="returns">Returns</h2>
<dl>
<dt><strong><code>str</code></strong> : <code>file contents</code></dt>
<dd> </dd>
</dl></div>
</dd>
<dt id="pluginconf.module_list"><code class="name flex">
<span>def <span class="ident">module_list</span></span>(<span>extra_paths=None)</span>
</code></dt>
<dd>
<div class="desc"><p>Search through ./plugins/ (and other configured plugin_base
names → paths) and get module basenames.</p>
<h2 id="parameters">Parameters</h2>
<dl>
<dt><strong><code>extra_paths</code></strong> : <code>list</code></dt>
<dd>in addition to plugin_base list</dd>
</dl>
<h2 id="returns">Returns</h2>
<dl>
<dt><strong><code>list</code></strong> : <code>names</code> of <code>found plugins</code></dt>
<dd> </dd>
</dl></div>
</dd>
<dt id="pluginconf.plugin_meta"><code class="name flex">
<span>def <span class="ident">plugin_meta</span></span>(<span>filename=None, src=None, module=None, frame=1, **kwargs)</span>
</code></dt>
<dd>
<div class="desc"><p>Extract plugin meta data block from specified source.</p>
<h2 id="parameters">Parameters</h2>
<dl>
<dt><strong><code>filename</code></strong> : <code>str</code></dt>
<dd>Read literal files, or .pyz contents.</dd>
<dt><strong><code>src</code></strong> : <code>str</code></dt>
<dd>From already uncovered script code.</dd>
<dt><strong><code>module</code></strong> : <code>str</code></dt>
<dd>Lookup per pkgutil, from plugin_base or top-level modules.</dd>
<dt><strong><code>frame</code></strong> : <code>int</code></dt>
<dd>Extract comment header of caller (default).</dd>
<dt><strong><code>extra_base</code></strong> : <code>list</code></dt>
<dd>Additional search directories.</dd>
<dt><strong><code>max_length</code></strong> : <code>list</code></dt>
<dd>Maximum size to read from files (6K default).</dd>
</dl>
<h2 id="returns">Returns</h2>
<dl>
<dt><strong><code>dict</code></strong> : <code>Extracted comment fields, with config: preparsed</code></dt>
<dd> </dd>
</dl>
<p>The result dictionary has fields accessible as e.g. <code>pmd["title"]</code>
or <code>pmd.version</code>. The documentation block after all fields: is called
["doc"]<code>. And </code>pmd.config` already parsed as a list of dictionaries.</p></div>
</dd>
</dl>
</section>
<section>
<h2 class="section-title" id="header-classes">Classes</h2>
<dl>
<dt id="pluginconf.OptionList"><code class="flex name class">
|
>
>
>
|
>
>
|
>
>
>
|
>
|
>
>
|
>
|
>
>
|
>
|
>
>
|
>
|
>
>
>
>
>
>
>
|
>
>
>
>
>
>
>
>
>
>
|
|
|
|
>
|
>
>
>
|
>
>
|
>
>
>
|
>
|
>
>
|
>
|
>
>
|
>
|
>
>
|
>
|
|
>
|
|
|
|
>
|
>
>
>
|
>
>
|
>
>
>
|
>
|
|
>
|
|
|
|
>
|
>
>
>
|
>
>
|
>
>
>
|
>
|
>
>
|
>
|
>
>
|
>
|
>
>
|
>
|
>
>
|
>
|
>
>
|
>
|
|
>
|
|
|
|
|
>
|
|
| 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
| <dt id="pluginconf.add_plugin_defaults"><code class="name flex">
<span>def <span class="ident">add_plugin_defaults</span></span>(<span>conf_options, conf_plugins, meta, module='')</span>
</code></dt>
<dd>
<div class="desc"><p>Utility function which collect defaults from plugin meta data to
a config store. Which in the case of streamtuner2 is really just a
dictionary <code>conf{}</code> and a plugin list in <code>conf.plugins{}</code>.</p>
<table>
<thead>
<tr>
<th>Parameters</th>
<th></th>
<th></th>
</tr>
</thead>
<tbody>
<tr>
<td>conf_options</td>
<td>dict 🔁</td>
<td>storage for amassed options</td>
</tr>
<tr>
<td>conf_plugins</td>
<td>dict 🔁</td>
<td>enable status based on plugin state/priority:</td>
</tr>
<tr>
<td>meta</td>
<td>dict</td>
<td>input plugin meta data (invoke once per plugin)</td>
</tr>
<tr>
<td>module</td>
<td>str</td>
<td>basename of meta: blocks plugin file</td>
</tr>
<tr>
<td><strong>Returns</strong></td>
<td>None</td>
<td>-</td>
</tr>
</tbody>
</table></div>
</dd>
<dt id="pluginconf.all_plugin_meta"><code class="name flex">
<span>def <span class="ident">all_plugin_meta</span></span>(<span>)</span>
</code></dt>
<dd>
<div class="desc"><p>This is a trivial wrapper to assemble a complete dictionary
of available/installed plugins. It associates each plugin name
with a its meta{} fields.</p>
<table>
<thead>
<tr>
<th>Parameters</th>
<th></th>
<th></th>
</tr>
</thead>
<tbody>
<tr>
<td><strong>Returns</strong></td>
<td>dict</td>
<td>names to meta data dict</td>
</tr>
</tbody>
</table></div>
</dd>
<dt id="pluginconf.get_data"><code class="name flex">
<span>def <span class="ident">get_data</span></span>(<span>filename, decode=False, gzip=False, file_root=None)</span>
</code></dt>
<dd>
<div class="desc"><p>Fetches file content from install path or from within PYZ
archive. This is just an alias and convenience wrapper for
pkgutil.get_data().
Utilizes the data_root as top-level reference.</p>
<table>
<thead>
<tr>
<th>Parameters</th>
<th></th>
<th></th>
</tr>
</thead>
<tbody>
<tr>
<td>filename</td>
<td>str</td>
<td>filename in pyz or bundle</td>
</tr>
<tr>
<td>decode</td>
<td>bool</td>
<td>text file decoding utf-8</td>
</tr>
<tr>
<td>gzip</td>
<td>bool</td>
<td>automatic gzdecode</td>
</tr>
<tr>
<td>file_root</td>
<td>list</td>
<td>alternative base module (application or pyz root)</td>
</tr>
<tr>
<td><strong>Returns</strong></td>
<td>str</td>
<td>file contents</td>
</tr>
</tbody>
</table></div>
</dd>
<dt id="pluginconf.module_list"><code class="name flex">
<span>def <span class="ident">module_list</span></span>(<span>extra_paths=None)</span>
</code></dt>
<dd>
<div class="desc"><p>Search through ./plugins/ (and other configured plugin_base
names → paths) and get module basenames.</p>
<table>
<thead>
<tr>
<th>Parameter</th>
<th></th>
<th></th>
</tr>
</thead>
<tbody>
<tr>
<td>extra_paths</td>
<td>list</td>
<td>in addition to plugin_base list</td>
</tr>
<tr>
<td><strong>Returns</strong></td>
<td>list</td>
<td>names of found plugins</td>
</tr>
</tbody>
</table></div>
</dd>
<dt id="pluginconf.plugin_meta"><code class="name flex">
<span>def <span class="ident">plugin_meta</span></span>(<span>filename=None, src=None, module=None, frame=1, **kwargs)</span>
</code></dt>
<dd>
<div class="desc"><p>Extract plugin meta data block from specified source.</p>
<table>
<thead>
<tr>
<th>Parameters</th>
<th></th>
<th></th>
</tr>
</thead>
<tbody>
<tr>
<td>filename</td>
<td>str</td>
<td>Read literal files, or .pyz contents.</td>
</tr>
<tr>
<td>src</td>
<td>str</td>
<td>From already uncovered script code.</td>
</tr>
<tr>
<td>module</td>
<td>str</td>
<td>Lookup per pkgutil, relative to plugin_base</td>
</tr>
<tr>
<td>frame</td>
<td>int</td>
<td>Extract comment header of caller (default).</td>
</tr>
<tr>
<td>extra_base</td>
<td>list</td>
<td>Additional search directories.</td>
</tr>
<tr>
<td>max_length</td>
<td>list</td>
<td>Maximum size to read from files (6K default).</td>
</tr>
<tr>
<td><strong>Returns</strong></td>
<td>dict</td>
<td>Extracted comment fields, with config: preparsed</td>
</tr>
</tbody>
</table>
<p>The result dictionary (<code><a title="pluginconf.PluginMeta" href="#pluginconf.PluginMeta">PluginMeta</a></code>) has fields accessible as e.g. <code>pmd["title"]</code>
or <code>pmd.version</code>. The documentation block after all fields: is called
<code>["doc"]</code>. And <code>pmd.config</code> already parsed as a list (<code><a title="pluginconf.OptionList" href="#pluginconf.OptionList">OptionList</a></code>) of dictionaries.</p></div>
</dd>
</dl>
</section>
<section>
<h2 class="section-title" id="header-classes">Classes</h2>
<dl>
<dt id="pluginconf.OptionList"><code class="flex name class">
|