Low level functions and classes related to callables.
The AUTO_TOPIC is the “marker” to use in callables to indicate that when a message is sent to those callables, the topic object for that message should be added to the data sent via the call arguments. See the docs in CallArgsInfo regarding its autoTopicArgName data member.
copyright: | Copyright 2006-2009 by Oliver Schoenborn, all rights reserved. |
---|---|
license: | BSD, see LICENSE.txt for details. |
getArgs | Returns an instance of CallArgsInfo for the given listener. |
getID | Get name and module name for a callable, ie function, bound |
getModule | Get the module in which an object was defined. Returns ‘__main__’ |
getRawFunction | Given a callable, return (offset, func) where func is the |
CallArgsInfo | Represent the “signature” or protocol of a listener in the context of |
ListenerInadequate | Raised when an attempt is made to subscribe a listener to |
Returns an instance of CallArgsInfo for the given listener. Raises ListenerInadequate if listener is not a callable.
Get name and module name for a callable, ie function, bound method or callable instance, by inspecting the callable. E.g. getID(Foo.bar) returns (‘Foo.bar’, ‘a.b’) if Foo.bar was defined in module a.b.
Get the module in which an object was defined. Returns ‘__main__’ if no module defined (which usually indicates either a builtin, or a definition within main script).
Given a callable, return (offset, func) where func is the function corresponding to callable, and offset is 0 or 1 to indicate whether the function’s first argument is ‘self’ (1) or not (0). Raises ValueError if callable_ is not of a recognized type (function, method or has __call__ method).