Overview
| Comment: | ad PluginMeta dict wrapper for briefer property access |
|---|---|
| Downloads: | Tarball | ZIP archive | SQL archive |
| Timelines: | family | ancestors | descendants | both | trunk |
| Files: | files | file ages | folders |
| SHA3-256: |
9427b32486c0cf73aac38d335664819f |
| User & Date: | mario on 2022-10-28 07:06:52 |
| Other Links: | manifest | tags |
Context
|
2022-10-28
| ||
| 07:07 | argument pylint change check-in: 5c58c55164 user: mario tags: trunk | |
| 07:06 | ad PluginMeta dict wrapper for briefer property access check-in: 9427b32486 user: mario tags: trunk | |
|
2022-10-27
| ||
| 10:43 | pylint fixes, doc additions check-in: a88ee41164 user: mario tags: trunk | |
Changes
Modified pluginconf/__init__.py from [874773144e] to [a475a4da70].
1 2 3 4 5 6 | 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 | - + + + + - + | # encoding: utf-8 # api: python ##type: extract # category: config # title: Plugin configuration # description: Read meta data, pyz/package contents, module locating |
| ︙ | |||
65 66 67 68 69 70 71 | 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 | - - - + + + - - - + + + | # # Generally this scheme concerns itself more with plugin basenames. # That is: module scripts in a package like `ext.plg1` and `ext.plg2`. # It can be initialized by injecting the plugin-package basename into # plugin_base = []. The associated paths will be used for module # lookup via pkgutil.iter_modules(). # |
| ︙ | |||
351 352 353 354 355 356 357 | 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 | + + + + + + + + + + + + + + - + |
src, meta["doc"] = src.split("\n\n", 1)
# Turn key:value lines into dictionary
for field in rx.keyval.findall(src):
meta[field[0].replace("-", "_")] = field[1].strip()
meta["config"] = plugin_meta_config(meta.get("config") or "")
return PluginMeta(meta)
# Dict wrapper
# ‾‾‾‾‾‾‾‾‾‾‾‾
class PluginMeta(dict):
""" Plugin meta data, convenience dict with property access """
def __getattr__(self, key):
""" Return [key] for .property access, else None """
return self.get(key)
def __hasattr__(self, key):
""" Return [key] for .property access, else None """
|
| ︙ |