Popular recipes tagged "meta:loc=127"http://code.activestate.com/recipes/tags/meta:loc=127/2016-04-21T14:12:33-07:00ActiveState Code Recipesnbitarray (Python)
2016-04-21T14:12:33-07:00yotahttp://code.activestate.com/recipes/users/4184815/http://code.activestate.com/recipes/580649-nbitarray/
<p style="color: grey">
Python
recipe 580649
by <a href="/recipes/users/4184815/">yota</a>
.
</p>
<p>library to store n bits data (n > 0) in a python array</p>
Python get shamsi Date time (Python)
2014-06-19T08:48:23-07:00Hassan Sajedihttp://code.activestate.com/recipes/users/4190234/http://code.activestate.com/recipes/578896-python-get-shamsi-date-time/
<p style="color: grey">
Python
recipe 578896
by <a href="/recipes/users/4190234/">Hassan Sajedi</a>
(<a href="/recipes/tags/datetime/">datetime</a>, <a href="/recipes/tags/python/">python</a>).
</p>
<p>Hey guys,
Below code generate shamsi code for iran datetime and is useful for iranian developer.
I hope suitable for all.</p>
Python Template Engine (Python)
2012-03-31T21:28:12-07:00Sunjay Varmahttp://code.activestate.com/recipes/users/4174115/http://code.activestate.com/recipes/578090-python-template-engine/
<p style="color: grey">
Python
recipe 578090
by <a href="/recipes/users/4174115/">Sunjay Varma</a>
(<a href="/recipes/tags/attributes/">attributes</a>, <a href="/recipes/tags/engine/">engine</a>, <a href="/recipes/tags/filter/">filter</a>, <a href="/recipes/tags/macro/">macro</a>, <a href="/recipes/tags/template/">template</a>).
</p>
<p>This is a simple template engine which allows you to replace macros within text. This engine allows for attributes and filters. The default implementation provides the entire string module as filters. Trying to use arguments will of course not work (since the framework supports no other arguments for the filter other than the filtered string itself).</p>
File Share Messenger 1.0 (Python)
2011-04-06T00:03:20-07:00Stephen Chappellhttp://code.activestate.com/recipes/users/2608421/http://code.activestate.com/recipes/577637-file-share-messenger-10/
<p style="color: grey">
Python
recipe 577637
by <a href="/recipes/users/2608421/">Stephen Chappell</a>
(<a href="/recipes/tags/file_io/">file_io</a>, <a href="/recipes/tags/file_share/">file_share</a>, <a href="/recipes/tags/gui/">gui</a>, <a href="/recipes/tags/messenger/">messenger</a>, <a href="/recipes/tags/network/">network</a>, <a href="/recipes/tags/workaround/">workaround</a>).
</p>
<p>File I/O has many potential uses, and in the case of network file shares, messaging can be conducted by creating files in a directory and scanning for new files to find new messages. In the case where there are restrictions within a network that prevent opening server sockets or creating and using client sockets, the technique in this recipe may be used with file shares instead. The program is simple and was written in about fifty minutes, so there are a great deal of enhancements that could be made to the recipe and its capabilities. Hopefully, this will provide inspiration for other program writers.</p>
<p>If you have any comments or wish to down-vote this recipe, please provide your insight as to what could be improved upon and how you would go about fixing any problems that you might find.</p>
Alias class attributes (Python)
2009-06-01T01:19:55-07:00Euan Goddardhttp://code.activestate.com/recipes/users/4170559/http://code.activestate.com/recipes/576787-alias-class-attributes/
<p style="color: grey">
Python
recipe 576787
by <a href="/recipes/users/4170559/">Euan Goddard</a>
(<a href="/recipes/tags/alias/">alias</a>, <a href="/recipes/tags/attribute/">attribute</a>, <a href="/recipes/tags/class/">class</a>, <a href="/recipes/tags/descriptor/">descriptor</a>, <a href="/recipes/tags/metaclass/">metaclass</a>).
</p>
<p>The alias metaclass allows a declarative way of creating aliases to attributes on a class. The main purpose of which is to adapt classes for duck-typing (see doc-string for me detail).</p>
Nicer struct syntax thanks to Py3 metaclasses (Python)
2009-02-25T07:39:52-08:00Daniel Brodiehttp://code.activestate.com/recipes/users/1892511/http://code.activestate.com/recipes/576666-nicer-struct-syntax-thanks-to-py3-metaclasses/
<p style="color: grey">
Python
recipe 576666
by <a href="/recipes/users/1892511/">Daniel Brodie</a>
(<a href="/recipes/tags/binary/">binary</a>, <a href="/recipes/tags/parsing/">parsing</a>, <a href="/recipes/tags/py3/">py3</a>, <a href="/recipes/tags/struct/">struct</a>).
</p>
<p>This is a quick-hack module I wrote up in a couple of hours that allows for a nicer syntax to build up struct-like binary packing and unpacking. The point was to get it to be concise and as C-like as possible. This script requires python3 for it's improved metaclass support.</p>
Simple conversion of excel files into CSV and YAML (Python)
2008-02-14T00:39:22-08:00Philip Kromerhttp://code.activestate.com/recipes/users/552075/http://code.activestate.com/recipes/546518-simple-conversion-of-excel-files-into-csv-and-yaml/
<p style="color: grey">
Python
recipe 546518
by <a href="/recipes/users/552075/">Philip Kromer</a>
(<a href="/recipes/tags/files/">files</a>).
</p>
<p>Takes an excel file, dumps out a series of CSV files (one for each sheet, named for the file and sheet) and a YAML file (an array of sheets, each sheet a dict containing the table_name and the table_data, a 2-d array of cell values).</p>
<p>Inspired by Bryan Niederberger's "Easy Cross Platform Excel Parsing With Xlrd", <a href="http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/483742" rel="nofollow">http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/483742</a> As opposed to his code, this script makes no attempt to understand the structure of the sheet (look for header cells, etc) -- it simply reads, converts, dumps.</p>
Google Hits (Python)
2008-06-08T21:29:17-07:00A Bhttp://code.activestate.com/recipes/users/4145641/http://code.activestate.com/recipes/572173-google-hits/
<p style="color: grey">
Python
recipe 572173
by <a href="/recipes/users/4145641/">A B</a>
(<a href="/recipes/tags/web/">web</a>).
Revision 2.
</p>
<p>The getHits function in this file takes as input a search term string, and returns as output a dict containing the number of web hits returned for that search term. The Google search engine and a SQLite database are used. See code for usage information.</p>
z_html.py (Python)
2006-07-05T09:40:44-07:00Stephen Chappellhttp://code.activestate.com/recipes/users/2608421/http://code.activestate.com/recipes/496862-z_htmlpy/
<p style="color: grey">
Python
recipe 496862
by <a href="/recipes/users/2608421/">Stephen Chappell</a>
(<a href="/recipes/tags/cgi/">cgi</a>).
</p>
<p>This recipe requires the z_matrix module.
Two classes are provided, HTML_Table and HTML_Month.
HTML_Table can manage the generation of a table in HTML format.
HTML_Month builds on top of HTML_Table and expands on its capabilities.
It allows for dynamically created tables that have the look of the selected month.</p>
self.super (Python)
2006-04-18T22:35:49-07:00Tim Delaneyhttp://code.activestate.com/recipes/users/1907998/http://code.activestate.com/recipes/286195-selfsuper/
<p style="color: grey">
Python
recipe 286195
by <a href="/recipes/users/1907998/">Tim Delaney</a>
(<a href="/recipes/tags/oop/">oop</a>).
Revision 5.
</p>
<p>Use self.super(<em>p, *</em>kw) instead of super(cls, self).func(<em>p, *</em>kw).</p>
<p>Latest version (much faster, with docs, tests, Pyrex version) is available at:
<a href="http://members.optusnet.com.au/tcdelaney/python.html#autosuper" rel="nofollow">http://members.optusnet.com.au/tcdelaney/python.html#autosuper</a></p>
Improved Gray Scale Quantization (Python)
2003-12-24T01:44:38-08:00Premshree Pillaihttp://code.activestate.com/recipes/users/1424728/http://code.activestate.com/recipes/259112-improved-gray-scale-quantization/
<p style="color: grey">
Python
recipe 259112
by <a href="/recipes/users/1424728/">Premshree Pillai</a>
(<a href="/recipes/tags/algorithms/">algorithms</a>).
</p>
<p>Improved Gray Scale (IGS) codes are used for the elimination of false contouring in images, and image compression. This Python program generates the IGS codes for a set of input gray level values.</p>
DBAttrib (Python)
2002-01-07T19:06:04-08:00j knapkahttp://code.activestate.com/recipes/users/135522/http://code.activestate.com/recipes/106131-dbattrib/
<p style="color: grey">
Python
recipe 106131
by <a href="/recipes/users/135522/">j knapka</a>
(<a href="/recipes/tags/database/">database</a>).
Revision 2.
</p>
<p>Associate object attributes with database columns.</p>