# Path: infi/pyutils/functors/functor.py
# class Functor(object):
#     def __call__(self, *args, **kwargs):
#         raise NotImplementedError()
# 
# Path: infi/pyutils/functors/always.py
# class Always(Functor):
#     def __init__(self, value):
#         super(Always, self).__init__()
#         self._value = value
#     def __call__(self, *args, **kwargs):
#         return self._value
#     def __repr__(self):
#         return "<Always {0!r}>".format(self._value)
# 
# Path: infi/pyutils/python_compat.py
# _PYTHON_VERSION = platform.python_version()
# _IS_PYTHON_3 = _PYTHON_VERSION >= '3'
# _IS_BELOW_PYTHON_2_7 = _PYTHON_VERSION < '2.7'
# def get_underlying_function(f):
# def _get_underlying_classmethod_function(f):
#     def create_bound_method(func, self):
#     class TemporaryClass(object):


import operator
import functools
from .functors.functor import Functor
from .functors.always import Always
from .python_compat import iteritems

class Predicate(Functor):
    def __init__(self, func=None):
        super(Predicate, self).__init__()
        self._func = func
    def __call__(self, *args, **kwargs):
        return self._func(*args, **kwargs)
    def __repr__(self):
        return "<Predicate {0!r}>".format(self._func or "?")

AlwaysTrue = Predicate(Always(True))

# Path: infi/pyutils/functors/functor.py
# class Functor(object):
#     def __call__(self, *args, **kwargs):
#         raise NotImplementedError()
# 
# Path: infi/pyutils/functors/always.py
# class Always(Functor):
#     def __init__(self, value):
#         super(Always, self).__init__()
#         self._value = value
#     def __call__(self, *args, **kwargs):
#         return self._value
#     def __repr__(self):
#         return "<Always {0!r}>".format(self._value)
# 
# Path: infi/pyutils/python_compat.py
# _PYTHON_VERSION = platform.python_version()
# _IS_PYTHON_3 = _PYTHON_VERSION >= '3'
# _IS_BELOW_PYTHON_2_7 = _PYTHON_VERSION < '2.7'
# def get_underlying_function(f):
# def _get_underlying_classmethod_function(f):
#     def create_bound_method(func, self):
#     class TemporaryClass(object):


# Path: infi/pyutils/predicates.py
import operator
import functools
from .functors.functor import Functor
from .functors.always import Always
from .python_compat import iteritems


class Predicate(Functor):
    def __init__(self, func=None):
        super(Predicate, self).__init__()
        self._func = func
    def __call__(self, *args, **kwargs):
        return self._func(*args, **kwargs)
    def __repr__(self):
        return "<Predicate {0!r}>".format(self._func or "?")

AlwaysTrue = Predicate(Always(True))

AlwaysFalse = Predicate(Always(False))