# Path: pysiriproxy/constants.py
# class Keys:
#     '''The Keys class defines various properties which contain strings which
#     are keys to the dictionary objects sent between the iPhone and Apple's
#     server.
# 
#     '''
# 
#     AceId = "aceId"
#     '''The aceId key.'''
# 
#     AssistantId = 'AssistantId'
#     '''The key for the AssistantId property of an object.'''
# 
#     Birthday = "birthday"
#     '''The birthday key for an object.'''
# 
#     Class = "class"
#     '''The class name for the object.'''
# 
#     Data = "data"
#     '''The key for the data property of an object. '''
# 
#     Date = "date"
#     '''The date key for an object.'''
# 
#     DateSent = "dateSent"
#     '''The key for the dateSent property of an object.'''
# 
#     DisplayText = "displayText"
#     '''The key for the displayText property of an object.'''
# 
#     DueDate = "dueDate"
#     '''The due date key for an object.'''
# 
#     FirstName = "firstName"
#     '''The key for the firstName property of an object.'''
# 
#     FullName = "fullName"
#     '''The key for the fullName property of an object.'''
# 
#     Group = "group"
#     '''The group for the object.'''
# 
#     Identifier = "identifier"
#     '''The key for the identifier property of an object.'''
# 
#     Interpretations = "interpretations"
#     '''The interpretations key for an object.'''
# 
#     Label = "label"
#     '''The key for the label property of an object.'''
# 
#     LastName = "lastName"
#     '''The key for the lastName property of an object.'''
# 
#     MsgSender = "msgSender"
#     '''The key for the msgSender property of an object.'''
# 
#     Number = "number"
#     '''The key for the number property of an object.'''
# 
#     OrderedContext = 'orderedContext'
#     '''The key for the orderedContext property of an object.'''
# 
#     Outgoing = "outgoing"
#     '''The key for the outgoing property of an object.'''
# 
#     Phones = "phones"
#     '''The key for the phones property of an object.'''
# 
#     Phrases = "phrases"
#     '''The phrases key for an object.'''
# 
#     Properties = "properties"
#     '''The properties key for the object.'''
# 
#     Recognition = "recognition"
#     '''The recognition key for an object.'''
# 
#     RefId = "refId"
#     '''The refId for the object.'''
# 
#     RemoveSpaceAfter = "removeSpaceAfter"
#     '''The removeSpaceAfter key for an object.'''
# 
#     RemoveSpaceBefore = "removeSpaceBefore"
#     '''The removeSpaceBefore key for an object.'''
# 
#     SelectionResponse = "selectionResponse"
#     '''The key for the selectionResponse property of an object.'''
# 
#     SessionValidationData = 'SessionValidationData'
#     '''The key for the SessionValidationData property of an object.'''
# 
#     SpeakableSelectionResponse = "speakableSelectionResponse"
#     '''The key for the speakableSelectionResponse property of an object.'''
# 
#     SpeakableText = "speakableText"
#     '''The speakable text key for an object.'''
# 
#     SpeechId = 'SpeechId'
#     '''The key for the SpeechId property of an object.'''
# 
#     Street = "street"
#     '''The street value.'''
# 
#     Text = "text"
#     '''The text key for an object.'''
# 
#     TheatricalReleaseDate = "theatricalReleaseDate"
#     '''The theatrical release date.'''
# 
#     Title = "title"
#     '''The title key for an object.'''
# 
#     Tokens = "tokens"
#     '''The tokens key for an object.'''
# 
#     Utterance = "utterance"
#     '''The utterance key for an object.'''
# 
#     Version = "v"
#     '''The version key for an object.'''
# 
# Path: pysiriproxy/plugins/speechRules.py
# _SPEECH_RULES_PROP = "SpeechRules"
# def getSpeechRules(function):
# def isSpeechRule(function):
# def speechRuleMatches(function, text):
# def createSpeechRule(ruleClass):
#     def wrapper(text, *args, **kwargs):
#     def __init__(self, text, *args, **kwargs):
#     def text(self):
#     def test(self, text):
#     def test(self, text):
#     def __init__(self, regex, ignoreCase=True):
#     def test(self, text):
# class SpeechRule:
# class MatchSpeechRule(SpeechRule):
# class RegexSpeechRule(SpeechRule):
# 
# Path: pysiriproxy/plugins/directions.py
# _DIRECTIONS_PROP = "Directions"
# def _addDirection(direction):
# def getDirections(function):
# def isDirectionFilter(function):
# def directionsMatch(function, direction):
# 
# Path: pysiriproxy/plugins/objectClasses.py
# _CLASSES_PROP = "Classes"
# def createClassFilter(className):
# def isObjectClassFilter(function):
# def getObjectClasses(function):
# def objectClassesMatch(function, objectClass):


