'Set the input data set.'

@Inputs.data
@check_sql_input
def set_data(self, data):

    self.closeContext()
    self.clear()
    error_msg = ''
    warning_msg = ''
    candidatevars = []
    if (data is not None):
        candidatevars = [v for v in (data.domain.variables + data.domain.metas) if (v.is_discrete and (len(v.values) >= 2))]
        if (not candidatevars):
            error_msg = 'Input    does    not    have    any    suitable    cluster    labels.'
            data = None
    if (data is not None):
        ncont = sum((v.is_continuous for v in data.domain.attributes))
        ndiscrete = (len(data.domain.attributes) - ncont)
        if (ncont == 0):
            data = None
            error_msg = 'No    continuous    columns'
        elif (ncont < len(data.domain.attributes)):
            warning_msg = '{0}    categorical    columns    will    not    be    used    for    distance    computation'.format(ndiscrete)
    self.data = data
    if (data is not None):
        self.cluster_var_model[:] = candidatevars
        if (data.domain.class_var in candidatevars):
            self.cluster_var_idx = candidatevars.index(data.domain.class_var)
        else:
            self.cluster_var_idx = 0
        annotvars = [var for var in data.domain.metas if var.is_string]
        self.annotation_var_model[:] = (['None'] + annotvars)
        self.annotation_var_idx = (1 if len(annotvars) else 0)
        self._effective_data = Orange.distance._preprocess(data)
        self.openContext(Orange.data.Domain(candidatevars))
    self.error(error_msg)
    self.warning(warning_msg)
