Axon.util.py

Version: Axon 1.0

Selection of utility functions and classes. (All highly trivial)

TODO: Fix test suite doc strings for auto testdocs

Pydoc Style Documentation

CLASSES

class Finality(exceptions.Exception)

  • Used for implementing try...finally... inside a generator

FUNCTIONS

axonRaise(someException, *args)

listSubset(requiredList, suppliedList)

logError(someException, *args)

  • Currently does nothing but can be rewritten to log ignored errors if the production value is true.

removeAll(xs, y)

  • Very simplistic method of removing all occurances of y in list xs.

safeList(arg=None)

testInterface(theComponent, interface)

Look for a minimal match interface for the component

DATA

production = False

Testdoc Documentation

Finality

  • dummy class deriving from Exception - used for implementing try...finally in a generator

axonRaise

  • behaviour depends on the value of production. If true it will simply return False. Otherwise it will throw an exception of the type passed to it with the other arguments passed to the constructor.

listSubset

  • returns true if the first list argument is a subset of the second list argument

logError

  • At the moment this function does nothing but can be rewritten to log ignored exception data. Equally the test does nothing.

production

  • Is a module value that turns off some exception to make the system tolerant of failure when running in production. For development and testing it should be False to allow uncaught exceptions to bring down the system.

removeAll - (xs:list,y)

  • removes all occurances of y from the list xs.

safeList

  • always returns a list even if the arg for constructing the list would normally cause a typeerror.

safeList

  • Like list it returns an empty list when called without an argument.

safeList

  • Returns an empty list if the argument would cause a TypeError if passed to list(). That is anything without an iterator method.

testInterface

  • returns true for a _minimal match_ on the interface of the component
  • In production mode failed tests will return false. Otherwise they will throw an exception that is likely to stop the system.

Michael, December 2004

 

Kamaelia is an open source project originated from and guided by BBC Research. For more information browse the site or get in contact.

This is an ongoing community based development site. As a result the contents of this page is the opinions of the contributors of the pages involved not the organisations involved. Specificially, this page may contain personal views which are not the views of the BBC. (the site is powered by a wiki engine)

(C) Copyright 2008 Kamaelia Contributors, including the British Broadcasting Corporation, All Rights Reserved

This web site is powered by the same code created for the bicker manor project. For more details, contact Michael Sparks at BBC Research directly (cf contact)