from types import GeneratorType
from pysiriproxy.constants import Keys
from pysiriproxy.plugins.speechRules import isSpeechRule, speechRuleMatches, \
    matches
from pysiriproxy.plugins.directions import isDirectionFilter, \
    directionsMatch, From_iPhone, From_Server
from pysiriproxy.plugins.objectClasses import isObjectClassFilter, \
    objectClassesMatch, SpeechPacket, SpeechRecognized, StartRequest
from pyamp.logging import Colors
from pyamp.util import getStackTrace
        '''Determine if the given filter function applies to either the
        given direction or the class of the given object.

        * direction -- The direction
        * obj -- The object

        '''
        objectClass = obj.get('class')
        return directionsMatch(function, direction) and \
            objectClassesMatch(function, objectClass)

    def __speechRuleApplies(self, function, text):
        '''Determine if the given speech rule function applies to
        the recognized text.

        * function -- The speech rule function
        * text -- The recognized text

        '''
        return speechRuleMatches(function, text)

    def __getStartRequestCommand(self, obj):
        '''Get the command name from the start request object.

        * obj -- The start request object

        '''
        utterance = None
        properties = obj.get(Keys.Properties)
        if properties is not None:

# Path: pysiriproxy/constants.py
# class Keys:
#     '''The Keys class defines various properties which contain strings which
#     are keys to the dictionary objects sent between the iPhone and Apple's
#     server.
# 
#     '''
# 
#     AceId = "aceId"
#     '''The aceId key.'''
# 
#     AssistantId = 'AssistantId'
#     '''The key for the AssistantId property of an object.'''
# 
#     Birthday = "birthday"
#     '''The birthday key for an object.'''
# 
#     Class = "class"
#     '''The class name for the object.'''
# 
#     Data = "data"
#     '''The key for the data property of an object. '''
# 
#     Date = "date"
#     '''The date key for an object.'''
# 
#     DateSent = "dateSent"
#     '''The key for the dateSent property of an object.'''
# 
#     DisplayText = "displayText"
#     '''The key for the displayText property of an object.'''
# 
#     DueDate = "dueDate"
#     '''The due date key for an object.'''
# 
#     FirstName = "firstName"
#     '''The key for the firstName property of an object.'''
# 
#     FullName = "fullName"
#     '''The key for the fullName property of an object.'''
# 
#     Group = "group"
#     '''The group for the object.'''
# 
#     Identifier = "identifier"
#     '''The key for the identifier property of an object.'''
# 
#     Interpretations = "interpretations"
#     '''The interpretations key for an object.'''
# 
#     Label = "label"
#     '''The key for the label property of an object.'''
# 
#     LastName = "lastName"
#     '''The key for the lastName property of an object.'''
# 
#     MsgSender = "msgSender"
#     '''The key for the msgSender property of an object.'''
# 
#     Number = "number"
#     '''The key for the number property of an object.'''
# 
#     OrderedContext = 'orderedContext'
#     '''The key for the orderedContext property of an object.'''
# 
#     Outgoing = "outgoing"
#     '''The key for the outgoing property of an object.'''
# 
#     Phones = "phones"
#     '''The key for the phones property of an object.'''
# 
#     Phrases = "phrases"
#     '''The phrases key for an object.'''
# 
#     Properties = "properties"
#     '''The properties key for the object.'''
# 
#     Recognition = "recognition"
#     '''The recognition key for an object.'''
# 
#     RefId = "refId"
#     '''The refId for the object.'''
# 
#     RemoveSpaceAfter = "removeSpaceAfter"
#     '''The removeSpaceAfter key for an object.'''
# 
#     RemoveSpaceBefore = "removeSpaceBefore"
#     '''The removeSpaceBefore key for an object.'''
# 
#     SelectionResponse = "selectionResponse"
#     '''The key for the selectionResponse property of an object.'''
# 
#     SessionValidationData = 'SessionValidationData'
#     '''The key for the SessionValidationData property of an object.'''
# 
#     SpeakableSelectionResponse = "speakableSelectionResponse"
#     '''The key for the speakableSelectionResponse property of an object.'''
# 
#     SpeakableText = "speakableText"
#     '''The speakable text key for an object.'''
# 
#     SpeechId = 'SpeechId'
#     '''The key for the SpeechId property of an object.'''
# 
#     Street = "street"
#     '''The street value.'''
# 
#     Text = "text"
#     '''The text key for an object.'''
# 
#     TheatricalReleaseDate = "theatricalReleaseDate"
#     '''The theatrical release date.'''
# 
#     Title = "title"
#     '''The title key for an object.'''
# 
#     Tokens = "tokens"
#     '''The tokens key for an object.'''
# 
#     Utterance = "utterance"
#     '''The utterance key for an object.'''
# 
#     Version = "v"
#     '''The version key for an object.'''
# 
# Path: pysiriproxy/plugins/speechRules.py
# _SPEECH_RULES_PROP = "SpeechRules"
# def getSpeechRules(function):
# def isSpeechRule(function):
# def speechRuleMatches(function, text):
# def createSpeechRule(ruleClass):
#     def wrapper(text, *args, **kwargs):
#     def __init__(self, text, *args, **kwargs):
#     def text(self):
#     def test(self, text):
#     def test(self, text):
#     def __init__(self, regex, ignoreCase=True):
#     def test(self, text):
# class SpeechRule:
# class MatchSpeechRule(SpeechRule):
# class RegexSpeechRule(SpeechRule):
# 
# Path: pysiriproxy/plugins/directions.py
# _DIRECTIONS_PROP = "Directions"
# def _addDirection(direction):
# def getDirections(function):
# def isDirectionFilter(function):
# def directionsMatch(function, direction):
# 
# Path: pysiriproxy/plugins/objectClasses.py
# _CLASSES_PROP = "Classes"
# def createClassFilter(className):
# def isObjectClassFilter(function):
# def getObjectClasses(function):
# def objectClassesMatch(function, objectClass):


