# Path: pyknow/fieldconstraint.py
# class P(Bindable, FieldConstraint):
#     """Predicate Field Constraint"""
#     def __new__(cls, match, __bind__=None):
#         if not isinstance(match, Callable):
#             raise TypeError("PredicateFC needs a callable.")
#         else:
#             obj = super(P, cls).__new__(cls, match)
#             obj.__bind__ = __bind__
#             return obj
# 
#     @property
#     def match(self):
#         return self[0]


from functools import singledispatch
from frozendict import frozendict
from .fieldconstraint import P
import collections.abc
@freeze.register(set)
@freeze.register(frozenset)
def freeze_set(obj):
    return frozenset(freeze(v) for v in obj)


@singledispatch
def unfreeze(obj):
    return obj


@unfreeze.register(dict)
@unfreeze.register(frozendict)
def unfreeze_frozendict(obj):
    return {k: unfreeze(v) for k, v in obj.items()}


@unfreeze.register(list)
@unfreeze.register(frozenlist)
def unfreeze_frozenlist(obj):
    return [unfreeze(x) for x in obj]


@unfreeze.register(set)
@unfreeze.register(frozenset)
def unfreeze_frozenset(obj):
    return {unfreeze(x) for x in obj}


def anyof(*what):

# Path: pyknow/fieldconstraint.py
# class P(Bindable, FieldConstraint):
#     """Predicate Field Constraint"""
#     def __new__(cls, match, __bind__=None):
#         if not isinstance(match, Callable):
#             raise TypeError("PredicateFC needs a callable.")
#         else:
#             obj = super(P, cls).__new__(cls, match)
#             obj.__bind__ = __bind__
#             return obj
# 
#     @property
#     def match(self):
#         return self[0]


# Path: pyknow/utils.py
from functools import singledispatch
from frozendict import frozendict
from .fieldconstraint import P
import collections.abc

@freeze.register(set)
@freeze.register(frozenset)
def freeze_set(obj):
    return frozenset(freeze(v) for v in obj)


@singledispatch
def unfreeze(obj):
    return obj


@unfreeze.register(dict)
@unfreeze.register(frozendict)
def unfreeze_frozendict(obj):
    return {k: unfreeze(v) for k, v in obj.items()}


@unfreeze.register(list)
@unfreeze.register(frozenlist)
def unfreeze_frozenlist(obj):
    return [unfreeze(x) for x in obj]


@unfreeze.register(set)
@unfreeze.register(frozenset)
def unfreeze_frozenset(obj):
    return {unfreeze(x) for x in obj}


def anyof(*what):

    return P(lambda y: y in what)