# 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.'''


import re
import biplist
from string import printable
from StringIO import StringIO
from datetime import datetime, timedelta
from CFPropertyList import CFPropertyList, native_types
from pysiriproxy.constants import Keys
from pyamp.util import getStackTrace
class BinaryPlist:
    '''The BinaryPlist class takes in a dictionary containing data and
    provides the ability to convert the dictionary into a binary plist.

    .. note:: This class uses the :mod:`biplist` module to convert a Python
              dictionary into a binary plist.

    '''

    TtsRegex = "@{tts#.*?}"
    '''The tag that indicates the start of a tts tag. This is a non-greedy
    regular expression so that it matches to only the first end curly brace.

    '''

    DateKeys = [
        Keys.Birthday,
        Keys.Date,
        Keys.DueDate,
        Keys.TheatricalReleaseDate,
        ]
    '''The DateKeys property contains the list of object keys that contain
    dates that need to be swapped with datetime objects.

    '''

    UnicodeKeys = [
        Keys.Label,
        Keys.SelectionResponse,
        Keys.SpeakableSelectionResponse,

# 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/plist.py
import re
import biplist
from string import printable
from StringIO import StringIO
from datetime import datetime, timedelta
from CFPropertyList import CFPropertyList, native_types
from pysiriproxy.constants import Keys
from pyamp.util import getStackTrace

class BinaryPlist:
    '''The BinaryPlist class takes in a dictionary containing data and
    provides the ability to convert the dictionary into a binary plist.

    .. note:: This class uses the :mod:`biplist` module to convert a Python
              dictionary into a binary plist.

    '''

    TtsRegex = "@{tts#.*?}"
    '''The tag that indicates the start of a tts tag. This is a non-greedy
    regular expression so that it matches to only the first end curly brace.

    '''

    DateKeys = [
        Keys.Birthday,
        Keys.Date,
        Keys.DueDate,
        Keys.TheatricalReleaseDate,
        ]
    '''The DateKeys property contains the list of object keys that contain
    dates that need to be swapped with datetime objects.

    '''

    UnicodeKeys = [
        Keys.Label,
        Keys.SelectionResponse,
        Keys.SpeakableSelectionResponse,

        Keys.SpeakableText,