Update of "api-config"
Overview
Artifact ID: | 4fbc11d5e2e6bde753a53f478e9e6a951d6c3420 |
---|---|
Page Name: | api-config |
Date: | 2017-02-20 15:12:01 |
Original User: | mario |
Mimetype: | text/html |
Next | 08e770f6c2b8d3fa773b92536f62842b77f803e1 |
Content
<html><head><title>Python: module config</title> <table width="100%" cellspacing=0 cellpadding=2 border=0 summary="heading"> <tr bgcolor="#7799ee"> <td valign=bottom> <br> <font color="#ffffff" face="helvetica, arial"> <br><big><big><strong>config</strong></big></big></font></td ><td align=right valign=bottom ><font color="#ffffff" face="helvetica, arial"><a href=".">index</a><br><a href="streamtuner2/config.py">/home/mario/projects/streamtuner2/config.py</a></font></td></tr></table> <p><tt># encoding: UTF-8<br> # api: streamtuner2<br> # type: class<br> # title: global config object<br> # description: reads ~/.config/streamtuner/*.json files<br> # config:<br> # { arg: -d, type: str, name: disable[], description: Omit plugin from initialization. }<br> # { arg: -e, type: str, name: enable[], description: Add channel plugin. }<br> # { arg: --gtk3, type: boolean, name: gtk3, description: Start with Gtk3 interface. }<br> # { arg: --nt, type: boolean, name: nothreads, description: Disable threading/gtk_idle UI. }<br> # { arg: -D, type: boolean, name: debug, description: Enable debug messages on console }<br> # { arg: action, type: str *, name: action[], description: CLI interface commands. }<br> # { arg: -x, type: boolean, name: exit, hidden: 1 }<br> # { arg: -V, type: boolean, name: version, description: Print version. }<br> # { arg: -w, type: boolean, name: pydoc, hiden: 1 }<br> # version: 2.7<br> # priority: core<br> # depends: pluginconf >= 0.1, os, json, re, zlib, pkgutil<br> #<br> # Ties together the global conf.* object. It's typically used<br> # in the main application and modules with:<br> #<br> # from config import *<br> #<br> # The underlying ConfigDict class is already instantiated and<br> # imported as `conf` then.<br> #<br> # With .save() or .load() it handles storage as JSON. Both<br> # utility functions are also used for other cache files.<br> # More specific config stores are available per .netrc(),<br> # and .init_args().<br> #<br> # Whereas plugin utility code is available per <a href="#-plugin_meta">plugin_meta</a>(),<br> # <a href="#-module_list">module_list</a>(), and <a href="#-get_data">get_data</a>(). There's a prepared function<br> # for add_plugin_config() on initialization.<br> #<br> # Also provides a simple logging interface with log.TYPE(...),<br> # which is also pre-instantiated.</tt></p> <p> <table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section"> <tr bgcolor="#aa55cc"> <td colspan=3 valign=bottom> <br> <font color="#ffffff" face="helvetica, arial"><big><strong>Modules</strong></big></font></td></tr> <tr><td bgcolor="#aa55cc"><tt> </tt></td><td> </td> <td width="100%"><table width="100%" summary="list"><tr><td width="25%" valign=top><a href="https://docs.python.org/3/library/argparse.html">argparse</a><br> <a href="https://docs.python.org/3/library/glob.html">glob</a><br> <a href="https://docs.python.org/3/library/gzip.html">gzip</a><br> <a href="https://docs.python.org/3/library/inspect.html">inspect</a><br> </td><td width="25%" valign=top><a href="https://docs.python.org/3/library/json.html">json</a><br> <a href="https://docs.python.org/3/library/os.html">os</a><br> <a href="https://docs.python.org/3/library/pkgutil.html">pkgutil</a><br> <a href="https://docs.python.org/3/library/platform.html">platform</a><br> </td><td width="25%" valign=top><a href="api-pluginconf">pluginconf</a><br> <a href="https://docs.python.org/3/library/re.html">re</a><br> <a href="https://docs.python.org/3/library/sys.html">sys</a><br> <a href="https://docs.python.org/3/library/zipfile.html">zipfile</a><br> </td><td width="25%" valign=top><a href="https://docs.python.org/3/library/zlib.html">zlib</a><br> </td></tr></table></td></tr></table><p> <table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section"> <tr bgcolor="#eeaa77"> <td colspan=3 valign=bottom> <br> <font color="#ffffff" face="helvetica, arial"><big><strong>Functions</strong></big></font></td></tr> <tr><td bgcolor="#eeaa77"><tt> </tt></td><td> </td> <td width="100%"><dl><dt><a name="-find_executable"><strong>find_executable</strong></a>(executable, path<font color="#909090">=None</font>)</dt><dd><tt>Tries to find 'executable' in the directories listed in 'path'.<br> <br> A string listing directories separated by 'os.pathsep'; defaults to<br> os.environ['PATH']. Returns the complete filename or None if not found.</tt></dd></dl> <dl><dt><a name="-get_data"><strong>get_data</strong></a>(fn, decode<font color="#909090">=False</font>, gz<font color="#909090">=False</font>, file_base<font color="#909090">=None</font>)</dt><dd><tt># Resource retrieval<br> # ‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾<br> # Fetches file content from install path or from within PYZ<br> # archive. This is just an alias and convenience wrapper for<br> # pkgutil.<a href="#-get_data">get_data</a>().<br> # Utilizes the module_base / file_base as top-level reference.</tt></dd></dl> <dl><dt><a name="-module_list"><strong>module_list</strong></a>(extra_paths<font color="#909090">=[]</font>)</dt><dd><tt># Plugin name lookup<br> # ‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾<br> # Search through ./plugins/ (and other configured plugin_base<br> # names → paths) and get module basenames.</tt></dd></dl> <dl><dt><a name="-plugin_meta"><strong>plugin_meta</strong></a>(fn<font color="#909090">=None</font>, src<font color="#909090">=None</font>, module<font color="#909090">=None</font>, frame<font color="#909090">=1</font>, extra_base<font color="#909090">=[]</font>)</dt><dd><tt># Plugin meta data extraction<br> # ‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾<br> # Can fetch infos from different sources:<br> #<br> # fn= read literal files, or .pyz contents<br> #<br> # src= from already uncovered script code<br> #<br> # module= lookup per pkgutil, from plugin bases<br> # or top-level modules<br> #<br> # frame= extract comment header of caller<br> # (default)</tt></dd></dl> </td></tr></table><p> <table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section"> <tr bgcolor="#55aa55"> <td colspan=3 valign=bottom> <br> <font color="#ffffff" face="helvetica, arial"><big><strong>Data</strong></big></font></td></tr> <tr><td bgcolor="#55aa55"><tt> </tt></td><td> </td> <td width="100%"><strong>__all__</strong> = ['conf', 'log', 'plugin_meta', 'module_list', 'get_data', 'find_executable']<br> <strong>conf</strong> = {u'filter_walledgardens': True, u'radionomy_page...e/mario/.config/streamtuner2', u'history': u'20'}<br> <strong>log</strong> = <config.log_printer object></td></tr></table>