Popular recipes tagged "wrapper" but not "debug"http://code.activestate.com/recipes/tags/wrapper-debug/2015-01-29T17:12:10-08:00ActiveState Code RecipesForward iterator (Python) 2015-01-29T17:12:10-08:00Andrea Corbellinihttp://code.activestate.com/recipes/users/4186880/http://code.activestate.com/recipes/578560-forward-iterator/ <p style="color: grey"> Python recipe 578560 by <a href="/recipes/users/4186880/">Andrea Corbellini</a> (<a href="/recipes/tags/iterator/">iterator</a>, <a href="/recipes/tags/wrapper/">wrapper</a>). Revision 2. </p> <p>A proxy for iterators that lets you <em>read ahead</em> items without consuming the iterator.</p> ChainedList and ChainedListView: Exposing Multiple Lists as a Single Sequence (Python) 2012-07-03T21:00:02-07:00Eric Snowhttp://code.activestate.com/recipes/users/4177816/http://code.activestate.com/recipes/578190-chainedlist-and-chainedlistview-exposing-multiple-/ <p style="color: grey"> Python recipe 578190 by <a href="/recipes/users/4177816/">Eric Snow</a> (<a href="/recipes/tags/lists/">lists</a>, <a href="/recipes/tags/wrapper/">wrapper</a>). </p> <p>Handy for composing lists without losing the underlying indepedence. The "lists" don't actually have to be lists, though for ChainedList they must be mutable.</p> Object wrapper class (Python) 2011-01-28T12:40:58-08:00Nichita Utiuhttp://code.activestate.com/recipes/users/4176755/http://code.activestate.com/recipes/577555-object-wrapper-class/ <p style="color: grey"> Python recipe 577555 by <a href="/recipes/users/4176755/">Nichita Utiu</a> (<a href="/recipes/tags/wrapper/">wrapper</a>). </p> <p>This is a wrapper class which, it wraps an object which it then proxies unnhandled getattr calls to.</p> Win Shortcuts wrapper. (Python) 2010-07-23T08:10:44-07:00Louis RIVIEREhttp://code.activestate.com/recipes/users/4035877/http://code.activestate.com/recipes/577321-win-shortcuts-wrapper/ <p style="color: grey"> Python recipe 577321 by <a href="/recipes/users/4035877/">Louis RIVIERE</a> (<a href="/recipes/tags/shortcuts/">shortcuts</a>, <a href="/recipes/tags/windows/">windows</a>, <a href="/recipes/tags/wrapper/">wrapper</a>). Revision 3. </p> <p>Reads or Creates Windows shortcuts (links).</p> Object Wrapper (Python) 2010-05-05T17:02:42-07:00Dmitryhttp://code.activestate.com/recipes/users/4173772/http://code.activestate.com/recipes/577215-object-wrapper/ <p style="color: grey"> Python recipe 577215 by <a href="/recipes/users/4173772/">Dmitry</a> (<a href="/recipes/tags/decorator/">decorator</a>, <a href="/recipes/tags/object/">object</a>, <a href="/recipes/tags/wrapper/">wrapper</a>). </p> <p>There is classical wrapper on Python language. If you have only object and can't change object generation you can use this class.</p> iter_except -- a useful variant of __builtin__.iter() (Python) 2010-03-27T02:04:22-07:00Raymond Hettingerhttp://code.activestate.com/recipes/users/178123/http://code.activestate.com/recipes/577155-iter_except-a-useful-variant-of-__builtin__iter/ <p style="color: grey"> Python recipe 577155 by <a href="/recipes/users/178123/">Raymond Hettinger</a> (<a href="/recipes/tags/converter/">converter</a>, <a href="/recipes/tags/iterator/">iterator</a>, <a href="/recipes/tags/wrapper/">wrapper</a>). </p> <p>Variant of iter(func, sentinel) that looks for an exception rather than for a sentinel value. Good for making iterators from of APIs that advance over a data and return an exception when they are done.</p> One-word logging.basicConfig wrapper (Python) 2010-01-06T06:54:09-08:00Denis Barmenkovhttp://code.activestate.com/recipes/users/57155/http://code.activestate.com/recipes/576994-one-word-loggingbasicconfig-wrapper/ <p style="color: grey"> Python recipe 576994 by <a href="/recipes/users/57155/">Denis Barmenkov</a> (<a href="/recipes/tags/basicconfig/">basicconfig</a>, <a href="/recipes/tags/logging/">logging</a>, <a href="/recipes/tags/wrapper/">wrapper</a>). Revision 2. </p> <p>Every Python logging manual have this code:</p> <pre class="prettyprint"><code>logging.basicConfig(level=logging.DEBUG, filename='debug.log', format='%(asctime)s %(levelname)s: %(message)s', datefmt='%Y-%m-%d %H:%M:%S') </code></pre> <p>This is a simple function which call it for you. All you need is remember one function name; useful on little scripts.</p> Python Wrapper for Google AJAX Language API (Python) 2009-08-22T12:59:38-07:00Ashish Yadavhttp://code.activestate.com/recipes/users/4171522/http://code.activestate.com/recipes/576890-python-wrapper-for-google-ajax-language-api/ <p style="color: grey"> Python recipe 576890 by <a href="/recipes/users/4171522/">Ashish Yadav</a> (<a href="/recipes/tags/google_ajax_api/">google_ajax_api</a>, <a href="/recipes/tags/language_translation/">language_translation</a>, <a href="/recipes/tags/wrapper/">wrapper</a>). Revision 3. </p> <p>A Python Wrapper for Google AJAX Language API, Uses Google Language Detection, in cases source language is not provided with the source text, Splits up text if it's longer then 4500 characters, as a limit put up by the API. Working fine for me, please let me know if i missed something.</p> Exception handling in a single line (Python) 2009-10-09T01:07:52-07:00Radek Szklarczykhttp://code.activestate.com/recipes/users/2847011/http://code.activestate.com/recipes/576872-exception-handling-in-a-single-line/ <p style="color: grey"> Python recipe 576872 by <a href="/recipes/users/2847011/">Radek Szklarczyk</a> (<a href="/recipes/tags/exception/">exception</a>, <a href="/recipes/tags/expression/">expression</a>, <a href="/recipes/tags/function/">function</a>, <a href="/recipes/tags/list_comprehension/">list_comprehension</a>, <a href="/recipes/tags/wrapper/">wrapper</a>). Revision 16. </p> <p>The rules of <em>duck typing</em> in python encourage programmers to use the "try...except..." clause. At the same time python with new versions enables to use more powerful list comprehensions (for example Conditional Expressions). However, it is impossible to write the "try...except..." clause in a list comprehension. The following recipe "protects" a function against exception and returns a default value in the case when exception is thrown.</p> Property wrapper (Python) 2010-07-20T14:30:30-07:00Louis RIVIEREhttp://code.activestate.com/recipes/users/4035877/http://code.activestate.com/recipes/502243-property-wrapper/ <p style="color: grey"> Python recipe 502243 by <a href="/recipes/users/4035877/">Louis RIVIERE</a> (<a href="/recipes/tags/property/">property</a>, <a href="/recipes/tags/wrapper/">wrapper</a>). </p> <p>This property shortcut doesn't restrict the property's attributes to get, set, del and doc. Besides these functions can have any name, not limited to fget, fset ... Note that the default doc is not the getter's one.</p>