Skip to content
This repository


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Zuo's Recipes and Drafts: small pieces of (a probably useful) code

branch: master
| Zuo's Recipes and Drafts: small pieces of (a probably useful) code |

[code in Python, unless explicitly marked differently]

Copyright (c) 2010, 2011 Jan Kaliszewski (zuo). All rights reserved.

All content is licensed under the MIT License (see: MIT_LICENSE),
unless explicitly marked differently.


Repo content:

* [plus]
  -- a module that provides an easy way to define and use your own
     CLOS-like around/before/after auxiliary methods (implemented using
     native Python features: decorators, class inheritance plus super(),
     private name mangling).

  -- a very fast switch/case-like dispatch tool (dict-or-list-based);
  -- you can define your dispatcher in an elegant, declarative way, as
     a class (possibly subclassing it...) with easy-to-use decorators;
  -- using subclasses does not affect efficiency.

* clonetools/*
  -- tools for cloning classes and functions, useful when you need to
     "copy" a class or a function to adjust it (e.g. adding __slots__
     to all base clases), without hurting the original class/function

  * clonetools/
    -- a submodule that can be used as a standalone module;
    -- for making "flat mirrors" of classes, i.e. fake subclasses with
       reduced class hierarchy.

  -- tiny fcntl.flock() (Unix file lock) behaviour sampling script;
  -- an exemplary/educational piece of code (not a utility script).

* [plus]
  -- simple multiprocess-safe logging and interprocess locking classes;
  -- Unix implementation (flock-based) + generic abstract classes.

  -- if you need to define named tuple subclasses (including reusable
     abstract ones) adding/overriding some methods; to have the named
     tuple ABC (abstract base class) for isinstance()/issubclass()
     tests; or simply would like to define your named tuple classes in
     a class-syntax-based and DRY way (without repeating type names...)
     -- this recipe is for you.

  -- use this script to automagically loop your .WAV instrument samples
     (to use them in any music sequencer/tracker, e.g. MilkyTracker...);
  -- requires numpy;
  -- licenced under GPL 2+ (see: LICENSE_GPL2 and LICENSE_GPL3).

  -- just import + call -- and you can filter and log your call/return/
     exception/etc. events (you can use the standard Python logging
     framework or pass your custom logging-or-doing-anything object);
  -- quite a flexible tool and about 50 effective SLOC only (excluding
     the example script);
  -- for debugging rather than for production (programs noticeably slow

* be continued :)
Something went wrong with that request. Please try again.