# Path: pysiriproxy/constants.py
# class Directions:
#     '''The Directions class contains several properties which are used to
#     indicate which direction data is entering the system.
# 
#     '''
# 
#     From_Server = "From_Server"
#     '''The From_Server property indicates that data was received from Apple's
#     server.
# 
#     '''
# 
#     From_iPhone = "From_iPhone"
#     '''The From_iPhone property indicates that data was received from the
#     iPhone.
# 
#     '''


from pysiriproxy.constants import Directions
from pyamp.patterns import listProperty
def isDirectionFilter(function):
    '''Determine if the given function is a directions filter.

    * function -- The function

    '''
    directions = getDirections(function)
    return directions is not None and len(directions) > 0


def directionsMatch(function, direction):
    '''Determine if the given direction is found in the list
    of directions for this function.

    * function -- The function
    * direction -- The given direction

    '''
    directions = getDirections(function)
    return directions is None or len(directions) == 0 \
        or direction in directions


# Define all of the direction decorators
From_iPhone = _addDirection(Directions.From_iPhone)
'''The From_iPhone property is a decorator which can be used to allow
functions to match objects that are received from the iPhone.

'''


# Path: pysiriproxy/constants.py
# class Directions:
#     '''The Directions class contains several properties which are used to
#     indicate which direction data is entering the system.
# 
#     '''
# 
#     From_Server = "From_Server"
#     '''The From_Server property indicates that data was received from Apple's
#     server.
# 
#     '''
# 
#     From_iPhone = "From_iPhone"
#     '''The From_iPhone property indicates that data was received from the
#     iPhone.
# 
#     '''


# Path: pysiriproxy/plugins/directions.py
from pysiriproxy.constants import Directions
from pyamp.patterns import listProperty

def isDirectionFilter(function):
    '''Determine if the given function is a directions filter.

    * function -- The function

    '''
    directions = getDirections(function)
    return directions is not None and len(directions) > 0


def directionsMatch(function, direction):
    '''Determine if the given direction is found in the list
    of directions for this function.

    * function -- The function
    * direction -- The given direction

    '''
    directions = getDirections(function)
    return directions is None or len(directions) == 0 \
        or direction in directions


# Define all of the direction decorators
From_iPhone = _addDirection(Directions.From_iPhone)
'''The From_iPhone property is a decorator which can be used to allow
functions to match objects that are received from the iPhone.

'''


From_Server = _addDirection(Directions.From_Server)