August'24: Kamaelia is in maintenance mode and will recieve periodic updates, about twice a year,
primarily targeted around Python 3 and ecosystem compatibility.
PRs are always welcome. Latest Release: 1.14.32 (2024/3/24)
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