Phoenix Logo

phoenix_title wx.lib.pubsub.core.topicargspecimpl.ArgsInfo

Encode the Message Data Specification (MDS) for a given topic. ArgsInfos form a tree identical to that of Topics in that ArgInfos have a reference to their parent and children ArgInfos, created for the parent and children topics.

The only difference between an ArgsInfo and an ArgSpecGiven is that the latter is what “user thinks is ok” whereas former has been validated: the specification for this topic is a strict superset of the specification of its parent, and a strict subset of the specification of each of its children. Also, the instance can be used to check validity and filter arguments.

The MDS can be created “empty”, ie “incomplete”, meaning it cannot yet be used to validate listener subscriptions to topics.


class_hierarchy Class Hierarchy

Inheritance diagram for class ArgsInfo:

method_summary Methods Summary

__init__  
check Check that the message arguments given satisfy the topic message
filterArgs Returns a dict which contains only those items of msgKwargs
getArgs  
getArgsDocs  
getCompleteAI Get the closest arg spec, starting from self and moving to parent,
getOptArgs  
getReqdArgs  
hasParent return True if self has argsInfo object as parent
hasSameArgs Returns true if self has all the message arguments given, no
isComplete  
numArgs  
setArgsDocs docs is a mapping from arg names to their documentation
updateAllArgsFinal This can only be called once, if the construction was done

api Class API



class ArgsInfo

Encode the Message Data Specification (MDS) for a given topic. ArgsInfos form a tree identical to that of Topics in that ArgInfos have a reference to their parent and children ArgInfos, created for the parent and children topics.

The only difference between an ArgsInfo and an ArgSpecGiven is that the latter is what “user thinks is ok” whereas former has been validated: the specification for this topic is a strict superset of the specification of its parent, and a strict subset of the specification of each of its children. Also, the instance can be used to check validity and filter arguments.

The MDS can be created “empty”, ie “incomplete”, meaning it cannot yet be used to validate listener subscriptions to topics.


Methods



__init__(self, topicNameTuple, specGiven, parentArgsInfo)


check(self, msgKwargs)

Check that the message arguments given satisfy the topic message data specification (MDS). Raises SenderMissingReqdMsgDataError if some required args are missing or not known, and raises SenderUnknownMsgDataError if some optional args are unknown.



filterArgs(self, msgKwargs)

Returns a dict which contains only those items of msgKwargs which are defined for topic. E.g. if msgKwargs is {a:1, b:’b’} and topic arg spec is (‘a’,) then return {a:1}. The returned dict is valid only if check(msgKwargs) was called (or check(superset of msgKwargs) was called).



getArgs(self)


getArgsDocs(self)


getCompleteAI(self)

Get the closest arg spec, starting from self and moving to parent, that is complete. So if self.isComplete() is True, then returns self, otherwise returns parent (if parent.isComplete()), etc.



getOptArgs(self)


getReqdArgs(self)


hasParent(self, argsInfo)

return True if self has argsInfo object as parent



hasSameArgs(self, *argNames)

Returns true if self has all the message arguments given, no more and no less. Order does not matter. So if getArgs() returns (‘arg1’, ‘arg2’) then self.hasSameArgs(‘arg2’, ‘arg1’) will return true.



isComplete(self)


numArgs(self)


setArgsDocs(self, docs)

docs is a mapping from arg names to their documentation



updateAllArgsFinal(self, topicDefn)

This can only be called once, if the construction was done with ArgSpecGiven.SPEC_GIVEN_NONE