Latest recipes tagged "only"http://code.activestate.com/recipes/tags/only/new/2016-04-15T13:25:20-07:00ActiveState Code RecipesPython2 keyword-only argument emulation as a decorator. Python3 compatible. (Python) 2016-04-15T13:25:20-07:00István Pásztorhttp://code.activestate.com/recipes/users/4189380/http://code.activestate.com/recipes/580639-python2-keyword-only-argument-emulation-as-a-decor/ <p style="color: grey"> Python recipe 580639 by <a href="/recipes/users/4189380/">István Pásztor</a> (<a href="/recipes/tags/args/">args</a>, <a href="/recipes/tags/arguments/">arguments</a>, <a href="/recipes/tags/keyword/">keyword</a>, <a href="/recipes/tags/keyword_only/">keyword_only</a>, <a href="/recipes/tags/kwonly/">kwonly</a>, <a href="/recipes/tags/only/">only</a>, <a href="/recipes/tags/python2/">python2</a>). Revision 4. </p> <p>Provides a very simple decorator (~40 lines of code) that can turn some or all of your default arguments into keyword-only arguments. You select one of your default arguments by name and the decorator turn this argument along with all default arguments on its right side into keyword only arguments. Check the docstring of the decorator or visit the github/pypi page for detailed documentation:</p> <ul> <li><a href="https://github.com/pasztorpisti/kwonly-args" rel="nofollow">https://github.com/pasztorpisti/kwonly-args</a></li> <li><a href="https://pypi.python.org/pypi/kwonly-args" rel="nofollow">https://pypi.python.org/pypi/kwonly-args</a></li> </ul> <p><code>$ pip install kwonly-args</code></p> Bash completed man and info pages generation (Python) 2011-08-24T03:14:13-07:00Josh Dhttp://code.activestate.com/recipes/users/4179060/http://code.activestate.com/recipes/577854-bash-completed-man-and-info-pages-generation/ <p style="color: grey"> Python recipe 577854 by <a href="/recipes/users/4179060/">Josh D</a> (<a href="/recipes/tags/a/">a</a>, <a href="/recipes/tags/all/">all</a>, <a href="/recipes/tags/and/">and</a>, <a href="/recipes/tags/bash/">bash</a>, <a href="/recipes/tags/be/">be</a>, <a href="/recipes/tags/command/">command</a>, <a href="/recipes/tags/completed/">completed</a>, <a href="/recipes/tags/consume/">consume</a>, <a href="/recipes/tags/file/">file</a>, <a href="/recipes/tags/first/">first</a>, <a href="/recipes/tags/generation/">generation</a>, <a href="/recipes/tags/get/">get</a>, <a href="/recipes/tags/in/">in</a>, <a href="/recipes/tags/info/">info</a>, <a href="/recipes/tags/line/">line</a>, <a href="/recipes/tags/man/">man</a>, <a href="/recipes/tags/modify/">modify</a>, <a href="/recipes/tags/must/">must</a>, <a href="/recipes/tags/only/">only</a>, <a href="/recipes/tags/pages/">pages</a>, <a href="/recipes/tags/possibilties/">possibilties</a>, <a href="/recipes/tags/possiblities/">possiblities</a>, <a href="/recipes/tags/py/">py</a>, <a href="/recipes/tags/python/">python</a>, <a href="/recipes/tags/run/">run</a>, <a href="/recipes/tags/script/">script</a>, <a href="/recipes/tags/so/">so</a>, <a href="/recipes/tags/tab/">tab</a>, <a href="/recipes/tags/terminal/">terminal</a>, <a href="/recipes/tags/the/">the</a>, <a href="/recipes/tags/this/">this</a>, <a href="/recipes/tags/to/">to</a>). Revision 6. </p> <p>The script it self is very self explaining - the task is simple. *NIX only unless with cygwin perhaps?</p> <p>To start this open a terminal and strike the "Tab" key to get all possibilities (strike y, and strike the space key alot). Select all then Copy and save in "comms.txt" Modify the file so ONLY the possiblities consume a line; no prompts or extra newlines. (first line must be a command, the last line must be a command)</p> <p>Save the file ("~/Documents/bashing/comms.txt" is my path) then run this script in "~/Documents/bashing/".</p> <p>This generates two (2) files: "bash_help_man.sh", "bash_help_info.sh".</p> <p>Then it runs these files: "bash bash_help_man.sh", "bash bash_help_info.sh".</p> <p>This produces 2 files for every command (every line) in "comms.txt". All manpages are wrote in "mans/", all infopages are wrote in "infos/"</p> <p>There is now alot of files to read and organize; lets separate these by size. Directories are under1kb, under2kb, etc.</p> <p>Once complete do as you wish the files less than 128 kb; these files are COPIED into there new respective home, I repeat COPIED.</p> <p>The files 128 kb and higher ARE NOT copied to anywhere!</p>