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

        :param msgData: the topic message data to filter
Returns a dict which contains only those items of msgData which are defined for topic.
        E.g. if msgData is {a:1, b:'b'} and topic arg spec is ('a',) then return {a:1}. The returned
        dict is valid only if check(msgData) was called (or check(superset of msgData) was called).
Returns a dict which contains only those items of msgData which are defined for topic . E . g . if msgData is { a : 1 b : b } and topic arg spec is ( a ) then return { a : 1 } . The returned dict is valid only if check ( msgData ) was called ( or check ( superset of msgData ) was called ) .
def filterArgs(self, msgData: MsgData) -> MsgData:
        """
        Returns a dict which contains only those items of msgData which are defined for topic.
        E.g. if msgData is {a:1, b:'b'} and topic arg spec is ('a',) then return {a:1}. The returned
        dict is valid only if check(msgData) was called (or check(superset of msgData) was called).

        :param msgData: the topic message data to filter
        """
        assert self.isComplete()
        if len(msgData) == self.numArgs():
            return msgData

        # only keep the keys from msgData that are also in topic's kwargs
        # method 1: SLOWEST
        # newKwargs = dict( (k,msgData[k]) for k in self.__msgArgs.allOptional if k in msgData )
        # newKwargs.update( (k,msgData[k]) for k in self.__msgArgs.allRequired )

        # method 2: FAST:
        # argNames = self.__msgArgs.getArgs()
        # newKwargs = dict( (key, val) for (key, val) in msgData.iteritems() if key in argNames )

        # method 3: FASTEST:
        argNames = set(self.getArgs()).intersection(msgData)
        newKwargs = dict((k, msgData[k]) for k in argNames)

        return newKwargs
def filterArgs ( self , msgData : MsgData ) -> MsgData : assert self . isComplete ( ) if len ( msgData ) == self . numArgs ( ) : return msgData # only keep the keys from msgData that are also in topic's kwargs # method 1: SLOWEST # newKwargs = dict( (k,msgData[k]) for k in self.__msgArgs.allOptional if k in msgData ) # newKwargs.update( (k,msgData[k]) for k in self.__msgArgs.allRequired ) # method 2: FAST: # argNames = self.__msgArgs.getArgs() # newKwargs = dict( (key, val) for (key, val) in msgData.iteritems() if key in argNames ) # method 3: FASTEST: argNames = set ( self . getArgs ( ) ) . intersection ( msgData ) newKwargs = dict ( ( k , msgData [ k ] ) for k in argNames ) return newKwargs