Popular recipes tagged "library" but not "code"http://code.activestate.com/recipes/tags/library-code/2017-01-05T16:57:15-08:00ActiveState Code RecipesGive Python code a web plus command-line interface with hug (Python) 2017-01-05T16:57:15-08:00Vasudev Ramhttp://code.activestate.com/recipes/users/4173351/http://code.activestate.com/recipes/580742-give-python-code-a-web-plus-command-line-interface/ <p style="color: grey"> Python recipe 580742 by <a href="/recipes/users/4173351/">Vasudev Ram</a> (<a href="/recipes/tags/cli/">cli</a>, <a href="/recipes/tags/commandline/">commandline</a>, <a href="/recipes/tags/hug/">hug</a>, <a href="/recipes/tags/library/">library</a>, <a href="/recipes/tags/python/">python</a>, <a href="/recipes/tags/python3/">python3</a>, <a href="/recipes/tags/user_interface/">user_interface</a>, <a href="/recipes/tags/web/">web</a>, <a href="/recipes/tags/web_server/">web_server</a>). </p> <p>This recipe shows how to take a Python function and wrap it with both a web and a command-line interface, somewhat easily, using the hug Python library. The example used shows how to wrap a function that uses the psutil library to get information on disk partitions. So you can see the disk partition info either via the web browser or the command line. The code for the recipe is shown below. It is also possible to wrap multiple functions in the same Python file, and expose all of them via both the web and the command-line.</p> <p>More information and multiple sample outputs are available here:</p> <p><a href="https://jugad2.blogspot.in/2017/01/give-your-python-function-webcli-hug.html" rel="nofollow">https://jugad2.blogspot.in/2017/01/give-your-python-function-webcli-hug.html</a></p> Search for oranges with the wikipedia Python library (Python) 2015-11-03T18:52:55-08:00Vasudev Ramhttp://code.activestate.com/recipes/users/4173351/http://code.activestate.com/recipes/579121-search-for-oranges-with-the-wikipedia-python-libra/ <p style="color: grey"> Python recipe 579121 by <a href="/recipes/users/4173351/">Vasudev Ram</a> (<a href="/recipes/tags/api/">api</a>, <a href="/recipes/tags/library/">library</a>, <a href="/recipes/tags/python/">python</a>, <a href="/recipes/tags/retrieving/">retrieving</a>, <a href="/recipes/tags/web/">web</a>, <a href="/recipes/tags/wikipedia/">wikipedia</a>). </p> <p>The wikipedia Python library (available on PyPI) is a wrapper for the official Wikipedia API. The library is higher level and easier to use than the API, though for limited functionality of the API. It can be used to easily do basic access of Wikipedia pages, which could be useful for many educational, reference and other purposes. This recipe shows the basic use of the wikipedia library, by using it to search for information about oranges.</p> Zenity Chunk Editor, creating an hashing to preserve Code Integrity. (Bash) 2013-10-22T01:30:42-07:00Patrick Riendeauhttp://code.activestate.com/recipes/users/4175653/http://code.activestate.com/recipes/578693-zenity-chunk-editor-creating-an-hashing-to-preserv/ <p style="color: grey"> Bash recipe 578693 by <a href="/recipes/users/4175653/">Patrick Riendeau</a> (<a href="/recipes/tags/bash/">bash</a>, <a href="/recipes/tags/debian/">debian</a>, <a href="/recipes/tags/development/">development</a>, <a href="/recipes/tags/library/">library</a>, <a href="/recipes/tags/mint/">mint</a>, <a href="/recipes/tags/shell/">shell</a>, <a href="/recipes/tags/ubuntu/">ubuntu</a>). </p> <p>It Open by default a uuid-like temporary file. There is no actual was to modify the name, but assuming the implementation of ZenityShellEval imply a limited acces to shell, you might recuperate information from shell or futur adding to transfer a name or simple renaming the uuid-like file-name... This is to prevent auto-execution of a script from canned-design by playing with without having all clearly create your shell script and/or having fully pseudo-code explained and having confirmation of your design work...</p> <p>Initially, the shell Editor look like this : is: <img src="https://github.com/priendeau/Fnct.d#ZenityShellEval" alt="Image of Zenity Shell In action" /></p> <p>The dependency are simple, it require My GitHub Fnct.D project, available here: <code>[link](https://github.com/priendeau/Fnct.d)</code> to be installed inside /etc/init.d/Fnct.D like this </p> <p>git clone <a href="https://github.com/priendeau/Fnct.d" rel="nofollow">https://github.com/priendeau/Fnct.d</a> /etc/init.d/Fnct.D</p> <p>and loading the Lib first:</p> <p>. /etc/init.d/Fnct.D/fnct_lib </p> Setting Namespaces (Python) 2012-07-05T02:39:42-07:00Stephen Chappellhttp://code.activestate.com/recipes/users/2608421/http://code.activestate.com/recipes/578195-setting-namespaces/ <p style="color: grey"> Python recipe 578195 by <a href="/recipes/users/2608421/">Stephen Chappell</a> (<a href="/recipes/tags/helpers/">helpers</a>, <a href="/recipes/tags/library/">library</a>, <a href="/recipes/tags/options/">options</a>, <a href="/recipes/tags/utility/">utility</a>). Revision 2. </p> <p>Provides a simple way to deal with program variable versioning.</p> <p>This module defines two classes to store application settings so that multiple file versions can coexist with each other. Loading and saving is designed to preserve all data among the different versions. Errors are generated to protect the data when type or value violations occur.</p> Settings Organizer (Python) 2012-07-04T22:16:36-07:00Stephen Chappellhttp://code.activestate.com/recipes/users/2608421/http://code.activestate.com/recipes/578173-settings-organizer/ <p style="color: grey"> Python recipe 578173 by <a href="/recipes/users/2608421/">Stephen Chappell</a> (<a href="/recipes/tags/helpers/">helpers</a>, <a href="/recipes/tags/library/">library</a>, <a href="/recipes/tags/options/">options</a>, <a href="/recipes/tags/utility/">utility</a>). Revision 3. </p> <p>Provide an easy method to manage program options among multiple versions.</p> <p>This module contains two classes used to store application settings in such a way that multiple file versions can possibly coexist with each other. Loading and saving settings is designed to preserve as much data between versions. An error is generated on loading if saving would lead to any data being lost.</p> Markov Encryption Module (for Python 2.5) (Python) 2012-07-25T22:33:03-07:00Stephen Chappellhttp://code.activestate.com/recipes/users/2608421/http://code.activestate.com/recipes/578135-markov-encryption-module-for-python-25/ <p style="color: grey"> Python recipe 578135 by <a href="/recipes/users/2608421/">Stephen Chappell</a> (<a href="/recipes/tags/encryption/">encryption</a>, <a href="/recipes/tags/library/">library</a>, <a href="/recipes/tags/module/">module</a>, <a href="/recipes/tags/utility/">utility</a>). Revision 4. </p> <p>This module provides classes that are useful for executing Markov encryption and decryption on data. ME was inspired by a combination of Markov chains with the puzzles of Sudoku. This implementation is a rewrite from the Python 3.x version and includes various changes and optimizations to work with Python 2.5 and related versions. All documentation has been left in <a href="http://code.activestate.com/recipes/578075/">recipe 578075</a> and should be referred to there.</p> Markov Encryption Module (Python) 2012-09-05T20:25:49-07:00Stephen Chappellhttp://code.activestate.com/recipes/users/2608421/http://code.activestate.com/recipes/578075-markov-encryption-module/ <p style="color: grey"> Python recipe 578075 by <a href="/recipes/users/2608421/">Stephen Chappell</a> (<a href="/recipes/tags/encryption/">encryption</a>, <a href="/recipes/tags/library/">library</a>, <a href="/recipes/tags/module/">module</a>, <a href="/recipes/tags/utility/">utility</a>). Revision 7. </p> <p>This module exposes primitives useful for executing Markov Encryption processes. ME was inspired by a combination of Markov chains with the puzzles of Sudoku. This implementation has undergone numerous changes and optimizations since its original design. Please see documentation.</p> vector (Python) 2012-01-09T05:35:39-08:00Stephen Chappellhttp://code.activestate.com/recipes/users/2608421/http://code.activestate.com/recipes/578006-vector/ <p style="color: grey"> Python recipe 578006 by <a href="/recipes/users/2608421/">Stephen Chappell</a> (<a href="/recipes/tags/datastructures/">datastructures</a>, <a href="/recipes/tags/library/">library</a>, <a href="/recipes/tags/utility/">utility</a>). </p> <p>Needed by <a href="http://code.activestate.com/recipes/578004/">recipe 578004</a>, this is meant to be a power pure-python-based module for running optimized 2D vector operations with a few possibilities not seen in most vector libraries. Many of the methods are overloaded to provide great versitility in what operations can be performed. To allow for even greater operations, the many methods mays be wrapped with the included <code>autocast</code> method so that even more datatypes can be used in whatever calculations the programmer may desire.</p> gsl with python3 (Python) 2010-02-26T11:34:01-08:00David Lamberthttp://code.activestate.com/recipes/users/4167420/http://code.activestate.com/recipes/576549-gsl-with-python3/ <p style="color: grey"> Python recipe 576549 by <a href="/recipes/users/4167420/">David Lambert</a> (<a href="/recipes/tags/gnu/">gnu</a>, <a href="/recipes/tags/gsl/">gsl</a>, <a href="/recipes/tags/library/">library</a>, <a href="/recipes/tags/scientific/">scientific</a>). </p> <p>Some shared library functionality is accessible directly from python. This code shows how to access a useful portion of the gsl from python3.</p> gsl real fft in python3 (Python) 2008-11-01T10:27:39-07:00David Lamberthttp://code.activestate.com/recipes/users/4167420/http://code.activestate.com/recipes/576550-gsl-real-fft-in-python3/ <p style="color: grey"> Python recipe 576550 by <a href="/recipes/users/4167420/">David Lambert</a> (<a href="/recipes/tags/fft/">fft</a>, <a href="/recipes/tags/gnu/">gnu</a>, <a href="/recipes/tags/gsl/">gsl</a>, <a href="/recipes/tags/library/">library</a>, <a href="/recipes/tags/scientific/">scientific</a>). </p> <p>Real_FFT wraps the gsl_fft_real_transform in a python3 setting. This recipe serves as a complete example for "<a href="http://code.activestate.com/recipes/576549/">Recipe 576549</a>: gsl with python3".</p> Using the python imaging library to generate degraded letter stimuli (Python) 2008-09-06T05:24:33-07:00Kaushik Ghosehttp://code.activestate.com/recipes/users/4166965/http://code.activestate.com/recipes/576490-using-the-python-imaging-library-to-generate-degra/ <p style="color: grey"> Python recipe 576490 by <a href="/recipes/users/4166965/">Kaushik Ghose</a> (<a href="/recipes/tags/imaging/">imaging</a>, <a href="/recipes/tags/library/">library</a>, <a href="/recipes/tags/science/">science</a>, <a href="/recipes/tags/stimuli/">stimuli</a>, <a href="/recipes/tags/visual/">visual</a>). </p> <p>Code to generate degraded letter stimuli, as used in the paper "The remarkable inefficiency of word recognition" (Pelli et al. 2003). Utilizes the Python Imaging Library, and is an example of the usage of this library.</p> Pad images to power-of-two dimensions. (Python) 2008-08-12T18:46:40-07:00Martin Wilsonhttp://code.activestate.com/recipes/users/4166376/http://code.activestate.com/recipes/576416-pad-images-to-power-of-two-dimensions/ <p style="color: grey"> Python recipe 576416 by <a href="/recipes/users/4166376/">Martin Wilson</a> (<a href="/recipes/tags/graphics/">graphics</a>, <a href="/recipes/tags/imaging/">imaging</a>, <a href="/recipes/tags/library/">library</a>, <a href="/recipes/tags/of/">of</a>, <a href="/recipes/tags/opengl/">opengl</a>, <a href="/recipes/tags/pil/">pil</a>, <a href="/recipes/tags/power/">power</a>, <a href="/recipes/tags/power_of_two/">power_of_two</a>, <a href="/recipes/tags/python_imaging_library/">python_imaging_library</a>, <a href="/recipes/tags/two/">two</a>). Revision 4. </p> <p>Pads any amount of images each to power-of-two dimensions, useful for OpenGL programming.</p>