Phoenix Logo

phoenix_title wx.lib.pubsub.core.callables.CallArgsInfo

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


class_hierarchy Class Hierarchy

Inheritance diagram for class CallArgsInfo:


method_summary Methods Summary

__init__ Inputs
getAllArgs  
getOptionalArgs  
getRequiredArgs Return a tuple of names indicating which call arguments

api Class API



class CallArgsInfo

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


Methods



__init__(self, func, firstArgIdx)

Inputs: - Args and defaultVals are the complete set of arguments and

default values as obtained form inspect.getargspec();
  • The firstArgIdx points to the first item in args that is of use, so it is typically 0 if listener is a function, and 1 if listener is a method.
  • The acceptsAllKwargs should be true if the listener has **kwargs in its protocol.

After construction, - self.allParams will contain the subset of ‘args’ without first

firstArgIdx items,
  • self.numRequired will indicate number of required arguments (ie self.allParams[:self.numRequired] are the required args names);
  • self.acceptsAllKwargs = acceptsAllKwargs
  • self.autoTopicArgName will be the name of argument in which to put the topic object for which pubsub message is sent, or None. This is identified by the argument that has a default value of AUTO_TOPIC.

For instance, listener(self, arg1, arg2=AUTO_TOPIC, arg3=None) will have self.allParams = (arg1, arg2, arg3), self.numRequired=1, and self.autoTopicArgName = ‘arg2’, whereas listener(self, arg1, arg3=None) will have self.allParams = (arg1, arg3), self.numRequired=1, and self.autoTopicArgName = None.



getAllArgs(self)


getOptionalArgs(self)


getRequiredArgs(self)

Return a tuple of names indicating which call arguments are required to be present when pub.sendMessage(...) is called.