platypush/message/event/__init__.py
def matches_condition(self, condition):
        """
        If the event matches an event condition, it will return an EventMatchResult
        :param condition: The platypush.event.hook.EventCondition object
        """

        result = EventMatchResult(is_match=False, parsed_args=self.args)
        match_scores = []

        if not isinstance(self, condition.type):
            return result

        for (attr, value) in condition.args.items():
            if attr not in self.args:
                return result

            if isinstance(self.args[attr], str):
                arg_result = self._matches_argument(argname=attr, condition_value=value)

                if arg_result.is_match:
                    match_scores.append(arg_result.score)
                    for (parsed_arg, parsed_value) in arg_result.parsed_args.items():
                        result.parsed_args[parsed_arg] = parsed_value
                else:
                    return result
            elif self.args[attr] != value:
                # TODO proper support for list and dictionary matches
                return result

        result.is_match = True
        if match_scores:
            result.score = sum(match_scores) / float(len(match_scores))

        return result

        If the event matches an event condition, it will return an EventMatchResult
        :param condition: The platypush.event.hook.EventCondition object
        
If the event matches an event condition, it will return an EventMatchResult
If the event matches an event condition it will return an EventMatchResult
def matches_condition(self, condition):
        result = EventMatchResult(is_match=False, parsed_args=self.args)
        match_scores = []
        if not isinstance(self, condition.type):
            return result
        for (attr, value) in condition.args.items():
            if attr not in self.args:
                return result
            if isinstance(self.args[attr], str):
                arg_result = self._matches_argument(argname=attr, condition_value=value)
                if arg_result.is_match:
                    match_scores.append(arg_result.score)
                    for (parsed_arg, parsed_value) in arg_result.parsed_args.items():
                        result.parsed_args[parsed_arg] = parsed_value
                else:
                    return result
            elif self.args[attr] != value:
                return result
        result.is_match = True
        if match_scores:
            result.score = sum(match_scores) / float(len(match_scores))
        return result
def matches_condition ( self , condition ) : result = EventMatchResult ( is_match = False , parsed_args = self . args ) match_scores = [ ] if not isinstance ( self , condition . type ) : return result for ( attr , value ) in condition . args . items ( ) : if attr not in self . args : return result if isinstance ( self . args [ attr ] , str ) : arg_result = self . _matches_argument ( argname = attr , condition_value = value ) if arg_result . is_match : match_scores . append ( arg_result . score ) for ( parsed_arg , parsed_value ) in arg_result . parsed_args . items ( ) : result . parsed_args [ parsed_arg ] = parsed_value else : return result elif self . args [ attr ] != value : return result result . is_match = True if match_scores : result . score = sum ( match_scores ) / float ( len ( match_scores ) ) return result
If the event matches an event condition, it will return an EventMatchResult
If the event matches an event condition it will return an EventMatchResult
"""
        If the event matches an event condition, it will return an EventMatchResult
        :param condition: The platypush.event.hook.EventCondition object
        """ # TODO proper support for list and dictionary matches
self
condition
The platypush.event.hook.EventCondition object
The platypush . event . hook . EventCondition object