# Path: pysiriproxy/plugins/plugin.py
from types import GeneratorType
from pysiriproxy.constants import Keys
from pysiriproxy.plugins.speechRules import isSpeechRule, speechRuleMatches, \
    matches
from pysiriproxy.plugins.directions import isDirectionFilter, \
    directionsMatch, From_iPhone, From_Server
from pysiriproxy.plugins.objectClasses import isObjectClassFilter, \
    objectClassesMatch, SpeechPacket, SpeechRecognized, StartRequest
from pyamp.logging import Colors
from pyamp.util import getStackTrace

        '''Determine if the given filter function applies to either the
        given direction or the class of the given object.

        * direction -- The direction
        * obj -- The object

        '''
        objectClass = obj.get('class')
        return directionsMatch(function, direction) and \
            objectClassesMatch(function, objectClass)

    def __speechRuleApplies(self, function, text):
        '''Determine if the given speech rule function applies to
        the recognized text.

        * function -- The speech rule function
        * text -- The recognized text

        '''
        return speechRuleMatches(function, text)

    def __getStartRequestCommand(self, obj):
        '''Get the command name from the start request object.

        * obj -- The start request object

        '''
        utterance = None
        properties = obj.get(Keys.Properties)
        if properties is not None:

            utterance = properties.get(Keys.Utterance)