Popular recipes tagged "meta:loc=164"http://code.activestate.com/recipes/tags/meta:loc=164/2013-05-26T18:00:58-07:00ActiveState Code RecipesPy2.6+ and Py3.0+ backport of Python 3.3's LRU Cache (Python) 2013-03-06T05:38:15-08:00Raymond Hettingerhttp://code.activestate.com/recipes/users/178123/http://code.activestate.com/recipes/578078-py26-and-py30-backport-of-python-33s-lru-cache/ <p style="color: grey"> Python recipe 578078 by <a href="/recipes/users/178123/">Raymond Hettinger</a> (<a href="/recipes/tags/cache/">cache</a>, <a href="/recipes/tags/lru/">lru</a>). Revision 6. </p> <p>Full-featured O(1) LRU cache backported from Python3.3. The full Py3.3 API is supported (thread safety, maxsize, keyword args, type checking, __wrapped__, and cache_info). Includes Py3.3 optimizations for better memory utilization, fewer dependencies, and fewer dict lookups.</p> slurp.py (Regex based simple parsing engine) (Python) 2013-05-26T18:00:58-07:00Mike 'Fuzzy' Partinhttp://code.activestate.com/recipes/users/4179778/http://code.activestate.com/recipes/578532-slurppy-regex-based-simple-parsing-engine/ <p style="color: grey"> Python recipe 578532 by <a href="/recipes/users/4179778/">Mike 'Fuzzy' Partin</a> (<a href="/recipes/tags/parser/">parser</a>, <a href="/recipes/tags/regex/">regex</a>, <a href="/recipes/tags/text_processing/">text_processing</a>). </p> <p>A parsing engine that allows you to define sets of patterns and callbacks, and process any I/O object in Pyton that has a readline() method.</p> Prime, Perfect and Fibonacci Number Widget Class (Python) 2010-05-19T17:02:28-07:00AJ. Mayorgahttp://code.activestate.com/recipes/users/4173476/http://code.activestate.com/recipes/577229-prime-perfect-and-fibonacci-number-widget-class/ <p style="color: grey"> Python recipe 577229 by <a href="/recipes/users/4173476/">AJ. Mayorga</a> (<a href="/recipes/tags/cryptography/">cryptography</a>, <a href="/recipes/tags/numbers/">numbers</a>, <a href="/recipes/tags/prime/">prime</a>, <a href="/recipes/tags/primes/">primes</a>). Revision 2. </p> <p>A class Ive had in my snippets for awhile that can generate prime, perfect and fibonacci sequences as well as check whether or not a supplied value is any of them.</p> Bible Verse Quiz - compare.py (Python) 2010-02-12T04:23:14-08:00Stephen Chappellhttp://code.activestate.com/recipes/users/2608421/http://code.activestate.com/recipes/577053-bible-verse-quiz-comparepy/ <p style="color: grey"> Python recipe 577053 by <a href="/recipes/users/2608421/">Stephen Chappell</a> (<a href="/recipes/tags/bible/">bible</a>, <a href="/recipes/tags/quiz/">quiz</a>, <a href="/recipes/tags/verse/">verse</a>, <a href="/recipes/tags/_versematch_/">_versematch_</a>). Revision 2. </p> <p>Give a string-oriented API to the generic "diff" module.</p> <p>The "diff" module is very powerful but practically useless on its own. The "search" and "empty_master" functions below resolve this problem.</p> Simple BBCode Support (Python) 2009-07-04T20:03:55-07:00Stephen Chappellhttp://code.activestate.com/recipes/users/2608421/http://code.activestate.com/recipes/576831-simple-bbcode-support/ <p style="color: grey"> Python recipe 576831 by <a href="/recipes/users/2608421/">Stephen Chappell</a> (<a href="/recipes/tags/bbcode/">bbcode</a>). Revision 8. </p> <p>After trying to write a BBCode support library, I decided that less in more. Though incomplete in its support of BBCode, it handles most cases with a minimal amount of code. Simply type "BBCode." followed by the operator. Call this with the text to be wrapped along with any arguments that operator may take. The virtual methods are case-sensitive, but the rendered names are returned in upper-case. If you are trying to write some forum-related software and want a lite BBCode implimentation, this recipe may serve your purposes well. The only aspect of this project that might be fixed at the user's discretion is support for numbered and bulleted lists (to be added to the _BBCode class as methods).</p> Javascript Namespaces (JavaScript) 2009-07-12T07:21:40-07:00Mike Kosshttp://code.activestate.com/recipes/users/4171086/http://code.activestate.com/recipes/576839-javascript-namespaces/ <p style="color: grey"> JavaScript recipe 576839 by <a href="/recipes/users/4171086/">Mike Koss</a> (<a href="/recipes/tags/javascript/">javascript</a>, <a href="/recipes/tags/namespaces/">namespaces</a>). Revision 2. </p> <p>This recipe enables you to modularize javascript libraries by placing all library code within a namespace object. All namespaces are rooted at "window.global_namespace". References between namespaces are supported by the Import function, which allows forward references to namespaces that have yet to be defined.</p> <p>See code comment for more detailed examples.</p> Stepping stone algorithum for solving the transhipment problem (Python) 2008-11-29T10:40:47-08:00James Coliinshttp://code.activestate.com/recipes/users/4167379/http://code.activestate.com/recipes/576575-stepping-stone-algorithum-for-solving-the-tranship/ <p style="color: grey"> Python recipe 576575 by <a href="/recipes/users/4167379/">James Coliins</a> (<a href="/recipes/tags/optimisation/">optimisation</a>). </p> <p>The transhipment problem is to minimise the cost of transporting goods between various sources and destinations.</p>