phoenix_title wx.lib.pubsub.core.callables

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 since 2006 by Oliver Schoenborn, all rights reserved.

license

BSD, see LICENSE_BSD_Simple.txt for details.

function_summary Functions Summary

getArgs

Returns an instance of CallArgsInfo for the given callable_.

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


class_summary Classes Summary

CallArgsInfo

Represent the “signature” or protocol of a listener in the context of

ListenerMismatchError

Raised when an attempt is made to subscribe a listener to


Functions



getArgs(callable_)

Returns an instance of CallArgsInfo for the given callable_. Raises ListenerMismatchError if callable_ is not a callable.



getID(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.



getModule(obj)

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).



getRawFunction(callable_)

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).