Popular recipes by Graham Poulter http://code.activestate.com/recipes/users/4172291/2013-10-07T21:03:30-07:00ActiveState Code RecipesConvert a nested Python data structure to XML (Python)
2011-10-17T12:48:59-07:00Graham Poulterhttp://code.activestate.com/recipes/users/4172291/http://code.activestate.com/recipes/577882-convert-a-nested-python-data-structure-to-xml/
<p style="color: grey">
Python
recipe 577882
by <a href="/recipes/users/4172291/">Graham Poulter</a>
(<a href="/recipes/tags/serialize/">serialize</a>, <a href="/recipes/tags/xml/">xml</a>).
Revision 2.
</p>
<p>Uses lxml.etree to convert a Python object consisting of nested dicts, tuples, lists, strings and string-convertable objects into a very basic no-attributes, untyped dialect of XML in which elements are named after dictionary keys, and "<i>" is the element for anonymous list and tuple items.</p>
<p>Does not support: encoding or decoding of strings, invalid floating point values, detection of circular references.</p>
HTML template animation built on PyQuery (Python)
2011-12-13T18:49:46-08:00Graham Poulterhttp://code.activestate.com/recipes/users/4172291/http://code.activestate.com/recipes/577983-html-template-animation-built-on-pyquery/
<p style="color: grey">
Python
recipe 577983
by <a href="/recipes/users/4172291/">Graham Poulter</a>
(<a href="/recipes/tags/templating/">templating</a>).
Revision 2.
</p>
<p>The beginnings of a class for "animating" plain HTML to produce a dynamic HTML output as an alternative to a templating language. It's inspired by Ruby's hquery library, which describes itself as "unobtrusive server scripting".</p>
Context manager for a daemon pid file (Python)
2013-10-07T21:03:30-07:00Graham Poulterhttp://code.activestate.com/recipes/users/4172291/http://code.activestate.com/recipes/577911-context-manager-for-a-daemon-pid-file/
<p style="color: grey">
Python
recipe 577911
by <a href="/recipes/users/4172291/">Graham Poulter</a>
(<a href="/recipes/tags/daemon/">daemon</a>, <a href="/recipes/tags/pid/">pid</a>).
Revision 3.
</p>
<p>Context manager for a pid (process id) file used to tell whether a daemon process is still running.</p>
<p>On entry, it writes the pid of the current process to the path. On exit, it removes the file.</p>
<p>Designed to work with python-daemon.</p>
Python Enum and/or named-integer class (Python)
2011-11-29T10:04:41-08:00Graham Poulterhttp://code.activestate.com/recipes/users/4172291/http://code.activestate.com/recipes/577921-python-enum-andor-named-integer-class/
<p style="color: grey">
Python
recipe 577921
by <a href="/recipes/users/4172291/">Graham Poulter</a>
(<a href="/recipes/tags/enum/">enum</a>).
Revision 6.
</p>
<p>Recipe for Python Enum class that builds on the "FOO = 1" pattern by adding a printable name. </p>
<p>In other words, an Enum instance is a named integer.</p>
Remove UTF-8 Byte Order Mark (BOM) from text files (Bash)
2011-10-18T06:37:52-07:00Graham Poulterhttp://code.activestate.com/recipes/users/4172291/http://code.activestate.com/recipes/577912-remove-utf-8-byte-order-mark-bom-from-text-files/
<p style="color: grey">
Bash
recipe 577912
by <a href="/recipes/users/4172291/">Graham Poulter</a>
(<a href="/recipes/tags/text/">text</a>, <a href="/recipes/tags/unicode/">unicode</a>, <a href="/recipes/tags/utf8/">utf8</a>).
</p>
<p>Shell script to removes UTF-8 Byte Order Mark (BOM) from text files, where present.</p>
Basic interface to Apache Solr (Python)
2011-10-17T12:46:55-07:00Graham Poulterhttp://code.activestate.com/recipes/users/4172291/http://code.activestate.com/recipes/577909-basic-interface-to-apache-solr/
<p style="color: grey">
Python
recipe 577909
by <a href="/recipes/users/4172291/">Graham Poulter</a>
(<a href="/recipes/tags/http/">http</a>, <a href="/recipes/tags/solr/">solr</a>).
</p>
<p>A basic model class representing Apache Solr. Abstracts the select, delete, update, and commit operations.</p>
<p>Select operation returns Python object parsed from a JSON-formatted response.</p>
Bazaar as a setuptools file finder (Python)
2011-10-25T12:25:34-07:00Graham Poulterhttp://code.activestate.com/recipes/users/4172291/http://code.activestate.com/recipes/577910-bazaar-as-a-setuptools-file-finder/
<p style="color: grey">
Python
recipe 577910
by <a href="/recipes/users/4172291/">Graham Poulter</a>
(<a href="/recipes/tags/bazaar/">bazaar</a>, <a href="/recipes/tags/setuptools/">setuptools</a>).
</p>
<p>Use Bazaar to list files for setup.py installation.</p>