from whylog.constraints import DifferentConstraint, IdenticalConstraint, TimeConstraint
from whylog.constraints.const import ConstraintType
from whylog.constraints.exceptions import UnsupportedConstraintTypeError


class ConstraintRegistry(object):
    CONSTRAINTS = {
        ConstraintType.IDENTICAL: IdenticalConstraint,
        ConstraintType.TIME_DELTA: TimeConstraint,
        ConstraintType.DIFFERENT: DifferentConstraint
        # register your constraint here
    }  # yapf: disable

    @classmethod
    def get_constraint(cls, constraint_data):
        if constraint_data['name'] in cls.CONSTRAINTS:
            return cls.CONSTRAINTS[constraint_data['name']](
                param_dict=constraint_data['params'],
                params_checking=False
            )
        raise UnsupportedConstraintTypeError(constraint_data)

    @classmethod
    def constraint_from_name(cls, constraint_name):
        return cls.CONSTRAINTS.get(constraint_name)


class ConstraintManager(object):
    """
    there should be one such object per rule being verified
    """

    def __init__(self):
        self._actual_constraints = {}

    def __getitem__(self, constraint_data):
        constraint = self._actual_constraints.get(constraint_data['name'])
        if constraint is None:
            constraint_verifier = ConstraintRegistry.get_constraint(constraint_data)
            self._actual_constraints[constraint_data['name']] = constraint_verifier
        return self._actual_constraints[constraint_data['name']]

@@ -1,28 +1,40 @@
+import six%0A%0A
 from whylog.constraints impo
@@ -968,16 +968,102 @@
 _name)%0A%0A
+    @classmethod%0A    def get_types(cls):%0A        return six.iterkeys(cls.CONSTRAINTS)%0A
 %0Aclass C

Add get_types method