def __init__()

in geneve/solver/__init__.py [0:0]


    def __init__(self, field, constraints, field_constraints, is_array):
        self.field = field
        self.value = [] if is_array else None
        self.is_array = is_array
        self.has_wildcards = has_wildcards(field)
        self.join_field_parts = None
        self.max_attempts = None
        self.cardinality = 0

        valid_constraints = self.common_constraints + getattr(self, "valid_constraints", [])

        for k, v, *flags in constraints + field_constraints:
            if k not in valid_constraints:
                raise NotImplementedError(f"Unsupported {self.type} '{field}' constraint: {k}")
            if k == "join_value":
                self.join_field_parts = split_path(v[1])
            if k == "max_attempts":
                v = int(v)
                if v < 0:
                    raise ValueError(f"max_attempts cannot be negative: {v}")
                if self.max_attempts is None or self.max_attempts > v:
                    self.max_attempts = v
            if k == "cardinality":
                if type(v) is tuple:
                    if len(v) > 1:
                        raise ValueError(f"Too many arguments for cardinality of '{field}': {v}")
                    v = v[0]
                self.cardinality = int(v)

        if self.max_attempts is None:
            self.max_attempts = _max_attempts