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

General utility functions & common includes

Test documentation

Tests passed:

  • 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
  • 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.
  • 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.
  • In production mode failed tests will return false. Otherwise they will throw an exception that is likely to stop the system.
  • testInterface - returns true for a _minimal match_ on the interface of the component.

Axon.util.Finality

class Finality(Exception)

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

Axon.util.axonRaise

axonRaise(someException, *args)

Raises the supplied exception with the supplied arguments if Axon.util.production is set to True.

Axon.util.listSubset

listSubset(requiredList, suppliedList)

Returns true if the requiredList is a subset of the suppliedList.

Axon.util.logError

logError(someException, *args)

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

Axon.util.removeAll

removeAll(xs, y)

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

Axon.util.safeList

safeList([arg])

Returns the list version of arg, otherwise returns an empty list.

Axon.util.testInterface

testInterface(theComponent, interface)

Look for a minimal match interface for the component. The interface should be a tuple of lists, i.e. ([inboxes],[outboxes]).

Feedback

Got a problem with the documentation? Something unclear that could be clearer? Want to help improve it? Constructive criticism is very welcome - especially if you can suggest a better rewording!

Please leave you feedback here in reply to the documentation thread in the Kamaelia blog.

-- Automatic documentation generator, 09 Dec 2009 at 04:00:25 UTC/GMT