The Voidspace Python Archive

Finished Projects and Unmaintained Code

Weirdness on Discworld

 

 

Loading ...

 

This page has the archive of finished projects and unmaintained code. Contained here are code snippets, modules and CGI scripts that are likely to be useful to someone - but that I don't use myself any more [1]. Everything here works (possibly within limitations) - but isn't going to get developed any further by me. I will still respond to bug reports though - and probably fix them Smile .

caseless

Case Insensitive Dictionary, List, and Sort

Version 2.2.0 21st February 2005

A module that provides two classes, and a function, for dealing with dictionaries and lists in a case insensitive way. caselessDict is a dictionary with case insensitive keys and methods. caselessList is a list like object with all the list methods, many of which are case insensitive. cSort is a function for sorting strings in a caseless way. (Which is also used as the sort method for caselessList). Full docs included in the source code. caselessDict and caselessList are subclasses of built-in types and so require Python 2.2 +, cSort isn't and therefore doesn't.

Download it here :

listquote

Functions for Lists, Quotes and CSVs

Version 1.4.0 28th August 2005

This module provides functions for turning lists into strings - and back again. It properly handles quoting and unquoting of elements and can even parse recursive lists. Because a CSV (comma separated value) file is basically a list: the module includes functions for easily reading and writing CSVs.

Read all about it at the listquote homepage.

Download it here :

Splitter

Split and Recombine Large Files

Version 1.0.0 28th May 2004

This is a piece of code that has been written many times by many people - but dammit python makes this kind of hacking fun !! Anyway - I had a 132meg file to take home and my biggest memory card was 128mb. The splitter class will chop files into chunks of definable size, and automatically join them together when given the filename of the first chunk. I haven't done a front end - but you can use it from any interactive python prompt. (I recommend IPython). Full docs in the source code as usual.

from splitter import Splitter
splitter = Splitter()
splitter.split(filename)
splitter.join(filename)

Download it here :

This recipe uses the marvellous Path Module by Jason Orendorff.

www.jorendorff.com/articles/python/path/ (included in the zip file)

includer

Intelligent Include Directive for Python

Version 1.0.0 13th August 2004

A recursive include directive - with other nifty features.

  • incdir command to tell it where to fetch includes from
  • will replace 'from module import... commands'
  • will remove stuff below if __name__ == "__main__" lines in included modules
python includer.py infilename outfilename
## INCLUDE filename
## INCDIR 'path name'

Browse the docs here.

This program allows you to include scripts into other scripts. It is written to make it easier to distribute scripts as single files: but maintain them as seperate modules.

Download it here :

PyName

Wordlist for Naming Python Projects

Version 1.0.0 7th October 2004

Slightly tongue in cheek, this isn't code at all. It's three lists of English words containing 'py' - intended to be helpful to those choosing names for python projects. The word lists were produced from an initial file of about 8 Mega Bytes. Words selected all contain 'py', single words or hyphenated words, but no compound words.

  • pywordlist.txt All words containg 'py' 23kb - 1946 words
  • pywordlist2.txt All words starting or ending in 'py' 16kb - 1406 words
  • pywordlist3.txt All words starting or ending in 'py'and less than 10 chars long 5kb - 658 words.

Download it here :

dateutils

Functions for Date Handling

Version 1.0.2 31st Jan 2004

This is a set of functions for dealing with dates - written for a little tool called Victory Days. They are particularly useful for dealing with appointments - e.g. the second Tuesday in March etc...

The functions will tell you what day of the week a date is, work out the 'Julian day number' of a date (and the reverse), add days (or weeks, months etc) to a date, tell you the number of days between two dates, and format a datestring etc. Full correction for leap years and much more. Browse a list of the functions here, and their usage.

Download it here :

Note

Most of this module is obsolete - either use the datetime module or the wrapper module dateutil.

This module is included here because it's still used by a couple of my modules and programs and I can't be bothered to refactor. Very Happy

It might be worth noting that there is a version [2] of datetime that is compatible with Python 2.2 included as part of SnakeSQL.

HTTP Test Script

Understanding HTTP Headers, Cookies, and Authentication

Version 1.3.1 10th January 2005

This is a CGI that I created as I was gaining a basic understanding of the http protocol. Given a url (from an html form) it will attempt to fetch that webpage. It displays all the headers that the server sends, details of any errors, and can even do basic authentication.

If cookielib or ClientCookie are available then it will save and handle cookies. Will also show you the raw HTML of the first part of the content fetched. This can be useful for debugging in various situations, or just as an illustration of aspects of CGI and http.

Download it here :

Check it out at :

Random Link

Teleport Out of Here

Version 1.0.0 21st January 2004

Version 2.0.0 5th February 2005

This is the first CGI I ever wrote. It's very basic but, it's a script that is asked for regularly. When this CGI is activated it diverts the browser to a location randomly chosen from a list stored on the server. Just a fun diversion for a website - guaranteed no serious use possible.

Version 1 sends a redirect header to a url randomly selected from a list (supplied as a file). With this version the user doesn't know where they will end up when they select the link.

Download it here :

The zip file has a linkfile with a selection of URLs to jump to.

Jump to a random location with : The randlink Portal

Version 2 sends a little piece of javascript with a randomly chosen URL already inserted. The advantage of this over normal Javascript 'random link' scripts is that the choice is made server side, the client doesn't have to download the whole list of URLs. It can also insert a relevant title for the url.

Download it here :

The zip file has a linkfile with a selection of URLs and Titles.

Randomly selected link, by randlink2.py :

Victory Days

A Tool for Calculating Victory Days

Version 1.0.0 6th Feb 2004

In the Jesus Fellowship Church we celebrate seven 'Victories' - moments of spiritual significance for the people who join us. The Seven Victories are :

  1. Conversion
  2. Baptism
  3. Making Covenant - Joining the Church
  4. Brotherhood - 3 months after making covenant
  5. Discipleship - 6 months after making covenant
  6. Endurance - 9 months after making covenant
  7. Fruitfulness - 12 months after making covenant

We celebrate these victories in agape, our Tuesday night 'family meal'. The challenge of course is working out which Tuesday is closest to 3, 6, 9, and 12 months after making covenant ! Victory Day Software does it all for us, with a nice Tkinter front end. It uses the dateutils module to work out the dates.

Victory Day Software Home Page

copy2cgi

Separate Building and Testing

Version 1.1.1 22nd September 2005

Often when writing CGIs (or even just editing my website), the folder I edit in is different from the folder I need the files in to test. This script will automagically copy files and directories from one place to another.

You can specify multiple sets of files and directories to copy. It requires Pythonutils 0.2.2.

Download it here :

[1]Some of them I do use, but I consider them finished, and am unlikely to put any more work into them.
[2]Almost complete.

For buying techie books, science fiction, computer hardware or the latest gadgets: visit The Voidspace Amazon Store. If you're looking for a new techie job, try the Voidspace Tech Job Board. This is part of the Hidden Network of technology and programming jobs.

Hosted by Webfaction

Return to Top

Page rendered with rest2web the Site Builder

Last edited Fri Feb 15 13:42:08 2008.


Counter...


Voidspace: Cyberpunk, Technology, Fiction and More
Search this Site:
 
Web Site

IronPython in ActionIronPython in Action

Blogads

Follow me on:

Twitter

Pownce

Jaiku

Del.icio.us

Shared Feeds

Tech Jobs

Hidden Network

Tech Jobs Board

Hosting for an agile web