{
    "file_diffs": [
        {
            "old_file_content": "import warnings\n\nfrom math import log\nfrom collections.abc import Iterable\nfrom itertools import chain\nfrom numbers import Integral\n\nimport numpy as np\n\nfrom Orange.data import (\n    Unknown, Variable, ContinuousVariable, DiscreteVariable, StringVariable\n)\nfrom Orange.util import deprecated, OrangeDeprecationWarning\n\n__all__ = [\"DomainConversion\", \"Domain\"]\n\n\nclass DomainConversion:\n    \"\"\"\n    Indices and functions for conversion between domains.\n\n    Every list contains indices (instances of int) of variables in the\n    source domain, or the variable's compute_value function if the source\n    domain does not contain the variable.\n\n    .. attribute:: source\n\n        The source domain. The destination is not stored since destination\n        domain is the one which contains the instance of DomainConversion.\n\n    .. attribute:: attributes\n\n        Indices for attribute values.\n\n    .. attribute:: class_vars\n\n        Indices for class variables\n\n    .. attribute:: variables\n\n        Indices for attributes and class variables\n        (:obj:`attributes`+:obj:`class_vars`).\n\n    .. attribute:: metas\n\n        Indices for meta attributes\n\n    .. attribute:: sparse_X\n\n        Flag whether the resulting X matrix should be sparse.\n\n    .. attribute:: sparse_Y\n\n        Flag whether the resulting Y matrix should be sparse.\n\n    .. attribute:: sparse_metas\n\n        Flag whether the resulting metas matrix should be sparse.\n    \"\"\"\n\n    def __init__(self, source, destination):\n        \"\"\"\n        Compute the conversion indices from the given `source` to `destination`\n        \"\"\"\n        def match(var):\n            if var in source:\n                sourcevar = source[var]\n                sourceindex = source.index(sourcevar)\n                if var.is_discrete and var is not sourcevar:\n                    mapping = var.get_mapper_from(sourcevar)\n                    return lambda table: mapping(table.get_column_view(sourceindex)[0])\n                return source.index(var)\n            return var.compute_value  # , which may also be None\n\n        self.source = source\n\n        self.attributes = [match(var) for var in destination.attributes]\n        self.class_vars = [match(var) for var in destination.class_vars]\n        self.variables = self.attributes + self.class_vars\n        self.metas = [match(var) for var in destination.metas]\n\n        def should_be_sparse(feats):\n            \"\"\"\n            For a matrix to be stored in sparse, more than 2/3 of columns\n            should be marked as sparse and there should be no string columns\n            since Scipy's sparse matrices don't support dtype=object.\n            \"\"\"\n            fraction_sparse = sum(f.sparse for f in feats) / max(len(feats), 1)\n            contain_strings = any(f.is_string for f in feats)\n            return fraction_sparse > 2/3 and not contain_strings\n\n        # check whether X, Y or metas should be sparse\n        self.sparse_X = should_be_sparse(destination.attributes)\n        self.sparse_Y = should_be_sparse(destination.class_vars)\n        self.sparse_metas = should_be_sparse(destination.metas)\n\n\ndef filter_visible(feats):\n    \"\"\"\n    Args:\n        feats (iterable): Features to be filtered.\n\n    Returns: A filtered tuple of features that are visible (i.e. not hidden).\n    \"\"\"\n    return (f for f in feats if not f.attributes.get('hidden', False))\n\n\nclass Domain:\n    def __init__(self, attributes, class_vars=None, metas=None, source=None):\n        \"\"\"\n        Initialize a new domain descriptor. Arguments give the features and\n        the class attribute(s). They can be described by descriptors (instances\n        of :class:`Variable`), or by indices or names if the source domain is\n        given.\n\n        :param attributes: a list of attributes\n        :type attributes: list of :class:`Variable`\n        :param class_vars: target variable or a list of target variables\n        :type class_vars: :class:`Variable` or list of :class:`Variable`\n        :param metas: a list of meta attributes\n        :type metas: list of :class:`Variable`\n        :param source: the source domain for attributes\n        :type source: Orange.data.Domain\n        :return: a new domain\n        :rtype: :class:`Domain`\n        \"\"\"\n\n        if class_vars is None:\n            class_vars = []\n        elif isinstance(class_vars, (Variable, Integral, str)):\n            class_vars = [class_vars]\n        elif isinstance(class_vars, Iterable):\n            class_vars = list(class_vars)\n\n        if not isinstance(attributes, list):\n            attributes = list(attributes)\n        metas = list(metas) if metas else []\n\n        # Replace str's and int's with descriptors if 'source' is given;\n        # complain otherwise\n        for lst in (attributes, class_vars, metas):\n            for i, var in enumerate(lst):\n                if not isinstance(var, Variable):\n                    if source is not None and isinstance(var, (str, int)):\n                        lst[i] = source[var]\n                    else:\n                        raise TypeError(\n                            \"descriptors must be instances of Variable, \"\n                            \"not '%s'\" % type(var).__name__)\n\n        names = [var.name for var in chain(attributes, class_vars, metas)]\n        if len(names) != len(set(names)):\n            raise Exception('All variables in the domain should have'\n                            ' unique names.')\n\n        # Store everything\n        self.attributes = tuple(attributes)\n        self.class_vars = tuple(class_vars)\n        self._variables = self.attributes + self.class_vars\n        self._metas = tuple(metas)\n        self.class_var = \\\n            self.class_vars[0] if len(self.class_vars) == 1 else None\n        if not all(var.is_primitive() for var in self._variables):\n            raise TypeError(\"variables must be primitive\")\n\n        self._indices = dict(chain.from_iterable(\n            ((var, idx), (var.name, idx), (idx, idx))\n            for idx, var in enumerate(self._variables)))\n        self._indices.update(chain.from_iterable(\n            ((var, -1-idx), (var.name, -1-idx), (-1-idx, -1-idx))\n            for idx, var in enumerate(self.metas)))\n\n        self.anonymous = False\n\n        self._hash = None  # cache for __hash__()\n\n    # noinspection PyPep8Naming\n    @classmethod\n    def from_numpy(cls, X, Y=None, metas=None):\n        \"\"\"\n        Create a domain corresponding to the given numpy arrays. This method\n        is usually invoked from :meth:`Orange.data.Table.from_numpy`.\n\n        All attributes are assumed to be continuous and are named\n        \"Feature <n>\". Target variables are discrete if the only two values\n        are 0 and 1; otherwise they are continuous. Discrete\n        targets are named \"Class <n>\" and continuous are named \"Target <n>\".\n        Domain is marked as :attr:`anonymous`, so data from any other domain of\n        the same shape can be converted into this one and vice-versa.\n\n        :param `numpy.ndarray` X: 2-dimensional array with data\n        :param Y: 1- of 2- dimensional data for target\n        :type Y: `numpy.ndarray` or None\n        :param `numpy.ndarray` metas: meta attributes\n        :type metas: `numpy.ndarray` or None\n        :return: a new domain\n        :rtype: :class:`Domain`\n        \"\"\"\n        def get_places(max_index):\n            return 0 if max_index == 1 else int(log(max_index, 10)) + 1\n\n        def get_name(base, index, places):\n            return base if not places \\\n                else \"{} {:0{}}\".format(base, index + 1, places)\n\n        if X.ndim != 2:\n            raise ValueError('X must be a 2-dimensional array')\n        n_attrs = X.shape[1]\n        places = get_places(n_attrs)\n        attr_vars = [ContinuousVariable(name=get_name(\"Feature\", a, places))\n                     for a in range(n_attrs)]\n        class_vars = []\n        if Y is not None:\n            if Y.ndim == 1:\n                Y = Y.reshape(len(Y), 1)\n            elif Y.ndim != 2:\n                raise ValueError('Y has invalid shape')\n            n_classes = Y.shape[1]\n            places = get_places(n_classes)\n            for i, values in enumerate(Y.T):\n                if set(values) == {0, 1}:\n                    name = get_name('Class', i, places)\n                    values = ['v1', 'v2']\n                    class_vars.append(DiscreteVariable(name, values))\n                else:\n                    name = get_name('Target', i + 1, places)\n                    class_vars.append(ContinuousVariable(name))\n        if metas is not None:\n            n_metas = metas.shape[1]\n            places = get_places(n_metas)\n            meta_vars = [StringVariable(get_name(\"Meta\", m, places))\n                         for m in range(n_metas)]\n        else:\n            meta_vars = []\n\n        domain = cls(attr_vars, class_vars, meta_vars)\n        domain.anonymous = True\n        return domain\n\n    @property\n    def variables(self):\n        return self._variables\n\n    @property\n    def metas(self):\n        return self._metas\n\n    @deprecated(\"len(Domain.variables)\")\n    def __len__(self):\n        \"\"\"The number of variables (features and class attributes).\n\n        The current behavior returns the length of only features and\n        class attributes. In the near future, it will include the\n        length of metas, too, and __iter__ will act accordingly.\"\"\"\n        return len(self._variables)\n\n    def __bool__(self):\n        warnings.warn(\n            \"Domain.__bool__ is ambiguous; use 'is None' or 'empty' instead\",\n            OrangeDeprecationWarning, stacklevel=2)\n        return len(self) > 0  # Keep the obsolete behaviour\n\n    def empty(self):\n        \"\"\"True if the domain has no variables of any kind\"\"\"\n        return not self.variables and not self.metas\n\n    def _get_equivalent(self, var):\n        if isinstance(var, Variable):\n            index = self._indices.get(var.name)\n            if index is not None:\n                if index >= 0:\n                    myvar = self.variables[index]\n                else:\n                    myvar = self.metas[-1 - index]\n                if myvar == var:\n                    return myvar\n        return None\n\n    def __getitem__(self, idx):\n        \"\"\"\n        Return a variable descriptor from the given argument, which can be\n        a descriptor, index or name. If `var` is a descriptor, the function\n        returns this same object.\n\n        :param idx: index, name or descriptor\n        :type idx: int, str or :class:`Variable`\n        :return: an instance of :class:`Variable` described by `var`\n        :rtype: :class:`Variable`\n        \"\"\"\n        if isinstance(idx, slice):\n            return self._variables[idx]\n\n        index = self._indices.get(idx)\n        if index is None:\n            var = self._get_equivalent(idx)\n            if var is not None:\n                return var\n            raise KeyError(idx)\n        if index >= 0:\n            return self.variables[index]\n        else:\n            return self.metas[-1 - index]\n\n    def __contains__(self, item):\n        \"\"\"\n        Return `True` if the item (`str`, `int`, :class:`Variable`) is\n        in the domain.\n        \"\"\"\n        return item in self._indices or self._get_equivalent(item) is not None\n\n    @deprecated(\"Domain.variables\")\n    def __iter__(self):\n        \"\"\"\n        Return an iterator through variables (features and class attributes).\n\n        The current behaviour is confusing, as `x in domain` returns True\n        for meta variables, but iter(domain) does not yield them.\n        This will be consolidated eventually (in 3.12?), the code that\n        currently iterates over domain should iterate over domain.variables\n        instead.\n        \"\"\"\n        return iter(self._variables)\n\n    def __str__(self):\n        \"\"\"\n        Return a list-like string with the domain's features, class attributes\n        and meta attributes.\n        \"\"\"\n        s = \"[\" + \", \".join(attr.name for attr in self.attributes)\n        if self.class_vars:\n            s += \" | \" + \", \".join(cls.name for cls in self.class_vars)\n        s += \"]\"\n        if self._metas:\n            s += \" {\" + \", \".join(meta.name for meta in self._metas) + \"}\"\n        return s\n\n    __repr__ = __str__\n\n    def index(self, var):\n        \"\"\"\n        Return the index of the given variable or meta attribute, represented\n        with an instance of :class:`Variable`, `int` or `str`.\n        \"\"\"\n\n        idx = self._indices.get(var)\n        if idx is not None:\n            return idx\n        equiv = self._get_equivalent(var)\n        if equiv is not None:\n            return self._indices[equiv]\n\n        raise ValueError(\"'%s' is not in domain\" % var)\n\n    def has_discrete_attributes(self, include_class=False, include_metas=False):\n        \"\"\"\n        Return `True` if domain has any discrete attributes. If\n        `include_class` is set, the check includes the class attribute(s). If\n        `include_metas` is set, the check includes the meta attributes.\n        \"\"\"\n        vars = self.variables if include_class else self.attributes\n        vars += self.metas if include_metas else ()\n        return any(var.is_discrete for var in vars)\n\n    def has_continuous_attributes(self, include_class=False, include_metas=False):\n        \"\"\"\n        Return `True` if domain has any continuous attributes. If\n        `include_class` is set, the check includes the class attribute(s). If\n        `include_metas` is set, the check includes the meta attributes.\n        \"\"\"\n        vars = self.variables if include_class else self.attributes\n        vars += self.metas if include_metas else ()\n        return any(var.is_continuous for var in vars)\n\n    def has_time_attributes(self, include_class=False, include_metas=False):\n        \"\"\"\n        Return `True` if domain has any time attributes. If\n        `include_class` is set, the check includes the class attribute(s). If\n        `include_metas` is set, the check includes the meta attributes.\n        \"\"\"\n        vars = self.variables if include_class else self.attributes\n        vars += self.metas if include_metas else ()\n        return any(var.is_time for var in vars)\n\n    @property\n    def has_continuous_class(self):\n        return bool(self.class_var and self.class_var.is_continuous)\n\n    @property\n    def has_discrete_class(self):\n        return bool(self.class_var and self.class_var.is_discrete)\n\n    @property\n    def has_time_class(self):\n        return bool(self.class_var and self.class_var.is_time)\n\n    # noinspection PyProtectedMember\n    def convert(self, inst):\n        \"\"\"\n        Convert a data instance from another domain to this domain.\n\n        :param inst: The data instance to be converted\n        :return: The data instance in this domain\n        \"\"\"\n        from .instance import Instance\n\n        if isinstance(inst, Instance):\n            if inst.domain == self:\n                return inst._x, inst._y, inst._metas\n            c = DomainConversion(inst.domain, self)\n            l = len(inst.domain.attributes)\n            values = [(inst._x[i] if 0 <= i < l\n                       else inst._y[i - l] if i >= l\n                       else inst._metas[-i - 1])\n                      if isinstance(i, int)\n                      else (Unknown if not i else i(inst))\n                      for i in c.variables]\n            metas = [(inst._x[i] if 0 <= i < l\n                      else inst._y[i - l] if i >= l\n                      else inst._metas[-i - 1])\n                     if isinstance(i, int)\n                     else (Unknown if not i else i(inst))\n                     for i in c.metas]\n        else:\n            nvars = len(self._variables)\n            nmetas = len(self._metas)\n            if len(inst) != nvars and len(inst) != nvars + nmetas:\n                raise ValueError(\"invalid data length for domain\")\n            values = [var.to_val(val)\n                      for var, val in zip(self._variables, inst)]\n            if len(inst) == nvars + nmetas:\n                metas = [var.to_val(val)\n                         for var, val in zip(self._metas, inst[nvars:])]\n            else:\n                metas = [var.Unknown for var in self._metas]\n        nattrs = len(self.attributes)\n        # Let np.array decide dtype for values\n        return np.array(values[:nattrs]), np.array(values[nattrs:]),\\\n               np.array(metas, dtype=object)\n\n    def select_columns(self, col_idx):\n        attributes, col_indices = self._compute_col_indices(col_idx)\n        if attributes is not None:\n            n_attrs = len(self.attributes)\n            r_attrs = [attributes[i]\n                       for i, col in enumerate(col_indices)\n                       if 0 <= col < n_attrs]\n            r_classes = [attributes[i]\n                         for i, col in enumerate(col_indices)\n                         if col >= n_attrs]\n            r_metas = [attributes[i]\n                       for i, col in enumerate(col_indices) if col < 0]\n            return Domain(r_attrs, r_classes, r_metas)\n        else:\n            return self\n\n    def _compute_col_indices(self, col_idx):\n        if col_idx is ...:\n            return None, None\n        if isinstance(col_idx, np.ndarray) and col_idx.dtype == bool:\n            return ([attr for attr, c in zip(self, col_idx) if c],\n                    np.nonzero(col_idx))\n        elif isinstance(col_idx, slice):\n            s = len(self.variables)\n            start, end, stride = col_idx.indices(s)\n            if col_idx.indices(s) == (0, s, 1):\n                return None, None\n            else:\n                return (self[col_idx],\n                        np.arange(start, end, stride))\n        elif isinstance(col_idx, Iterable) and not isinstance(col_idx, str):\n            attributes = [self[col] for col in col_idx]\n            if attributes == self.attributes:\n                return None, None\n            return attributes, np.fromiter(\n                (self.index(attr) for attr in attributes), int)\n        elif isinstance(col_idx, Integral):\n            attr = self[col_idx]\n        else:\n            attr = self[col_idx]\n            col_idx = self.index(attr)\n        return [attr], np.array([col_idx])\n\n    def checksum(self):\n        return hash(self)\n\n    def copy(self):\n        \"\"\"\n        Make a copy of the domain. New features are proxies of the old ones,\n        hence the new domain can be used anywhere the old domain was used.\n\n        Returns:\n            Domain: a copy of the domain.\n        \"\"\"\n        return Domain(\n            attributes=[a.make_proxy() for a in self.attributes],\n            class_vars=[a.make_proxy() for a in self.class_vars],\n            metas=[a.make_proxy() for a in self.metas],\n            source=self,\n        )\n\n    def __eq__(self, other):\n        if not isinstance(other, Domain):\n            return False\n\n        return (self.attributes == other.attributes and\n                self.class_vars == other.class_vars and\n                self.metas == other.metas)\n\n    def __hash__(self):\n        if self._hash is None:\n            self._hash = hash(self.attributes) ^ hash(self.class_vars) ^ hash(self.metas)\n        return self._hash\n",
            "new_file_content": "import itertools\nimport warnings\n\nfrom math import log\nfrom collections.abc import Iterable\nfrom itertools import chain\nfrom numbers import Integral\n\nimport numpy as np\n\nfrom Orange.data import (\n    Unknown, Variable, ContinuousVariable, DiscreteVariable, StringVariable\n)\nfrom Orange.util import deprecated, OrangeDeprecationWarning\n\n__all__ = [\"DomainConversion\", \"Domain\"]\n\n\nclass DomainConversion:\n    \"\"\"\n    Indices and functions for conversion between domains.\n\n    Every list contains indices (instances of int) of variables in the\n    source domain, or the variable's compute_value function if the source\n    domain does not contain the variable.\n\n    .. attribute:: source\n\n        The source domain. The destination is not stored since destination\n        domain is the one which contains the instance of DomainConversion.\n\n    .. attribute:: attributes\n\n        Indices for attribute values.\n\n    .. attribute:: class_vars\n\n        Indices for class variables\n\n    .. attribute:: variables\n\n        Indices for attributes and class variables\n        (:obj:`attributes`+:obj:`class_vars`).\n\n    .. attribute:: metas\n\n        Indices for meta attributes\n\n    .. attribute:: sparse_X\n\n        Flag whether the resulting X matrix should be sparse.\n\n    .. attribute:: sparse_Y\n\n        Flag whether the resulting Y matrix should be sparse.\n\n    .. attribute:: sparse_metas\n\n        Flag whether the resulting metas matrix should be sparse.\n    \"\"\"\n\n    def __init__(self, source, destination):\n        \"\"\"\n        Compute the conversion indices from the given `source` to `destination`\n        \"\"\"\n        def match(var):\n            if var in source:\n                sourcevar = source[var]\n                sourceindex = source.index(sourcevar)\n                if var.is_discrete and var is not sourcevar:\n                    mapping = var.get_mapper_from(sourcevar)\n                    return lambda table: mapping(table.get_column_view(sourceindex)[0])\n                return source.index(var)\n            return var.compute_value  # , which may also be None\n\n        self.source = source\n\n        self.attributes = [match(var) for var in destination.attributes]\n        self.class_vars = [match(var) for var in destination.class_vars]\n        self.variables = self.attributes + self.class_vars\n        self.metas = [match(var) for var in destination.metas]\n\n        def should_be_sparse(feats):\n            \"\"\"\n            For a matrix to be stored in sparse, more than 2/3 of columns\n            should be marked as sparse and there should be no string columns\n            since Scipy's sparse matrices don't support dtype=object.\n            \"\"\"\n            fraction_sparse = sum(f.sparse for f in feats) / max(len(feats), 1)\n            contain_strings = any(f.is_string for f in feats)\n            return fraction_sparse > 2/3 and not contain_strings\n\n        # check whether X, Y or metas should be sparse\n        self.sparse_X = should_be_sparse(destination.attributes)\n        self.sparse_Y = should_be_sparse(destination.class_vars)\n        self.sparse_metas = should_be_sparse(destination.metas)\n\n\ndef filter_visible(feats):\n    \"\"\"\n    Args:\n        feats (iterable): Features to be filtered.\n\n    Returns: A filtered tuple of features that are visible (i.e. not hidden).\n    \"\"\"\n    return (f for f in feats if not f.attributes.get('hidden', False))\n\n\nclass Domain:\n    def __init__(self, attributes, class_vars=None, metas=None, source=None):\n        \"\"\"\n        Initialize a new domain descriptor. Arguments give the features and\n        the class attribute(s). They can be described by descriptors (instances\n        of :class:`Variable`), or by indices or names if the source domain is\n        given.\n\n        :param attributes: a list of attributes\n        :type attributes: list of :class:`Variable`\n        :param class_vars: target variable or a list of target variables\n        :type class_vars: :class:`Variable` or list of :class:`Variable`\n        :param metas: a list of meta attributes\n        :type metas: list of :class:`Variable`\n        :param source: the source domain for attributes\n        :type source: Orange.data.Domain\n        :return: a new domain\n        :rtype: :class:`Domain`\n        \"\"\"\n\n        if class_vars is None:\n            class_vars = []\n        elif isinstance(class_vars, (Variable, Integral, str)):\n            class_vars = [class_vars]\n        elif isinstance(class_vars, Iterable):\n            class_vars = list(class_vars)\n\n        if not isinstance(attributes, list):\n            attributes = list(attributes)\n        metas = list(metas) if metas else []\n\n        # Replace str's and int's with descriptors if 'source' is given;\n        # complain otherwise\n        for lst in (attributes, class_vars, metas):\n            for i, var in enumerate(lst):\n                if not isinstance(var, Variable):\n                    if source is not None and isinstance(var, (str, int)):\n                        lst[i] = source[var]\n                    else:\n                        raise TypeError(\n                            \"descriptors must be instances of Variable, \"\n                            \"not '%s'\" % type(var).__name__)\n\n        names = [var.name for var in chain(attributes, class_vars, metas)]\n        if len(names) != len(set(names)):\n            raise Exception('All variables in the domain should have'\n                            ' unique names.')\n\n        # Store everything\n        self.attributes = tuple(attributes)\n        self.class_vars = tuple(class_vars)\n        self._variables = self.attributes + self.class_vars\n        self._metas = tuple(metas)\n        self.class_var = \\\n            self.class_vars[0] if len(self.class_vars) == 1 else None\n        if not all(var.is_primitive() for var in self._variables):\n            raise TypeError(\"variables must be primitive\")\n\n        self._indices = dict(chain.from_iterable(\n            ((var, idx), (var.name, idx), (idx, idx))\n            for idx, var in enumerate(self._variables)))\n        self._indices.update(chain.from_iterable(\n            ((var, -1-idx), (var.name, -1-idx), (-1-idx, -1-idx))\n            for idx, var in enumerate(self.metas)))\n\n        self.anonymous = False\n\n        self._hash = None  # cache for __hash__()\n\n    # noinspection PyPep8Naming\n    @classmethod\n    def from_numpy(cls, X, Y=None, metas=None):\n        \"\"\"\n        Create a domain corresponding to the given numpy arrays. This method\n        is usually invoked from :meth:`Orange.data.Table.from_numpy`.\n\n        All attributes are assumed to be continuous and are named\n        \"Feature <n>\". Target variables are discrete if the only two values\n        are 0 and 1; otherwise they are continuous. Discrete\n        targets are named \"Class <n>\" and continuous are named \"Target <n>\".\n        Domain is marked as :attr:`anonymous`, so data from any other domain of\n        the same shape can be converted into this one and vice-versa.\n\n        :param `numpy.ndarray` X: 2-dimensional array with data\n        :param Y: 1- of 2- dimensional data for target\n        :type Y: `numpy.ndarray` or None\n        :param `numpy.ndarray` metas: meta attributes\n        :type metas: `numpy.ndarray` or None\n        :return: a new domain\n        :rtype: :class:`Domain`\n        \"\"\"\n        def get_places(max_index):\n            return 0 if max_index == 1 else int(log(max_index, 10)) + 1\n\n        def get_name(base, index, places):\n            return base if not places \\\n                else \"{} {:0{}}\".format(base, index + 1, places)\n\n        if X.ndim != 2:\n            raise ValueError('X must be a 2-dimensional array')\n        n_attrs = X.shape[1]\n        places = get_places(n_attrs)\n        attr_vars = [ContinuousVariable(name=get_name(\"Feature\", a, places))\n                     for a in range(n_attrs)]\n        class_vars = []\n        if Y is not None:\n            if Y.ndim == 1:\n                Y = Y.reshape(len(Y), 1)\n            elif Y.ndim != 2:\n                raise ValueError('Y has invalid shape')\n            n_classes = Y.shape[1]\n            places = get_places(n_classes)\n            for i, values in enumerate(Y.T):\n                if set(values) == {0, 1}:\n                    name = get_name('Class', i, places)\n                    values = ['v1', 'v2']\n                    class_vars.append(DiscreteVariable(name, values))\n                else:\n                    name = get_name('Target', i + 1, places)\n                    class_vars.append(ContinuousVariable(name))\n        if metas is not None:\n            n_metas = metas.shape[1]\n            places = get_places(n_metas)\n            meta_vars = [StringVariable(get_name(\"Meta\", m, places))\n                         for m in range(n_metas)]\n        else:\n            meta_vars = []\n\n        domain = cls(attr_vars, class_vars, meta_vars)\n        domain.anonymous = True\n        return domain\n\n    @property\n    def variables(self):\n        return self._variables\n\n    @property\n    def metas(self):\n        return self._metas\n\n    def __len__(self):\n        \"\"\"The number of variables (features and class attributes).\n\n        The current behavior returns the length of only features and\n        class attributes. In the near future, it will include the\n        length of metas, too, and __iter__ will act accordingly.\"\"\"\n        return len(self._variables) + len(self._metas)\n\n    def __bool__(self):\n        warnings.warn(\n            \"Domain.__bool__ is ambiguous; use 'is None' or 'empty' instead\",\n            OrangeDeprecationWarning, stacklevel=2)\n        return len(self) > 0  # Keep the obsolete behaviour\n\n    def empty(self):\n        \"\"\"True if the domain has no variables of any kind\"\"\"\n        return not self.variables and not self.metas\n\n    def _get_equivalent(self, var):\n        if isinstance(var, Variable):\n            index = self._indices.get(var.name)\n            if index is not None:\n                if index >= 0:\n                    myvar = self.variables[index]\n                else:\n                    myvar = self.metas[-1 - index]\n                if myvar == var:\n                    return myvar\n        return None\n\n    def __getitem__(self, idx):\n        \"\"\"\n        Return a variable descriptor from the given argument, which can be\n        a descriptor, index or name. If `var` is a descriptor, the function\n        returns this same object.\n\n        :param idx: index, name or descriptor\n        :type idx: int, str or :class:`Variable`\n        :return: an instance of :class:`Variable` described by `var`\n        :rtype: :class:`Variable`\n        \"\"\"\n        if isinstance(idx, slice):\n            return self._variables[idx]\n\n        index = self._indices.get(idx)\n        if index is None:\n            var = self._get_equivalent(idx)\n            if var is not None:\n                return var\n            raise KeyError(idx)\n        if index >= 0:\n            return self.variables[index]\n        else:\n            return self.metas[-1 - index]\n\n    def __contains__(self, item):\n        \"\"\"\n        Return `True` if the item (`str`, `int`, :class:`Variable`) is\n        in the domain.\n        \"\"\"\n        return item in self._indices or self._get_equivalent(item) is not None\n\n    def __iter__(self):\n        \"\"\"\n        Return an iterator through variables (features and class attributes).\n        \"\"\"\n        return itertools.chain(self._variables, self._metas)\n\n    def __str__(self):\n        \"\"\"\n        Return a list-like string with the domain's features, class attributes\n        and meta attributes.\n        \"\"\"\n        s = \"[\" + \", \".join(attr.name for attr in self.attributes)\n        if self.class_vars:\n            s += \" | \" + \", \".join(cls.name for cls in self.class_vars)\n        s += \"]\"\n        if self._metas:\n            s += \" {\" + \", \".join(meta.name for meta in self._metas) + \"}\"\n        return s\n\n    __repr__ = __str__\n\n    def index(self, var):\n        \"\"\"\n        Return the index of the given variable or meta attribute, represented\n        with an instance of :class:`Variable`, `int` or `str`.\n        \"\"\"\n\n        idx = self._indices.get(var)\n        if idx is not None:\n            return idx\n        equiv = self._get_equivalent(var)\n        if equiv is not None:\n            return self._indices[equiv]\n\n        raise ValueError(\"'%s' is not in domain\" % var)\n\n    def has_discrete_attributes(self, include_class=False, include_metas=False):\n        \"\"\"\n        Return `True` if domain has any discrete attributes. If\n        `include_class` is set, the check includes the class attribute(s). If\n        `include_metas` is set, the check includes the meta attributes.\n        \"\"\"\n        vars = self.variables if include_class else self.attributes\n        vars += self.metas if include_metas else ()\n        return any(var.is_discrete for var in vars)\n\n    def has_continuous_attributes(self, include_class=False, include_metas=False):\n        \"\"\"\n        Return `True` if domain has any continuous attributes. If\n        `include_class` is set, the check includes the class attribute(s). If\n        `include_metas` is set, the check includes the meta attributes.\n        \"\"\"\n        vars = self.variables if include_class else self.attributes\n        vars += self.metas if include_metas else ()\n        return any(var.is_continuous for var in vars)\n\n    def has_time_attributes(self, include_class=False, include_metas=False):\n        \"\"\"\n        Return `True` if domain has any time attributes. If\n        `include_class` is set, the check includes the class attribute(s). If\n        `include_metas` is set, the check includes the meta attributes.\n        \"\"\"\n        vars = self.variables if include_class else self.attributes\n        vars += self.metas if include_metas else ()\n        return any(var.is_time for var in vars)\n\n    @property\n    def has_continuous_class(self):\n        return bool(self.class_var and self.class_var.is_continuous)\n\n    @property\n    def has_discrete_class(self):\n        return bool(self.class_var and self.class_var.is_discrete)\n\n    @property\n    def has_time_class(self):\n        return bool(self.class_var and self.class_var.is_time)\n\n    # noinspection PyProtectedMember\n    def convert(self, inst):\n        \"\"\"\n        Convert a data instance from another domain to this domain.\n\n        :param inst: The data instance to be converted\n        :return: The data instance in this domain\n        \"\"\"\n        from .instance import Instance\n\n        if isinstance(inst, Instance):\n            if inst.domain == self:\n                return inst._x, inst._y, inst._metas\n            c = DomainConversion(inst.domain, self)\n            l = len(inst.domain.attributes)\n            values = [(inst._x[i] if 0 <= i < l\n                       else inst._y[i - l] if i >= l\n                       else inst._metas[-i - 1])\n                      if isinstance(i, int)\n                      else (Unknown if not i else i(inst))\n                      for i in c.variables]\n            metas = [(inst._x[i] if 0 <= i < l\n                      else inst._y[i - l] if i >= l\n                      else inst._metas[-i - 1])\n                     if isinstance(i, int)\n                     else (Unknown if not i else i(inst))\n                     for i in c.metas]\n        else:\n            nvars = len(self._variables)\n            nmetas = len(self._metas)\n            if len(inst) != nvars and len(inst) != nvars + nmetas:\n                raise ValueError(\"invalid data length for domain\")\n            values = [var.to_val(val)\n                      for var, val in zip(self._variables, inst)]\n            if len(inst) == nvars + nmetas:\n                metas = [var.to_val(val)\n                         for var, val in zip(self._metas, inst[nvars:])]\n            else:\n                metas = [var.Unknown for var in self._metas]\n        nattrs = len(self.attributes)\n        # Let np.array decide dtype for values\n        return np.array(values[:nattrs]), np.array(values[nattrs:]),\\\n               np.array(metas, dtype=object)\n\n    def select_columns(self, col_idx):\n        attributes, col_indices = self._compute_col_indices(col_idx)\n        if attributes is not None:\n            n_attrs = len(self.attributes)\n            r_attrs = [attributes[i]\n                       for i, col in enumerate(col_indices)\n                       if 0 <= col < n_attrs]\n            r_classes = [attributes[i]\n                         for i, col in enumerate(col_indices)\n                         if col >= n_attrs]\n            r_metas = [attributes[i]\n                       for i, col in enumerate(col_indices) if col < 0]\n            return Domain(r_attrs, r_classes, r_metas)\n        else:\n            return self\n\n    def _compute_col_indices(self, col_idx):\n        if col_idx is ...:\n            return None, None\n        if isinstance(col_idx, np.ndarray) and col_idx.dtype == bool:\n            return ([attr for attr, c in zip(self, col_idx) if c],\n                    np.nonzero(col_idx))\n        elif isinstance(col_idx, slice):\n            s = len(self.variables)\n            start, end, stride = col_idx.indices(s)\n            if col_idx.indices(s) == (0, s, 1):\n                return None, None\n            else:\n                return (self[col_idx],\n                        np.arange(start, end, stride))\n        elif isinstance(col_idx, Iterable) and not isinstance(col_idx, str):\n            attributes = [self[col] for col in col_idx]\n            if attributes == self.attributes:\n                return None, None\n            return attributes, np.fromiter(\n                (self.index(attr) for attr in attributes), int)\n        elif isinstance(col_idx, Integral):\n            attr = self[col_idx]\n        else:\n            attr = self[col_idx]\n            col_idx = self.index(attr)\n        return [attr], np.array([col_idx])\n\n    def checksum(self):\n        return hash(self)\n\n    def copy(self):\n        \"\"\"\n        Make a copy of the domain. New features are proxies of the old ones,\n        hence the new domain can be used anywhere the old domain was used.\n\n        Returns:\n            Domain: a copy of the domain.\n        \"\"\"\n        return Domain(\n            attributes=[a.make_proxy() for a in self.attributes],\n            class_vars=[a.make_proxy() for a in self.class_vars],\n            metas=[a.make_proxy() for a in self.metas],\n            source=self,\n        )\n\n    def __eq__(self, other):\n        if not isinstance(other, Domain):\n            return False\n\n        return (self.attributes == other.attributes and\n                self.class_vars == other.class_vars and\n                self.metas == other.metas)\n\n    def __hash__(self):\n        if self._hash is None:\n            self._hash = hash(self.attributes) ^ hash(self.class_vars) ^ hash(self.metas)\n        return self._hash\n",
            "header": {
                "file": {
                    "path": "Orange/data/domain.py"
                },
                "misc_line": null
            },
            "index_line": {
                "old_commit_hash": "35e5a0dc7",
                "new_commit_hash": "f3988a5ad",
                "mode": "100644"
            },
            "is_binary_file": false,
            "binary_line": null,
            "minus_file": {
                "path": "a/Orange/data/domain.py"
            },
            "plus_file": {
                "path": "b/Orange/data/domain.py"
            },
            "hunks": [
                {
                    "descriptor": {
                        "old_range": {
                            "start": 1,
                            "length": 3
                        },
                        "new_range": {
                            "start": 1,
                            "length": 4
                        },
                        "section": ""
                    },
                    "line_group": {
                        "all_lines": [
                            {
                                "content": "import itertools",
                                "type": "added"
                            },
                            {
                                "content": "import warnings",
                                "type": "context"
                            },
                            {
                                "content": "",
                                "type": "context"
                            },
                            {
                                "content": "from math import log",
                                "type": "context"
                            }
                        ]
                    },
                    "modified_entities": [],
                    "added_entities": [
                        {
                            "file_name": "Orange/data/domain.py",
                            "type": "import",
                            "name": "itertools",
                            "content": "import itertools",
                            "ast_type_str": "Import",
                            "start_lineno": 1,
                            "end_lineno": 1,
                            "parent": null
                        }
                    ],
                    "deleted_entities": []
                },
                {
                    "descriptor": {
                        "old_range": {
                            "start": 245,
                            "length": 14
                        },
                        "new_range": {
                            "start": 246,
                            "length": 13
                        },
                        "section": "class Domain:"
                    },
                    "line_group": {
                        "all_lines": [
                            {
                                "content": "    def metas(self):",
                                "type": "context"
                            },
                            {
                                "content": "        return self._metas",
                                "type": "context"
                            },
                            {
                                "content": "",
                                "type": "context"
                            },
                            {
                                "content": "    @deprecated(\"len(Domain.variables)\")",
                                "type": "deleted"
                            },
                            {
                                "content": "    def __len__(self):",
                                "type": "context"
                            },
                            {
                                "content": "        \"\"\"The number of variables (features and class attributes).",
                                "type": "context"
                            },
                            {
                                "content": "",
                                "type": "context"
                            },
                            {
                                "content": "        The current behavior returns the length of only features and",
                                "type": "context"
                            },
                            {
                                "content": "        class attributes. In the near future, it will include the",
                                "type": "context"
                            },
                            {
                                "content": "        length of metas, too, and __iter__ will act accordingly.\"\"\"",
                                "type": "context"
                            },
                            {
                                "content": "        return len(self._variables)",
                                "type": "deleted"
                            },
                            {
                                "content": "        return len(self._variables) + len(self._metas)",
                                "type": "added"
                            },
                            {
                                "content": "",
                                "type": "context"
                            },
                            {
                                "content": "    def __bool__(self):",
                                "type": "context"
                            },
                            {
                                "content": "        warnings.warn(",
                                "type": "context"
                            }
                        ]
                    },
                    "modified_entities": [
                        {
                            "file_name": "Orange/data/domain.py",
                            "type": "class",
                            "name": "Domain",
                            "content": "class Domain:\n    def __init__(self, attributes, class_vars=None, metas=None, source=None):\n        \"\"\"\n        Initialize a new domain descriptor. Arguments give the features and\n        the class attribute(s). They can be described by descriptors (instances\n        of :class:`Variable`), or by indices or names if the source domain is\n        given.\n\n        :param attributes: a list of attributes\n        :type attributes: list of :class:`Variable`\n        :param class_vars: target variable or a list of target variables\n        :type class_vars: :class:`Variable` or list of :class:`Variable`\n        :param metas: a list of meta attributes\n        :type metas: list of :class:`Variable`\n        :param source: the source domain for attributes\n        :type source: Orange.data.Domain\n        :return: a new domain\n        :rtype: :class:`Domain`\n        \"\"\"\n\n        if class_vars is None:\n            class_vars = []\n        elif isinstance(class_vars, (Variable, Integral, str)):\n            class_vars = [class_vars]\n        elif isinstance(class_vars, Iterable):\n            class_vars = list(class_vars)\n\n        if not isinstance(attributes, list):\n            attributes = list(attributes)\n        metas = list(metas) if metas else []\n\n        # Replace str's and int's with descriptors if 'source' is given;\n        # complain otherwise\n        for lst in (attributes, class_vars, metas):\n            for i, var in enumerate(lst):\n                if not isinstance(var, Variable):\n                    if source is not None and isinstance(var, (str, int)):\n                        lst[i] = source[var]\n                    else:\n                        raise TypeError(\n                            \"descriptors must be instances of Variable, \"\n                            \"not '%s'\" % type(var).__name__)\n\n        names = [var.name for var in chain(attributes, class_vars, metas)]\n        if len(names) != len(set(names)):\n            raise Exception('All variables in the domain should have'\n                            ' unique names.')\n\n        # Store everything\n        self.attributes = tuple(attributes)\n        self.class_vars = tuple(class_vars)\n        self._variables = self.attributes + self.class_vars\n        self._metas = tuple(metas)\n        self.class_var = \\\n            self.class_vars[0] if len(self.class_vars) == 1 else None\n        if not all(var.is_primitive() for var in self._variables):\n            raise TypeError(\"variables must be primitive\")\n\n        self._indices = dict(chain.from_iterable(\n            ((var, idx), (var.name, idx), (idx, idx))\n            for idx, var in enumerate(self._variables)))\n        self._indices.update(chain.from_iterable(\n            ((var, -1-idx), (var.name, -1-idx), (-1-idx, -1-idx))\n            for idx, var in enumerate(self.metas)))\n\n        self.anonymous = False\n\n        self._hash = None  # cache for __hash__()\n\n    # noinspection PyPep8Naming\n    @classmethod\n    def from_numpy(cls, X, Y=None, metas=None):\n        \"\"\"\n        Create a domain corresponding to the given numpy arrays. This method\n        is usually invoked from :meth:`Orange.data.Table.from_numpy`.\n\n        All attributes are assumed to be continuous and are named\n        \"Feature <n>\". Target variables are discrete if the only two values\n        are 0 and 1; otherwise they are continuous. Discrete\n        targets are named \"Class <n>\" and continuous are named \"Target <n>\".\n        Domain is marked as :attr:`anonymous`, so data from any other domain of\n        the same shape can be converted into this one and vice-versa.\n\n        :param `numpy.ndarray` X: 2-dimensional array with data\n        :param Y: 1- of 2- dimensional data for target\n        :type Y: `numpy.ndarray` or None\n        :param `numpy.ndarray` metas: meta attributes\n        :type metas: `numpy.ndarray` or None\n        :return: a new domain\n        :rtype: :class:`Domain`\n        \"\"\"\n        def get_places(max_index):\n            return 0 if max_index == 1 else int(log(max_index, 10)) + 1\n\n        def get_name(base, index, places):\n            return base if not places \\\n                else \"{} {:0{}}\".format(base, index + 1, places)\n\n        if X.ndim != 2:\n            raise ValueError('X must be a 2-dimensional array')\n        n_attrs = X.shape[1]\n        places = get_places(n_attrs)\n        attr_vars = [ContinuousVariable(name=get_name(\"Feature\", a, places))\n                     for a in range(n_attrs)]\n        class_vars = []\n        if Y is not None:\n            if Y.ndim == 1:\n                Y = Y.reshape(len(Y), 1)\n            elif Y.ndim != 2:\n                raise ValueError('Y has invalid shape')\n            n_classes = Y.shape[1]\n            places = get_places(n_classes)\n            for i, values in enumerate(Y.T):\n                if set(values) == {0, 1}:\n                    name = get_name('Class', i, places)\n                    values = ['v1', 'v2']\n                    class_vars.append(DiscreteVariable(name, values))\n                else:\n                    name = get_name('Target', i + 1, places)\n                    class_vars.append(ContinuousVariable(name))\n        if metas is not None:\n            n_metas = metas.shape[1]\n            places = get_places(n_metas)\n            meta_vars = [StringVariable(get_name(\"Meta\", m, places))\n                         for m in range(n_metas)]\n        else:\n            meta_vars = []\n\n        domain = cls(attr_vars, class_vars, meta_vars)\n        domain.anonymous = True\n        return domain\n\n    @property\n    def variables(self):\n        return self._variables\n\n    @property\n    def metas(self):\n        return self._metas\n\n    @deprecated(\"len(Domain.variables)\")\n    def __len__(self):\n        \"\"\"The number of variables (features and class attributes).\n\n        The current behavior returns the length of only features and\n        class attributes. In the near future, it will include the\n        length of metas, too, and __iter__ will act accordingly.\"\"\"\n        return len(self._variables)\n\n    def __bool__(self):\n        warnings.warn(\n            \"Domain.__bool__ is ambiguous; use 'is None' or 'empty' instead\",\n            OrangeDeprecationWarning, stacklevel=2)\n        return len(self) > 0  # Keep the obsolete behaviour\n\n    def empty(self):\n        \"\"\"True if the domain has no variables of any kind\"\"\"\n        return not self.variables and not self.metas\n\n    def _get_equivalent(self, var):\n        if isinstance(var, Variable):\n            index = self._indices.get(var.name)\n            if index is not None:\n                if index >= 0:\n                    myvar = self.variables[index]\n                else:\n                    myvar = self.metas[-1 - index]\n                if myvar == var:\n                    return myvar\n        return None\n\n    def __getitem__(self, idx):\n        \"\"\"\n        Return a variable descriptor from the given argument, which can be\n        a descriptor, index or name. If `var` is a descriptor, the function\n        returns this same object.\n\n        :param idx: index, name or descriptor\n        :type idx: int, str or :class:`Variable`\n        :return: an instance of :class:`Variable` described by `var`\n        :rtype: :class:`Variable`\n        \"\"\"\n        if isinstance(idx, slice):\n            return self._variables[idx]\n\n        index = self._indices.get(idx)\n        if index is None:\n            var = self._get_equivalent(idx)\n            if var is not None:\n                return var\n            raise KeyError(idx)\n        if index >= 0:\n            return self.variables[index]\n        else:\n            return self.metas[-1 - index]\n\n    def __contains__(self, item):\n        \"\"\"\n        Return `True` if the item (`str`, `int`, :class:`Variable`) is\n        in the domain.\n        \"\"\"\n        return item in self._indices or self._get_equivalent(item) is not None\n\n    @deprecated(\"Domain.variables\")\n    def __iter__(self):\n        \"\"\"\n        Return an iterator through variables (features and class attributes).\n\n        The current behaviour is confusing, as `x in domain` returns True\n        for meta variables, but iter(domain) does not yield them.\n        This will be consolidated eventually (in 3.12?), the code that\n        currently iterates over domain should iterate over domain.variables\n        instead.\n        \"\"\"\n        return iter(self._variables)\n\n    def __str__(self):\n        \"\"\"\n        Return a list-like string with the domain's features, class attributes\n        and meta attributes.\n        \"\"\"\n        s = \"[\" + \", \".join(attr.name for attr in self.attributes)\n        if self.class_vars:\n            s += \" | \" + \", \".join(cls.name for cls in self.class_vars)\n        s += \"]\"\n        if self._metas:\n            s += \" {\" + \", \".join(meta.name for meta in self._metas) + \"}\"\n        return s\n\n    __repr__ = __str__\n\n    def index(self, var):\n        \"\"\"\n        Return the index of the given variable or meta attribute, represented\n        with an instance of :class:`Variable`, `int` or `str`.\n        \"\"\"\n\n        idx = self._indices.get(var)\n        if idx is not None:\n            return idx\n        equiv = self._get_equivalent(var)\n        if equiv is not None:\n            return self._indices[equiv]\n\n        raise ValueError(\"'%s' is not in domain\" % var)\n\n    def has_discrete_attributes(self, include_class=False, include_metas=False):\n        \"\"\"\n        Return `True` if domain has any discrete attributes. If\n        `include_class` is set, the check includes the class attribute(s). If\n        `include_metas` is set, the check includes the meta attributes.\n        \"\"\"\n        vars = self.variables if include_class else self.attributes\n        vars += self.metas if include_metas else ()\n        return any(var.is_discrete for var in vars)\n\n    def has_continuous_attributes(self, include_class=False, include_metas=False):\n        \"\"\"\n        Return `True` if domain has any continuous attributes. If\n        `include_class` is set, the check includes the class attribute(s). If\n        `include_metas` is set, the check includes the meta attributes.\n        \"\"\"\n        vars = self.variables if include_class else self.attributes\n        vars += self.metas if include_metas else ()\n        return any(var.is_continuous for var in vars)\n\n    def has_time_attributes(self, include_class=False, include_metas=False):\n        \"\"\"\n        Return `True` if domain has any time attributes. If\n        `include_class` is set, the check includes the class attribute(s). If\n        `include_metas` is set, the check includes the meta attributes.\n        \"\"\"\n        vars = self.variables if include_class else self.attributes\n        vars += self.metas if include_metas else ()\n        return any(var.is_time for var in vars)\n\n    @property\n    def has_continuous_class(self):\n        return bool(self.class_var and self.class_var.is_continuous)\n\n    @property\n    def has_discrete_class(self):\n        return bool(self.class_var and self.class_var.is_discrete)\n\n    @property\n    def has_time_class(self):\n        return bool(self.class_var and self.class_var.is_time)\n\n    # noinspection PyProtectedMember\n    def convert(self, inst):\n        \"\"\"\n        Convert a data instance from another domain to this domain.\n\n        :param inst: The data instance to be converted\n        :return: The data instance in this domain\n        \"\"\"\n        from .instance import Instance\n\n        if isinstance(inst, Instance):\n            if inst.domain == self:\n                return inst._x, inst._y, inst._metas\n            c = DomainConversion(inst.domain, self)\n            l = len(inst.domain.attributes)\n            values = [(inst._x[i] if 0 <= i < l\n                       else inst._y[i - l] if i >= l\n                       else inst._metas[-i - 1])\n                      if isinstance(i, int)\n                      else (Unknown if not i else i(inst))\n                      for i in c.variables]\n            metas = [(inst._x[i] if 0 <= i < l\n                      else inst._y[i - l] if i >= l\n                      else inst._metas[-i - 1])\n                     if isinstance(i, int)\n                     else (Unknown if not i else i(inst))\n                     for i in c.metas]\n        else:\n            nvars = len(self._variables)\n            nmetas = len(self._metas)\n            if len(inst) != nvars and len(inst) != nvars + nmetas:\n                raise ValueError(\"invalid data length for domain\")\n            values = [var.to_val(val)\n                      for var, val in zip(self._variables, inst)]\n            if len(inst) == nvars + nmetas:\n                metas = [var.to_val(val)\n                         for var, val in zip(self._metas, inst[nvars:])]\n            else:\n                metas = [var.Unknown for var in self._metas]\n        nattrs = len(self.attributes)\n        # Let np.array decide dtype for values\n        return np.array(values[:nattrs]), np.array(values[nattrs:]),\\\n               np.array(metas, dtype=object)\n\n    def select_columns(self, col_idx):\n        attributes, col_indices = self._compute_col_indices(col_idx)\n        if attributes is not None:\n            n_attrs = len(self.attributes)\n            r_attrs = [attributes[i]\n                       for i, col in enumerate(col_indices)\n                       if 0 <= col < n_attrs]\n            r_classes = [attributes[i]\n                         for i, col in enumerate(col_indices)\n                         if col >= n_attrs]\n            r_metas = [attributes[i]\n                       for i, col in enumerate(col_indices) if col < 0]\n            return Domain(r_attrs, r_classes, r_metas)\n        else:\n            return self\n\n    def _compute_col_indices(self, col_idx):\n        if col_idx is ...:\n            return None, None\n        if isinstance(col_idx, np.ndarray) and col_idx.dtype == bool:\n            return ([attr for attr, c in zip(self, col_idx) if c],\n                    np.nonzero(col_idx))\n        elif isinstance(col_idx, slice):\n            s = len(self.variables)\n            start, end, stride = col_idx.indices(s)\n            if col_idx.indices(s) == (0, s, 1):\n                return None, None\n            else:\n                return (self[col_idx],\n                        np.arange(start, end, stride))\n        elif isinstance(col_idx, Iterable) and not isinstance(col_idx, str):\n            attributes = [self[col] for col in col_idx]\n            if attributes == self.attributes:\n                return None, None\n            return attributes, np.fromiter(\n                (self.index(attr) for attr in attributes), int)\n        elif isinstance(col_idx, Integral):\n            attr = self[col_idx]\n        else:\n            attr = self[col_idx]\n            col_idx = self.index(attr)\n        return [attr], np.array([col_idx])\n\n    def checksum(self):\n        return hash(self)\n\n    def copy(self):\n        \"\"\"\n        Make a copy of the domain. New features are proxies of the old ones,\n        hence the new domain can be used anywhere the old domain was used.\n\n        Returns:\n            Domain: a copy of the domain.\n        \"\"\"\n        return Domain(\n            attributes=[a.make_proxy() for a in self.attributes],\n            class_vars=[a.make_proxy() for a in self.class_vars],\n            metas=[a.make_proxy() for a in self.metas],\n            source=self,\n        )\n\n    def __eq__(self, other):\n        if not isinstance(other, Domain):\n            return False\n\n        return (self.attributes == other.attributes and\n                self.class_vars == other.class_vars and\n                self.metas == other.metas)\n\n    def __hash__(self):\n        if self._hash is None:\n            self._hash = hash(self.attributes) ^ hash(self.class_vars) ^ hash(self.metas)\n        return self._hash",
                            "ast_type_str": "ClassDef",
                            "start_lineno": 108,
                            "end_lineno": 512,
                            "parent": null
                        },
                        {
                            "file_name": "Orange/data/domain.py",
                            "type": "method",
                            "name": "Domain.__len__",
                            "content": "class Domain:\n    def __init__(self, attributes, class_vars=None, metas=None, source=None):\n        \"\"\"\n        Initialize a new domain descriptor. Arguments give the features and\n        the class attribute(s). They can be described by descriptors (instances\n        of :class:`Variable`), or by indices or names if the source domain is\n        given.\n\n        :param attributes: a list of attributes\n        :type attributes: list of :class:`Variable`\n        :param class_vars: target variable or a list of target variables\n        :type class_vars: :class:`Variable` or list of :class:`Variable`\n        :param metas: a list of meta attributes\n        :type metas: list of :class:`Variable`\n        :param source: the source domain for attributes\n        :type source: Orange.data.Domain\n        :return: a new domain\n        :rtype: :class:`Domain`\n        \"\"\"\n\n        if class_vars is None:\n            class_vars = []\n        elif isinstance(class_vars, (Variable, Integral, str)):\n            class_vars = [class_vars]\n        elif isinstance(class_vars, Iterable):\n            class_vars = list(class_vars)\n\n        if not isinstance(attributes, list):\n            attributes = list(attributes)\n        metas = list(metas) if metas else []\n\n        # Replace str's and int's with descriptors if 'source' is given;\n        # complain otherwise\n        for lst in (attributes, class_vars, metas):\n            for i, var in enumerate(lst):\n                if not isinstance(var, Variable):\n                    if source is not None and isinstance(var, (str, int)):\n                        lst[i] = source[var]\n                    else:\n                        raise TypeError(\n                            \"descriptors must be instances of Variable, \"\n                            \"not '%s'\" % type(var).__name__)\n\n        names = [var.name for var in chain(attributes, class_vars, metas)]\n        if len(names) != len(set(names)):\n            raise Exception('All variables in the domain should have'\n                            ' unique names.')\n\n        # Store everything\n        self.attributes = tuple(attributes)\n        self.class_vars = tuple(class_vars)\n        self._variables = self.attributes + self.class_vars\n        self._metas = tuple(metas)\n        self.class_var = \\\n            self.class_vars[0] if len(self.class_vars) == 1 else None\n        if not all(var.is_primitive() for var in self._variables):\n            raise TypeError(\"variables must be primitive\")\n\n        self._indices = dict(chain.from_iterable(\n            ((var, idx), (var.name, idx), (idx, idx))\n            for idx, var in enumerate(self._variables)))\n        self._indices.update(chain.from_iterable(\n            ((var, -1-idx), (var.name, -1-idx), (-1-idx, -1-idx))\n            for idx, var in enumerate(self.metas)))\n\n        self.anonymous = False\n\n        self._hash = None  # cache for __hash__()\n\n    # noinspection PyPep8Naming\n    @classmethod\n    def from_numpy(cls, X, Y=None, metas=None):\n        \"\"\"\n        Create a domain corresponding to the given numpy arrays. This method\n        is usually invoked from :meth:`Orange.data.Table.from_numpy`.\n\n        All attributes are assumed to be continuous and are named\n        \"Feature <n>\". Target variables are discrete if the only two values\n        are 0 and 1; otherwise they are continuous. Discrete\n        targets are named \"Class <n>\" and continuous are named \"Target <n>\".\n        Domain is marked as :attr:`anonymous`, so data from any other domain of\n        the same shape can be converted into this one and vice-versa.\n\n        :param `numpy.ndarray` X: 2-dimensional array with data\n        :param Y: 1- of 2- dimensional data for target\n        :type Y: `numpy.ndarray` or None\n        :param `numpy.ndarray` metas: meta attributes\n        :type metas: `numpy.ndarray` or None\n        :return: a new domain\n        :rtype: :class:`Domain`\n        \"\"\"\n        def get_places(max_index):\n            return 0 if max_index == 1 else int(log(max_index, 10)) + 1\n\n        def get_name(base, index, places):\n            return base if not places \\\n                else \"{} {:0{}}\".format(base, index + 1, places)\n\n        if X.ndim != 2:\n            raise ValueError('X must be a 2-dimensional array')\n        n_attrs = X.shape[1]\n        places = get_places(n_attrs)\n        attr_vars = [ContinuousVariable(name=get_name(\"Feature\", a, places))\n                     for a in range(n_attrs)]\n        class_vars = []\n        if Y is not None:\n            if Y.ndim == 1:\n                Y = Y.reshape(len(Y), 1)\n            elif Y.ndim != 2:\n                raise ValueError('Y has invalid shape')\n            n_classes = Y.shape[1]\n            places = get_places(n_classes)\n            for i, values in enumerate(Y.T):\n                if set(values) == {0, 1}:\n                    name = get_name('Class', i, places)\n                    values = ['v1', 'v2']\n                    class_vars.append(DiscreteVariable(name, values))\n                else:\n                    name = get_name('Target', i + 1, places)\n                    class_vars.append(ContinuousVariable(name))\n        if metas is not None:\n            n_metas = metas.shape[1]\n            places = get_places(n_metas)\n            meta_vars = [StringVariable(get_name(\"Meta\", m, places))\n                         for m in range(n_metas)]\n        else:\n            meta_vars = []\n\n        domain = cls(attr_vars, class_vars, meta_vars)\n        domain.anonymous = True\n        return domain\n\n    @property\n    def variables(self):\n        return self._variables\n\n    @property\n    def metas(self):\n        return self._metas\n\n    @deprecated(\"len(Domain.variables)\")\n    def __len__(self):\n        \"\"\"The number of variables (features and class attributes).\n\n        The current behavior returns the length of only features and\n        class attributes. In the near future, it will include the\n        length of metas, too, and __iter__ will act accordingly.\"\"\"\n        return len(self._variables)\n\n    def __bool__(self):\n        warnings.warn(\n            \"Domain.__bool__ is ambiguous; use 'is None' or 'empty' instead\",\n            OrangeDeprecationWarning, stacklevel=2)\n        return len(self) > 0  # Keep the obsolete behaviour\n\n    def empty(self):\n        \"\"\"True if the domain has no variables of any kind\"\"\"\n        return not self.variables and not self.metas\n\n    def _get_equivalent(self, var):\n        if isinstance(var, Variable):\n            index = self._indices.get(var.name)\n            if index is not None:\n                if index >= 0:\n                    myvar = self.variables[index]\n                else:\n                    myvar = self.metas[-1 - index]\n                if myvar == var:\n                    return myvar\n        return None\n\n    def __getitem__(self, idx):\n        \"\"\"\n        Return a variable descriptor from the given argument, which can be\n        a descriptor, index or name. If `var` is a descriptor, the function\n        returns this same object.\n\n        :param idx: index, name or descriptor\n        :type idx: int, str or :class:`Variable`\n        :return: an instance of :class:`Variable` described by `var`\n        :rtype: :class:`Variable`\n        \"\"\"\n        if isinstance(idx, slice):\n            return self._variables[idx]\n\n        index = self._indices.get(idx)\n        if index is None:\n            var = self._get_equivalent(idx)\n            if var is not None:\n                return var\n            raise KeyError(idx)\n        if index >= 0:\n            return self.variables[index]\n        else:\n            return self.metas[-1 - index]\n\n    def __contains__(self, item):\n        \"\"\"\n        Return `True` if the item (`str`, `int`, :class:`Variable`) is\n        in the domain.\n        \"\"\"\n        return item in self._indices or self._get_equivalent(item) is not None\n\n    @deprecated(\"Domain.variables\")\n    def __iter__(self):\n        \"\"\"\n        Return an iterator through variables (features and class attributes).\n\n        The current behaviour is confusing, as `x in domain` returns True\n        for meta variables, but iter(domain) does not yield them.\n        This will be consolidated eventually (in 3.12?), the code that\n        currently iterates over domain should iterate over domain.variables\n        instead.\n        \"\"\"\n        return iter(self._variables)\n\n    def __str__(self):\n        \"\"\"\n        Return a list-like string with the domain's features, class attributes\n        and meta attributes.\n        \"\"\"\n        s = \"[\" + \", \".join(attr.name for attr in self.attributes)\n        if self.class_vars:\n            s += \" | \" + \", \".join(cls.name for cls in self.class_vars)\n        s += \"]\"\n        if self._metas:\n            s += \" {\" + \", \".join(meta.name for meta in self._metas) + \"}\"\n        return s\n\n    __repr__ = __str__\n\n    def index(self, var):\n        \"\"\"\n        Return the index of the given variable or meta attribute, represented\n        with an instance of :class:`Variable`, `int` or `str`.\n        \"\"\"\n\n        idx = self._indices.get(var)\n        if idx is not None:\n            return idx\n        equiv = self._get_equivalent(var)\n        if equiv is not None:\n            return self._indices[equiv]\n\n        raise ValueError(\"'%s' is not in domain\" % var)\n\n    def has_discrete_attributes(self, include_class=False, include_metas=False):\n        \"\"\"\n        Return `True` if domain has any discrete attributes. If\n        `include_class` is set, the check includes the class attribute(s). If\n        `include_metas` is set, the check includes the meta attributes.\n        \"\"\"\n        vars = self.variables if include_class else self.attributes\n        vars += self.metas if include_metas else ()\n        return any(var.is_discrete for var in vars)\n\n    def has_continuous_attributes(self, include_class=False, include_metas=False):\n        \"\"\"\n        Return `True` if domain has any continuous attributes. If\n        `include_class` is set, the check includes the class attribute(s). If\n        `include_metas` is set, the check includes the meta attributes.\n        \"\"\"\n        vars = self.variables if include_class else self.attributes\n        vars += self.metas if include_metas else ()\n        return any(var.is_continuous for var in vars)\n\n    def has_time_attributes(self, include_class=False, include_metas=False):\n        \"\"\"\n        Return `True` if domain has any time attributes. If\n        `include_class` is set, the check includes the class attribute(s). If\n        `include_metas` is set, the check includes the meta attributes.\n        \"\"\"\n        vars = self.variables if include_class else self.attributes\n        vars += self.metas if include_metas else ()\n        return any(var.is_time for var in vars)\n\n    @property\n    def has_continuous_class(self):\n        return bool(self.class_var and self.class_var.is_continuous)\n\n    @property\n    def has_discrete_class(self):\n        return bool(self.class_var and self.class_var.is_discrete)\n\n    @property\n    def has_time_class(self):\n        return bool(self.class_var and self.class_var.is_time)\n\n    # noinspection PyProtectedMember\n    def convert(self, inst):\n        \"\"\"\n        Convert a data instance from another domain to this domain.\n\n        :param inst: The data instance to be converted\n        :return: The data instance in this domain\n        \"\"\"\n        from .instance import Instance\n\n        if isinstance(inst, Instance):\n            if inst.domain == self:\n                return inst._x, inst._y, inst._metas\n            c = DomainConversion(inst.domain, self)\n            l = len(inst.domain.attributes)\n            values = [(inst._x[i] if 0 <= i < l\n                       else inst._y[i - l] if i >= l\n                       else inst._metas[-i - 1])\n                      if isinstance(i, int)\n                      else (Unknown if not i else i(inst))\n                      for i in c.variables]\n            metas = [(inst._x[i] if 0 <= i < l\n                      else inst._y[i - l] if i >= l\n                      else inst._metas[-i - 1])\n                     if isinstance(i, int)\n                     else (Unknown if not i else i(inst))\n                     for i in c.metas]\n        else:\n            nvars = len(self._variables)\n            nmetas = len(self._metas)\n            if len(inst) != nvars and len(inst) != nvars + nmetas:\n                raise ValueError(\"invalid data length for domain\")\n            values = [var.to_val(val)\n                      for var, val in zip(self._variables, inst)]\n            if len(inst) == nvars + nmetas:\n                metas = [var.to_val(val)\n                         for var, val in zip(self._metas, inst[nvars:])]\n            else:\n                metas = [var.Unknown for var in self._metas]\n        nattrs = len(self.attributes)\n        # Let np.array decide dtype for values\n        return np.array(values[:nattrs]), np.array(values[nattrs:]),\\\n               np.array(metas, dtype=object)\n\n    def select_columns(self, col_idx):\n        attributes, col_indices = self._compute_col_indices(col_idx)\n        if attributes is not None:\n            n_attrs = len(self.attributes)\n            r_attrs = [attributes[i]\n                       for i, col in enumerate(col_indices)\n                       if 0 <= col < n_attrs]\n            r_classes = [attributes[i]\n                         for i, col in enumerate(col_indices)\n                         if col >= n_attrs]\n            r_metas = [attributes[i]\n                       for i, col in enumerate(col_indices) if col < 0]\n            return Domain(r_attrs, r_classes, r_metas)\n        else:\n            return self\n\n    def _compute_col_indices(self, col_idx):\n        if col_idx is ...:\n            return None, None\n        if isinstance(col_idx, np.ndarray) and col_idx.dtype == bool:\n            return ([attr for attr, c in zip(self, col_idx) if c],\n                    np.nonzero(col_idx))\n        elif isinstance(col_idx, slice):\n            s = len(self.variables)\n            start, end, stride = col_idx.indices(s)\n            if col_idx.indices(s) == (0, s, 1):\n                return None, None\n            else:\n                return (self[col_idx],\n                        np.arange(start, end, stride))\n        elif isinstance(col_idx, Iterable) and not isinstance(col_idx, str):\n            attributes = [self[col] for col in col_idx]\n            if attributes == self.attributes:\n                return None, None\n            return attributes, np.fromiter(\n                (self.index(attr) for attr in attributes), int)\n        elif isinstance(col_idx, Integral):\n            attr = self[col_idx]\n        else:\n            attr = self[col_idx]\n            col_idx = self.index(attr)\n        return [attr], np.array([col_idx])\n\n    def checksum(self):\n        return hash(self)\n\n    def copy(self):\n        \"\"\"\n        Make a copy of the domain. New features are proxies of the old ones,\n        hence the new domain can be used anywhere the old domain was used.\n\n        Returns:\n            Domain: a copy of the domain.\n        \"\"\"\n        return Domain(\n            attributes=[a.make_proxy() for a in self.attributes],\n            class_vars=[a.make_proxy() for a in self.class_vars],\n            metas=[a.make_proxy() for a in self.metas],\n            source=self,\n        )\n\n    def __eq__(self, other):\n        if not isinstance(other, Domain):\n            return False\n\n        return (self.attributes == other.attributes and\n                self.class_vars == other.class_vars and\n                self.metas == other.metas)\n\n    def __hash__(self):\n        if self._hash is None:\n            self._hash = hash(self.attributes) ^ hash(self.class_vars) ^ hash(self.metas)\n        return self._hash",
                            "ast_type_str": "ClassDef",
                            "start_lineno": 249,
                            "end_lineno": 255,
                            "parent": {
                                "file_name": "Orange/data/domain.py",
                                "type": "class",
                                "name": "Domain",
                                "content": "class Domain:\n    def __init__(self, attributes, class_vars=None, metas=None, source=None):\n        \"\"\"\n        Initialize a new domain descriptor. Arguments give the features and\n        the class attribute(s). They can be described by descriptors (instances\n        of :class:`Variable`), or by indices or names if the source domain is\n        given.\n\n        :param attributes: a list of attributes\n        :type attributes: list of :class:`Variable`\n        :param class_vars: target variable or a list of target variables\n        :type class_vars: :class:`Variable` or list of :class:`Variable`\n        :param metas: a list of meta attributes\n        :type metas: list of :class:`Variable`\n        :param source: the source domain for attributes\n        :type source: Orange.data.Domain\n        :return: a new domain\n        :rtype: :class:`Domain`\n        \"\"\"\n\n        if class_vars is None:\n            class_vars = []\n        elif isinstance(class_vars, (Variable, Integral, str)):\n            class_vars = [class_vars]\n        elif isinstance(class_vars, Iterable):\n            class_vars = list(class_vars)\n\n        if not isinstance(attributes, list):\n            attributes = list(attributes)\n        metas = list(metas) if metas else []\n\n        # Replace str's and int's with descriptors if 'source' is given;\n        # complain otherwise\n        for lst in (attributes, class_vars, metas):\n            for i, var in enumerate(lst):\n                if not isinstance(var, Variable):\n                    if source is not None and isinstance(var, (str, int)):\n                        lst[i] = source[var]\n                    else:\n                        raise TypeError(\n                            \"descriptors must be instances of Variable, \"\n                            \"not '%s'\" % type(var).__name__)\n\n        names = [var.name for var in chain(attributes, class_vars, metas)]\n        if len(names) != len(set(names)):\n            raise Exception('All variables in the domain should have'\n                            ' unique names.')\n\n        # Store everything\n        self.attributes = tuple(attributes)\n        self.class_vars = tuple(class_vars)\n        self._variables = self.attributes + self.class_vars\n        self._metas = tuple(metas)\n        self.class_var = \\\n            self.class_vars[0] if len(self.class_vars) == 1 else None\n        if not all(var.is_primitive() for var in self._variables):\n            raise TypeError(\"variables must be primitive\")\n\n        self._indices = dict(chain.from_iterable(\n            ((var, idx), (var.name, idx), (idx, idx))\n            for idx, var in enumerate(self._variables)))\n        self._indices.update(chain.from_iterable(\n            ((var, -1-idx), (var.name, -1-idx), (-1-idx, -1-idx))\n            for idx, var in enumerate(self.metas)))\n\n        self.anonymous = False\n\n        self._hash = None  # cache for __hash__()\n\n    # noinspection PyPep8Naming\n    @classmethod\n    def from_numpy(cls, X, Y=None, metas=None):\n        \"\"\"\n        Create a domain corresponding to the given numpy arrays. This method\n        is usually invoked from :meth:`Orange.data.Table.from_numpy`.\n\n        All attributes are assumed to be continuous and are named\n        \"Feature <n>\". Target variables are discrete if the only two values\n        are 0 and 1; otherwise they are continuous. Discrete\n        targets are named \"Class <n>\" and continuous are named \"Target <n>\".\n        Domain is marked as :attr:`anonymous`, so data from any other domain of\n        the same shape can be converted into this one and vice-versa.\n\n        :param `numpy.ndarray` X: 2-dimensional array with data\n        :param Y: 1- of 2- dimensional data for target\n        :type Y: `numpy.ndarray` or None\n        :param `numpy.ndarray` metas: meta attributes\n        :type metas: `numpy.ndarray` or None\n        :return: a new domain\n        :rtype: :class:`Domain`\n        \"\"\"\n        def get_places(max_index):\n            return 0 if max_index == 1 else int(log(max_index, 10)) + 1\n\n        def get_name(base, index, places):\n            return base if not places \\\n                else \"{} {:0{}}\".format(base, index + 1, places)\n\n        if X.ndim != 2:\n            raise ValueError('X must be a 2-dimensional array')\n        n_attrs = X.shape[1]\n        places = get_places(n_attrs)\n        attr_vars = [ContinuousVariable(name=get_name(\"Feature\", a, places))\n                     for a in range(n_attrs)]\n        class_vars = []\n        if Y is not None:\n            if Y.ndim == 1:\n                Y = Y.reshape(len(Y), 1)\n            elif Y.ndim != 2:\n                raise ValueError('Y has invalid shape')\n            n_classes = Y.shape[1]\n            places = get_places(n_classes)\n            for i, values in enumerate(Y.T):\n                if set(values) == {0, 1}:\n                    name = get_name('Class', i, places)\n                    values = ['v1', 'v2']\n                    class_vars.append(DiscreteVariable(name, values))\n                else:\n                    name = get_name('Target', i + 1, places)\n                    class_vars.append(ContinuousVariable(name))\n        if metas is not None:\n            n_metas = metas.shape[1]\n            places = get_places(n_metas)\n            meta_vars = [StringVariable(get_name(\"Meta\", m, places))\n                         for m in range(n_metas)]\n        else:\n            meta_vars = []\n\n        domain = cls(attr_vars, class_vars, meta_vars)\n        domain.anonymous = True\n        return domain\n\n    @property\n    def variables(self):\n        return self._variables\n\n    @property\n    def metas(self):\n        return self._metas\n\n    @deprecated(\"len(Domain.variables)\")\n    def __len__(self):\n        \"\"\"The number of variables (features and class attributes).\n\n        The current behavior returns the length of only features and\n        class attributes. In the near future, it will include the\n        length of metas, too, and __iter__ will act accordingly.\"\"\"\n        return len(self._variables)\n\n    def __bool__(self):\n        warnings.warn(\n            \"Domain.__bool__ is ambiguous; use 'is None' or 'empty' instead\",\n            OrangeDeprecationWarning, stacklevel=2)\n        return len(self) > 0  # Keep the obsolete behaviour\n\n    def empty(self):\n        \"\"\"True if the domain has no variables of any kind\"\"\"\n        return not self.variables and not self.metas\n\n    def _get_equivalent(self, var):\n        if isinstance(var, Variable):\n            index = self._indices.get(var.name)\n            if index is not None:\n                if index >= 0:\n                    myvar = self.variables[index]\n                else:\n                    myvar = self.metas[-1 - index]\n                if myvar == var:\n                    return myvar\n        return None\n\n    def __getitem__(self, idx):\n        \"\"\"\n        Return a variable descriptor from the given argument, which can be\n        a descriptor, index or name. If `var` is a descriptor, the function\n        returns this same object.\n\n        :param idx: index, name or descriptor\n        :type idx: int, str or :class:`Variable`\n        :return: an instance of :class:`Variable` described by `var`\n        :rtype: :class:`Variable`\n        \"\"\"\n        if isinstance(idx, slice):\n            return self._variables[idx]\n\n        index = self._indices.get(idx)\n        if index is None:\n            var = self._get_equivalent(idx)\n            if var is not None:\n                return var\n            raise KeyError(idx)\n        if index >= 0:\n            return self.variables[index]\n        else:\n            return self.metas[-1 - index]\n\n    def __contains__(self, item):\n        \"\"\"\n        Return `True` if the item (`str`, `int`, :class:`Variable`) is\n        in the domain.\n        \"\"\"\n        return item in self._indices or self._get_equivalent(item) is not None\n\n    @deprecated(\"Domain.variables\")\n    def __iter__(self):\n        \"\"\"\n        Return an iterator through variables (features and class attributes).\n\n        The current behaviour is confusing, as `x in domain` returns True\n        for meta variables, but iter(domain) does not yield them.\n        This will be consolidated eventually (in 3.12?), the code that\n        currently iterates over domain should iterate over domain.variables\n        instead.\n        \"\"\"\n        return iter(self._variables)\n\n    def __str__(self):\n        \"\"\"\n        Return a list-like string with the domain's features, class attributes\n        and meta attributes.\n        \"\"\"\n        s = \"[\" + \", \".join(attr.name for attr in self.attributes)\n        if self.class_vars:\n            s += \" | \" + \", \".join(cls.name for cls in self.class_vars)\n        s += \"]\"\n        if self._metas:\n            s += \" {\" + \", \".join(meta.name for meta in self._metas) + \"}\"\n        return s\n\n    __repr__ = __str__\n\n    def index(self, var):\n        \"\"\"\n        Return the index of the given variable or meta attribute, represented\n        with an instance of :class:`Variable`, `int` or `str`.\n        \"\"\"\n\n        idx = self._indices.get(var)\n        if idx is not None:\n            return idx\n        equiv = self._get_equivalent(var)\n        if equiv is not None:\n            return self._indices[equiv]\n\n        raise ValueError(\"'%s' is not in domain\" % var)\n\n    def has_discrete_attributes(self, include_class=False, include_metas=False):\n        \"\"\"\n        Return `True` if domain has any discrete attributes. If\n        `include_class` is set, the check includes the class attribute(s). If\n        `include_metas` is set, the check includes the meta attributes.\n        \"\"\"\n        vars = self.variables if include_class else self.attributes\n        vars += self.metas if include_metas else ()\n        return any(var.is_discrete for var in vars)\n\n    def has_continuous_attributes(self, include_class=False, include_metas=False):\n        \"\"\"\n        Return `True` if domain has any continuous attributes. If\n        `include_class` is set, the check includes the class attribute(s). If\n        `include_metas` is set, the check includes the meta attributes.\n        \"\"\"\n        vars = self.variables if include_class else self.attributes\n        vars += self.metas if include_metas else ()\n        return any(var.is_continuous for var in vars)\n\n    def has_time_attributes(self, include_class=False, include_metas=False):\n        \"\"\"\n        Return `True` if domain has any time attributes. If\n        `include_class` is set, the check includes the class attribute(s). If\n        `include_metas` is set, the check includes the meta attributes.\n        \"\"\"\n        vars = self.variables if include_class else self.attributes\n        vars += self.metas if include_metas else ()\n        return any(var.is_time for var in vars)\n\n    @property\n    def has_continuous_class(self):\n        return bool(self.class_var and self.class_var.is_continuous)\n\n    @property\n    def has_discrete_class(self):\n        return bool(self.class_var and self.class_var.is_discrete)\n\n    @property\n    def has_time_class(self):\n        return bool(self.class_var and self.class_var.is_time)\n\n    # noinspection PyProtectedMember\n    def convert(self, inst):\n        \"\"\"\n        Convert a data instance from another domain to this domain.\n\n        :param inst: The data instance to be converted\n        :return: The data instance in this domain\n        \"\"\"\n        from .instance import Instance\n\n        if isinstance(inst, Instance):\n            if inst.domain == self:\n                return inst._x, inst._y, inst._metas\n            c = DomainConversion(inst.domain, self)\n            l = len(inst.domain.attributes)\n            values = [(inst._x[i] if 0 <= i < l\n                       else inst._y[i - l] if i >= l\n                       else inst._metas[-i - 1])\n                      if isinstance(i, int)\n                      else (Unknown if not i else i(inst))\n                      for i in c.variables]\n            metas = [(inst._x[i] if 0 <= i < l\n                      else inst._y[i - l] if i >= l\n                      else inst._metas[-i - 1])\n                     if isinstance(i, int)\n                     else (Unknown if not i else i(inst))\n                     for i in c.metas]\n        else:\n            nvars = len(self._variables)\n            nmetas = len(self._metas)\n            if len(inst) != nvars and len(inst) != nvars + nmetas:\n                raise ValueError(\"invalid data length for domain\")\n            values = [var.to_val(val)\n                      for var, val in zip(self._variables, inst)]\n            if len(inst) == nvars + nmetas:\n                metas = [var.to_val(val)\n                         for var, val in zip(self._metas, inst[nvars:])]\n            else:\n                metas = [var.Unknown for var in self._metas]\n        nattrs = len(self.attributes)\n        # Let np.array decide dtype for values\n        return np.array(values[:nattrs]), np.array(values[nattrs:]),\\\n               np.array(metas, dtype=object)\n\n    def select_columns(self, col_idx):\n        attributes, col_indices = self._compute_col_indices(col_idx)\n        if attributes is not None:\n            n_attrs = len(self.attributes)\n            r_attrs = [attributes[i]\n                       for i, col in enumerate(col_indices)\n                       if 0 <= col < n_attrs]\n            r_classes = [attributes[i]\n                         for i, col in enumerate(col_indices)\n                         if col >= n_attrs]\n            r_metas = [attributes[i]\n                       for i, col in enumerate(col_indices) if col < 0]\n            return Domain(r_attrs, r_classes, r_metas)\n        else:\n            return self\n\n    def _compute_col_indices(self, col_idx):\n        if col_idx is ...:\n            return None, None\n        if isinstance(col_idx, np.ndarray) and col_idx.dtype == bool:\n            return ([attr for attr, c in zip(self, col_idx) if c],\n                    np.nonzero(col_idx))\n        elif isinstance(col_idx, slice):\n            s = len(self.variables)\n            start, end, stride = col_idx.indices(s)\n            if col_idx.indices(s) == (0, s, 1):\n                return None, None\n            else:\n                return (self[col_idx],\n                        np.arange(start, end, stride))\n        elif isinstance(col_idx, Iterable) and not isinstance(col_idx, str):\n            attributes = [self[col] for col in col_idx]\n            if attributes == self.attributes:\n                return None, None\n            return attributes, np.fromiter(\n                (self.index(attr) for attr in attributes), int)\n        elif isinstance(col_idx, Integral):\n            attr = self[col_idx]\n        else:\n            attr = self[col_idx]\n            col_idx = self.index(attr)\n        return [attr], np.array([col_idx])\n\n    def checksum(self):\n        return hash(self)\n\n    def copy(self):\n        \"\"\"\n        Make a copy of the domain. New features are proxies of the old ones,\n        hence the new domain can be used anywhere the old domain was used.\n\n        Returns:\n            Domain: a copy of the domain.\n        \"\"\"\n        return Domain(\n            attributes=[a.make_proxy() for a in self.attributes],\n            class_vars=[a.make_proxy() for a in self.class_vars],\n            metas=[a.make_proxy() for a in self.metas],\n            source=self,\n        )\n\n    def __eq__(self, other):\n        if not isinstance(other, Domain):\n            return False\n\n        return (self.attributes == other.attributes and\n                self.class_vars == other.class_vars and\n                self.metas == other.metas)\n\n    def __hash__(self):\n        if self._hash is None:\n            self._hash = hash(self.attributes) ^ hash(self.class_vars) ^ hash(self.metas)\n        return self._hash",
                                "ast_type_str": "ClassDef",
                                "start_lineno": 108,
                                "end_lineno": 512,
                                "parent": null
                            }
                        }
                    ],
                    "added_entities": [],
                    "deleted_entities": []
                },
                {
                    "descriptor": {
                        "old_range": {
                            "start": 308,
                            "length": 18
                        },
                        "new_range": {
                            "start": 308,
                            "length": 11
                        },
                        "section": "class Domain:"
                    },
                    "line_group": {
                        "all_lines": [
                            {
                                "content": "        \"\"\"",
                                "type": "context"
                            },
                            {
                                "content": "        return item in self._indices or self._get_equivalent(item) is not None",
                                "type": "context"
                            },
                            {
                                "content": "",
                                "type": "context"
                            },
                            {
                                "content": "    @deprecated(\"Domain.variables\")",
                                "type": "deleted"
                            },
                            {
                                "content": "    def __iter__(self):",
                                "type": "context"
                            },
                            {
                                "content": "        \"\"\"",
                                "type": "context"
                            },
                            {
                                "content": "        Return an iterator through variables (features and class attributes).",
                                "type": "context"
                            },
                            {
                                "content": "",
                                "type": "deleted"
                            },
                            {
                                "content": "        The current behaviour is confusing, as `x in domain` returns True",
                                "type": "deleted"
                            },
                            {
                                "content": "        for meta variables, but iter(domain) does not yield them.",
                                "type": "deleted"
                            },
                            {
                                "content": "        This will be consolidated eventually (in 3.12?), the code that",
                                "type": "deleted"
                            },
                            {
                                "content": "        currently iterates over domain should iterate over domain.variables",
                                "type": "deleted"
                            },
                            {
                                "content": "        instead.",
                                "type": "deleted"
                            },
                            {
                                "content": "        \"\"\"",
                                "type": "context"
                            },
                            {
                                "content": "        return iter(self._variables)",
                                "type": "deleted"
                            },
                            {
                                "content": "        return itertools.chain(self._variables, self._metas)",
                                "type": "added"
                            },
                            {
                                "content": "",
                                "type": "context"
                            },
                            {
                                "content": "    def __str__(self):",
                                "type": "context"
                            },
                            {
                                "content": "        \"\"\"",
                                "type": "context"
                            }
                        ]
                    },
                    "modified_entities": [
                        {
                            "file_name": "Orange/data/domain.py",
                            "type": "class",
                            "name": "Domain",
                            "content": "class Domain:\n    def __init__(self, attributes, class_vars=None, metas=None, source=None):\n        \"\"\"\n        Initialize a new domain descriptor. Arguments give the features and\n        the class attribute(s). They can be described by descriptors (instances\n        of :class:`Variable`), or by indices or names if the source domain is\n        given.\n\n        :param attributes: a list of attributes\n        :type attributes: list of :class:`Variable`\n        :param class_vars: target variable or a list of target variables\n        :type class_vars: :class:`Variable` or list of :class:`Variable`\n        :param metas: a list of meta attributes\n        :type metas: list of :class:`Variable`\n        :param source: the source domain for attributes\n        :type source: Orange.data.Domain\n        :return: a new domain\n        :rtype: :class:`Domain`\n        \"\"\"\n\n        if class_vars is None:\n            class_vars = []\n        elif isinstance(class_vars, (Variable, Integral, str)):\n            class_vars = [class_vars]\n        elif isinstance(class_vars, Iterable):\n            class_vars = list(class_vars)\n\n        if not isinstance(attributes, list):\n            attributes = list(attributes)\n        metas = list(metas) if metas else []\n\n        # Replace str's and int's with descriptors if 'source' is given;\n        # complain otherwise\n        for lst in (attributes, class_vars, metas):\n            for i, var in enumerate(lst):\n                if not isinstance(var, Variable):\n                    if source is not None and isinstance(var, (str, int)):\n                        lst[i] = source[var]\n                    else:\n                        raise TypeError(\n                            \"descriptors must be instances of Variable, \"\n                            \"not '%s'\" % type(var).__name__)\n\n        names = [var.name for var in chain(attributes, class_vars, metas)]\n        if len(names) != len(set(names)):\n            raise Exception('All variables in the domain should have'\n                            ' unique names.')\n\n        # Store everything\n        self.attributes = tuple(attributes)\n        self.class_vars = tuple(class_vars)\n        self._variables = self.attributes + self.class_vars\n        self._metas = tuple(metas)\n        self.class_var = \\\n            self.class_vars[0] if len(self.class_vars) == 1 else None\n        if not all(var.is_primitive() for var in self._variables):\n            raise TypeError(\"variables must be primitive\")\n\n        self._indices = dict(chain.from_iterable(\n            ((var, idx), (var.name, idx), (idx, idx))\n            for idx, var in enumerate(self._variables)))\n        self._indices.update(chain.from_iterable(\n            ((var, -1-idx), (var.name, -1-idx), (-1-idx, -1-idx))\n            for idx, var in enumerate(self.metas)))\n\n        self.anonymous = False\n\n        self._hash = None  # cache for __hash__()\n\n    # noinspection PyPep8Naming\n    @classmethod\n    def from_numpy(cls, X, Y=None, metas=None):\n        \"\"\"\n        Create a domain corresponding to the given numpy arrays. This method\n        is usually invoked from :meth:`Orange.data.Table.from_numpy`.\n\n        All attributes are assumed to be continuous and are named\n        \"Feature <n>\". Target variables are discrete if the only two values\n        are 0 and 1; otherwise they are continuous. Discrete\n        targets are named \"Class <n>\" and continuous are named \"Target <n>\".\n        Domain is marked as :attr:`anonymous`, so data from any other domain of\n        the same shape can be converted into this one and vice-versa.\n\n        :param `numpy.ndarray` X: 2-dimensional array with data\n        :param Y: 1- of 2- dimensional data for target\n        :type Y: `numpy.ndarray` or None\n        :param `numpy.ndarray` metas: meta attributes\n        :type metas: `numpy.ndarray` or None\n        :return: a new domain\n        :rtype: :class:`Domain`\n        \"\"\"\n        def get_places(max_index):\n            return 0 if max_index == 1 else int(log(max_index, 10)) + 1\n\n        def get_name(base, index, places):\n            return base if not places \\\n                else \"{} {:0{}}\".format(base, index + 1, places)\n\n        if X.ndim != 2:\n            raise ValueError('X must be a 2-dimensional array')\n        n_attrs = X.shape[1]\n        places = get_places(n_attrs)\n        attr_vars = [ContinuousVariable(name=get_name(\"Feature\", a, places))\n                     for a in range(n_attrs)]\n        class_vars = []\n        if Y is not None:\n            if Y.ndim == 1:\n                Y = Y.reshape(len(Y), 1)\n            elif Y.ndim != 2:\n                raise ValueError('Y has invalid shape')\n            n_classes = Y.shape[1]\n            places = get_places(n_classes)\n            for i, values in enumerate(Y.T):\n                if set(values) == {0, 1}:\n                    name = get_name('Class', i, places)\n                    values = ['v1', 'v2']\n                    class_vars.append(DiscreteVariable(name, values))\n                else:\n                    name = get_name('Target', i + 1, places)\n                    class_vars.append(ContinuousVariable(name))\n        if metas is not None:\n            n_metas = metas.shape[1]\n            places = get_places(n_metas)\n            meta_vars = [StringVariable(get_name(\"Meta\", m, places))\n                         for m in range(n_metas)]\n        else:\n            meta_vars = []\n\n        domain = cls(attr_vars, class_vars, meta_vars)\n        domain.anonymous = True\n        return domain\n\n    @property\n    def variables(self):\n        return self._variables\n\n    @property\n    def metas(self):\n        return self._metas\n\n    @deprecated(\"len(Domain.variables)\")\n    def __len__(self):\n        \"\"\"The number of variables (features and class attributes).\n\n        The current behavior returns the length of only features and\n        class attributes. In the near future, it will include the\n        length of metas, too, and __iter__ will act accordingly.\"\"\"\n        return len(self._variables)\n\n    def __bool__(self):\n        warnings.warn(\n            \"Domain.__bool__ is ambiguous; use 'is None' or 'empty' instead\",\n            OrangeDeprecationWarning, stacklevel=2)\n        return len(self) > 0  # Keep the obsolete behaviour\n\n    def empty(self):\n        \"\"\"True if the domain has no variables of any kind\"\"\"\n        return not self.variables and not self.metas\n\n    def _get_equivalent(self, var):\n        if isinstance(var, Variable):\n            index = self._indices.get(var.name)\n            if index is not None:\n                if index >= 0:\n                    myvar = self.variables[index]\n                else:\n                    myvar = self.metas[-1 - index]\n                if myvar == var:\n                    return myvar\n        return None\n\n    def __getitem__(self, idx):\n        \"\"\"\n        Return a variable descriptor from the given argument, which can be\n        a descriptor, index or name. If `var` is a descriptor, the function\n        returns this same object.\n\n        :param idx: index, name or descriptor\n        :type idx: int, str or :class:`Variable`\n        :return: an instance of :class:`Variable` described by `var`\n        :rtype: :class:`Variable`\n        \"\"\"\n        if isinstance(idx, slice):\n            return self._variables[idx]\n\n        index = self._indices.get(idx)\n        if index is None:\n            var = self._get_equivalent(idx)\n            if var is not None:\n                return var\n            raise KeyError(idx)\n        if index >= 0:\n            return self.variables[index]\n        else:\n            return self.metas[-1 - index]\n\n    def __contains__(self, item):\n        \"\"\"\n        Return `True` if the item (`str`, `int`, :class:`Variable`) is\n        in the domain.\n        \"\"\"\n        return item in self._indices or self._get_equivalent(item) is not None\n\n    @deprecated(\"Domain.variables\")\n    def __iter__(self):\n        \"\"\"\n        Return an iterator through variables (features and class attributes).\n\n        The current behaviour is confusing, as `x in domain` returns True\n        for meta variables, but iter(domain) does not yield them.\n        This will be consolidated eventually (in 3.12?), the code that\n        currently iterates over domain should iterate over domain.variables\n        instead.\n        \"\"\"\n        return iter(self._variables)\n\n    def __str__(self):\n        \"\"\"\n        Return a list-like string with the domain's features, class attributes\n        and meta attributes.\n        \"\"\"\n        s = \"[\" + \", \".join(attr.name for attr in self.attributes)\n        if self.class_vars:\n            s += \" | \" + \", \".join(cls.name for cls in self.class_vars)\n        s += \"]\"\n        if self._metas:\n            s += \" {\" + \", \".join(meta.name for meta in self._metas) + \"}\"\n        return s\n\n    __repr__ = __str__\n\n    def index(self, var):\n        \"\"\"\n        Return the index of the given variable or meta attribute, represented\n        with an instance of :class:`Variable`, `int` or `str`.\n        \"\"\"\n\n        idx = self._indices.get(var)\n        if idx is not None:\n            return idx\n        equiv = self._get_equivalent(var)\n        if equiv is not None:\n            return self._indices[equiv]\n\n        raise ValueError(\"'%s' is not in domain\" % var)\n\n    def has_discrete_attributes(self, include_class=False, include_metas=False):\n        \"\"\"\n        Return `True` if domain has any discrete attributes. If\n        `include_class` is set, the check includes the class attribute(s). If\n        `include_metas` is set, the check includes the meta attributes.\n        \"\"\"\n        vars = self.variables if include_class else self.attributes\n        vars += self.metas if include_metas else ()\n        return any(var.is_discrete for var in vars)\n\n    def has_continuous_attributes(self, include_class=False, include_metas=False):\n        \"\"\"\n        Return `True` if domain has any continuous attributes. If\n        `include_class` is set, the check includes the class attribute(s). If\n        `include_metas` is set, the check includes the meta attributes.\n        \"\"\"\n        vars = self.variables if include_class else self.attributes\n        vars += self.metas if include_metas else ()\n        return any(var.is_continuous for var in vars)\n\n    def has_time_attributes(self, include_class=False, include_metas=False):\n        \"\"\"\n        Return `True` if domain has any time attributes. If\n        `include_class` is set, the check includes the class attribute(s). If\n        `include_metas` is set, the check includes the meta attributes.\n        \"\"\"\n        vars = self.variables if include_class else self.attributes\n        vars += self.metas if include_metas else ()\n        return any(var.is_time for var in vars)\n\n    @property\n    def has_continuous_class(self):\n        return bool(self.class_var and self.class_var.is_continuous)\n\n    @property\n    def has_discrete_class(self):\n        return bool(self.class_var and self.class_var.is_discrete)\n\n    @property\n    def has_time_class(self):\n        return bool(self.class_var and self.class_var.is_time)\n\n    # noinspection PyProtectedMember\n    def convert(self, inst):\n        \"\"\"\n        Convert a data instance from another domain to this domain.\n\n        :param inst: The data instance to be converted\n        :return: The data instance in this domain\n        \"\"\"\n        from .instance import Instance\n\n        if isinstance(inst, Instance):\n            if inst.domain == self:\n                return inst._x, inst._y, inst._metas\n            c = DomainConversion(inst.domain, self)\n            l = len(inst.domain.attributes)\n            values = [(inst._x[i] if 0 <= i < l\n                       else inst._y[i - l] if i >= l\n                       else inst._metas[-i - 1])\n                      if isinstance(i, int)\n                      else (Unknown if not i else i(inst))\n                      for i in c.variables]\n            metas = [(inst._x[i] if 0 <= i < l\n                      else inst._y[i - l] if i >= l\n                      else inst._metas[-i - 1])\n                     if isinstance(i, int)\n                     else (Unknown if not i else i(inst))\n                     for i in c.metas]\n        else:\n            nvars = len(self._variables)\n            nmetas = len(self._metas)\n            if len(inst) != nvars and len(inst) != nvars + nmetas:\n                raise ValueError(\"invalid data length for domain\")\n            values = [var.to_val(val)\n                      for var, val in zip(self._variables, inst)]\n            if len(inst) == nvars + nmetas:\n                metas = [var.to_val(val)\n                         for var, val in zip(self._metas, inst[nvars:])]\n            else:\n                metas = [var.Unknown for var in self._metas]\n        nattrs = len(self.attributes)\n        # Let np.array decide dtype for values\n        return np.array(values[:nattrs]), np.array(values[nattrs:]),\\\n               np.array(metas, dtype=object)\n\n    def select_columns(self, col_idx):\n        attributes, col_indices = self._compute_col_indices(col_idx)\n        if attributes is not None:\n            n_attrs = len(self.attributes)\n            r_attrs = [attributes[i]\n                       for i, col in enumerate(col_indices)\n                       if 0 <= col < n_attrs]\n            r_classes = [attributes[i]\n                         for i, col in enumerate(col_indices)\n                         if col >= n_attrs]\n            r_metas = [attributes[i]\n                       for i, col in enumerate(col_indices) if col < 0]\n            return Domain(r_attrs, r_classes, r_metas)\n        else:\n            return self\n\n    def _compute_col_indices(self, col_idx):\n        if col_idx is ...:\n            return None, None\n        if isinstance(col_idx, np.ndarray) and col_idx.dtype == bool:\n            return ([attr for attr, c in zip(self, col_idx) if c],\n                    np.nonzero(col_idx))\n        elif isinstance(col_idx, slice):\n            s = len(self.variables)\n            start, end, stride = col_idx.indices(s)\n            if col_idx.indices(s) == (0, s, 1):\n                return None, None\n            else:\n                return (self[col_idx],\n                        np.arange(start, end, stride))\n        elif isinstance(col_idx, Iterable) and not isinstance(col_idx, str):\n            attributes = [self[col] for col in col_idx]\n            if attributes == self.attributes:\n                return None, None\n            return attributes, np.fromiter(\n                (self.index(attr) for attr in attributes), int)\n        elif isinstance(col_idx, Integral):\n            attr = self[col_idx]\n        else:\n            attr = self[col_idx]\n            col_idx = self.index(attr)\n        return [attr], np.array([col_idx])\n\n    def checksum(self):\n        return hash(self)\n\n    def copy(self):\n        \"\"\"\n        Make a copy of the domain. New features are proxies of the old ones,\n        hence the new domain can be used anywhere the old domain was used.\n\n        Returns:\n            Domain: a copy of the domain.\n        \"\"\"\n        return Domain(\n            attributes=[a.make_proxy() for a in self.attributes],\n            class_vars=[a.make_proxy() for a in self.class_vars],\n            metas=[a.make_proxy() for a in self.metas],\n            source=self,\n        )\n\n    def __eq__(self, other):\n        if not isinstance(other, Domain):\n            return False\n\n        return (self.attributes == other.attributes and\n                self.class_vars == other.class_vars and\n                self.metas == other.metas)\n\n    def __hash__(self):\n        if self._hash is None:\n            self._hash = hash(self.attributes) ^ hash(self.class_vars) ^ hash(self.metas)\n        return self._hash",
                            "ast_type_str": "ClassDef",
                            "start_lineno": 108,
                            "end_lineno": 512,
                            "parent": null
                        },
                        {
                            "file_name": "Orange/data/domain.py",
                            "type": "method",
                            "name": "Domain.__iter__",
                            "content": "class Domain:\n    def __init__(self, attributes, class_vars=None, metas=None, source=None):\n        \"\"\"\n        Initialize a new domain descriptor. Arguments give the features and\n        the class attribute(s). They can be described by descriptors (instances\n        of :class:`Variable`), or by indices or names if the source domain is\n        given.\n\n        :param attributes: a list of attributes\n        :type attributes: list of :class:`Variable`\n        :param class_vars: target variable or a list of target variables\n        :type class_vars: :class:`Variable` or list of :class:`Variable`\n        :param metas: a list of meta attributes\n        :type metas: list of :class:`Variable`\n        :param source: the source domain for attributes\n        :type source: Orange.data.Domain\n        :return: a new domain\n        :rtype: :class:`Domain`\n        \"\"\"\n\n        if class_vars is None:\n            class_vars = []\n        elif isinstance(class_vars, (Variable, Integral, str)):\n            class_vars = [class_vars]\n        elif isinstance(class_vars, Iterable):\n            class_vars = list(class_vars)\n\n        if not isinstance(attributes, list):\n            attributes = list(attributes)\n        metas = list(metas) if metas else []\n\n        # Replace str's and int's with descriptors if 'source' is given;\n        # complain otherwise\n        for lst in (attributes, class_vars, metas):\n            for i, var in enumerate(lst):\n                if not isinstance(var, Variable):\n                    if source is not None and isinstance(var, (str, int)):\n                        lst[i] = source[var]\n                    else:\n                        raise TypeError(\n                            \"descriptors must be instances of Variable, \"\n                            \"not '%s'\" % type(var).__name__)\n\n        names = [var.name for var in chain(attributes, class_vars, metas)]\n        if len(names) != len(set(names)):\n            raise Exception('All variables in the domain should have'\n                            ' unique names.')\n\n        # Store everything\n        self.attributes = tuple(attributes)\n        self.class_vars = tuple(class_vars)\n        self._variables = self.attributes + self.class_vars\n        self._metas = tuple(metas)\n        self.class_var = \\\n            self.class_vars[0] if len(self.class_vars) == 1 else None\n        if not all(var.is_primitive() for var in self._variables):\n            raise TypeError(\"variables must be primitive\")\n\n        self._indices = dict(chain.from_iterable(\n            ((var, idx), (var.name, idx), (idx, idx))\n            for idx, var in enumerate(self._variables)))\n        self._indices.update(chain.from_iterable(\n            ((var, -1-idx), (var.name, -1-idx), (-1-idx, -1-idx))\n            for idx, var in enumerate(self.metas)))\n\n        self.anonymous = False\n\n        self._hash = None  # cache for __hash__()\n\n    # noinspection PyPep8Naming\n    @classmethod\n    def from_numpy(cls, X, Y=None, metas=None):\n        \"\"\"\n        Create a domain corresponding to the given numpy arrays. This method\n        is usually invoked from :meth:`Orange.data.Table.from_numpy`.\n\n        All attributes are assumed to be continuous and are named\n        \"Feature <n>\". Target variables are discrete if the only two values\n        are 0 and 1; otherwise they are continuous. Discrete\n        targets are named \"Class <n>\" and continuous are named \"Target <n>\".\n        Domain is marked as :attr:`anonymous`, so data from any other domain of\n        the same shape can be converted into this one and vice-versa.\n\n        :param `numpy.ndarray` X: 2-dimensional array with data\n        :param Y: 1- of 2- dimensional data for target\n        :type Y: `numpy.ndarray` or None\n        :param `numpy.ndarray` metas: meta attributes\n        :type metas: `numpy.ndarray` or None\n        :return: a new domain\n        :rtype: :class:`Domain`\n        \"\"\"\n        def get_places(max_index):\n            return 0 if max_index == 1 else int(log(max_index, 10)) + 1\n\n        def get_name(base, index, places):\n            return base if not places \\\n                else \"{} {:0{}}\".format(base, index + 1, places)\n\n        if X.ndim != 2:\n            raise ValueError('X must be a 2-dimensional array')\n        n_attrs = X.shape[1]\n        places = get_places(n_attrs)\n        attr_vars = [ContinuousVariable(name=get_name(\"Feature\", a, places))\n                     for a in range(n_attrs)]\n        class_vars = []\n        if Y is not None:\n            if Y.ndim == 1:\n                Y = Y.reshape(len(Y), 1)\n            elif Y.ndim != 2:\n                raise ValueError('Y has invalid shape')\n            n_classes = Y.shape[1]\n            places = get_places(n_classes)\n            for i, values in enumerate(Y.T):\n                if set(values) == {0, 1}:\n                    name = get_name('Class', i, places)\n                    values = ['v1', 'v2']\n                    class_vars.append(DiscreteVariable(name, values))\n                else:\n                    name = get_name('Target', i + 1, places)\n                    class_vars.append(ContinuousVariable(name))\n        if metas is not None:\n            n_metas = metas.shape[1]\n            places = get_places(n_metas)\n            meta_vars = [StringVariable(get_name(\"Meta\", m, places))\n                         for m in range(n_metas)]\n        else:\n            meta_vars = []\n\n        domain = cls(attr_vars, class_vars, meta_vars)\n        domain.anonymous = True\n        return domain\n\n    @property\n    def variables(self):\n        return self._variables\n\n    @property\n    def metas(self):\n        return self._metas\n\n    @deprecated(\"len(Domain.variables)\")\n    def __len__(self):\n        \"\"\"The number of variables (features and class attributes).\n\n        The current behavior returns the length of only features and\n        class attributes. In the near future, it will include the\n        length of metas, too, and __iter__ will act accordingly.\"\"\"\n        return len(self._variables)\n\n    def __bool__(self):\n        warnings.warn(\n            \"Domain.__bool__ is ambiguous; use 'is None' or 'empty' instead\",\n            OrangeDeprecationWarning, stacklevel=2)\n        return len(self) > 0  # Keep the obsolete behaviour\n\n    def empty(self):\n        \"\"\"True if the domain has no variables of any kind\"\"\"\n        return not self.variables and not self.metas\n\n    def _get_equivalent(self, var):\n        if isinstance(var, Variable):\n            index = self._indices.get(var.name)\n            if index is not None:\n                if index >= 0:\n                    myvar = self.variables[index]\n                else:\n                    myvar = self.metas[-1 - index]\n                if myvar == var:\n                    return myvar\n        return None\n\n    def __getitem__(self, idx):\n        \"\"\"\n        Return a variable descriptor from the given argument, which can be\n        a descriptor, index or name. If `var` is a descriptor, the function\n        returns this same object.\n\n        :param idx: index, name or descriptor\n        :type idx: int, str or :class:`Variable`\n        :return: an instance of :class:`Variable` described by `var`\n        :rtype: :class:`Variable`\n        \"\"\"\n        if isinstance(idx, slice):\n            return self._variables[idx]\n\n        index = self._indices.get(idx)\n        if index is None:\n            var = self._get_equivalent(idx)\n            if var is not None:\n                return var\n            raise KeyError(idx)\n        if index >= 0:\n            return self.variables[index]\n        else:\n            return self.metas[-1 - index]\n\n    def __contains__(self, item):\n        \"\"\"\n        Return `True` if the item (`str`, `int`, :class:`Variable`) is\n        in the domain.\n        \"\"\"\n        return item in self._indices or self._get_equivalent(item) is not None\n\n    @deprecated(\"Domain.variables\")\n    def __iter__(self):\n        \"\"\"\n        Return an iterator through variables (features and class attributes).\n\n        The current behaviour is confusing, as `x in domain` returns True\n        for meta variables, but iter(domain) does not yield them.\n        This will be consolidated eventually (in 3.12?), the code that\n        currently iterates over domain should iterate over domain.variables\n        instead.\n        \"\"\"\n        return iter(self._variables)\n\n    def __str__(self):\n        \"\"\"\n        Return a list-like string with the domain's features, class attributes\n        and meta attributes.\n        \"\"\"\n        s = \"[\" + \", \".join(attr.name for attr in self.attributes)\n        if self.class_vars:\n            s += \" | \" + \", \".join(cls.name for cls in self.class_vars)\n        s += \"]\"\n        if self._metas:\n            s += \" {\" + \", \".join(meta.name for meta in self._metas) + \"}\"\n        return s\n\n    __repr__ = __str__\n\n    def index(self, var):\n        \"\"\"\n        Return the index of the given variable or meta attribute, represented\n        with an instance of :class:`Variable`, `int` or `str`.\n        \"\"\"\n\n        idx = self._indices.get(var)\n        if idx is not None:\n            return idx\n        equiv = self._get_equivalent(var)\n        if equiv is not None:\n            return self._indices[equiv]\n\n        raise ValueError(\"'%s' is not in domain\" % var)\n\n    def has_discrete_attributes(self, include_class=False, include_metas=False):\n        \"\"\"\n        Return `True` if domain has any discrete attributes. If\n        `include_class` is set, the check includes the class attribute(s). If\n        `include_metas` is set, the check includes the meta attributes.\n        \"\"\"\n        vars = self.variables if include_class else self.attributes\n        vars += self.metas if include_metas else ()\n        return any(var.is_discrete for var in vars)\n\n    def has_continuous_attributes(self, include_class=False, include_metas=False):\n        \"\"\"\n        Return `True` if domain has any continuous attributes. If\n        `include_class` is set, the check includes the class attribute(s). If\n        `include_metas` is set, the check includes the meta attributes.\n        \"\"\"\n        vars = self.variables if include_class else self.attributes\n        vars += self.metas if include_metas else ()\n        return any(var.is_continuous for var in vars)\n\n    def has_time_attributes(self, include_class=False, include_metas=False):\n        \"\"\"\n        Return `True` if domain has any time attributes. If\n        `include_class` is set, the check includes the class attribute(s). If\n        `include_metas` is set, the check includes the meta attributes.\n        \"\"\"\n        vars = self.variables if include_class else self.attributes\n        vars += self.metas if include_metas else ()\n        return any(var.is_time for var in vars)\n\n    @property\n    def has_continuous_class(self):\n        return bool(self.class_var and self.class_var.is_continuous)\n\n    @property\n    def has_discrete_class(self):\n        return bool(self.class_var and self.class_var.is_discrete)\n\n    @property\n    def has_time_class(self):\n        return bool(self.class_var and self.class_var.is_time)\n\n    # noinspection PyProtectedMember\n    def convert(self, inst):\n        \"\"\"\n        Convert a data instance from another domain to this domain.\n\n        :param inst: The data instance to be converted\n        :return: The data instance in this domain\n        \"\"\"\n        from .instance import Instance\n\n        if isinstance(inst, Instance):\n            if inst.domain == self:\n                return inst._x, inst._y, inst._metas\n            c = DomainConversion(inst.domain, self)\n            l = len(inst.domain.attributes)\n            values = [(inst._x[i] if 0 <= i < l\n                       else inst._y[i - l] if i >= l\n                       else inst._metas[-i - 1])\n                      if isinstance(i, int)\n                      else (Unknown if not i else i(inst))\n                      for i in c.variables]\n            metas = [(inst._x[i] if 0 <= i < l\n                      else inst._y[i - l] if i >= l\n                      else inst._metas[-i - 1])\n                     if isinstance(i, int)\n                     else (Unknown if not i else i(inst))\n                     for i in c.metas]\n        else:\n            nvars = len(self._variables)\n            nmetas = len(self._metas)\n            if len(inst) != nvars and len(inst) != nvars + nmetas:\n                raise ValueError(\"invalid data length for domain\")\n            values = [var.to_val(val)\n                      for var, val in zip(self._variables, inst)]\n            if len(inst) == nvars + nmetas:\n                metas = [var.to_val(val)\n                         for var, val in zip(self._metas, inst[nvars:])]\n            else:\n                metas = [var.Unknown for var in self._metas]\n        nattrs = len(self.attributes)\n        # Let np.array decide dtype for values\n        return np.array(values[:nattrs]), np.array(values[nattrs:]),\\\n               np.array(metas, dtype=object)\n\n    def select_columns(self, col_idx):\n        attributes, col_indices = self._compute_col_indices(col_idx)\n        if attributes is not None:\n            n_attrs = len(self.attributes)\n            r_attrs = [attributes[i]\n                       for i, col in enumerate(col_indices)\n                       if 0 <= col < n_attrs]\n            r_classes = [attributes[i]\n                         for i, col in enumerate(col_indices)\n                         if col >= n_attrs]\n            r_metas = [attributes[i]\n                       for i, col in enumerate(col_indices) if col < 0]\n            return Domain(r_attrs, r_classes, r_metas)\n        else:\n            return self\n\n    def _compute_col_indices(self, col_idx):\n        if col_idx is ...:\n            return None, None\n        if isinstance(col_idx, np.ndarray) and col_idx.dtype == bool:\n            return ([attr for attr, c in zip(self, col_idx) if c],\n                    np.nonzero(col_idx))\n        elif isinstance(col_idx, slice):\n            s = len(self.variables)\n            start, end, stride = col_idx.indices(s)\n            if col_idx.indices(s) == (0, s, 1):\n                return None, None\n            else:\n                return (self[col_idx],\n                        np.arange(start, end, stride))\n        elif isinstance(col_idx, Iterable) and not isinstance(col_idx, str):\n            attributes = [self[col] for col in col_idx]\n            if attributes == self.attributes:\n                return None, None\n            return attributes, np.fromiter(\n                (self.index(attr) for attr in attributes), int)\n        elif isinstance(col_idx, Integral):\n            attr = self[col_idx]\n        else:\n            attr = self[col_idx]\n            col_idx = self.index(attr)\n        return [attr], np.array([col_idx])\n\n    def checksum(self):\n        return hash(self)\n\n    def copy(self):\n        \"\"\"\n        Make a copy of the domain. New features are proxies of the old ones,\n        hence the new domain can be used anywhere the old domain was used.\n\n        Returns:\n            Domain: a copy of the domain.\n        \"\"\"\n        return Domain(\n            attributes=[a.make_proxy() for a in self.attributes],\n            class_vars=[a.make_proxy() for a in self.class_vars],\n            metas=[a.make_proxy() for a in self.metas],\n            source=self,\n        )\n\n    def __eq__(self, other):\n        if not isinstance(other, Domain):\n            return False\n\n        return (self.attributes == other.attributes and\n                self.class_vars == other.class_vars and\n                self.metas == other.metas)\n\n    def __hash__(self):\n        if self._hash is None:\n            self._hash = hash(self.attributes) ^ hash(self.class_vars) ^ hash(self.metas)\n        return self._hash",
                            "ast_type_str": "ClassDef",
                            "start_lineno": 312,
                            "end_lineno": 322,
                            "parent": {
                                "file_name": "Orange/data/domain.py",
                                "type": "class",
                                "name": "Domain",
                                "content": "class Domain:\n    def __init__(self, attributes, class_vars=None, metas=None, source=None):\n        \"\"\"\n        Initialize a new domain descriptor. Arguments give the features and\n        the class attribute(s). They can be described by descriptors (instances\n        of :class:`Variable`), or by indices or names if the source domain is\n        given.\n\n        :param attributes: a list of attributes\n        :type attributes: list of :class:`Variable`\n        :param class_vars: target variable or a list of target variables\n        :type class_vars: :class:`Variable` or list of :class:`Variable`\n        :param metas: a list of meta attributes\n        :type metas: list of :class:`Variable`\n        :param source: the source domain for attributes\n        :type source: Orange.data.Domain\n        :return: a new domain\n        :rtype: :class:`Domain`\n        \"\"\"\n\n        if class_vars is None:\n            class_vars = []\n        elif isinstance(class_vars, (Variable, Integral, str)):\n            class_vars = [class_vars]\n        elif isinstance(class_vars, Iterable):\n            class_vars = list(class_vars)\n\n        if not isinstance(attributes, list):\n            attributes = list(attributes)\n        metas = list(metas) if metas else []\n\n        # Replace str's and int's with descriptors if 'source' is given;\n        # complain otherwise\n        for lst in (attributes, class_vars, metas):\n            for i, var in enumerate(lst):\n                if not isinstance(var, Variable):\n                    if source is not None and isinstance(var, (str, int)):\n                        lst[i] = source[var]\n                    else:\n                        raise TypeError(\n                            \"descriptors must be instances of Variable, \"\n                            \"not '%s'\" % type(var).__name__)\n\n        names = [var.name for var in chain(attributes, class_vars, metas)]\n        if len(names) != len(set(names)):\n            raise Exception('All variables in the domain should have'\n                            ' unique names.')\n\n        # Store everything\n        self.attributes = tuple(attributes)\n        self.class_vars = tuple(class_vars)\n        self._variables = self.attributes + self.class_vars\n        self._metas = tuple(metas)\n        self.class_var = \\\n            self.class_vars[0] if len(self.class_vars) == 1 else None\n        if not all(var.is_primitive() for var in self._variables):\n            raise TypeError(\"variables must be primitive\")\n\n        self._indices = dict(chain.from_iterable(\n            ((var, idx), (var.name, idx), (idx, idx))\n            for idx, var in enumerate(self._variables)))\n        self._indices.update(chain.from_iterable(\n            ((var, -1-idx), (var.name, -1-idx), (-1-idx, -1-idx))\n            for idx, var in enumerate(self.metas)))\n\n        self.anonymous = False\n\n        self._hash = None  # cache for __hash__()\n\n    # noinspection PyPep8Naming\n    @classmethod\n    def from_numpy(cls, X, Y=None, metas=None):\n        \"\"\"\n        Create a domain corresponding to the given numpy arrays. This method\n        is usually invoked from :meth:`Orange.data.Table.from_numpy`.\n\n        All attributes are assumed to be continuous and are named\n        \"Feature <n>\". Target variables are discrete if the only two values\n        are 0 and 1; otherwise they are continuous. Discrete\n        targets are named \"Class <n>\" and continuous are named \"Target <n>\".\n        Domain is marked as :attr:`anonymous`, so data from any other domain of\n        the same shape can be converted into this one and vice-versa.\n\n        :param `numpy.ndarray` X: 2-dimensional array with data\n        :param Y: 1- of 2- dimensional data for target\n        :type Y: `numpy.ndarray` or None\n        :param `numpy.ndarray` metas: meta attributes\n        :type metas: `numpy.ndarray` or None\n        :return: a new domain\n        :rtype: :class:`Domain`\n        \"\"\"\n        def get_places(max_index):\n            return 0 if max_index == 1 else int(log(max_index, 10)) + 1\n\n        def get_name(base, index, places):\n            return base if not places \\\n                else \"{} {:0{}}\".format(base, index + 1, places)\n\n        if X.ndim != 2:\n            raise ValueError('X must be a 2-dimensional array')\n        n_attrs = X.shape[1]\n        places = get_places(n_attrs)\n        attr_vars = [ContinuousVariable(name=get_name(\"Feature\", a, places))\n                     for a in range(n_attrs)]\n        class_vars = []\n        if Y is not None:\n            if Y.ndim == 1:\n                Y = Y.reshape(len(Y), 1)\n            elif Y.ndim != 2:\n                raise ValueError('Y has invalid shape')\n            n_classes = Y.shape[1]\n            places = get_places(n_classes)\n            for i, values in enumerate(Y.T):\n                if set(values) == {0, 1}:\n                    name = get_name('Class', i, places)\n                    values = ['v1', 'v2']\n                    class_vars.append(DiscreteVariable(name, values))\n                else:\n                    name = get_name('Target', i + 1, places)\n                    class_vars.append(ContinuousVariable(name))\n        if metas is not None:\n            n_metas = metas.shape[1]\n            places = get_places(n_metas)\n            meta_vars = [StringVariable(get_name(\"Meta\", m, places))\n                         for m in range(n_metas)]\n        else:\n            meta_vars = []\n\n        domain = cls(attr_vars, class_vars, meta_vars)\n        domain.anonymous = True\n        return domain\n\n    @property\n    def variables(self):\n        return self._variables\n\n    @property\n    def metas(self):\n        return self._metas\n\n    @deprecated(\"len(Domain.variables)\")\n    def __len__(self):\n        \"\"\"The number of variables (features and class attributes).\n\n        The current behavior returns the length of only features and\n        class attributes. In the near future, it will include the\n        length of metas, too, and __iter__ will act accordingly.\"\"\"\n        return len(self._variables)\n\n    def __bool__(self):\n        warnings.warn(\n            \"Domain.__bool__ is ambiguous; use 'is None' or 'empty' instead\",\n            OrangeDeprecationWarning, stacklevel=2)\n        return len(self) > 0  # Keep the obsolete behaviour\n\n    def empty(self):\n        \"\"\"True if the domain has no variables of any kind\"\"\"\n        return not self.variables and not self.metas\n\n    def _get_equivalent(self, var):\n        if isinstance(var, Variable):\n            index = self._indices.get(var.name)\n            if index is not None:\n                if index >= 0:\n                    myvar = self.variables[index]\n                else:\n                    myvar = self.metas[-1 - index]\n                if myvar == var:\n                    return myvar\n        return None\n\n    def __getitem__(self, idx):\n        \"\"\"\n        Return a variable descriptor from the given argument, which can be\n        a descriptor, index or name. If `var` is a descriptor, the function\n        returns this same object.\n\n        :param idx: index, name or descriptor\n        :type idx: int, str or :class:`Variable`\n        :return: an instance of :class:`Variable` described by `var`\n        :rtype: :class:`Variable`\n        \"\"\"\n        if isinstance(idx, slice):\n            return self._variables[idx]\n\n        index = self._indices.get(idx)\n        if index is None:\n            var = self._get_equivalent(idx)\n            if var is not None:\n                return var\n            raise KeyError(idx)\n        if index >= 0:\n            return self.variables[index]\n        else:\n            return self.metas[-1 - index]\n\n    def __contains__(self, item):\n        \"\"\"\n        Return `True` if the item (`str`, `int`, :class:`Variable`) is\n        in the domain.\n        \"\"\"\n        return item in self._indices or self._get_equivalent(item) is not None\n\n    @deprecated(\"Domain.variables\")\n    def __iter__(self):\n        \"\"\"\n        Return an iterator through variables (features and class attributes).\n\n        The current behaviour is confusing, as `x in domain` returns True\n        for meta variables, but iter(domain) does not yield them.\n        This will be consolidated eventually (in 3.12?), the code that\n        currently iterates over domain should iterate over domain.variables\n        instead.\n        \"\"\"\n        return iter(self._variables)\n\n    def __str__(self):\n        \"\"\"\n        Return a list-like string with the domain's features, class attributes\n        and meta attributes.\n        \"\"\"\n        s = \"[\" + \", \".join(attr.name for attr in self.attributes)\n        if self.class_vars:\n            s += \" | \" + \", \".join(cls.name for cls in self.class_vars)\n        s += \"]\"\n        if self._metas:\n            s += \" {\" + \", \".join(meta.name for meta in self._metas) + \"}\"\n        return s\n\n    __repr__ = __str__\n\n    def index(self, var):\n        \"\"\"\n        Return the index of the given variable or meta attribute, represented\n        with an instance of :class:`Variable`, `int` or `str`.\n        \"\"\"\n\n        idx = self._indices.get(var)\n        if idx is not None:\n            return idx\n        equiv = self._get_equivalent(var)\n        if equiv is not None:\n            return self._indices[equiv]\n\n        raise ValueError(\"'%s' is not in domain\" % var)\n\n    def has_discrete_attributes(self, include_class=False, include_metas=False):\n        \"\"\"\n        Return `True` if domain has any discrete attributes. If\n        `include_class` is set, the check includes the class attribute(s). If\n        `include_metas` is set, the check includes the meta attributes.\n        \"\"\"\n        vars = self.variables if include_class else self.attributes\n        vars += self.metas if include_metas else ()\n        return any(var.is_discrete for var in vars)\n\n    def has_continuous_attributes(self, include_class=False, include_metas=False):\n        \"\"\"\n        Return `True` if domain has any continuous attributes. If\n        `include_class` is set, the check includes the class attribute(s). If\n        `include_metas` is set, the check includes the meta attributes.\n        \"\"\"\n        vars = self.variables if include_class else self.attributes\n        vars += self.metas if include_metas else ()\n        return any(var.is_continuous for var in vars)\n\n    def has_time_attributes(self, include_class=False, include_metas=False):\n        \"\"\"\n        Return `True` if domain has any time attributes. If\n        `include_class` is set, the check includes the class attribute(s). If\n        `include_metas` is set, the check includes the meta attributes.\n        \"\"\"\n        vars = self.variables if include_class else self.attributes\n        vars += self.metas if include_metas else ()\n        return any(var.is_time for var in vars)\n\n    @property\n    def has_continuous_class(self):\n        return bool(self.class_var and self.class_var.is_continuous)\n\n    @property\n    def has_discrete_class(self):\n        return bool(self.class_var and self.class_var.is_discrete)\n\n    @property\n    def has_time_class(self):\n        return bool(self.class_var and self.class_var.is_time)\n\n    # noinspection PyProtectedMember\n    def convert(self, inst):\n        \"\"\"\n        Convert a data instance from another domain to this domain.\n\n        :param inst: The data instance to be converted\n        :return: The data instance in this domain\n        \"\"\"\n        from .instance import Instance\n\n        if isinstance(inst, Instance):\n            if inst.domain == self:\n                return inst._x, inst._y, inst._metas\n            c = DomainConversion(inst.domain, self)\n            l = len(inst.domain.attributes)\n            values = [(inst._x[i] if 0 <= i < l\n                       else inst._y[i - l] if i >= l\n                       else inst._metas[-i - 1])\n                      if isinstance(i, int)\n                      else (Unknown if not i else i(inst))\n                      for i in c.variables]\n            metas = [(inst._x[i] if 0 <= i < l\n                      else inst._y[i - l] if i >= l\n                      else inst._metas[-i - 1])\n                     if isinstance(i, int)\n                     else (Unknown if not i else i(inst))\n                     for i in c.metas]\n        else:\n            nvars = len(self._variables)\n            nmetas = len(self._metas)\n            if len(inst) != nvars and len(inst) != nvars + nmetas:\n                raise ValueError(\"invalid data length for domain\")\n            values = [var.to_val(val)\n                      for var, val in zip(self._variables, inst)]\n            if len(inst) == nvars + nmetas:\n                metas = [var.to_val(val)\n                         for var, val in zip(self._metas, inst[nvars:])]\n            else:\n                metas = [var.Unknown for var in self._metas]\n        nattrs = len(self.attributes)\n        # Let np.array decide dtype for values\n        return np.array(values[:nattrs]), np.array(values[nattrs:]),\\\n               np.array(metas, dtype=object)\n\n    def select_columns(self, col_idx):\n        attributes, col_indices = self._compute_col_indices(col_idx)\n        if attributes is not None:\n            n_attrs = len(self.attributes)\n            r_attrs = [attributes[i]\n                       for i, col in enumerate(col_indices)\n                       if 0 <= col < n_attrs]\n            r_classes = [attributes[i]\n                         for i, col in enumerate(col_indices)\n                         if col >= n_attrs]\n            r_metas = [attributes[i]\n                       for i, col in enumerate(col_indices) if col < 0]\n            return Domain(r_attrs, r_classes, r_metas)\n        else:\n            return self\n\n    def _compute_col_indices(self, col_idx):\n        if col_idx is ...:\n            return None, None\n        if isinstance(col_idx, np.ndarray) and col_idx.dtype == bool:\n            return ([attr for attr, c in zip(self, col_idx) if c],\n                    np.nonzero(col_idx))\n        elif isinstance(col_idx, slice):\n            s = len(self.variables)\n            start, end, stride = col_idx.indices(s)\n            if col_idx.indices(s) == (0, s, 1):\n                return None, None\n            else:\n                return (self[col_idx],\n                        np.arange(start, end, stride))\n        elif isinstance(col_idx, Iterable) and not isinstance(col_idx, str):\n            attributes = [self[col] for col in col_idx]\n            if attributes == self.attributes:\n                return None, None\n            return attributes, np.fromiter(\n                (self.index(attr) for attr in attributes), int)\n        elif isinstance(col_idx, Integral):\n            attr = self[col_idx]\n        else:\n            attr = self[col_idx]\n            col_idx = self.index(attr)\n        return [attr], np.array([col_idx])\n\n    def checksum(self):\n        return hash(self)\n\n    def copy(self):\n        \"\"\"\n        Make a copy of the domain. New features are proxies of the old ones,\n        hence the new domain can be used anywhere the old domain was used.\n\n        Returns:\n            Domain: a copy of the domain.\n        \"\"\"\n        return Domain(\n            attributes=[a.make_proxy() for a in self.attributes],\n            class_vars=[a.make_proxy() for a in self.class_vars],\n            metas=[a.make_proxy() for a in self.metas],\n            source=self,\n        )\n\n    def __eq__(self, other):\n        if not isinstance(other, Domain):\n            return False\n\n        return (self.attributes == other.attributes and\n                self.class_vars == other.class_vars and\n                self.metas == other.metas)\n\n    def __hash__(self):\n        if self._hash is None:\n            self._hash = hash(self.attributes) ^ hash(self.class_vars) ^ hash(self.metas)\n        return self._hash",
                                "ast_type_str": "ClassDef",
                                "start_lineno": 108,
                                "end_lineno": 512,
                                "parent": null
                            }
                        }
                    ],
                    "added_entities": [],
                    "deleted_entities": []
                }
            ]
        },
        {
            "old_file_content": "# Test methods with long descriptive names can omit docstrings\n# pylint: disable=missing-docstring\nimport warnings\nfrom time import time\nfrom numbers import Real\nfrom itertools import starmap, chain\nimport unittest\n\nimport numpy as np\nfrom numpy.testing import assert_array_equal\n\nfrom Orange.data import (\n    ContinuousVariable, DiscreteVariable, StringVariable, TimeVariable,\n    Domain, Table, DomainConversion)\nfrom Orange.data.domain import filter_visible\nfrom Orange.preprocess import Continuize, Impute\nfrom Orange.tests.base import create_pickling_tests\nfrom Orange.util import OrangeDeprecationWarning\n\n\ndef create_domain(*ss):\n    vars_ = dict(\n        age=ContinuousVariable(name=\"AGE\"),\n        gender=DiscreteVariable(name=\"Gender\", values=(\"M\", \"F\")),\n        incomeA=ContinuousVariable(name=\"incomeA\"),\n        income=ContinuousVariable(name=\"income\"),\n        education=DiscreteVariable(name=\"education\", values=(\"GS\", \"HS\", \"C\")),\n        ssn=StringVariable(name=\"SSN\"),\n        race=DiscreteVariable(name=\"race\",\n                              values=(\"White\", \"Hypsanic\", \"African\", \"Other\")),\n        arrival=TimeVariable(\"arrival\"))\n\n    def map_vars(s):\n        return [vars_[x] for x in s]\n    return Domain(*[map_vars(s) for s in ss])\n\n\nPickleDomain = create_pickling_tests(\n    \"PickleDomain\",\n    (\"empty_domain\", lambda: create_domain([])),\n    (\"with_continuous_variable\", lambda: create_domain([\"age\"])),\n    (\"with_discrete_variable\", lambda: create_domain([\"gender\"])),\n    (\"with_mixed_variables\", lambda: create_domain([\"age\", \"gender\"])),\n    (\"with_continuous_class\", lambda: create_domain([\"age\", \"gender\"], [\"incomeA\"])),\n    (\"with_discrete_class\", lambda: create_domain([\"age\", \"gender\"], [\"education\"])),\n    (\"with_multiple_classes\", lambda: create_domain([\"age\", \"gender\"],\n                                                    [\"incomeA\", \"education\"])),\n    (\"with_metas\", lambda: create_domain([\"age\", \"gender\"], [], [\"ssn\"])),\n    (\"with_class_and_metas\", lambda: create_domain([\"age\", \"gender\"],\n                                                   [\"incomeA\", \"education\"],\n                                                   [\"ssn\"])),\n)\n\n\nage, gender, incomeA, income, education, ssn, race, arrival = \\\n    create_domain([], [],\n                  [\"age\", \"gender\", \"incomeA\", \"income\", \"education\", \"ssn\",\n                   \"race\", \"arrival\"]).metas\n\n\nclass TestDomainInit(unittest.TestCase):\n    def test_init_class(self):\n        attributes = (age, gender, income)\n        d = Domain(attributes, race)\n        self.assertEqual(d.variables, attributes + (race,))\n        self.assertEqual(d.attributes, attributes)\n        self.assertEqual(d.class_var, race)\n        self.assertEqual(d.class_vars, (race,))\n        self.assertEqual(d.metas, ())\n\n    def test_init_class_list(self):\n        attributes = (age, gender, income)\n        d = Domain(attributes, [race])\n        self.assertEqual(d.variables, attributes + (race,))\n        self.assertEqual(d.attributes, attributes)\n        self.assertEqual(d.class_var, race)\n        self.assertEqual(d.class_vars, (race,))\n        self.assertEqual(d.metas, ())\n\n    def test_init_no_class(self):\n        attributes = (age, gender, income)\n        d = Domain(attributes)\n        self.assertEqual(d.variables, attributes)\n        self.assertEqual(d.attributes, attributes)\n        self.assertEqual(d.class_var, None)\n        self.assertEqual(d.class_vars, ())\n        self.assertEqual(d.metas, ())\n\n    def test_init_no_class_false(self):\n        attributes = (age, gender, income)\n        d = Domain(attributes, None)\n        self.assertEqual(d.variables, attributes)\n        self.assertEqual(d.attributes, attributes)\n        self.assertEqual(d.class_var, None)\n        self.assertEqual(d.class_vars, ())\n        self.assertEqual(d.metas, ())\n\n    def test_init_multi_class(self):\n        attributes = (age, gender, income)\n        d = Domain(attributes, (education, race))\n        self.assertEqual(d.variables, attributes + (education, race))\n        self.assertEqual(d.attributes, attributes)\n        self.assertIsNone(d.class_var)\n        self.assertEqual(d.class_vars, (education, race))\n        self.assertEqual(d.metas, ())\n\n    def test_init_source(self):\n        attributes = (age, gender, income)\n        d = Domain(attributes, (education, race))\n        d2 = Domain([\"Gender\", 0, income], source=d)\n        self.assertEqual(d2.variables, (gender, age, income))\n\n    def test_init_source_class(self):\n        attributes = (age, gender, income)\n        d = Domain(attributes, (education, race))\n        d2 = Domain([\"Gender\", 0], \"income\", source=d)\n        self.assertEqual(d2.variables, (gender, age, income))\n\n    def test_init_metas(self):\n        attributes = (age, gender, income)\n        metas = (ssn, race)\n        d = Domain(attributes, education, metas=metas)\n        self.assertEqual(d.variables, attributes + (education, ))\n        self.assertEqual(d.attributes, attributes)\n        self.assertEqual(d.class_var, education)\n        self.assertEqual(d.class_vars, (education, ))\n        self.assertEqual(d.metas, metas)\n\n    def test_from_numpy_names(self):\n        for n_cols, name in [(5, \"Feature {}\"),\n                             (99, \"Feature {:02}\"),\n                             (100, \"Feature {:03}\")]:\n            d = Domain.from_numpy(np.zeros((1, n_cols)))\n            self.assertTrue(d.anonymous)\n            self.assertEqual([var.name for var in d.attributes],\n                             [name.format(i) for i in range(1, n_cols+1)])\n\n        d = Domain.from_numpy(np.zeros((1, 1)))\n        self.assertTrue(d.anonymous)\n        self.assertEqual(d.attributes[0].name, \"Feature\")\n\n        d = Domain.from_numpy(np.zeros((1, 3)), np.zeros((1, 1)),\n                              np.zeros((1, 100)))\n        self.assertTrue(d.anonymous)\n        self.assertEqual([var.name for var in d.attributes],\n                         [\"Feature {}\".format(i) for i in range(1, 4)])\n        self.assertEqual(d.class_var.name, \"Target\")\n        self.assertEqual([var.name for var in d.metas],\n                         [\"Meta {:03}\".format(i) for i in range(1, 101)])\n\n    def test_from_numpy_dimensions(self):\n        for dimension in [[5], [5, 1]]:\n            d = Domain.from_numpy(np.zeros((1, 1)), np.zeros(dimension))\n            self.assertTrue(d.anonymous)\n            self.assertEqual(len(d.class_vars), 1)\n\n        self.assertRaises(ValueError, Domain.from_numpy, np.zeros(2))\n        self.assertRaises(ValueError, Domain.from_numpy, np.zeros((2, 2, 2)))\n        self.assertRaises(ValueError, Domain.from_numpy, np.zeros((2, 2)), np.zeros((2, 2, 2)))\n\n    def test_nonunique_domain_error(self):\n        self.assertRaises(Exception, Domain, [ContinuousVariable('a'),\n                                              ContinuousVariable('a')])\n\n    def test_from_numpy_values(self):\n        for aran_min, aran_max, vartype in [(1, 3, ContinuousVariable),\n                                            (0, 2, DiscreteVariable),\n                                            (18, 23, ContinuousVariable)]:\n            n_rows, n_cols, = aran_max - aran_min, 1\n            d = Domain.from_numpy(np.zeros((1, 1)),\n                                  np.arange(aran_min, aran_max).reshape(n_rows, n_cols))\n            self.assertTrue(d.anonymous)\n            self.assertIsInstance(d.class_var, vartype)\n            if isinstance(vartype, DiscreteVariable):\n                self.assertEqual(d.class_var.values, [\"v{}\".format(i) for i in range(1, 3)])\n\n    def test_wrong_vartypes(self):\n        attributes = (age, gender, income)\n        for args in ((attributes, ssn),\n                     (attributes + (ssn,)),\n                     ((ssn, ) + attributes)):\n            with self.assertRaises(TypeError):\n                Domain(*args)\n\n    def test_wrong_vartypes_w_source(self):\n        d = Domain((age, gender), metas=(ssn,))\n        with self.assertRaises(TypeError):\n            Domain(-1, source=d)\n\n    def test_wrong_types(self):\n        with self.assertRaises(TypeError):\n            Domain((age, []))\n        with self.assertRaises(TypeError):\n            Domain((age, \"income\"))\n        with self.assertRaises(TypeError):\n            Domain(([], age))\n        with self.assertRaises(TypeError):\n            Domain((\"income\", age))\n        with self.assertRaises(TypeError):\n            Domain((age,), self)\n        with self.assertRaises(TypeError):\n            Domain((age,), metas=(\"income\",))\n\n    def test_get_item(self):\n        d = Domain((age, gender, income), metas=(ssn, race))\n        for idx, var in [(age, age),\n                         (\"AGE\", age),\n                         (0, age),\n                         (income, income),\n                         (\"income\", income),\n                         (2, income),\n                         (ssn, ssn),\n                         (\"SSN\", ssn),\n                         (-1, ssn),\n                         (-2, race)]:\n            self.assertEqual(d[idx], var)\n\n    def test_index(self):\n        d = Domain((age, gender, income), metas=(ssn, race))\n        for idx, var in [(age, 0),\n                         (\"AGE\", 0),\n                         (0, 0),\n                         (np.int_(0), 0),\n                         (income, 2),\n                         (\"income\", 2),\n                         (2, 2),\n                         (np.int_(2), 2),\n                         (ssn, -1),\n                         (\"SSN\", -1),\n                         (-1, -1),\n                         (np.int_(-1), -1),\n                         (-2, -2), (np.int_(-2), -2)]:\n            self.assertEqual(d.index(idx), var)\n\n    def test_get_item_slices(self):\n        d = Domain((age, gender, income, race), metas=(ssn, education))\n        self.assertEqual(d[:2], (age, gender))\n        self.assertEqual(d[1:3], (gender, income))\n        self.assertEqual(d[2:], (income, race))\n\n    def test_get_item_error(self):\n        d = Domain((age, gender, income), metas=(ssn, race))\n        for idx in (3, -3, incomeA, \"no_such_thing\"):\n            with self.assertRaises(KeyError):\n                _ = d[idx]\n\n        with self.assertRaises(TypeError):\n            _ = d[[2]]\n\n    def test_index_error(self):\n        d = Domain((age, gender, income), metas=(ssn, race))\n        for idx in (3, np.int(3), -3, np.int(-3), incomeA, \"no_such_thing\"):\n            with self.assertRaises(ValueError):\n                d.index(idx)\n\n        with self.assertRaises(TypeError):\n            d.index([2])\n\n    def test_contains(self):\n        d = Domain((age, gender, income), metas=(ssn,))\n        for var in [\"AGE\", age, 0, np.int_(0),\n                    \"income\", income, 2, np.int_(2),\n                    \"SSN\", ssn, -1, np.int_(-1)]:\n            self.assertIn(var, d)\n\n        for var in [\"no_such_thing\", race, 3, np.int_(3), -2, np.int_(-2)]:\n            self.assertNotIn(var, d)\n\n        with self.assertRaises(TypeError):\n            {} in d\n        with self.assertRaises(TypeError):\n            [] in d\n\n    def test_iter(self):\n        with warnings.catch_warnings(record=True):\n            warnings.simplefilter(\"error\")\n\n            d = Domain((age, gender, income), metas=(ssn,))\n            with self.assertRaises(OrangeDeprecationWarning):\n                list(d)\n\n            warnings.simplefilter(\"ignore\")\n            self.assertEqual([var for var in d], [age, gender, income])\n\n            d = Domain((age, ), metas=(ssn,))\n            self.assertEqual([var for var in d], [age])\n\n            d = Domain((), metas=(ssn,))\n            self.assertEqual([var for var in d], [])\n\n    def test_str(self):\n        cases = (\n            (((),), \"[]\"),\n            (((age,),), \"[AGE]\"),\n            (((), age), \"[ | AGE]\"),\n            (((gender,), age), \"[Gender | AGE]\"),\n            (((gender, income), None), \"[Gender, income]\"),\n            (((gender, income), age), \"[Gender, income | AGE]\"),\n            (((gender,), (age, income)), \"[Gender | AGE, income]\"),\n            (((gender,), (age, income), (ssn,)),\n             \"[Gender | AGE, income] {SSN}\"),\n            (((gender,), (age, income), (ssn, race)),\n             \"[Gender | AGE, income] {SSN, race}\"),\n            (((), (), (ssn, race)), \"[] {SSN, race}\"),\n        )\n\n        for args, printout in cases:\n            self.assertEqual(str(Domain(*args)), printout)\n\n    def test_has_discrete(self):\n        self.assertFalse(Domain([]).has_discrete_attributes())\n        self.assertFalse(Domain([], [age]).has_discrete_attributes())\n        self.assertFalse(Domain([], race).has_discrete_attributes())\n\n        self.assertFalse(Domain([age], None).has_discrete_attributes())\n        self.assertTrue(Domain([race], None).has_discrete_attributes())\n        self.assertTrue(Domain([age, race], None).has_discrete_attributes())\n        self.assertTrue(Domain([race, age], None).has_discrete_attributes())\n\n        self.assertFalse(Domain([], [age]).has_discrete_attributes(True))\n        self.assertTrue(Domain([], [race]).has_discrete_attributes(True))\n        self.assertFalse(Domain([age], None).has_discrete_attributes(True))\n        self.assertTrue(Domain([race], None).has_discrete_attributes(True))\n        self.assertTrue(Domain([age], race).has_discrete_attributes(True))\n        self.assertTrue(Domain([race], age).has_discrete_attributes(True))\n        self.assertTrue(Domain([], [race, age]).has_discrete_attributes(True))\n\n        d = Domain([], None, [gender])\n        self.assertTrue(d.has_discrete_attributes(False, True))\n        d = Domain([], None, [age])\n        self.assertFalse(d.has_discrete_attributes(False, True))\n        d = Domain([], [age], [gender])\n        self.assertTrue(d.has_discrete_attributes(True, True))\n        d = Domain([], [incomeA], [age])\n        self.assertFalse(d.has_discrete_attributes(True, True))\n\n    def test_has_continuous(self):\n        self.assertFalse(Domain([]).has_continuous_attributes())\n        self.assertFalse(Domain([], [age]).has_continuous_attributes())\n        self.assertFalse(Domain([], [race]).has_continuous_attributes())\n\n        self.assertTrue(Domain([age], None).has_continuous_attributes())\n        self.assertFalse(Domain([race], None).has_continuous_attributes())\n        self.assertTrue(Domain([age, race], None).has_continuous_attributes())\n        self.assertTrue(Domain([race, age], None).has_continuous_attributes())\n\n        self.assertTrue(Domain([], [age]).has_continuous_attributes(True))\n        self.assertFalse(Domain([], [race]).has_continuous_attributes(True))\n        self.assertTrue(Domain([age], None).has_continuous_attributes(True))\n        self.assertFalse(Domain([race], None).has_continuous_attributes(True))\n        self.assertTrue(Domain([age], race).has_continuous_attributes(True))\n        self.assertTrue(Domain([race], age).has_continuous_attributes(True))\n        self.assertTrue(Domain([], [race, age]).has_continuous_attributes(True))\n\n        d = Domain([], None, [age])\n        self.assertTrue(d.has_continuous_attributes(False, True))\n        d = Domain([], None, [gender])\n        self.assertFalse(d.has_continuous_attributes(False, True))\n        d = Domain([], [gender], [age])\n        self.assertTrue(d.has_continuous_attributes(True, True))\n        d = Domain([], [race], [gender])\n        self.assertFalse(d.has_continuous_attributes(True, True))\n\n    def test_has_time(self):\n        self.assertFalse(Domain([]).has_time_attributes())\n        self.assertFalse(Domain([], [age]).has_time_attributes())\n        self.assertFalse(Domain([], [race]).has_time_attributes())\n        self.assertFalse(Domain([], [arrival]).has_time_attributes())\n        self.assertFalse(Domain([], [], [arrival]).has_time_attributes())\n\n        self.assertTrue(Domain([arrival], []).has_time_attributes())\n        self.assertTrue(Domain([], [arrival]).has_time_attributes(\n            include_class=True))\n        self.assertTrue(Domain([], [], [arrival]).has_time_attributes(\n            include_metas=True))\n\n        self.assertFalse(Domain([arrival], []).has_time_class)\n        self.assertTrue(Domain([], [arrival]).has_time_class)\n        self.assertFalse(Domain([], [], [arrival]).has_time_class)\n\n    def test_get_conversion(self):\n        compute_value = lambda: 42\n        new_income = income.copy(compute_value=compute_value, name='new_income')\n\n        d = Domain((age, gender, income), metas=(ssn, race))\n        e = Domain((gender, race), None, metas=(age, income, ssn))\n        f = Domain((gender,), (race, income), metas=(age, incomeA, ssn))\n        g = Domain((), metas=(age, gender, ssn))\n        h = Domain((gender,), (race, income), metas=(age, new_income, ssn))\n\n        for conver, domain, attr, class_vars, metas in (\n                (d, e, [1, -2], [], [0, 2, -1]),\n                (d, f, [1], [-2, 2], [0, None, -1]),\n                (f, g, [], [], [-1, 0, -3]),\n                (g, h, [-2], [None, None], [-1, compute_value, -3])):\n            to_domain = DomainConversion(conver, domain)\n            self.assertIs(to_domain.source, conver)\n            self.assertEqual(to_domain.attributes, attr)\n            self.assertEqual(to_domain.class_vars, class_vars)\n            self.assertEqual(to_domain.metas, metas)\n\n    def test_conversion(self):\n        domain = Domain([age, income], [race],\n                        [gender, education, ssn])\n\n        x, y, metas = domain.convert([42, 13, \"White\"])\n        assert_array_equal(x, np.array([42, 13]))\n        assert_array_equal(y, np.array([0]))\n        metas_exp = [gender.Unknown, education.Unknown, ssn.Unknown]\n\n        def equal(a, b):\n            if isinstance(a, Real) and isinstance(b, Real) and \\\n                    np.isnan(a) and np.isnan(b):\n                return True\n            else:\n                return a == b\n\n        self.assertTrue(all(starmap(equal, zip(metas, metas_exp))))\n\n        x, y, metas = domain.convert([42, 13, \"White\", \"M\", \"HS\", \"1234567\"])\n        assert_array_equal(x, np.array([42, 13]))\n        assert_array_equal(y, np.array([0]))\n        assert_array_equal(metas, np.array([0, 1, \"1234567\"], dtype=object))\n\n    def test_conversion_size(self):\n        domain = Domain([age, gender, income], [race])\n        self.assertRaises(ValueError, domain.convert, [0] * 3)\n        self.assertRaises(ValueError, domain.convert, [0] * 5)\n\n        domain = Domain([age, income], [race],\n                        [gender, education, ssn])\n        self.assertRaises(ValueError, domain.convert, [0] * 2)\n        self.assertRaises(ValueError, domain.convert, [0] * 4)\n        self.assertRaises(ValueError, domain.convert, [0] * 7)\n        domain.convert([0] * 3)\n        domain.convert([0] * 6)\n\n    def test_preprocessor_chaining(self):\n        domain = Domain([DiscreteVariable(\"a\", values=\"01\"),\n                         DiscreteVariable(\"b\", values=\"01\")],\n                        DiscreteVariable(\"y\", values=\"01\"))\n        table = Table.from_list(domain, [[0, 1], [1, np.NaN]], [0, 1])\n        pre1 = Continuize()(Impute()(table))\n        pre2 = table.transform(pre1.domain)\n        np.testing.assert_almost_equal(pre1.X, pre2.X)\n\n    def test_different_domains_with_same_attributes_are_equal(self):\n        domain1 = Domain([])\n        domain2 = Domain([])\n        self.assertEqual(domain1, domain2)\n\n        var1 = ContinuousVariable('var1')\n        domain1.attributes = (var1,)\n        self.assertNotEqual(domain1, domain2)\n\n        domain2.attributes = (var1,)\n        self.assertEqual(domain1, domain2)\n\n        domain1.class_vars = (var1,)\n        self.assertNotEqual(domain1, domain2)\n\n        domain2.class_vars = (var1,)\n        self.assertEqual(domain1, domain2)\n\n        domain1._metas = (var1,)\n        self.assertNotEqual(domain1, domain2)\n\n        domain2._metas = (var1,)\n        self.assertEqual(domain1, domain2)\n\n    def test_domain_conversion_is_fast_enough(self):\n        attrs = [ContinuousVariable(\"f%i\" % i) for i in range(10000)]\n        class_vars = [ContinuousVariable(\"c%i\" % i) for i in range(10)]\n        metas = [ContinuousVariable(\"m%i\" % i) for i in range(10)]\n        source = Domain(attrs, class_vars, metas)\n\n        start = time()\n        cases = (((attrs[:1000], class_vars, metas),\n                  list(range(1000)), list(range(10000, 10010)), list(range(-1, -11, -1))),\n                 ((metas, attrs[:1000], class_vars),\n                  list(range(-1, -11, -1)), list(range(1000)), list(range(10000, 10010))),\n                 ((class_vars, metas, attrs[:1000]),\n                  list(range(10000, 10010)), list(range(-1, -11, -1)), list(range(1000))))\n\n        for domain_args, attributes, class_vars, metas in cases:\n            c1 = DomainConversion(source, Domain(*domain_args))\n            self.assertEqual(c1.attributes, attributes)\n            self.assertEqual(c1.class_vars, class_vars)\n            self.assertEqual(c1.metas, metas)\n\n        self.assertLessEqual(time() - start, 1)\n\n    def test_copy(self):\n        age.number_of_decimals = 5\n        attributes = (age, gender, income)\n\n        domain = Domain(attributes, [race], [ssn])\n\n        new_domain = domain.copy()\n        new_domain[age].number_of_decimals = 10\n\n        self.assertEqual(domain[age].number_of_decimals, 5)\n        self.assertEqual(new_domain[age].number_of_decimals, 10)\n\n    def test_domain_conversion_sparsity(self):\n        destination = Domain(\n            attributes=[\n                ContinuousVariable(name='a'),\n                ContinuousVariable(name='b'),\n                ContinuousVariable(name='c'),\n            ],\n            class_vars=[DiscreteVariable('d', values=('e', ))],\n            metas=[StringVariable('f')]\n        )\n\n        # all dense\n        source = Domain(attributes=[])\n        conversion = DomainConversion(source, destination)\n        self.assertFalse(conversion.sparse_X)\n        self.assertFalse(conversion.sparse_Y)\n        self.assertFalse(conversion.sparse_metas)\n\n        # set destination attributes as sparse\n        for a in destination.attributes:\n            a.sparse = True\n        source = Domain(attributes=[])\n        conversion = DomainConversion(source, destination)\n        self.assertTrue(conversion.sparse_X)\n        self.assertFalse(conversion.sparse_Y)\n        self.assertFalse(conversion.sparse_metas)\n\n        # set all destination variable as sparse\n        for a in chain(destination.variables, destination.metas):\n            a.sparse = True\n        source = Domain(attributes=[])\n        conversion = DomainConversion(source, destination)\n        self.assertTrue(conversion.sparse_X)\n        self.assertTrue(conversion.sparse_Y)\n        self.assertFalse(conversion.sparse_metas)\n\n    def test_get_item_similar_vars(self):\n        a = DiscreteVariable(\"Cluster\", values=[\"c\"])\n        var1 = a.renamed(\"Cluster x\")\n        var2 = DiscreteVariable(\"Cluster\", values=[\"a\", \"b\"])\n\n        domain = Domain(\n            [],\n            metas=[var1, var2]\n        )\n        # pylint: disable=protected-access\n        self.assertDictEqual(\n            {-1: -1, -2: -2, var1: -1, var2: -2, var1.name: -1, var2.name: -2},\n            domain._indices\n        )\n        self.assertIs(domain[domain.metas[0]], domain.metas[0])\n\n\nclass TestDomainFilter(unittest.TestCase):\n    def setUp(self):\n        self.iris = Table('iris')\n\n    def test_filter_visible(self):\n        n_feats = len(self.iris.domain.attributes)\n\n        self.iris.domain.attributes[0].attributes.update({'hidden': True})\n        filtered = list(filter_visible(self.iris.domain.attributes))\n        self.assertNotIn(self.iris.domain.attributes[0], filtered)\n        self.assertEqual(len(filtered), n_feats - 1)\n\n\nif __name__ == \"__main__\":\n    unittest.main()\n",
            "new_file_content": "# Test methods with long descriptive names can omit docstrings\n# pylint: disable=missing-docstring\nfrom time import time\nfrom numbers import Real\nfrom itertools import starmap, chain\nimport unittest\n\nimport numpy as np\nfrom numpy.testing import assert_array_equal\n\nfrom Orange.data import (\n    ContinuousVariable, DiscreteVariable, StringVariable, TimeVariable,\n    Domain, Table, DomainConversion)\nfrom Orange.data.domain import filter_visible\nfrom Orange.preprocess import Continuize, Impute\nfrom Orange.tests.base import create_pickling_tests\n\n\ndef create_domain(*ss):\n    vars_ = dict(\n        age=ContinuousVariable(name=\"AGE\"),\n        gender=DiscreteVariable(name=\"Gender\", values=(\"M\", \"F\")),\n        incomeA=ContinuousVariable(name=\"incomeA\"),\n        income=ContinuousVariable(name=\"income\"),\n        education=DiscreteVariable(name=\"education\", values=(\"GS\", \"HS\", \"C\")),\n        ssn=StringVariable(name=\"SSN\"),\n        race=DiscreteVariable(name=\"race\",\n                              values=(\"White\", \"Hypsanic\", \"African\", \"Other\")),\n        arrival=TimeVariable(\"arrival\"))\n\n    def map_vars(s):\n        return [vars_[x] for x in s]\n    return Domain(*[map_vars(s) for s in ss])\n\n\nPickleDomain = create_pickling_tests(\n    \"PickleDomain\",\n    (\"empty_domain\", lambda: create_domain([])),\n    (\"with_continuous_variable\", lambda: create_domain([\"age\"])),\n    (\"with_discrete_variable\", lambda: create_domain([\"gender\"])),\n    (\"with_mixed_variables\", lambda: create_domain([\"age\", \"gender\"])),\n    (\"with_continuous_class\", lambda: create_domain([\"age\", \"gender\"], [\"incomeA\"])),\n    (\"with_discrete_class\", lambda: create_domain([\"age\", \"gender\"], [\"education\"])),\n    (\"with_multiple_classes\", lambda: create_domain([\"age\", \"gender\"],\n                                                    [\"incomeA\", \"education\"])),\n    (\"with_metas\", lambda: create_domain([\"age\", \"gender\"], [], [\"ssn\"])),\n    (\"with_class_and_metas\", lambda: create_domain([\"age\", \"gender\"],\n                                                   [\"incomeA\", \"education\"],\n                                                   [\"ssn\"])),\n)\n\n\nage, gender, incomeA, income, education, ssn, race, arrival = \\\n    create_domain([], [],\n                  [\"age\", \"gender\", \"incomeA\", \"income\", \"education\", \"ssn\",\n                   \"race\", \"arrival\"]).metas\n\n\nclass TestDomainInit(unittest.TestCase):\n    def test_init_class(self):\n        attributes = (age, gender, income)\n        d = Domain(attributes, race)\n        self.assertEqual(d.variables, attributes + (race,))\n        self.assertEqual(d.attributes, attributes)\n        self.assertEqual(d.class_var, race)\n        self.assertEqual(d.class_vars, (race,))\n        self.assertEqual(d.metas, ())\n\n    def test_init_class_list(self):\n        attributes = (age, gender, income)\n        d = Domain(attributes, [race])\n        self.assertEqual(d.variables, attributes + (race,))\n        self.assertEqual(d.attributes, attributes)\n        self.assertEqual(d.class_var, race)\n        self.assertEqual(d.class_vars, (race,))\n        self.assertEqual(d.metas, ())\n\n    def test_init_no_class(self):\n        attributes = (age, gender, income)\n        d = Domain(attributes)\n        self.assertEqual(d.variables, attributes)\n        self.assertEqual(d.attributes, attributes)\n        self.assertEqual(d.class_var, None)\n        self.assertEqual(d.class_vars, ())\n        self.assertEqual(d.metas, ())\n\n    def test_init_no_class_false(self):\n        attributes = (age, gender, income)\n        d = Domain(attributes, None)\n        self.assertEqual(d.variables, attributes)\n        self.assertEqual(d.attributes, attributes)\n        self.assertEqual(d.class_var, None)\n        self.assertEqual(d.class_vars, ())\n        self.assertEqual(d.metas, ())\n\n    def test_init_multi_class(self):\n        attributes = (age, gender, income)\n        d = Domain(attributes, (education, race))\n        self.assertEqual(d.variables, attributes + (education, race))\n        self.assertEqual(d.attributes, attributes)\n        self.assertIsNone(d.class_var)\n        self.assertEqual(d.class_vars, (education, race))\n        self.assertEqual(d.metas, ())\n\n    def test_init_source(self):\n        attributes = (age, gender, income)\n        d = Domain(attributes, (education, race))\n        d2 = Domain([\"Gender\", 0, income], source=d)\n        self.assertEqual(d2.variables, (gender, age, income))\n\n    def test_init_source_class(self):\n        attributes = (age, gender, income)\n        d = Domain(attributes, (education, race))\n        d2 = Domain([\"Gender\", 0], \"income\", source=d)\n        self.assertEqual(d2.variables, (gender, age, income))\n\n    def test_init_metas(self):\n        attributes = (age, gender, income)\n        metas = (ssn, race)\n        d = Domain(attributes, education, metas=metas)\n        self.assertEqual(d.variables, attributes + (education, ))\n        self.assertEqual(d.attributes, attributes)\n        self.assertEqual(d.class_var, education)\n        self.assertEqual(d.class_vars, (education, ))\n        self.assertEqual(d.metas, metas)\n\n    def test_from_numpy_names(self):\n        for n_cols, name in [(5, \"Feature {}\"),\n                             (99, \"Feature {:02}\"),\n                             (100, \"Feature {:03}\")]:\n            d = Domain.from_numpy(np.zeros((1, n_cols)))\n            self.assertTrue(d.anonymous)\n            self.assertEqual([var.name for var in d.attributes],\n                             [name.format(i) for i in range(1, n_cols+1)])\n\n        d = Domain.from_numpy(np.zeros((1, 1)))\n        self.assertTrue(d.anonymous)\n        self.assertEqual(d.attributes[0].name, \"Feature\")\n\n        d = Domain.from_numpy(np.zeros((1, 3)), np.zeros((1, 1)),\n                              np.zeros((1, 100)))\n        self.assertTrue(d.anonymous)\n        self.assertEqual([var.name for var in d.attributes],\n                         [\"Feature {}\".format(i) for i in range(1, 4)])\n        self.assertEqual(d.class_var.name, \"Target\")\n        self.assertEqual([var.name for var in d.metas],\n                         [\"Meta {:03}\".format(i) for i in range(1, 101)])\n\n    def test_from_numpy_dimensions(self):\n        for dimension in [[5], [5, 1]]:\n            d = Domain.from_numpy(np.zeros((1, 1)), np.zeros(dimension))\n            self.assertTrue(d.anonymous)\n            self.assertEqual(len(d.class_vars), 1)\n\n        self.assertRaises(ValueError, Domain.from_numpy, np.zeros(2))\n        self.assertRaises(ValueError, Domain.from_numpy, np.zeros((2, 2, 2)))\n        self.assertRaises(ValueError, Domain.from_numpy, np.zeros((2, 2)), np.zeros((2, 2, 2)))\n\n    def test_nonunique_domain_error(self):\n        self.assertRaises(Exception, Domain, [ContinuousVariable('a'),\n                                              ContinuousVariable('a')])\n\n    def test_from_numpy_values(self):\n        for aran_min, aran_max, vartype in [(1, 3, ContinuousVariable),\n                                            (0, 2, DiscreteVariable),\n                                            (18, 23, ContinuousVariable)]:\n            n_rows, n_cols, = aran_max - aran_min, 1\n            d = Domain.from_numpy(np.zeros((1, 1)),\n                                  np.arange(aran_min, aran_max).reshape(n_rows, n_cols))\n            self.assertTrue(d.anonymous)\n            self.assertIsInstance(d.class_var, vartype)\n            if isinstance(vartype, DiscreteVariable):\n                self.assertEqual(d.class_var.values, [\"v{}\".format(i) for i in range(1, 3)])\n\n    def test_wrong_vartypes(self):\n        attributes = (age, gender, income)\n        for args in ((attributes, ssn),\n                     (attributes + (ssn,)),\n                     ((ssn, ) + attributes)):\n            with self.assertRaises(TypeError):\n                Domain(*args)\n\n    def test_wrong_vartypes_w_source(self):\n        d = Domain((age, gender), metas=(ssn,))\n        with self.assertRaises(TypeError):\n            Domain(-1, source=d)\n\n    def test_wrong_types(self):\n        with self.assertRaises(TypeError):\n            Domain((age, []))\n        with self.assertRaises(TypeError):\n            Domain((age, \"income\"))\n        with self.assertRaises(TypeError):\n            Domain(([], age))\n        with self.assertRaises(TypeError):\n            Domain((\"income\", age))\n        with self.assertRaises(TypeError):\n            Domain((age,), self)\n        with self.assertRaises(TypeError):\n            Domain((age,), metas=(\"income\",))\n\n    def test_get_item(self):\n        d = Domain((age, gender, income), metas=(ssn, race))\n        for idx, var in [(age, age),\n                         (\"AGE\", age),\n                         (0, age),\n                         (income, income),\n                         (\"income\", income),\n                         (2, income),\n                         (ssn, ssn),\n                         (\"SSN\", ssn),\n                         (-1, ssn),\n                         (-2, race)]:\n            self.assertEqual(d[idx], var)\n\n    def test_index(self):\n        d = Domain((age, gender, income), metas=(ssn, race))\n        for idx, var in [(age, 0),\n                         (\"AGE\", 0),\n                         (0, 0),\n                         (np.int_(0), 0),\n                         (income, 2),\n                         (\"income\", 2),\n                         (2, 2),\n                         (np.int_(2), 2),\n                         (ssn, -1),\n                         (\"SSN\", -1),\n                         (-1, -1),\n                         (np.int_(-1), -1),\n                         (-2, -2), (np.int_(-2), -2)]:\n            self.assertEqual(d.index(idx), var)\n\n    def test_get_item_slices(self):\n        d = Domain((age, gender, income, race), metas=(ssn, education))\n        self.assertEqual(d[:2], (age, gender))\n        self.assertEqual(d[1:3], (gender, income))\n        self.assertEqual(d[2:], (income, race))\n\n    def test_get_item_error(self):\n        d = Domain((age, gender, income), metas=(ssn, race))\n        for idx in (3, -3, incomeA, \"no_such_thing\"):\n            with self.assertRaises(KeyError):\n                _ = d[idx]\n\n        with self.assertRaises(TypeError):\n            _ = d[[2]]\n\n    def test_index_error(self):\n        d = Domain((age, gender, income), metas=(ssn, race))\n        for idx in (3, np.int(3), -3, np.int(-3), incomeA, \"no_such_thing\"):\n            with self.assertRaises(ValueError):\n                d.index(idx)\n\n        with self.assertRaises(TypeError):\n            d.index([2])\n\n    def test_contains(self):\n        d = Domain((age, gender, income), metas=(ssn,))\n        for var in [\"AGE\", age, 0, np.int_(0),\n                    \"income\", income, 2, np.int_(2),\n                    \"SSN\", ssn, -1, np.int_(-1)]:\n            self.assertIn(var, d)\n\n        for var in [\"no_such_thing\", race, 3, np.int_(3), -2, np.int_(-2)]:\n            self.assertNotIn(var, d)\n\n        with self.assertRaises(TypeError):\n            {} in d\n        with self.assertRaises(TypeError):\n            [] in d\n\n    def test_iter(self):\n        d = Domain((age, gender, income), metas=(ssn,))\n        self.assertEqual(list(d), [age, gender, income, ssn])\n\n        d = Domain((age, ), metas=(ssn,))\n        self.assertEqual(list(d), [age, ssn])\n\n        d = Domain((), metas=(ssn,))\n        self.assertEqual(list(d), [ssn])\n\n    def test_str(self):\n        cases = (\n            (((),), \"[]\"),\n            (((age,),), \"[AGE]\"),\n            (((), age), \"[ | AGE]\"),\n            (((gender,), age), \"[Gender | AGE]\"),\n            (((gender, income), None), \"[Gender, income]\"),\n            (((gender, income), age), \"[Gender, income | AGE]\"),\n            (((gender,), (age, income)), \"[Gender | AGE, income]\"),\n            (((gender,), (age, income), (ssn,)),\n             \"[Gender | AGE, income] {SSN}\"),\n            (((gender,), (age, income), (ssn, race)),\n             \"[Gender | AGE, income] {SSN, race}\"),\n            (((), (), (ssn, race)), \"[] {SSN, race}\"),\n        )\n\n        for args, printout in cases:\n            self.assertEqual(str(Domain(*args)), printout)\n\n    def test_has_discrete(self):\n        self.assertFalse(Domain([]).has_discrete_attributes())\n        self.assertFalse(Domain([], [age]).has_discrete_attributes())\n        self.assertFalse(Domain([], race).has_discrete_attributes())\n\n        self.assertFalse(Domain([age], None).has_discrete_attributes())\n        self.assertTrue(Domain([race], None).has_discrete_attributes())\n        self.assertTrue(Domain([age, race], None).has_discrete_attributes())\n        self.assertTrue(Domain([race, age], None).has_discrete_attributes())\n\n        self.assertFalse(Domain([], [age]).has_discrete_attributes(True))\n        self.assertTrue(Domain([], [race]).has_discrete_attributes(True))\n        self.assertFalse(Domain([age], None).has_discrete_attributes(True))\n        self.assertTrue(Domain([race], None).has_discrete_attributes(True))\n        self.assertTrue(Domain([age], race).has_discrete_attributes(True))\n        self.assertTrue(Domain([race], age).has_discrete_attributes(True))\n        self.assertTrue(Domain([], [race, age]).has_discrete_attributes(True))\n\n        d = Domain([], None, [gender])\n        self.assertTrue(d.has_discrete_attributes(False, True))\n        d = Domain([], None, [age])\n        self.assertFalse(d.has_discrete_attributes(False, True))\n        d = Domain([], [age], [gender])\n        self.assertTrue(d.has_discrete_attributes(True, True))\n        d = Domain([], [incomeA], [age])\n        self.assertFalse(d.has_discrete_attributes(True, True))\n\n    def test_has_continuous(self):\n        self.assertFalse(Domain([]).has_continuous_attributes())\n        self.assertFalse(Domain([], [age]).has_continuous_attributes())\n        self.assertFalse(Domain([], [race]).has_continuous_attributes())\n\n        self.assertTrue(Domain([age], None).has_continuous_attributes())\n        self.assertFalse(Domain([race], None).has_continuous_attributes())\n        self.assertTrue(Domain([age, race], None).has_continuous_attributes())\n        self.assertTrue(Domain([race, age], None).has_continuous_attributes())\n\n        self.assertTrue(Domain([], [age]).has_continuous_attributes(True))\n        self.assertFalse(Domain([], [race]).has_continuous_attributes(True))\n        self.assertTrue(Domain([age], None).has_continuous_attributes(True))\n        self.assertFalse(Domain([race], None).has_continuous_attributes(True))\n        self.assertTrue(Domain([age], race).has_continuous_attributes(True))\n        self.assertTrue(Domain([race], age).has_continuous_attributes(True))\n        self.assertTrue(Domain([], [race, age]).has_continuous_attributes(True))\n\n        d = Domain([], None, [age])\n        self.assertTrue(d.has_continuous_attributes(False, True))\n        d = Domain([], None, [gender])\n        self.assertFalse(d.has_continuous_attributes(False, True))\n        d = Domain([], [gender], [age])\n        self.assertTrue(d.has_continuous_attributes(True, True))\n        d = Domain([], [race], [gender])\n        self.assertFalse(d.has_continuous_attributes(True, True))\n\n    def test_has_time(self):\n        self.assertFalse(Domain([]).has_time_attributes())\n        self.assertFalse(Domain([], [age]).has_time_attributes())\n        self.assertFalse(Domain([], [race]).has_time_attributes())\n        self.assertFalse(Domain([], [arrival]).has_time_attributes())\n        self.assertFalse(Domain([], [], [arrival]).has_time_attributes())\n\n        self.assertTrue(Domain([arrival], []).has_time_attributes())\n        self.assertTrue(Domain([], [arrival]).has_time_attributes(\n            include_class=True))\n        self.assertTrue(Domain([], [], [arrival]).has_time_attributes(\n            include_metas=True))\n\n        self.assertFalse(Domain([arrival], []).has_time_class)\n        self.assertTrue(Domain([], [arrival]).has_time_class)\n        self.assertFalse(Domain([], [], [arrival]).has_time_class)\n\n    def test_get_conversion(self):\n        compute_value = lambda: 42\n        new_income = income.copy(compute_value=compute_value, name='new_income')\n\n        d = Domain((age, gender, income), metas=(ssn, race))\n        e = Domain((gender, race), None, metas=(age, income, ssn))\n        f = Domain((gender,), (race, income), metas=(age, incomeA, ssn))\n        g = Domain((), metas=(age, gender, ssn))\n        h = Domain((gender,), (race, income), metas=(age, new_income, ssn))\n\n        for conver, domain, attr, class_vars, metas in (\n                (d, e, [1, -2], [], [0, 2, -1]),\n                (d, f, [1], [-2, 2], [0, None, -1]),\n                (f, g, [], [], [-1, 0, -3]),\n                (g, h, [-2], [None, None], [-1, compute_value, -3])):\n            to_domain = DomainConversion(conver, domain)\n            self.assertIs(to_domain.source, conver)\n            self.assertEqual(to_domain.attributes, attr)\n            self.assertEqual(to_domain.class_vars, class_vars)\n            self.assertEqual(to_domain.metas, metas)\n\n    def test_conversion(self):\n        domain = Domain([age, income], [race],\n                        [gender, education, ssn])\n\n        x, y, metas = domain.convert([42, 13, \"White\"])\n        assert_array_equal(x, np.array([42, 13]))\n        assert_array_equal(y, np.array([0]))\n        metas_exp = [gender.Unknown, education.Unknown, ssn.Unknown]\n\n        def equal(a, b):\n            if isinstance(a, Real) and isinstance(b, Real) and \\\n                    np.isnan(a) and np.isnan(b):\n                return True\n            else:\n                return a == b\n\n        self.assertTrue(all(starmap(equal, zip(metas, metas_exp))))\n\n        x, y, metas = domain.convert([42, 13, \"White\", \"M\", \"HS\", \"1234567\"])\n        assert_array_equal(x, np.array([42, 13]))\n        assert_array_equal(y, np.array([0]))\n        assert_array_equal(metas, np.array([0, 1, \"1234567\"], dtype=object))\n\n    def test_conversion_size(self):\n        domain = Domain([age, gender, income], [race])\n        self.assertRaises(ValueError, domain.convert, [0] * 3)\n        self.assertRaises(ValueError, domain.convert, [0] * 5)\n\n        domain = Domain([age, income], [race],\n                        [gender, education, ssn])\n        self.assertRaises(ValueError, domain.convert, [0] * 2)\n        self.assertRaises(ValueError, domain.convert, [0] * 4)\n        self.assertRaises(ValueError, domain.convert, [0] * 7)\n        domain.convert([0] * 3)\n        domain.convert([0] * 6)\n\n    def test_preprocessor_chaining(self):\n        domain = Domain([DiscreteVariable(\"a\", values=\"01\"),\n                         DiscreteVariable(\"b\", values=\"01\")],\n                        DiscreteVariable(\"y\", values=\"01\"))\n        table = Table.from_list(domain, [[0, 1], [1, np.NaN]], [0, 1])\n        pre1 = Continuize()(Impute()(table))\n        pre2 = table.transform(pre1.domain)\n        np.testing.assert_almost_equal(pre1.X, pre2.X)\n\n    def test_different_domains_with_same_attributes_are_equal(self):\n        domain1 = Domain([])\n        domain2 = Domain([])\n        self.assertEqual(domain1, domain2)\n\n        var1 = ContinuousVariable('var1')\n        domain1.attributes = (var1,)\n        self.assertNotEqual(domain1, domain2)\n\n        domain2.attributes = (var1,)\n        self.assertEqual(domain1, domain2)\n\n        domain1.class_vars = (var1,)\n        self.assertNotEqual(domain1, domain2)\n\n        domain2.class_vars = (var1,)\n        self.assertEqual(domain1, domain2)\n\n        domain1._metas = (var1,)\n        self.assertNotEqual(domain1, domain2)\n\n        domain2._metas = (var1,)\n        self.assertEqual(domain1, domain2)\n\n    def test_domain_conversion_is_fast_enough(self):\n        attrs = [ContinuousVariable(\"f%i\" % i) for i in range(10000)]\n        class_vars = [ContinuousVariable(\"c%i\" % i) for i in range(10)]\n        metas = [ContinuousVariable(\"m%i\" % i) for i in range(10)]\n        source = Domain(attrs, class_vars, metas)\n\n        start = time()\n        cases = (((attrs[:1000], class_vars, metas),\n                  list(range(1000)), list(range(10000, 10010)), list(range(-1, -11, -1))),\n                 ((metas, attrs[:1000], class_vars),\n                  list(range(-1, -11, -1)), list(range(1000)), list(range(10000, 10010))),\n                 ((class_vars, metas, attrs[:1000]),\n                  list(range(10000, 10010)), list(range(-1, -11, -1)), list(range(1000))))\n\n        for domain_args, attributes, class_vars, metas in cases:\n            c1 = DomainConversion(source, Domain(*domain_args))\n            self.assertEqual(c1.attributes, attributes)\n            self.assertEqual(c1.class_vars, class_vars)\n            self.assertEqual(c1.metas, metas)\n\n        self.assertLessEqual(time() - start, 1)\n\n    def test_copy(self):\n        age.number_of_decimals = 5\n        attributes = (age, gender, income)\n\n        domain = Domain(attributes, [race], [ssn])\n\n        new_domain = domain.copy()\n        new_domain[age].number_of_decimals = 10\n\n        self.assertEqual(domain[age].number_of_decimals, 5)\n        self.assertEqual(new_domain[age].number_of_decimals, 10)\n\n    def test_domain_conversion_sparsity(self):\n        destination = Domain(\n            attributes=[\n                ContinuousVariable(name='a'),\n                ContinuousVariable(name='b'),\n                ContinuousVariable(name='c'),\n            ],\n            class_vars=[DiscreteVariable('d', values=('e', ))],\n            metas=[StringVariable('f')]\n        )\n\n        # all dense\n        source = Domain(attributes=[])\n        conversion = DomainConversion(source, destination)\n        self.assertFalse(conversion.sparse_X)\n        self.assertFalse(conversion.sparse_Y)\n        self.assertFalse(conversion.sparse_metas)\n\n        # set destination attributes as sparse\n        for a in destination.attributes:\n            a.sparse = True\n        source = Domain(attributes=[])\n        conversion = DomainConversion(source, destination)\n        self.assertTrue(conversion.sparse_X)\n        self.assertFalse(conversion.sparse_Y)\n        self.assertFalse(conversion.sparse_metas)\n\n        # set all destination variable as sparse\n        for a in chain(destination.variables, destination.metas):\n            a.sparse = True\n        source = Domain(attributes=[])\n        conversion = DomainConversion(source, destination)\n        self.assertTrue(conversion.sparse_X)\n        self.assertTrue(conversion.sparse_Y)\n        self.assertFalse(conversion.sparse_metas)\n\n    def test_get_item_similar_vars(self):\n        a = DiscreteVariable(\"Cluster\", values=[\"c\"])\n        var1 = a.renamed(\"Cluster x\")\n        var2 = DiscreteVariable(\"Cluster\", values=[\"a\", \"b\"])\n\n        domain = Domain(\n            [],\n            metas=[var1, var2]\n        )\n        # pylint: disable=protected-access\n        self.assertDictEqual(\n            {-1: -1, -2: -2, var1: -1, var2: -2, var1.name: -1, var2.name: -2},\n            domain._indices\n        )\n        self.assertIs(domain[domain.metas[0]], domain.metas[0])\n\n\nclass TestDomainFilter(unittest.TestCase):\n    def setUp(self):\n        self.iris = Table('iris')\n\n    def test_filter_visible(self):\n        n_feats = len(self.iris.domain.attributes)\n\n        self.iris.domain.attributes[0].attributes.update({'hidden': True})\n        filtered = list(filter_visible(self.iris.domain.attributes))\n        self.assertNotIn(self.iris.domain.attributes[0], filtered)\n        self.assertEqual(len(filtered), n_feats - 1)\n\n\nif __name__ == \"__main__\":\n    unittest.main()\n",
            "header": {
                "file": {
                    "path": "Orange/tests/test_domain.py"
                },
                "misc_line": null
            },
            "index_line": {
                "old_commit_hash": "db8f846de",
                "new_commit_hash": "73386a01a",
                "mode": "100644"
            },
            "is_binary_file": false,
            "binary_line": null,
            "minus_file": {
                "path": "a/Orange/tests/test_domain.py"
            },
            "plus_file": {
                "path": "b/Orange/tests/test_domain.py"
            },
            "hunks": [
                {
                    "descriptor": {
                        "old_range": {
                            "start": 1,
                            "length": 6
                        },
                        "new_range": {
                            "start": 1,
                            "length": 5
                        },
                        "section": ""
                    },
                    "line_group": {
                        "all_lines": [
                            {
                                "content": "# Test methods with long descriptive names can omit docstrings",
                                "type": "context"
                            },
                            {
                                "content": "# pylint: disable=missing-docstring",
                                "type": "context"
                            },
                            {
                                "content": "import warnings",
                                "type": "deleted"
                            },
                            {
                                "content": "from time import time",
                                "type": "context"
                            },
                            {
                                "content": "from numbers import Real",
                                "type": "context"
                            },
                            {
                                "content": "from itertools import starmap, chain",
                                "type": "context"
                            }
                        ]
                    },
                    "modified_entities": [],
                    "added_entities": [],
                    "deleted_entities": [
                        {
                            "file_name": "Orange/tests/test_domain.py",
                            "type": "import",
                            "name": "warnings",
                            "content": "import warnings",
                            "ast_type_str": "Import",
                            "start_lineno": 3,
                            "end_lineno": 3,
                            "parent": null
                        }
                    ]
                },
                {
                    "descriptor": {
                        "old_range": {
                            "start": 15,
                            "length": 7
                        },
                        "new_range": {
                            "start": 14,
                            "length": 6
                        },
                        "section": "from Orange.data import ("
                    },
                    "line_group": {
                        "all_lines": [
                            {
                                "content": "from Orange.data.domain import filter_visible",
                                "type": "context"
                            },
                            {
                                "content": "from Orange.preprocess import Continuize, Impute",
                                "type": "context"
                            },
                            {
                                "content": "from Orange.tests.base import create_pickling_tests",
                                "type": "context"
                            },
                            {
                                "content": "from Orange.util import OrangeDeprecationWarning",
                                "type": "deleted"
                            },
                            {
                                "content": "",
                                "type": "context"
                            },
                            {
                                "content": "",
                                "type": "context"
                            },
                            {
                                "content": "def create_domain(*ss):",
                                "type": "context"
                            }
                        ]
                    },
                    "modified_entities": [],
                    "added_entities": [],
                    "deleted_entities": [
                        {
                            "file_name": "Orange/tests/test_domain.py",
                            "type": "statement",
                            "name": "",
                            "content": "from Orange.util import OrangeDeprecationWarning",
                            "ast_type_str": "ImportFrom",
                            "start_lineno": 18,
                            "end_lineno": 18,
                            "parent": null
                        }
                    ]
                },
                {
                    "descriptor": {
                        "old_range": {
                            "start": 272,
                            "length": 21
                        },
                        "new_range": {
                            "start": 270,
                            "length": 14
                        },
                        "section": "class TestDomainInit(unittest.TestCase):"
                    },
                    "line_group": {
                        "all_lines": [
                            {
                                "content": "            [] in d",
                                "type": "context"
                            },
                            {
                                "content": "",
                                "type": "context"
                            },
                            {
                                "content": "    def test_iter(self):",
                                "type": "context"
                            },
                            {
                                "content": "        with warnings.catch_warnings(record=True):",
                                "type": "deleted"
                            },
                            {
                                "content": "            warnings.simplefilter(\"error\")",
                                "type": "deleted"
                            },
                            {
                                "content": "",
                                "type": "deleted"
                            },
                            {
                                "content": "            d = Domain((age, gender, income), metas=(ssn,))",
                                "type": "deleted"
                            },
                            {
                                "content": "            with self.assertRaises(OrangeDeprecationWarning):",
                                "type": "deleted"
                            },
                            {
                                "content": "                list(d)",
                                "type": "deleted"
                            },
                            {
                                "content": "",
                                "type": "deleted"
                            },
                            {
                                "content": "            warnings.simplefilter(\"ignore\")",
                                "type": "deleted"
                            },
                            {
                                "content": "            self.assertEqual([var for var in d], [age, gender, income])",
                                "type": "deleted"
                            },
                            {
                                "content": "        d = Domain((age, gender, income), metas=(ssn,))",
                                "type": "added"
                            },
                            {
                                "content": "        self.assertEqual(list(d), [age, gender, income, ssn])",
                                "type": "added"
                            },
                            {
                                "content": "",
                                "type": "context"
                            },
                            {
                                "content": "            d = Domain((age, ), metas=(ssn,))",
                                "type": "deleted"
                            },
                            {
                                "content": "            self.assertEqual([var for var in d], [age])",
                                "type": "deleted"
                            },
                            {
                                "content": "        d = Domain((age, ), metas=(ssn,))",
                                "type": "added"
                            },
                            {
                                "content": "        self.assertEqual(list(d), [age, ssn])",
                                "type": "added"
                            },
                            {
                                "content": "",
                                "type": "context"
                            },
                            {
                                "content": "            d = Domain((), metas=(ssn,))",
                                "type": "deleted"
                            },
                            {
                                "content": "            self.assertEqual([var for var in d], [])",
                                "type": "deleted"
                            },
                            {
                                "content": "        d = Domain((), metas=(ssn,))",
                                "type": "added"
                            },
                            {
                                "content": "        self.assertEqual(list(d), [ssn])",
                                "type": "added"
                            },
                            {
                                "content": "",
                                "type": "context"
                            },
                            {
                                "content": "    def test_str(self):",
                                "type": "context"
                            },
                            {
                                "content": "        cases = (",
                                "type": "context"
                            },
                            {
                                "content": "",
                                "type": "context"
                            }
                        ]
                    },
                    "modified_entities": [
                        {
                            "file_name": "Orange/tests/test_domain.py",
                            "type": "class",
                            "name": "TestDomainInit",
                            "content": "class TestDomainInit(unittest.TestCase):\n    def test_init_class(self):\n        attributes = (age, gender, income)\n        d = Domain(attributes, race)\n        self.assertEqual(d.variables, attributes + (race,))\n        self.assertEqual(d.attributes, attributes)\n        self.assertEqual(d.class_var, race)\n        self.assertEqual(d.class_vars, (race,))\n        self.assertEqual(d.metas, ())\n\n    def test_init_class_list(self):\n        attributes = (age, gender, income)\n        d = Domain(attributes, [race])\n        self.assertEqual(d.variables, attributes + (race,))\n        self.assertEqual(d.attributes, attributes)\n        self.assertEqual(d.class_var, race)\n        self.assertEqual(d.class_vars, (race,))\n        self.assertEqual(d.metas, ())\n\n    def test_init_no_class(self):\n        attributes = (age, gender, income)\n        d = Domain(attributes)\n        self.assertEqual(d.variables, attributes)\n        self.assertEqual(d.attributes, attributes)\n        self.assertEqual(d.class_var, None)\n        self.assertEqual(d.class_vars, ())\n        self.assertEqual(d.metas, ())\n\n    def test_init_no_class_false(self):\n        attributes = (age, gender, income)\n        d = Domain(attributes, None)\n        self.assertEqual(d.variables, attributes)\n        self.assertEqual(d.attributes, attributes)\n        self.assertEqual(d.class_var, None)\n        self.assertEqual(d.class_vars, ())\n        self.assertEqual(d.metas, ())\n\n    def test_init_multi_class(self):\n        attributes = (age, gender, income)\n        d = Domain(attributes, (education, race))\n        self.assertEqual(d.variables, attributes + (education, race))\n        self.assertEqual(d.attributes, attributes)\n        self.assertIsNone(d.class_var)\n        self.assertEqual(d.class_vars, (education, race))\n        self.assertEqual(d.metas, ())\n\n    def test_init_source(self):\n        attributes = (age, gender, income)\n        d = Domain(attributes, (education, race))\n        d2 = Domain([\"Gender\", 0, income], source=d)\n        self.assertEqual(d2.variables, (gender, age, income))\n\n    def test_init_source_class(self):\n        attributes = (age, gender, income)\n        d = Domain(attributes, (education, race))\n        d2 = Domain([\"Gender\", 0], \"income\", source=d)\n        self.assertEqual(d2.variables, (gender, age, income))\n\n    def test_init_metas(self):\n        attributes = (age, gender, income)\n        metas = (ssn, race)\n        d = Domain(attributes, education, metas=metas)\n        self.assertEqual(d.variables, attributes + (education, ))\n        self.assertEqual(d.attributes, attributes)\n        self.assertEqual(d.class_var, education)\n        self.assertEqual(d.class_vars, (education, ))\n        self.assertEqual(d.metas, metas)\n\n    def test_from_numpy_names(self):\n        for n_cols, name in [(5, \"Feature {}\"),\n                             (99, \"Feature {:02}\"),\n                             (100, \"Feature {:03}\")]:\n            d = Domain.from_numpy(np.zeros((1, n_cols)))\n            self.assertTrue(d.anonymous)\n            self.assertEqual([var.name for var in d.attributes],\n                             [name.format(i) for i in range(1, n_cols+1)])\n\n        d = Domain.from_numpy(np.zeros((1, 1)))\n        self.assertTrue(d.anonymous)\n        self.assertEqual(d.attributes[0].name, \"Feature\")\n\n        d = Domain.from_numpy(np.zeros((1, 3)), np.zeros((1, 1)),\n                              np.zeros((1, 100)))\n        self.assertTrue(d.anonymous)\n        self.assertEqual([var.name for var in d.attributes],\n                         [\"Feature {}\".format(i) for i in range(1, 4)])\n        self.assertEqual(d.class_var.name, \"Target\")\n        self.assertEqual([var.name for var in d.metas],\n                         [\"Meta {:03}\".format(i) for i in range(1, 101)])\n\n    def test_from_numpy_dimensions(self):\n        for dimension in [[5], [5, 1]]:\n            d = Domain.from_numpy(np.zeros((1, 1)), np.zeros(dimension))\n            self.assertTrue(d.anonymous)\n            self.assertEqual(len(d.class_vars), 1)\n\n        self.assertRaises(ValueError, Domain.from_numpy, np.zeros(2))\n        self.assertRaises(ValueError, Domain.from_numpy, np.zeros((2, 2, 2)))\n        self.assertRaises(ValueError, Domain.from_numpy, np.zeros((2, 2)), np.zeros((2, 2, 2)))\n\n    def test_nonunique_domain_error(self):\n        self.assertRaises(Exception, Domain, [ContinuousVariable('a'),\n                                              ContinuousVariable('a')])\n\n    def test_from_numpy_values(self):\n        for aran_min, aran_max, vartype in [(1, 3, ContinuousVariable),\n                                            (0, 2, DiscreteVariable),\n                                            (18, 23, ContinuousVariable)]:\n            n_rows, n_cols, = aran_max - aran_min, 1\n            d = Domain.from_numpy(np.zeros((1, 1)),\n                                  np.arange(aran_min, aran_max).reshape(n_rows, n_cols))\n            self.assertTrue(d.anonymous)\n            self.assertIsInstance(d.class_var, vartype)\n            if isinstance(vartype, DiscreteVariable):\n                self.assertEqual(d.class_var.values, [\"v{}\".format(i) for i in range(1, 3)])\n\n    def test_wrong_vartypes(self):\n        attributes = (age, gender, income)\n        for args in ((attributes, ssn),\n                     (attributes + (ssn,)),\n                     ((ssn, ) + attributes)):\n            with self.assertRaises(TypeError):\n                Domain(*args)\n\n    def test_wrong_vartypes_w_source(self):\n        d = Domain((age, gender), metas=(ssn,))\n        with self.assertRaises(TypeError):\n            Domain(-1, source=d)\n\n    def test_wrong_types(self):\n        with self.assertRaises(TypeError):\n            Domain((age, []))\n        with self.assertRaises(TypeError):\n            Domain((age, \"income\"))\n        with self.assertRaises(TypeError):\n            Domain(([], age))\n        with self.assertRaises(TypeError):\n            Domain((\"income\", age))\n        with self.assertRaises(TypeError):\n            Domain((age,), self)\n        with self.assertRaises(TypeError):\n            Domain((age,), metas=(\"income\",))\n\n    def test_get_item(self):\n        d = Domain((age, gender, income), metas=(ssn, race))\n        for idx, var in [(age, age),\n                         (\"AGE\", age),\n                         (0, age),\n                         (income, income),\n                         (\"income\", income),\n                         (2, income),\n                         (ssn, ssn),\n                         (\"SSN\", ssn),\n                         (-1, ssn),\n                         (-2, race)]:\n            self.assertEqual(d[idx], var)\n\n    def test_index(self):\n        d = Domain((age, gender, income), metas=(ssn, race))\n        for idx, var in [(age, 0),\n                         (\"AGE\", 0),\n                         (0, 0),\n                         (np.int_(0), 0),\n                         (income, 2),\n                         (\"income\", 2),\n                         (2, 2),\n                         (np.int_(2), 2),\n                         (ssn, -1),\n                         (\"SSN\", -1),\n                         (-1, -1),\n                         (np.int_(-1), -1),\n                         (-2, -2), (np.int_(-2), -2)]:\n            self.assertEqual(d.index(idx), var)\n\n    def test_get_item_slices(self):\n        d = Domain((age, gender, income, race), metas=(ssn, education))\n        self.assertEqual(d[:2], (age, gender))\n        self.assertEqual(d[1:3], (gender, income))\n        self.assertEqual(d[2:], (income, race))\n\n    def test_get_item_error(self):\n        d = Domain((age, gender, income), metas=(ssn, race))\n        for idx in (3, -3, incomeA, \"no_such_thing\"):\n            with self.assertRaises(KeyError):\n                _ = d[idx]\n\n        with self.assertRaises(TypeError):\n            _ = d[[2]]\n\n    def test_index_error(self):\n        d = Domain((age, gender, income), metas=(ssn, race))\n        for idx in (3, np.int(3), -3, np.int(-3), incomeA, \"no_such_thing\"):\n            with self.assertRaises(ValueError):\n                d.index(idx)\n\n        with self.assertRaises(TypeError):\n            d.index([2])\n\n    def test_contains(self):\n        d = Domain((age, gender, income), metas=(ssn,))\n        for var in [\"AGE\", age, 0, np.int_(0),\n                    \"income\", income, 2, np.int_(2),\n                    \"SSN\", ssn, -1, np.int_(-1)]:\n            self.assertIn(var, d)\n\n        for var in [\"no_such_thing\", race, 3, np.int_(3), -2, np.int_(-2)]:\n            self.assertNotIn(var, d)\n\n        with self.assertRaises(TypeError):\n            {} in d\n        with self.assertRaises(TypeError):\n            [] in d\n\n    def test_iter(self):\n        with warnings.catch_warnings(record=True):\n            warnings.simplefilter(\"error\")\n\n            d = Domain((age, gender, income), metas=(ssn,))\n            with self.assertRaises(OrangeDeprecationWarning):\n                list(d)\n\n            warnings.simplefilter(\"ignore\")\n            self.assertEqual([var for var in d], [age, gender, income])\n\n            d = Domain((age, ), metas=(ssn,))\n            self.assertEqual([var for var in d], [age])\n\n            d = Domain((), metas=(ssn,))\n            self.assertEqual([var for var in d], [])\n\n    def test_str(self):\n        cases = (\n            (((),), \"[]\"),\n            (((age,),), \"[AGE]\"),\n            (((), age), \"[ | AGE]\"),\n            (((gender,), age), \"[Gender | AGE]\"),\n            (((gender, income), None), \"[Gender, income]\"),\n            (((gender, income), age), \"[Gender, income | AGE]\"),\n            (((gender,), (age, income)), \"[Gender | AGE, income]\"),\n            (((gender,), (age, income), (ssn,)),\n             \"[Gender | AGE, income] {SSN}\"),\n            (((gender,), (age, income), (ssn, race)),\n             \"[Gender | AGE, income] {SSN, race}\"),\n            (((), (), (ssn, race)), \"[] {SSN, race}\"),\n        )\n\n        for args, printout in cases:\n            self.assertEqual(str(Domain(*args)), printout)\n\n    def test_has_discrete(self):\n        self.assertFalse(Domain([]).has_discrete_attributes())\n        self.assertFalse(Domain([], [age]).has_discrete_attributes())\n        self.assertFalse(Domain([], race).has_discrete_attributes())\n\n        self.assertFalse(Domain([age], None).has_discrete_attributes())\n        self.assertTrue(Domain([race], None).has_discrete_attributes())\n        self.assertTrue(Domain([age, race], None).has_discrete_attributes())\n        self.assertTrue(Domain([race, age], None).has_discrete_attributes())\n\n        self.assertFalse(Domain([], [age]).has_discrete_attributes(True))\n        self.assertTrue(Domain([], [race]).has_discrete_attributes(True))\n        self.assertFalse(Domain([age], None).has_discrete_attributes(True))\n        self.assertTrue(Domain([race], None).has_discrete_attributes(True))\n        self.assertTrue(Domain([age], race).has_discrete_attributes(True))\n        self.assertTrue(Domain([race], age).has_discrete_attributes(True))\n        self.assertTrue(Domain([], [race, age]).has_discrete_attributes(True))\n\n        d = Domain([], None, [gender])\n        self.assertTrue(d.has_discrete_attributes(False, True))\n        d = Domain([], None, [age])\n        self.assertFalse(d.has_discrete_attributes(False, True))\n        d = Domain([], [age], [gender])\n        self.assertTrue(d.has_discrete_attributes(True, True))\n        d = Domain([], [incomeA], [age])\n        self.assertFalse(d.has_discrete_attributes(True, True))\n\n    def test_has_continuous(self):\n        self.assertFalse(Domain([]).has_continuous_attributes())\n        self.assertFalse(Domain([], [age]).has_continuous_attributes())\n        self.assertFalse(Domain([], [race]).has_continuous_attributes())\n\n        self.assertTrue(Domain([age], None).has_continuous_attributes())\n        self.assertFalse(Domain([race], None).has_continuous_attributes())\n        self.assertTrue(Domain([age, race], None).has_continuous_attributes())\n        self.assertTrue(Domain([race, age], None).has_continuous_attributes())\n\n        self.assertTrue(Domain([], [age]).has_continuous_attributes(True))\n        self.assertFalse(Domain([], [race]).has_continuous_attributes(True))\n        self.assertTrue(Domain([age], None).has_continuous_attributes(True))\n        self.assertFalse(Domain([race], None).has_continuous_attributes(True))\n        self.assertTrue(Domain([age], race).has_continuous_attributes(True))\n        self.assertTrue(Domain([race], age).has_continuous_attributes(True))\n        self.assertTrue(Domain([], [race, age]).has_continuous_attributes(True))\n\n        d = Domain([], None, [age])\n        self.assertTrue(d.has_continuous_attributes(False, True))\n        d = Domain([], None, [gender])\n        self.assertFalse(d.has_continuous_attributes(False, True))\n        d = Domain([], [gender], [age])\n        self.assertTrue(d.has_continuous_attributes(True, True))\n        d = Domain([], [race], [gender])\n        self.assertFalse(d.has_continuous_attributes(True, True))\n\n    def test_has_time(self):\n        self.assertFalse(Domain([]).has_time_attributes())\n        self.assertFalse(Domain([], [age]).has_time_attributes())\n        self.assertFalse(Domain([], [race]).has_time_attributes())\n        self.assertFalse(Domain([], [arrival]).has_time_attributes())\n        self.assertFalse(Domain([], [], [arrival]).has_time_attributes())\n\n        self.assertTrue(Domain([arrival], []).has_time_attributes())\n        self.assertTrue(Domain([], [arrival]).has_time_attributes(\n            include_class=True))\n        self.assertTrue(Domain([], [], [arrival]).has_time_attributes(\n            include_metas=True))\n\n        self.assertFalse(Domain([arrival], []).has_time_class)\n        self.assertTrue(Domain([], [arrival]).has_time_class)\n        self.assertFalse(Domain([], [], [arrival]).has_time_class)\n\n    def test_get_conversion(self):\n        compute_value = lambda: 42\n        new_income = income.copy(compute_value=compute_value, name='new_income')\n\n        d = Domain((age, gender, income), metas=(ssn, race))\n        e = Domain((gender, race), None, metas=(age, income, ssn))\n        f = Domain((gender,), (race, income), metas=(age, incomeA, ssn))\n        g = Domain((), metas=(age, gender, ssn))\n        h = Domain((gender,), (race, income), metas=(age, new_income, ssn))\n\n        for conver, domain, attr, class_vars, metas in (\n                (d, e, [1, -2], [], [0, 2, -1]),\n                (d, f, [1], [-2, 2], [0, None, -1]),\n                (f, g, [], [], [-1, 0, -3]),\n                (g, h, [-2], [None, None], [-1, compute_value, -3])):\n            to_domain = DomainConversion(conver, domain)\n            self.assertIs(to_domain.source, conver)\n            self.assertEqual(to_domain.attributes, attr)\n            self.assertEqual(to_domain.class_vars, class_vars)\n            self.assertEqual(to_domain.metas, metas)\n\n    def test_conversion(self):\n        domain = Domain([age, income], [race],\n                        [gender, education, ssn])\n\n        x, y, metas = domain.convert([42, 13, \"White\"])\n        assert_array_equal(x, np.array([42, 13]))\n        assert_array_equal(y, np.array([0]))\n        metas_exp = [gender.Unknown, education.Unknown, ssn.Unknown]\n\n        def equal(a, b):\n            if isinstance(a, Real) and isinstance(b, Real) and \\\n                    np.isnan(a) and np.isnan(b):\n                return True\n            else:\n                return a == b\n\n        self.assertTrue(all(starmap(equal, zip(metas, metas_exp))))\n\n        x, y, metas = domain.convert([42, 13, \"White\", \"M\", \"HS\", \"1234567\"])\n        assert_array_equal(x, np.array([42, 13]))\n        assert_array_equal(y, np.array([0]))\n        assert_array_equal(metas, np.array([0, 1, \"1234567\"], dtype=object))\n\n    def test_conversion_size(self):\n        domain = Domain([age, gender, income], [race])\n        self.assertRaises(ValueError, domain.convert, [0] * 3)\n        self.assertRaises(ValueError, domain.convert, [0] * 5)\n\n        domain = Domain([age, income], [race],\n                        [gender, education, ssn])\n        self.assertRaises(ValueError, domain.convert, [0] * 2)\n        self.assertRaises(ValueError, domain.convert, [0] * 4)\n        self.assertRaises(ValueError, domain.convert, [0] * 7)\n        domain.convert([0] * 3)\n        domain.convert([0] * 6)\n\n    def test_preprocessor_chaining(self):\n        domain = Domain([DiscreteVariable(\"a\", values=\"01\"),\n                         DiscreteVariable(\"b\", values=\"01\")],\n                        DiscreteVariable(\"y\", values=\"01\"))\n        table = Table.from_list(domain, [[0, 1], [1, np.NaN]], [0, 1])\n        pre1 = Continuize()(Impute()(table))\n        pre2 = table.transform(pre1.domain)\n        np.testing.assert_almost_equal(pre1.X, pre2.X)\n\n    def test_different_domains_with_same_attributes_are_equal(self):\n        domain1 = Domain([])\n        domain2 = Domain([])\n        self.assertEqual(domain1, domain2)\n\n        var1 = ContinuousVariable('var1')\n        domain1.attributes = (var1,)\n        self.assertNotEqual(domain1, domain2)\n\n        domain2.attributes = (var1,)\n        self.assertEqual(domain1, domain2)\n\n        domain1.class_vars = (var1,)\n        self.assertNotEqual(domain1, domain2)\n\n        domain2.class_vars = (var1,)\n        self.assertEqual(domain1, domain2)\n\n        domain1._metas = (var1,)\n        self.assertNotEqual(domain1, domain2)\n\n        domain2._metas = (var1,)\n        self.assertEqual(domain1, domain2)\n\n    def test_domain_conversion_is_fast_enough(self):\n        attrs = [ContinuousVariable(\"f%i\" % i) for i in range(10000)]\n        class_vars = [ContinuousVariable(\"c%i\" % i) for i in range(10)]\n        metas = [ContinuousVariable(\"m%i\" % i) for i in range(10)]\n        source = Domain(attrs, class_vars, metas)\n\n        start = time()\n        cases = (((attrs[:1000], class_vars, metas),\n                  list(range(1000)), list(range(10000, 10010)), list(range(-1, -11, -1))),\n                 ((metas, attrs[:1000], class_vars),\n                  list(range(-1, -11, -1)), list(range(1000)), list(range(10000, 10010))),\n                 ((class_vars, metas, attrs[:1000]),\n                  list(range(10000, 10010)), list(range(-1, -11, -1)), list(range(1000))))\n\n        for domain_args, attributes, class_vars, metas in cases:\n            c1 = DomainConversion(source, Domain(*domain_args))\n            self.assertEqual(c1.attributes, attributes)\n            self.assertEqual(c1.class_vars, class_vars)\n            self.assertEqual(c1.metas, metas)\n\n        self.assertLessEqual(time() - start, 1)\n\n    def test_copy(self):\n        age.number_of_decimals = 5\n        attributes = (age, gender, income)\n\n        domain = Domain(attributes, [race], [ssn])\n\n        new_domain = domain.copy()\n        new_domain[age].number_of_decimals = 10\n\n        self.assertEqual(domain[age].number_of_decimals, 5)\n        self.assertEqual(new_domain[age].number_of_decimals, 10)\n\n    def test_domain_conversion_sparsity(self):\n        destination = Domain(\n            attributes=[\n                ContinuousVariable(name='a'),\n                ContinuousVariable(name='b'),\n                ContinuousVariable(name='c'),\n            ],\n            class_vars=[DiscreteVariable('d', values=('e', ))],\n            metas=[StringVariable('f')]\n        )\n\n        # all dense\n        source = Domain(attributes=[])\n        conversion = DomainConversion(source, destination)\n        self.assertFalse(conversion.sparse_X)\n        self.assertFalse(conversion.sparse_Y)\n        self.assertFalse(conversion.sparse_metas)\n\n        # set destination attributes as sparse\n        for a in destination.attributes:\n            a.sparse = True\n        source = Domain(attributes=[])\n        conversion = DomainConversion(source, destination)\n        self.assertTrue(conversion.sparse_X)\n        self.assertFalse(conversion.sparse_Y)\n        self.assertFalse(conversion.sparse_metas)\n\n        # set all destination variable as sparse\n        for a in chain(destination.variables, destination.metas):\n            a.sparse = True\n        source = Domain(attributes=[])\n        conversion = DomainConversion(source, destination)\n        self.assertTrue(conversion.sparse_X)\n        self.assertTrue(conversion.sparse_Y)\n        self.assertFalse(conversion.sparse_metas)\n\n    def test_get_item_similar_vars(self):\n        a = DiscreteVariable(\"Cluster\", values=[\"c\"])\n        var1 = a.renamed(\"Cluster x\")\n        var2 = DiscreteVariable(\"Cluster\", values=[\"a\", \"b\"])\n\n        domain = Domain(\n            [],\n            metas=[var1, var2]\n        )\n        # pylint: disable=protected-access\n        self.assertDictEqual(\n            {-1: -1, -2: -2, var1: -1, var2: -2, var1.name: -1, var2.name: -2},\n            domain._indices\n        )\n        self.assertIs(domain[domain.metas[0]], domain.metas[0])",
                            "ast_type_str": "ClassDef",
                            "start_lineno": 61,
                            "end_lineno": 555,
                            "parent": null
                        },
                        {
                            "file_name": "Orange/tests/test_domain.py",
                            "type": "method",
                            "name": "TestDomainInit.test_iter",
                            "content": "class TestDomainInit(unittest.TestCase):\n    def test_init_class(self):\n        attributes = (age, gender, income)\n        d = Domain(attributes, race)\n        self.assertEqual(d.variables, attributes + (race,))\n        self.assertEqual(d.attributes, attributes)\n        self.assertEqual(d.class_var, race)\n        self.assertEqual(d.class_vars, (race,))\n        self.assertEqual(d.metas, ())\n\n    def test_init_class_list(self):\n        attributes = (age, gender, income)\n        d = Domain(attributes, [race])\n        self.assertEqual(d.variables, attributes + (race,))\n        self.assertEqual(d.attributes, attributes)\n        self.assertEqual(d.class_var, race)\n        self.assertEqual(d.class_vars, (race,))\n        self.assertEqual(d.metas, ())\n\n    def test_init_no_class(self):\n        attributes = (age, gender, income)\n        d = Domain(attributes)\n        self.assertEqual(d.variables, attributes)\n        self.assertEqual(d.attributes, attributes)\n        self.assertEqual(d.class_var, None)\n        self.assertEqual(d.class_vars, ())\n        self.assertEqual(d.metas, ())\n\n    def test_init_no_class_false(self):\n        attributes = (age, gender, income)\n        d = Domain(attributes, None)\n        self.assertEqual(d.variables, attributes)\n        self.assertEqual(d.attributes, attributes)\n        self.assertEqual(d.class_var, None)\n        self.assertEqual(d.class_vars, ())\n        self.assertEqual(d.metas, ())\n\n    def test_init_multi_class(self):\n        attributes = (age, gender, income)\n        d = Domain(attributes, (education, race))\n        self.assertEqual(d.variables, attributes + (education, race))\n        self.assertEqual(d.attributes, attributes)\n        self.assertIsNone(d.class_var)\n        self.assertEqual(d.class_vars, (education, race))\n        self.assertEqual(d.metas, ())\n\n    def test_init_source(self):\n        attributes = (age, gender, income)\n        d = Domain(attributes, (education, race))\n        d2 = Domain([\"Gender\", 0, income], source=d)\n        self.assertEqual(d2.variables, (gender, age, income))\n\n    def test_init_source_class(self):\n        attributes = (age, gender, income)\n        d = Domain(attributes, (education, race))\n        d2 = Domain([\"Gender\", 0], \"income\", source=d)\n        self.assertEqual(d2.variables, (gender, age, income))\n\n    def test_init_metas(self):\n        attributes = (age, gender, income)\n        metas = (ssn, race)\n        d = Domain(attributes, education, metas=metas)\n        self.assertEqual(d.variables, attributes + (education, ))\n        self.assertEqual(d.attributes, attributes)\n        self.assertEqual(d.class_var, education)\n        self.assertEqual(d.class_vars, (education, ))\n        self.assertEqual(d.metas, metas)\n\n    def test_from_numpy_names(self):\n        for n_cols, name in [(5, \"Feature {}\"),\n                             (99, \"Feature {:02}\"),\n                             (100, \"Feature {:03}\")]:\n            d = Domain.from_numpy(np.zeros((1, n_cols)))\n            self.assertTrue(d.anonymous)\n            self.assertEqual([var.name for var in d.attributes],\n                             [name.format(i) for i in range(1, n_cols+1)])\n\n        d = Domain.from_numpy(np.zeros((1, 1)))\n        self.assertTrue(d.anonymous)\n        self.assertEqual(d.attributes[0].name, \"Feature\")\n\n        d = Domain.from_numpy(np.zeros((1, 3)), np.zeros((1, 1)),\n                              np.zeros((1, 100)))\n        self.assertTrue(d.anonymous)\n        self.assertEqual([var.name for var in d.attributes],\n                         [\"Feature {}\".format(i) for i in range(1, 4)])\n        self.assertEqual(d.class_var.name, \"Target\")\n        self.assertEqual([var.name for var in d.metas],\n                         [\"Meta {:03}\".format(i) for i in range(1, 101)])\n\n    def test_from_numpy_dimensions(self):\n        for dimension in [[5], [5, 1]]:\n            d = Domain.from_numpy(np.zeros((1, 1)), np.zeros(dimension))\n            self.assertTrue(d.anonymous)\n            self.assertEqual(len(d.class_vars), 1)\n\n        self.assertRaises(ValueError, Domain.from_numpy, np.zeros(2))\n        self.assertRaises(ValueError, Domain.from_numpy, np.zeros((2, 2, 2)))\n        self.assertRaises(ValueError, Domain.from_numpy, np.zeros((2, 2)), np.zeros((2, 2, 2)))\n\n    def test_nonunique_domain_error(self):\n        self.assertRaises(Exception, Domain, [ContinuousVariable('a'),\n                                              ContinuousVariable('a')])\n\n    def test_from_numpy_values(self):\n        for aran_min, aran_max, vartype in [(1, 3, ContinuousVariable),\n                                            (0, 2, DiscreteVariable),\n                                            (18, 23, ContinuousVariable)]:\n            n_rows, n_cols, = aran_max - aran_min, 1\n            d = Domain.from_numpy(np.zeros((1, 1)),\n                                  np.arange(aran_min, aran_max).reshape(n_rows, n_cols))\n            self.assertTrue(d.anonymous)\n            self.assertIsInstance(d.class_var, vartype)\n            if isinstance(vartype, DiscreteVariable):\n                self.assertEqual(d.class_var.values, [\"v{}\".format(i) for i in range(1, 3)])\n\n    def test_wrong_vartypes(self):\n        attributes = (age, gender, income)\n        for args in ((attributes, ssn),\n                     (attributes + (ssn,)),\n                     ((ssn, ) + attributes)):\n            with self.assertRaises(TypeError):\n                Domain(*args)\n\n    def test_wrong_vartypes_w_source(self):\n        d = Domain((age, gender), metas=(ssn,))\n        with self.assertRaises(TypeError):\n            Domain(-1, source=d)\n\n    def test_wrong_types(self):\n        with self.assertRaises(TypeError):\n            Domain((age, []))\n        with self.assertRaises(TypeError):\n            Domain((age, \"income\"))\n        with self.assertRaises(TypeError):\n            Domain(([], age))\n        with self.assertRaises(TypeError):\n            Domain((\"income\", age))\n        with self.assertRaises(TypeError):\n            Domain((age,), self)\n        with self.assertRaises(TypeError):\n            Domain((age,), metas=(\"income\",))\n\n    def test_get_item(self):\n        d = Domain((age, gender, income), metas=(ssn, race))\n        for idx, var in [(age, age),\n                         (\"AGE\", age),\n                         (0, age),\n                         (income, income),\n                         (\"income\", income),\n                         (2, income),\n                         (ssn, ssn),\n                         (\"SSN\", ssn),\n                         (-1, ssn),\n                         (-2, race)]:\n            self.assertEqual(d[idx], var)\n\n    def test_index(self):\n        d = Domain((age, gender, income), metas=(ssn, race))\n        for idx, var in [(age, 0),\n                         (\"AGE\", 0),\n                         (0, 0),\n                         (np.int_(0), 0),\n                         (income, 2),\n                         (\"income\", 2),\n                         (2, 2),\n                         (np.int_(2), 2),\n                         (ssn, -1),\n                         (\"SSN\", -1),\n                         (-1, -1),\n                         (np.int_(-1), -1),\n                         (-2, -2), (np.int_(-2), -2)]:\n            self.assertEqual(d.index(idx), var)\n\n    def test_get_item_slices(self):\n        d = Domain((age, gender, income, race), metas=(ssn, education))\n        self.assertEqual(d[:2], (age, gender))\n        self.assertEqual(d[1:3], (gender, income))\n        self.assertEqual(d[2:], (income, race))\n\n    def test_get_item_error(self):\n        d = Domain((age, gender, income), metas=(ssn, race))\n        for idx in (3, -3, incomeA, \"no_such_thing\"):\n            with self.assertRaises(KeyError):\n                _ = d[idx]\n\n        with self.assertRaises(TypeError):\n            _ = d[[2]]\n\n    def test_index_error(self):\n        d = Domain((age, gender, income), metas=(ssn, race))\n        for idx in (3, np.int(3), -3, np.int(-3), incomeA, \"no_such_thing\"):\n            with self.assertRaises(ValueError):\n                d.index(idx)\n\n        with self.assertRaises(TypeError):\n            d.index([2])\n\n    def test_contains(self):\n        d = Domain((age, gender, income), metas=(ssn,))\n        for var in [\"AGE\", age, 0, np.int_(0),\n                    \"income\", income, 2, np.int_(2),\n                    \"SSN\", ssn, -1, np.int_(-1)]:\n            self.assertIn(var, d)\n\n        for var in [\"no_such_thing\", race, 3, np.int_(3), -2, np.int_(-2)]:\n            self.assertNotIn(var, d)\n\n        with self.assertRaises(TypeError):\n            {} in d\n        with self.assertRaises(TypeError):\n            [] in d\n\n    def test_iter(self):\n        with warnings.catch_warnings(record=True):\n            warnings.simplefilter(\"error\")\n\n            d = Domain((age, gender, income), metas=(ssn,))\n            with self.assertRaises(OrangeDeprecationWarning):\n                list(d)\n\n            warnings.simplefilter(\"ignore\")\n            self.assertEqual([var for var in d], [age, gender, income])\n\n            d = Domain((age, ), metas=(ssn,))\n            self.assertEqual([var for var in d], [age])\n\n            d = Domain((), metas=(ssn,))\n            self.assertEqual([var for var in d], [])\n\n    def test_str(self):\n        cases = (\n            (((),), \"[]\"),\n            (((age,),), \"[AGE]\"),\n            (((), age), \"[ | AGE]\"),\n            (((gender,), age), \"[Gender | AGE]\"),\n            (((gender, income), None), \"[Gender, income]\"),\n            (((gender, income), age), \"[Gender, income | AGE]\"),\n            (((gender,), (age, income)), \"[Gender | AGE, income]\"),\n            (((gender,), (age, income), (ssn,)),\n             \"[Gender | AGE, income] {SSN}\"),\n            (((gender,), (age, income), (ssn, race)),\n             \"[Gender | AGE, income] {SSN, race}\"),\n            (((), (), (ssn, race)), \"[] {SSN, race}\"),\n        )\n\n        for args, printout in cases:\n            self.assertEqual(str(Domain(*args)), printout)\n\n    def test_has_discrete(self):\n        self.assertFalse(Domain([]).has_discrete_attributes())\n        self.assertFalse(Domain([], [age]).has_discrete_attributes())\n        self.assertFalse(Domain([], race).has_discrete_attributes())\n\n        self.assertFalse(Domain([age], None).has_discrete_attributes())\n        self.assertTrue(Domain([race], None).has_discrete_attributes())\n        self.assertTrue(Domain([age, race], None).has_discrete_attributes())\n        self.assertTrue(Domain([race, age], None).has_discrete_attributes())\n\n        self.assertFalse(Domain([], [age]).has_discrete_attributes(True))\n        self.assertTrue(Domain([], [race]).has_discrete_attributes(True))\n        self.assertFalse(Domain([age], None).has_discrete_attributes(True))\n        self.assertTrue(Domain([race], None).has_discrete_attributes(True))\n        self.assertTrue(Domain([age], race).has_discrete_attributes(True))\n        self.assertTrue(Domain([race], age).has_discrete_attributes(True))\n        self.assertTrue(Domain([], [race, age]).has_discrete_attributes(True))\n\n        d = Domain([], None, [gender])\n        self.assertTrue(d.has_discrete_attributes(False, True))\n        d = Domain([], None, [age])\n        self.assertFalse(d.has_discrete_attributes(False, True))\n        d = Domain([], [age], [gender])\n        self.assertTrue(d.has_discrete_attributes(True, True))\n        d = Domain([], [incomeA], [age])\n        self.assertFalse(d.has_discrete_attributes(True, True))\n\n    def test_has_continuous(self):\n        self.assertFalse(Domain([]).has_continuous_attributes())\n        self.assertFalse(Domain([], [age]).has_continuous_attributes())\n        self.assertFalse(Domain([], [race]).has_continuous_attributes())\n\n        self.assertTrue(Domain([age], None).has_continuous_attributes())\n        self.assertFalse(Domain([race], None).has_continuous_attributes())\n        self.assertTrue(Domain([age, race], None).has_continuous_attributes())\n        self.assertTrue(Domain([race, age], None).has_continuous_attributes())\n\n        self.assertTrue(Domain([], [age]).has_continuous_attributes(True))\n        self.assertFalse(Domain([], [race]).has_continuous_attributes(True))\n        self.assertTrue(Domain([age], None).has_continuous_attributes(True))\n        self.assertFalse(Domain([race], None).has_continuous_attributes(True))\n        self.assertTrue(Domain([age], race).has_continuous_attributes(True))\n        self.assertTrue(Domain([race], age).has_continuous_attributes(True))\n        self.assertTrue(Domain([], [race, age]).has_continuous_attributes(True))\n\n        d = Domain([], None, [age])\n        self.assertTrue(d.has_continuous_attributes(False, True))\n        d = Domain([], None, [gender])\n        self.assertFalse(d.has_continuous_attributes(False, True))\n        d = Domain([], [gender], [age])\n        self.assertTrue(d.has_continuous_attributes(True, True))\n        d = Domain([], [race], [gender])\n        self.assertFalse(d.has_continuous_attributes(True, True))\n\n    def test_has_time(self):\n        self.assertFalse(Domain([]).has_time_attributes())\n        self.assertFalse(Domain([], [age]).has_time_attributes())\n        self.assertFalse(Domain([], [race]).has_time_attributes())\n        self.assertFalse(Domain([], [arrival]).has_time_attributes())\n        self.assertFalse(Domain([], [], [arrival]).has_time_attributes())\n\n        self.assertTrue(Domain([arrival], []).has_time_attributes())\n        self.assertTrue(Domain([], [arrival]).has_time_attributes(\n            include_class=True))\n        self.assertTrue(Domain([], [], [arrival]).has_time_attributes(\n            include_metas=True))\n\n        self.assertFalse(Domain([arrival], []).has_time_class)\n        self.assertTrue(Domain([], [arrival]).has_time_class)\n        self.assertFalse(Domain([], [], [arrival]).has_time_class)\n\n    def test_get_conversion(self):\n        compute_value = lambda: 42\n        new_income = income.copy(compute_value=compute_value, name='new_income')\n\n        d = Domain((age, gender, income), metas=(ssn, race))\n        e = Domain((gender, race), None, metas=(age, income, ssn))\n        f = Domain((gender,), (race, income), metas=(age, incomeA, ssn))\n        g = Domain((), metas=(age, gender, ssn))\n        h = Domain((gender,), (race, income), metas=(age, new_income, ssn))\n\n        for conver, domain, attr, class_vars, metas in (\n                (d, e, [1, -2], [], [0, 2, -1]),\n                (d, f, [1], [-2, 2], [0, None, -1]),\n                (f, g, [], [], [-1, 0, -3]),\n                (g, h, [-2], [None, None], [-1, compute_value, -3])):\n            to_domain = DomainConversion(conver, domain)\n            self.assertIs(to_domain.source, conver)\n            self.assertEqual(to_domain.attributes, attr)\n            self.assertEqual(to_domain.class_vars, class_vars)\n            self.assertEqual(to_domain.metas, metas)\n\n    def test_conversion(self):\n        domain = Domain([age, income], [race],\n                        [gender, education, ssn])\n\n        x, y, metas = domain.convert([42, 13, \"White\"])\n        assert_array_equal(x, np.array([42, 13]))\n        assert_array_equal(y, np.array([0]))\n        metas_exp = [gender.Unknown, education.Unknown, ssn.Unknown]\n\n        def equal(a, b):\n            if isinstance(a, Real) and isinstance(b, Real) and \\\n                    np.isnan(a) and np.isnan(b):\n                return True\n            else:\n                return a == b\n\n        self.assertTrue(all(starmap(equal, zip(metas, metas_exp))))\n\n        x, y, metas = domain.convert([42, 13, \"White\", \"M\", \"HS\", \"1234567\"])\n        assert_array_equal(x, np.array([42, 13]))\n        assert_array_equal(y, np.array([0]))\n        assert_array_equal(metas, np.array([0, 1, \"1234567\"], dtype=object))\n\n    def test_conversion_size(self):\n        domain = Domain([age, gender, income], [race])\n        self.assertRaises(ValueError, domain.convert, [0] * 3)\n        self.assertRaises(ValueError, domain.convert, [0] * 5)\n\n        domain = Domain([age, income], [race],\n                        [gender, education, ssn])\n        self.assertRaises(ValueError, domain.convert, [0] * 2)\n        self.assertRaises(ValueError, domain.convert, [0] * 4)\n        self.assertRaises(ValueError, domain.convert, [0] * 7)\n        domain.convert([0] * 3)\n        domain.convert([0] * 6)\n\n    def test_preprocessor_chaining(self):\n        domain = Domain([DiscreteVariable(\"a\", values=\"01\"),\n                         DiscreteVariable(\"b\", values=\"01\")],\n                        DiscreteVariable(\"y\", values=\"01\"))\n        table = Table.from_list(domain, [[0, 1], [1, np.NaN]], [0, 1])\n        pre1 = Continuize()(Impute()(table))\n        pre2 = table.transform(pre1.domain)\n        np.testing.assert_almost_equal(pre1.X, pre2.X)\n\n    def test_different_domains_with_same_attributes_are_equal(self):\n        domain1 = Domain([])\n        domain2 = Domain([])\n        self.assertEqual(domain1, domain2)\n\n        var1 = ContinuousVariable('var1')\n        domain1.attributes = (var1,)\n        self.assertNotEqual(domain1, domain2)\n\n        domain2.attributes = (var1,)\n        self.assertEqual(domain1, domain2)\n\n        domain1.class_vars = (var1,)\n        self.assertNotEqual(domain1, domain2)\n\n        domain2.class_vars = (var1,)\n        self.assertEqual(domain1, domain2)\n\n        domain1._metas = (var1,)\n        self.assertNotEqual(domain1, domain2)\n\n        domain2._metas = (var1,)\n        self.assertEqual(domain1, domain2)\n\n    def test_domain_conversion_is_fast_enough(self):\n        attrs = [ContinuousVariable(\"f%i\" % i) for i in range(10000)]\n        class_vars = [ContinuousVariable(\"c%i\" % i) for i in range(10)]\n        metas = [ContinuousVariable(\"m%i\" % i) for i in range(10)]\n        source = Domain(attrs, class_vars, metas)\n\n        start = time()\n        cases = (((attrs[:1000], class_vars, metas),\n                  list(range(1000)), list(range(10000, 10010)), list(range(-1, -11, -1))),\n                 ((metas, attrs[:1000], class_vars),\n                  list(range(-1, -11, -1)), list(range(1000)), list(range(10000, 10010))),\n                 ((class_vars, metas, attrs[:1000]),\n                  list(range(10000, 10010)), list(range(-1, -11, -1)), list(range(1000))))\n\n        for domain_args, attributes, class_vars, metas in cases:\n            c1 = DomainConversion(source, Domain(*domain_args))\n            self.assertEqual(c1.attributes, attributes)\n            self.assertEqual(c1.class_vars, class_vars)\n            self.assertEqual(c1.metas, metas)\n\n        self.assertLessEqual(time() - start, 1)\n\n    def test_copy(self):\n        age.number_of_decimals = 5\n        attributes = (age, gender, income)\n\n        domain = Domain(attributes, [race], [ssn])\n\n        new_domain = domain.copy()\n        new_domain[age].number_of_decimals = 10\n\n        self.assertEqual(domain[age].number_of_decimals, 5)\n        self.assertEqual(new_domain[age].number_of_decimals, 10)\n\n    def test_domain_conversion_sparsity(self):\n        destination = Domain(\n            attributes=[\n                ContinuousVariable(name='a'),\n                ContinuousVariable(name='b'),\n                ContinuousVariable(name='c'),\n            ],\n            class_vars=[DiscreteVariable('d', values=('e', ))],\n            metas=[StringVariable('f')]\n        )\n\n        # all dense\n        source = Domain(attributes=[])\n        conversion = DomainConversion(source, destination)\n        self.assertFalse(conversion.sparse_X)\n        self.assertFalse(conversion.sparse_Y)\n        self.assertFalse(conversion.sparse_metas)\n\n        # set destination attributes as sparse\n        for a in destination.attributes:\n            a.sparse = True\n        source = Domain(attributes=[])\n        conversion = DomainConversion(source, destination)\n        self.assertTrue(conversion.sparse_X)\n        self.assertFalse(conversion.sparse_Y)\n        self.assertFalse(conversion.sparse_metas)\n\n        # set all destination variable as sparse\n        for a in chain(destination.variables, destination.metas):\n            a.sparse = True\n        source = Domain(attributes=[])\n        conversion = DomainConversion(source, destination)\n        self.assertTrue(conversion.sparse_X)\n        self.assertTrue(conversion.sparse_Y)\n        self.assertFalse(conversion.sparse_metas)\n\n    def test_get_item_similar_vars(self):\n        a = DiscreteVariable(\"Cluster\", values=[\"c\"])\n        var1 = a.renamed(\"Cluster x\")\n        var2 = DiscreteVariable(\"Cluster\", values=[\"a\", \"b\"])\n\n        domain = Domain(\n            [],\n            metas=[var1, var2]\n        )\n        # pylint: disable=protected-access\n        self.assertDictEqual(\n            {-1: -1, -2: -2, var1: -1, var2: -2, var1.name: -1, var2.name: -2},\n            domain._indices\n        )\n        self.assertIs(domain[domain.metas[0]], domain.metas[0])",
                            "ast_type_str": "ClassDef",
                            "start_lineno": 274,
                            "end_lineno": 289,
                            "parent": {
                                "file_name": "Orange/tests/test_domain.py",
                                "type": "class",
                                "name": "TestDomainInit",
                                "content": "class TestDomainInit(unittest.TestCase):\n    def test_init_class(self):\n        attributes = (age, gender, income)\n        d = Domain(attributes, race)\n        self.assertEqual(d.variables, attributes + (race,))\n        self.assertEqual(d.attributes, attributes)\n        self.assertEqual(d.class_var, race)\n        self.assertEqual(d.class_vars, (race,))\n        self.assertEqual(d.metas, ())\n\n    def test_init_class_list(self):\n        attributes = (age, gender, income)\n        d = Domain(attributes, [race])\n        self.assertEqual(d.variables, attributes + (race,))\n        self.assertEqual(d.attributes, attributes)\n        self.assertEqual(d.class_var, race)\n        self.assertEqual(d.class_vars, (race,))\n        self.assertEqual(d.metas, ())\n\n    def test_init_no_class(self):\n        attributes = (age, gender, income)\n        d = Domain(attributes)\n        self.assertEqual(d.variables, attributes)\n        self.assertEqual(d.attributes, attributes)\n        self.assertEqual(d.class_var, None)\n        self.assertEqual(d.class_vars, ())\n        self.assertEqual(d.metas, ())\n\n    def test_init_no_class_false(self):\n        attributes = (age, gender, income)\n        d = Domain(attributes, None)\n        self.assertEqual(d.variables, attributes)\n        self.assertEqual(d.attributes, attributes)\n        self.assertEqual(d.class_var, None)\n        self.assertEqual(d.class_vars, ())\n        self.assertEqual(d.metas, ())\n\n    def test_init_multi_class(self):\n        attributes = (age, gender, income)\n        d = Domain(attributes, (education, race))\n        self.assertEqual(d.variables, attributes + (education, race))\n        self.assertEqual(d.attributes, attributes)\n        self.assertIsNone(d.class_var)\n        self.assertEqual(d.class_vars, (education, race))\n        self.assertEqual(d.metas, ())\n\n    def test_init_source(self):\n        attributes = (age, gender, income)\n        d = Domain(attributes, (education, race))\n        d2 = Domain([\"Gender\", 0, income], source=d)\n        self.assertEqual(d2.variables, (gender, age, income))\n\n    def test_init_source_class(self):\n        attributes = (age, gender, income)\n        d = Domain(attributes, (education, race))\n        d2 = Domain([\"Gender\", 0], \"income\", source=d)\n        self.assertEqual(d2.variables, (gender, age, income))\n\n    def test_init_metas(self):\n        attributes = (age, gender, income)\n        metas = (ssn, race)\n        d = Domain(attributes, education, metas=metas)\n        self.assertEqual(d.variables, attributes + (education, ))\n        self.assertEqual(d.attributes, attributes)\n        self.assertEqual(d.class_var, education)\n        self.assertEqual(d.class_vars, (education, ))\n        self.assertEqual(d.metas, metas)\n\n    def test_from_numpy_names(self):\n        for n_cols, name in [(5, \"Feature {}\"),\n                             (99, \"Feature {:02}\"),\n                             (100, \"Feature {:03}\")]:\n            d = Domain.from_numpy(np.zeros((1, n_cols)))\n            self.assertTrue(d.anonymous)\n            self.assertEqual([var.name for var in d.attributes],\n                             [name.format(i) for i in range(1, n_cols+1)])\n\n        d = Domain.from_numpy(np.zeros((1, 1)))\n        self.assertTrue(d.anonymous)\n        self.assertEqual(d.attributes[0].name, \"Feature\")\n\n        d = Domain.from_numpy(np.zeros((1, 3)), np.zeros((1, 1)),\n                              np.zeros((1, 100)))\n        self.assertTrue(d.anonymous)\n        self.assertEqual([var.name for var in d.attributes],\n                         [\"Feature {}\".format(i) for i in range(1, 4)])\n        self.assertEqual(d.class_var.name, \"Target\")\n        self.assertEqual([var.name for var in d.metas],\n                         [\"Meta {:03}\".format(i) for i in range(1, 101)])\n\n    def test_from_numpy_dimensions(self):\n        for dimension in [[5], [5, 1]]:\n            d = Domain.from_numpy(np.zeros((1, 1)), np.zeros(dimension))\n            self.assertTrue(d.anonymous)\n            self.assertEqual(len(d.class_vars), 1)\n\n        self.assertRaises(ValueError, Domain.from_numpy, np.zeros(2))\n        self.assertRaises(ValueError, Domain.from_numpy, np.zeros((2, 2, 2)))\n        self.assertRaises(ValueError, Domain.from_numpy, np.zeros((2, 2)), np.zeros((2, 2, 2)))\n\n    def test_nonunique_domain_error(self):\n        self.assertRaises(Exception, Domain, [ContinuousVariable('a'),\n                                              ContinuousVariable('a')])\n\n    def test_from_numpy_values(self):\n        for aran_min, aran_max, vartype in [(1, 3, ContinuousVariable),\n                                            (0, 2, DiscreteVariable),\n                                            (18, 23, ContinuousVariable)]:\n            n_rows, n_cols, = aran_max - aran_min, 1\n            d = Domain.from_numpy(np.zeros((1, 1)),\n                                  np.arange(aran_min, aran_max).reshape(n_rows, n_cols))\n            self.assertTrue(d.anonymous)\n            self.assertIsInstance(d.class_var, vartype)\n            if isinstance(vartype, DiscreteVariable):\n                self.assertEqual(d.class_var.values, [\"v{}\".format(i) for i in range(1, 3)])\n\n    def test_wrong_vartypes(self):\n        attributes = (age, gender, income)\n        for args in ((attributes, ssn),\n                     (attributes + (ssn,)),\n                     ((ssn, ) + attributes)):\n            with self.assertRaises(TypeError):\n                Domain(*args)\n\n    def test_wrong_vartypes_w_source(self):\n        d = Domain((age, gender), metas=(ssn,))\n        with self.assertRaises(TypeError):\n            Domain(-1, source=d)\n\n    def test_wrong_types(self):\n        with self.assertRaises(TypeError):\n            Domain((age, []))\n        with self.assertRaises(TypeError):\n            Domain((age, \"income\"))\n        with self.assertRaises(TypeError):\n            Domain(([], age))\n        with self.assertRaises(TypeError):\n            Domain((\"income\", age))\n        with self.assertRaises(TypeError):\n            Domain((age,), self)\n        with self.assertRaises(TypeError):\n            Domain((age,), metas=(\"income\",))\n\n    def test_get_item(self):\n        d = Domain((age, gender, income), metas=(ssn, race))\n        for idx, var in [(age, age),\n                         (\"AGE\", age),\n                         (0, age),\n                         (income, income),\n                         (\"income\", income),\n                         (2, income),\n                         (ssn, ssn),\n                         (\"SSN\", ssn),\n                         (-1, ssn),\n                         (-2, race)]:\n            self.assertEqual(d[idx], var)\n\n    def test_index(self):\n        d = Domain((age, gender, income), metas=(ssn, race))\n        for idx, var in [(age, 0),\n                         (\"AGE\", 0),\n                         (0, 0),\n                         (np.int_(0), 0),\n                         (income, 2),\n                         (\"income\", 2),\n                         (2, 2),\n                         (np.int_(2), 2),\n                         (ssn, -1),\n                         (\"SSN\", -1),\n                         (-1, -1),\n                         (np.int_(-1), -1),\n                         (-2, -2), (np.int_(-2), -2)]:\n            self.assertEqual(d.index(idx), var)\n\n    def test_get_item_slices(self):\n        d = Domain((age, gender, income, race), metas=(ssn, education))\n        self.assertEqual(d[:2], (age, gender))\n        self.assertEqual(d[1:3], (gender, income))\n        self.assertEqual(d[2:], (income, race))\n\n    def test_get_item_error(self):\n        d = Domain((age, gender, income), metas=(ssn, race))\n        for idx in (3, -3, incomeA, \"no_such_thing\"):\n            with self.assertRaises(KeyError):\n                _ = d[idx]\n\n        with self.assertRaises(TypeError):\n            _ = d[[2]]\n\n    def test_index_error(self):\n        d = Domain((age, gender, income), metas=(ssn, race))\n        for idx in (3, np.int(3), -3, np.int(-3), incomeA, \"no_such_thing\"):\n            with self.assertRaises(ValueError):\n                d.index(idx)\n\n        with self.assertRaises(TypeError):\n            d.index([2])\n\n    def test_contains(self):\n        d = Domain((age, gender, income), metas=(ssn,))\n        for var in [\"AGE\", age, 0, np.int_(0),\n                    \"income\", income, 2, np.int_(2),\n                    \"SSN\", ssn, -1, np.int_(-1)]:\n            self.assertIn(var, d)\n\n        for var in [\"no_such_thing\", race, 3, np.int_(3), -2, np.int_(-2)]:\n            self.assertNotIn(var, d)\n\n        with self.assertRaises(TypeError):\n            {} in d\n        with self.assertRaises(TypeError):\n            [] in d\n\n    def test_iter(self):\n        with warnings.catch_warnings(record=True):\n            warnings.simplefilter(\"error\")\n\n            d = Domain((age, gender, income), metas=(ssn,))\n            with self.assertRaises(OrangeDeprecationWarning):\n                list(d)\n\n            warnings.simplefilter(\"ignore\")\n            self.assertEqual([var for var in d], [age, gender, income])\n\n            d = Domain((age, ), metas=(ssn,))\n            self.assertEqual([var for var in d], [age])\n\n            d = Domain((), metas=(ssn,))\n            self.assertEqual([var for var in d], [])\n\n    def test_str(self):\n        cases = (\n            (((),), \"[]\"),\n            (((age,),), \"[AGE]\"),\n            (((), age), \"[ | AGE]\"),\n            (((gender,), age), \"[Gender | AGE]\"),\n            (((gender, income), None), \"[Gender, income]\"),\n            (((gender, income), age), \"[Gender, income | AGE]\"),\n            (((gender,), (age, income)), \"[Gender | AGE, income]\"),\n            (((gender,), (age, income), (ssn,)),\n             \"[Gender | AGE, income] {SSN}\"),\n            (((gender,), (age, income), (ssn, race)),\n             \"[Gender | AGE, income] {SSN, race}\"),\n            (((), (), (ssn, race)), \"[] {SSN, race}\"),\n        )\n\n        for args, printout in cases:\n            self.assertEqual(str(Domain(*args)), printout)\n\n    def test_has_discrete(self):\n        self.assertFalse(Domain([]).has_discrete_attributes())\n        self.assertFalse(Domain([], [age]).has_discrete_attributes())\n        self.assertFalse(Domain([], race).has_discrete_attributes())\n\n        self.assertFalse(Domain([age], None).has_discrete_attributes())\n        self.assertTrue(Domain([race], None).has_discrete_attributes())\n        self.assertTrue(Domain([age, race], None).has_discrete_attributes())\n        self.assertTrue(Domain([race, age], None).has_discrete_attributes())\n\n        self.assertFalse(Domain([], [age]).has_discrete_attributes(True))\n        self.assertTrue(Domain([], [race]).has_discrete_attributes(True))\n        self.assertFalse(Domain([age], None).has_discrete_attributes(True))\n        self.assertTrue(Domain([race], None).has_discrete_attributes(True))\n        self.assertTrue(Domain([age], race).has_discrete_attributes(True))\n        self.assertTrue(Domain([race], age).has_discrete_attributes(True))\n        self.assertTrue(Domain([], [race, age]).has_discrete_attributes(True))\n\n        d = Domain([], None, [gender])\n        self.assertTrue(d.has_discrete_attributes(False, True))\n        d = Domain([], None, [age])\n        self.assertFalse(d.has_discrete_attributes(False, True))\n        d = Domain([], [age], [gender])\n        self.assertTrue(d.has_discrete_attributes(True, True))\n        d = Domain([], [incomeA], [age])\n        self.assertFalse(d.has_discrete_attributes(True, True))\n\n    def test_has_continuous(self):\n        self.assertFalse(Domain([]).has_continuous_attributes())\n        self.assertFalse(Domain([], [age]).has_continuous_attributes())\n        self.assertFalse(Domain([], [race]).has_continuous_attributes())\n\n        self.assertTrue(Domain([age], None).has_continuous_attributes())\n        self.assertFalse(Domain([race], None).has_continuous_attributes())\n        self.assertTrue(Domain([age, race], None).has_continuous_attributes())\n        self.assertTrue(Domain([race, age], None).has_continuous_attributes())\n\n        self.assertTrue(Domain([], [age]).has_continuous_attributes(True))\n        self.assertFalse(Domain([], [race]).has_continuous_attributes(True))\n        self.assertTrue(Domain([age], None).has_continuous_attributes(True))\n        self.assertFalse(Domain([race], None).has_continuous_attributes(True))\n        self.assertTrue(Domain([age], race).has_continuous_attributes(True))\n        self.assertTrue(Domain([race], age).has_continuous_attributes(True))\n        self.assertTrue(Domain([], [race, age]).has_continuous_attributes(True))\n\n        d = Domain([], None, [age])\n        self.assertTrue(d.has_continuous_attributes(False, True))\n        d = Domain([], None, [gender])\n        self.assertFalse(d.has_continuous_attributes(False, True))\n        d = Domain([], [gender], [age])\n        self.assertTrue(d.has_continuous_attributes(True, True))\n        d = Domain([], [race], [gender])\n        self.assertFalse(d.has_continuous_attributes(True, True))\n\n    def test_has_time(self):\n        self.assertFalse(Domain([]).has_time_attributes())\n        self.assertFalse(Domain([], [age]).has_time_attributes())\n        self.assertFalse(Domain([], [race]).has_time_attributes())\n        self.assertFalse(Domain([], [arrival]).has_time_attributes())\n        self.assertFalse(Domain([], [], [arrival]).has_time_attributes())\n\n        self.assertTrue(Domain([arrival], []).has_time_attributes())\n        self.assertTrue(Domain([], [arrival]).has_time_attributes(\n            include_class=True))\n        self.assertTrue(Domain([], [], [arrival]).has_time_attributes(\n            include_metas=True))\n\n        self.assertFalse(Domain([arrival], []).has_time_class)\n        self.assertTrue(Domain([], [arrival]).has_time_class)\n        self.assertFalse(Domain([], [], [arrival]).has_time_class)\n\n    def test_get_conversion(self):\n        compute_value = lambda: 42\n        new_income = income.copy(compute_value=compute_value, name='new_income')\n\n        d = Domain((age, gender, income), metas=(ssn, race))\n        e = Domain((gender, race), None, metas=(age, income, ssn))\n        f = Domain((gender,), (race, income), metas=(age, incomeA, ssn))\n        g = Domain((), metas=(age, gender, ssn))\n        h = Domain((gender,), (race, income), metas=(age, new_income, ssn))\n\n        for conver, domain, attr, class_vars, metas in (\n                (d, e, [1, -2], [], [0, 2, -1]),\n                (d, f, [1], [-2, 2], [0, None, -1]),\n                (f, g, [], [], [-1, 0, -3]),\n                (g, h, [-2], [None, None], [-1, compute_value, -3])):\n            to_domain = DomainConversion(conver, domain)\n            self.assertIs(to_domain.source, conver)\n            self.assertEqual(to_domain.attributes, attr)\n            self.assertEqual(to_domain.class_vars, class_vars)\n            self.assertEqual(to_domain.metas, metas)\n\n    def test_conversion(self):\n        domain = Domain([age, income], [race],\n                        [gender, education, ssn])\n\n        x, y, metas = domain.convert([42, 13, \"White\"])\n        assert_array_equal(x, np.array([42, 13]))\n        assert_array_equal(y, np.array([0]))\n        metas_exp = [gender.Unknown, education.Unknown, ssn.Unknown]\n\n        def equal(a, b):\n            if isinstance(a, Real) and isinstance(b, Real) and \\\n                    np.isnan(a) and np.isnan(b):\n                return True\n            else:\n                return a == b\n\n        self.assertTrue(all(starmap(equal, zip(metas, metas_exp))))\n\n        x, y, metas = domain.convert([42, 13, \"White\", \"M\", \"HS\", \"1234567\"])\n        assert_array_equal(x, np.array([42, 13]))\n        assert_array_equal(y, np.array([0]))\n        assert_array_equal(metas, np.array([0, 1, \"1234567\"], dtype=object))\n\n    def test_conversion_size(self):\n        domain = Domain([age, gender, income], [race])\n        self.assertRaises(ValueError, domain.convert, [0] * 3)\n        self.assertRaises(ValueError, domain.convert, [0] * 5)\n\n        domain = Domain([age, income], [race],\n                        [gender, education, ssn])\n        self.assertRaises(ValueError, domain.convert, [0] * 2)\n        self.assertRaises(ValueError, domain.convert, [0] * 4)\n        self.assertRaises(ValueError, domain.convert, [0] * 7)\n        domain.convert([0] * 3)\n        domain.convert([0] * 6)\n\n    def test_preprocessor_chaining(self):\n        domain = Domain([DiscreteVariable(\"a\", values=\"01\"),\n                         DiscreteVariable(\"b\", values=\"01\")],\n                        DiscreteVariable(\"y\", values=\"01\"))\n        table = Table.from_list(domain, [[0, 1], [1, np.NaN]], [0, 1])\n        pre1 = Continuize()(Impute()(table))\n        pre2 = table.transform(pre1.domain)\n        np.testing.assert_almost_equal(pre1.X, pre2.X)\n\n    def test_different_domains_with_same_attributes_are_equal(self):\n        domain1 = Domain([])\n        domain2 = Domain([])\n        self.assertEqual(domain1, domain2)\n\n        var1 = ContinuousVariable('var1')\n        domain1.attributes = (var1,)\n        self.assertNotEqual(domain1, domain2)\n\n        domain2.attributes = (var1,)\n        self.assertEqual(domain1, domain2)\n\n        domain1.class_vars = (var1,)\n        self.assertNotEqual(domain1, domain2)\n\n        domain2.class_vars = (var1,)\n        self.assertEqual(domain1, domain2)\n\n        domain1._metas = (var1,)\n        self.assertNotEqual(domain1, domain2)\n\n        domain2._metas = (var1,)\n        self.assertEqual(domain1, domain2)\n\n    def test_domain_conversion_is_fast_enough(self):\n        attrs = [ContinuousVariable(\"f%i\" % i) for i in range(10000)]\n        class_vars = [ContinuousVariable(\"c%i\" % i) for i in range(10)]\n        metas = [ContinuousVariable(\"m%i\" % i) for i in range(10)]\n        source = Domain(attrs, class_vars, metas)\n\n        start = time()\n        cases = (((attrs[:1000], class_vars, metas),\n                  list(range(1000)), list(range(10000, 10010)), list(range(-1, -11, -1))),\n                 ((metas, attrs[:1000], class_vars),\n                  list(range(-1, -11, -1)), list(range(1000)), list(range(10000, 10010))),\n                 ((class_vars, metas, attrs[:1000]),\n                  list(range(10000, 10010)), list(range(-1, -11, -1)), list(range(1000))))\n\n        for domain_args, attributes, class_vars, metas in cases:\n            c1 = DomainConversion(source, Domain(*domain_args))\n            self.assertEqual(c1.attributes, attributes)\n            self.assertEqual(c1.class_vars, class_vars)\n            self.assertEqual(c1.metas, metas)\n\n        self.assertLessEqual(time() - start, 1)\n\n    def test_copy(self):\n        age.number_of_decimals = 5\n        attributes = (age, gender, income)\n\n        domain = Domain(attributes, [race], [ssn])\n\n        new_domain = domain.copy()\n        new_domain[age].number_of_decimals = 10\n\n        self.assertEqual(domain[age].number_of_decimals, 5)\n        self.assertEqual(new_domain[age].number_of_decimals, 10)\n\n    def test_domain_conversion_sparsity(self):\n        destination = Domain(\n            attributes=[\n                ContinuousVariable(name='a'),\n                ContinuousVariable(name='b'),\n                ContinuousVariable(name='c'),\n            ],\n            class_vars=[DiscreteVariable('d', values=('e', ))],\n            metas=[StringVariable('f')]\n        )\n\n        # all dense\n        source = Domain(attributes=[])\n        conversion = DomainConversion(source, destination)\n        self.assertFalse(conversion.sparse_X)\n        self.assertFalse(conversion.sparse_Y)\n        self.assertFalse(conversion.sparse_metas)\n\n        # set destination attributes as sparse\n        for a in destination.attributes:\n            a.sparse = True\n        source = Domain(attributes=[])\n        conversion = DomainConversion(source, destination)\n        self.assertTrue(conversion.sparse_X)\n        self.assertFalse(conversion.sparse_Y)\n        self.assertFalse(conversion.sparse_metas)\n\n        # set all destination variable as sparse\n        for a in chain(destination.variables, destination.metas):\n            a.sparse = True\n        source = Domain(attributes=[])\n        conversion = DomainConversion(source, destination)\n        self.assertTrue(conversion.sparse_X)\n        self.assertTrue(conversion.sparse_Y)\n        self.assertFalse(conversion.sparse_metas)\n\n    def test_get_item_similar_vars(self):\n        a = DiscreteVariable(\"Cluster\", values=[\"c\"])\n        var1 = a.renamed(\"Cluster x\")\n        var2 = DiscreteVariable(\"Cluster\", values=[\"a\", \"b\"])\n\n        domain = Domain(\n            [],\n            metas=[var1, var2]\n        )\n        # pylint: disable=protected-access\n        self.assertDictEqual(\n            {-1: -1, -2: -2, var1: -1, var2: -2, var1.name: -1, var2.name: -2},\n            domain._indices\n        )\n        self.assertIs(domain[domain.metas[0]], domain.metas[0])",
                                "ast_type_str": "ClassDef",
                                "start_lineno": 61,
                                "end_lineno": 555,
                                "parent": null
                            }
                        }
                    ],
                    "added_entities": [],
                    "deleted_entities": []
                }
            ]
        }
    ],
    "old_commit_hash": "ea8c3b0ce9ff87f849b1462aab0b34bd3e35d4ed^",
    "new_commit_hash": "ea8c3b0ce9ff87f849b1462aab0b34bd3e35d4ed",
    "commit_message": "domain: Resolve __iter__ and __len__ deprecation\n\nNow iterates attributes, class vars, and metas.\nIt used to not iterate metas.",
    "commit_date": "2021-10-08T13:48:20+02:00",
    "metadata": {}
}
{
    "repo_name": "orange3",
    "new_commit_hash": "ea8c3b0ce9ff87f849b1462aab0b34bd3e35d4ed",
    "test_file_codes": [
        "# Test methods with long descriptive names can omit docstrings\n# pylint: disable=missing-docstring\nfrom time import time\nfrom numbers import Real\nfrom itertools import starmap, chain\nimport unittest\n\nimport numpy as np\nfrom numpy.testing import assert_array_equal\n\nfrom Orange.data import (\n    ContinuousVariable, DiscreteVariable, StringVariable, TimeVariable,\n    Domain, Table, DomainConversion)\nfrom Orange.data.domain import filter_visible\nfrom Orange.preprocess import Continuize, Impute\nfrom Orange.tests.base import create_pickling_tests\n\n\ndef create_domain(*ss):\n    vars_ = dict(\n        age=ContinuousVariable(name=\"AGE\"),\n        gender=DiscreteVariable(name=\"Gender\", values=(\"M\", \"F\")),\n        incomeA=ContinuousVariable(name=\"incomeA\"),\n        income=ContinuousVariable(name=\"income\"),\n        education=DiscreteVariable(name=\"education\", values=(\"GS\", \"HS\", \"C\")),\n        ssn=StringVariable(name=\"SSN\"),\n        race=DiscreteVariable(name=\"race\",\n                              values=(\"White\", \"Hypsanic\", \"African\", \"Other\")),\n        arrival=TimeVariable(\"arrival\"))\n\n    def map_vars(s):\n        return [vars_[x] for x in s]\n    return Domain(*[map_vars(s) for s in ss])\n\n\nPickleDomain = create_pickling_tests(\n    \"PickleDomain\",\n    (\"empty_domain\", lambda: create_domain([])),\n    (\"with_continuous_variable\", lambda: create_domain([\"age\"])),\n    (\"with_discrete_variable\", lambda: create_domain([\"gender\"])),\n    (\"with_mixed_variables\", lambda: create_domain([\"age\", \"gender\"])),\n    (\"with_continuous_class\", lambda: create_domain([\"age\", \"gender\"], [\"incomeA\"])),\n    (\"with_discrete_class\", lambda: create_domain([\"age\", \"gender\"], [\"education\"])),\n    (\"with_multiple_classes\", lambda: create_domain([\"age\", \"gender\"],\n                                                    [\"incomeA\", \"education\"])),\n    (\"with_metas\", lambda: create_domain([\"age\", \"gender\"], [], [\"ssn\"])),\n    (\"with_class_and_metas\", lambda: create_domain([\"age\", \"gender\"],\n                                                   [\"incomeA\", \"education\"],\n                                                   [\"ssn\"])),\n)\n\n\nage, gender, incomeA, income, education, ssn, race, arrival = \\\n    create_domain([], [],\n                  [\"age\", \"gender\", \"incomeA\", \"income\", \"education\", \"ssn\",\n                   \"race\", \"arrival\"]).metas\n\n\nclass TestDomainInit(unittest.TestCase):\n    def test_init_class(self):\n        attributes = (age, gender, income)\n        d = Domain(attributes, race)\n        self.assertEqual(d.variables, attributes + (race,))\n        self.assertEqual(d.attributes, attributes)\n        self.assertEqual(d.class_var, race)\n        self.assertEqual(d.class_vars, (race,))\n        self.assertEqual(d.metas, ())\n\n    def test_init_class_list(self):\n        attributes = (age, gender, income)\n        d = Domain(attributes, [race])\n        self.assertEqual(d.variables, attributes + (race,))\n        self.assertEqual(d.attributes, attributes)\n        self.assertEqual(d.class_var, race)\n        self.assertEqual(d.class_vars, (race,))\n        self.assertEqual(d.metas, ())\n\n    def test_init_no_class(self):\n        attributes = (age, gender, income)\n        d = Domain(attributes)\n        self.assertEqual(d.variables, attributes)\n        self.assertEqual(d.attributes, attributes)\n        self.assertEqual(d.class_var, None)\n        self.assertEqual(d.class_vars, ())\n        self.assertEqual(d.metas, ())\n\n    def test_init_no_class_false(self):\n        attributes = (age, gender, income)\n        d = Domain(attributes, None)\n        self.assertEqual(d.variables, attributes)\n        self.assertEqual(d.attributes, attributes)\n        self.assertEqual(d.class_var, None)\n        self.assertEqual(d.class_vars, ())\n        self.assertEqual(d.metas, ())\n\n    def test_init_multi_class(self):\n        attributes = (age, gender, income)\n        d = Domain(attributes, (education, race))\n        self.assertEqual(d.variables, attributes + (education, race))\n        self.assertEqual(d.attributes, attributes)\n        self.assertIsNone(d.class_var)\n        self.assertEqual(d.class_vars, (education, race))\n        self.assertEqual(d.metas, ())\n\n    def test_init_source(self):\n        attributes = (age, gender, income)\n        d = Domain(attributes, (education, race))\n        d2 = Domain([\"Gender\", 0, income], source=d)\n        self.assertEqual(d2.variables, (gender, age, income))\n\n    def test_init_source_class(self):\n        attributes = (age, gender, income)\n        d = Domain(attributes, (education, race))\n        d2 = Domain([\"Gender\", 0], \"income\", source=d)\n        self.assertEqual(d2.variables, (gender, age, income))\n\n    def test_init_metas(self):\n        attributes = (age, gender, income)\n        metas = (ssn, race)\n        d = Domain(attributes, education, metas=metas)\n        self.assertEqual(d.variables, attributes + (education, ))\n        self.assertEqual(d.attributes, attributes)\n        self.assertEqual(d.class_var, education)\n        self.assertEqual(d.class_vars, (education, ))\n        self.assertEqual(d.metas, metas)\n\n    def test_from_numpy_names(self):\n        for n_cols, name in [(5, \"Feature {}\"),\n                             (99, \"Feature {:02}\"),\n                             (100, \"Feature {:03}\")]:\n            d = Domain.from_numpy(np.zeros((1, n_cols)))\n            self.assertTrue(d.anonymous)\n            self.assertEqual([var.name for var in d.attributes],\n                             [name.format(i) for i in range(1, n_cols+1)])\n\n        d = Domain.from_numpy(np.zeros((1, 1)))\n        self.assertTrue(d.anonymous)\n        self.assertEqual(d.attributes[0].name, \"Feature\")\n\n        d = Domain.from_numpy(np.zeros((1, 3)), np.zeros((1, 1)),\n                              np.zeros((1, 100)))\n        self.assertTrue(d.anonymous)\n        self.assertEqual([var.name for var in d.attributes],\n                         [\"Feature {}\".format(i) for i in range(1, 4)])\n        self.assertEqual(d.class_var.name, \"Target\")\n        self.assertEqual([var.name for var in d.metas],\n                         [\"Meta {:03}\".format(i) for i in range(1, 101)])\n\n    def test_from_numpy_dimensions(self):\n        for dimension in [[5], [5, 1]]:\n            d = Domain.from_numpy(np.zeros((1, 1)), np.zeros(dimension))\n            self.assertTrue(d.anonymous)\n            self.assertEqual(len(d.class_vars), 1)\n\n        self.assertRaises(ValueError, Domain.from_numpy, np.zeros(2))\n        self.assertRaises(ValueError, Domain.from_numpy, np.zeros((2, 2, 2)))\n        self.assertRaises(ValueError, Domain.from_numpy, np.zeros((2, 2)), np.zeros((2, 2, 2)))\n\n    def test_nonunique_domain_error(self):\n        self.assertRaises(Exception, Domain, [ContinuousVariable('a'),\n                                              ContinuousVariable('a')])\n\n    def test_from_numpy_values(self):\n        for aran_min, aran_max, vartype in [(1, 3, ContinuousVariable),\n                                            (0, 2, DiscreteVariable),\n                                            (18, 23, ContinuousVariable)]:\n            n_rows, n_cols, = aran_max - aran_min, 1\n            d = Domain.from_numpy(np.zeros((1, 1)),\n                                  np.arange(aran_min, aran_max).reshape(n_rows, n_cols))\n            self.assertTrue(d.anonymous)\n            self.assertIsInstance(d.class_var, vartype)\n            if isinstance(vartype, DiscreteVariable):\n                self.assertEqual(d.class_var.values, [\"v{}\".format(i) for i in range(1, 3)])\n\n    def test_wrong_vartypes(self):\n        attributes = (age, gender, income)\n        for args in ((attributes, ssn),\n                     (attributes + (ssn,)),\n                     ((ssn, ) + attributes)):\n            with self.assertRaises(TypeError):\n                Domain(*args)\n\n    def test_wrong_vartypes_w_source(self):\n        d = Domain((age, gender), metas=(ssn,))\n        with self.assertRaises(TypeError):\n            Domain(-1, source=d)\n\n    def test_wrong_types(self):\n        with self.assertRaises(TypeError):\n            Domain((age, []))\n        with self.assertRaises(TypeError):\n            Domain((age, \"income\"))\n        with self.assertRaises(TypeError):\n            Domain(([], age))\n        with self.assertRaises(TypeError):\n            Domain((\"income\", age))\n        with self.assertRaises(TypeError):\n            Domain((age,), self)\n        with self.assertRaises(TypeError):\n            Domain((age,), metas=(\"income\",))\n\n    def test_get_item(self):\n        d = Domain((age, gender, income), metas=(ssn, race))\n        for idx, var in [(age, age),\n                         (\"AGE\", age),\n                         (0, age),\n                         (income, income),\n                         (\"income\", income),\n                         (2, income),\n                         (ssn, ssn),\n                         (\"SSN\", ssn),\n                         (-1, ssn),\n                         (-2, race)]:\n            self.assertEqual(d[idx], var)\n\n    def test_index(self):\n        d = Domain((age, gender, income), metas=(ssn, race))\n        for idx, var in [(age, 0),\n                         (\"AGE\", 0),\n                         (0, 0),\n                         (np.int_(0), 0),\n                         (income, 2),\n                         (\"income\", 2),\n                         (2, 2),\n                         (np.int_(2), 2),\n                         (ssn, -1),\n                         (\"SSN\", -1),\n                         (-1, -1),\n                         (np.int_(-1), -1),\n                         (-2, -2), (np.int_(-2), -2)]:\n            self.assertEqual(d.index(idx), var)\n\n    def test_get_item_slices(self):\n        d = Domain((age, gender, income, race), metas=(ssn, education))\n        self.assertEqual(d[:2], (age, gender))\n        self.assertEqual(d[1:3], (gender, income))\n        self.assertEqual(d[2:], (income, race))\n\n    def test_get_item_error(self):\n        d = Domain((age, gender, income), metas=(ssn, race))\n        for idx in (3, -3, incomeA, \"no_such_thing\"):\n            with self.assertRaises(KeyError):\n                _ = d[idx]\n\n        with self.assertRaises(TypeError):\n            _ = d[[2]]\n\n    def test_index_error(self):\n        d = Domain((age, gender, income), metas=(ssn, race))\n        for idx in (3, np.int(3), -3, np.int(-3), incomeA, \"no_such_thing\"):\n            with self.assertRaises(ValueError):\n                d.index(idx)\n\n        with self.assertRaises(TypeError):\n            d.index([2])\n\n    def test_contains(self):\n        d = Domain((age, gender, income), metas=(ssn,))\n        for var in [\"AGE\", age, 0, np.int_(0),\n                    \"income\", income, 2, np.int_(2),\n                    \"SSN\", ssn, -1, np.int_(-1)]:\n            self.assertIn(var, d)\n\n        for var in [\"no_such_thing\", race, 3, np.int_(3), -2, np.int_(-2)]:\n            self.assertNotIn(var, d)\n\n        with self.assertRaises(TypeError):\n            {} in d\n        with self.assertRaises(TypeError):\n            [] in d\n\n    def test_iter(self):\n        d = Domain((age, gender, income), metas=(ssn,))\n        self.assertEqual(list(d), [age, gender, income, ssn])\n\n        d = Domain((age, ), metas=(ssn,))\n        self.assertEqual(list(d), [age, ssn])\n\n        d = Domain((), metas=(ssn,))\n        self.assertEqual(list(d), [ssn])\n\n    def test_str(self):\n        cases = (\n            (((),), \"[]\"),\n            (((age,),), \"[AGE]\"),\n            (((), age), \"[ | AGE]\"),\n            (((gender,), age), \"[Gender | AGE]\"),\n            (((gender, income), None), \"[Gender, income]\"),\n            (((gender, income), age), \"[Gender, income | AGE]\"),\n            (((gender,), (age, income)), \"[Gender | AGE, income]\"),\n            (((gender,), (age, income), (ssn,)),\n             \"[Gender | AGE, income] {SSN}\"),\n            (((gender,), (age, income), (ssn, race)),\n             \"[Gender | AGE, income] {SSN, race}\"),\n            (((), (), (ssn, race)), \"[] {SSN, race}\"),\n        )\n\n        for args, printout in cases:\n            self.assertEqual(str(Domain(*args)), printout)\n\n    def test_has_discrete(self):\n        self.assertFalse(Domain([]).has_discrete_attributes())\n        self.assertFalse(Domain([], [age]).has_discrete_attributes())\n        self.assertFalse(Domain([], race).has_discrete_attributes())\n\n        self.assertFalse(Domain([age], None).has_discrete_attributes())\n        self.assertTrue(Domain([race], None).has_discrete_attributes())\n        self.assertTrue(Domain([age, race], None).has_discrete_attributes())\n        self.assertTrue(Domain([race, age], None).has_discrete_attributes())\n\n        self.assertFalse(Domain([], [age]).has_discrete_attributes(True))\n        self.assertTrue(Domain([], [race]).has_discrete_attributes(True))\n        self.assertFalse(Domain([age], None).has_discrete_attributes(True))\n        self.assertTrue(Domain([race], None).has_discrete_attributes(True))\n        self.assertTrue(Domain([age], race).has_discrete_attributes(True))\n        self.assertTrue(Domain([race], age).has_discrete_attributes(True))\n        self.assertTrue(Domain([], [race, age]).has_discrete_attributes(True))\n\n        d = Domain([], None, [gender])\n        self.assertTrue(d.has_discrete_attributes(False, True))\n        d = Domain([], None, [age])\n        self.assertFalse(d.has_discrete_attributes(False, True))\n        d = Domain([], [age], [gender])\n        self.assertTrue(d.has_discrete_attributes(True, True))\n        d = Domain([], [incomeA], [age])\n        self.assertFalse(d.has_discrete_attributes(True, True))\n\n    def test_has_continuous(self):\n        self.assertFalse(Domain([]).has_continuous_attributes())\n        self.assertFalse(Domain([], [age]).has_continuous_attributes())\n        self.assertFalse(Domain([], [race]).has_continuous_attributes())\n\n        self.assertTrue(Domain([age], None).has_continuous_attributes())\n        self.assertFalse(Domain([race], None).has_continuous_attributes())\n        self.assertTrue(Domain([age, race], None).has_continuous_attributes())\n        self.assertTrue(Domain([race, age], None).has_continuous_attributes())\n\n        self.assertTrue(Domain([], [age]).has_continuous_attributes(True))\n        self.assertFalse(Domain([], [race]).has_continuous_attributes(True))\n        self.assertTrue(Domain([age], None).has_continuous_attributes(True))\n        self.assertFalse(Domain([race], None).has_continuous_attributes(True))\n        self.assertTrue(Domain([age], race).has_continuous_attributes(True))\n        self.assertTrue(Domain([race], age).has_continuous_attributes(True))\n        self.assertTrue(Domain([], [race, age]).has_continuous_attributes(True))\n\n        d = Domain([], None, [age])\n        self.assertTrue(d.has_continuous_attributes(False, True))\n        d = Domain([], None, [gender])\n        self.assertFalse(d.has_continuous_attributes(False, True))\n        d = Domain([], [gender], [age])\n        self.assertTrue(d.has_continuous_attributes(True, True))\n        d = Domain([], [race], [gender])\n        self.assertFalse(d.has_continuous_attributes(True, True))\n\n    def test_has_time(self):\n        self.assertFalse(Domain([]).has_time_attributes())\n        self.assertFalse(Domain([], [age]).has_time_attributes())\n        self.assertFalse(Domain([], [race]).has_time_attributes())\n        self.assertFalse(Domain([], [arrival]).has_time_attributes())\n        self.assertFalse(Domain([], [], [arrival]).has_time_attributes())\n\n        self.assertTrue(Domain([arrival], []).has_time_attributes())\n        self.assertTrue(Domain([], [arrival]).has_time_attributes(\n            include_class=True))\n        self.assertTrue(Domain([], [], [arrival]).has_time_attributes(\n            include_metas=True))\n\n        self.assertFalse(Domain([arrival], []).has_time_class)\n        self.assertTrue(Domain([], [arrival]).has_time_class)\n        self.assertFalse(Domain([], [], [arrival]).has_time_class)\n\n    def test_get_conversion(self):\n        compute_value = lambda: 42\n        new_income = income.copy(compute_value=compute_value, name='new_income')\n\n        d = Domain((age, gender, income), metas=(ssn, race))\n        e = Domain((gender, race), None, metas=(age, income, ssn))\n        f = Domain((gender,), (race, income), metas=(age, incomeA, ssn))\n        g = Domain((), metas=(age, gender, ssn))\n        h = Domain((gender,), (race, income), metas=(age, new_income, ssn))\n\n        for conver, domain, attr, class_vars, metas in (\n                (d, e, [1, -2], [], [0, 2, -1]),\n                (d, f, [1], [-2, 2], [0, None, -1]),\n                (f, g, [], [], [-1, 0, -3]),\n                (g, h, [-2], [None, None], [-1, compute_value, -3])):\n            to_domain = DomainConversion(conver, domain)\n            self.assertIs(to_domain.source, conver)\n            self.assertEqual(to_domain.attributes, attr)\n            self.assertEqual(to_domain.class_vars, class_vars)\n            self.assertEqual(to_domain.metas, metas)\n\n    def test_conversion(self):\n        domain = Domain([age, income], [race],\n                        [gender, education, ssn])\n\n        x, y, metas = domain.convert([42, 13, \"White\"])\n        assert_array_equal(x, np.array([42, 13]))\n        assert_array_equal(y, np.array([0]))\n        metas_exp = [gender.Unknown, education.Unknown, ssn.Unknown]\n\n        def equal(a, b):\n            if isinstance(a, Real) and isinstance(b, Real) and \\\n                    np.isnan(a) and np.isnan(b):\n                return True\n            else:\n                return a == b\n\n        self.assertTrue(all(starmap(equal, zip(metas, metas_exp))))\n\n        x, y, metas = domain.convert([42, 13, \"White\", \"M\", \"HS\", \"1234567\"])\n        assert_array_equal(x, np.array([42, 13]))\n        assert_array_equal(y, np.array([0]))\n        assert_array_equal(metas, np.array([0, 1, \"1234567\"], dtype=object))\n\n    def test_conversion_size(self):\n        domain = Domain([age, gender, income], [race])\n        self.assertRaises(ValueError, domain.convert, [0] * 3)\n        self.assertRaises(ValueError, domain.convert, [0] * 5)\n\n        domain = Domain([age, income], [race],\n                        [gender, education, ssn])\n        self.assertRaises(ValueError, domain.convert, [0] * 2)\n        self.assertRaises(ValueError, domain.convert, [0] * 4)\n        self.assertRaises(ValueError, domain.convert, [0] * 7)\n        domain.convert([0] * 3)\n        domain.convert([0] * 6)\n\n    def test_preprocessor_chaining(self):\n        domain = Domain([DiscreteVariable(\"a\", values=\"01\"),\n                         DiscreteVariable(\"b\", values=\"01\")],\n                        DiscreteVariable(\"y\", values=\"01\"))\n        table = Table.from_list(domain, [[0, 1], [1, np.NaN]], [0, 1])\n        pre1 = Continuize()(Impute()(table))\n        pre2 = table.transform(pre1.domain)\n        np.testing.assert_almost_equal(pre1.X, pre2.X)\n\n    def test_different_domains_with_same_attributes_are_equal(self):\n        domain1 = Domain([])\n        domain2 = Domain([])\n        self.assertEqual(domain1, domain2)\n\n        var1 = ContinuousVariable('var1')\n        domain1.attributes = (var1,)\n        self.assertNotEqual(domain1, domain2)\n\n        domain2.attributes = (var1,)\n        self.assertEqual(domain1, domain2)\n\n        domain1.class_vars = (var1,)\n        self.assertNotEqual(domain1, domain2)\n\n        domain2.class_vars = (var1,)\n        self.assertEqual(domain1, domain2)\n\n        domain1._metas = (var1,)\n        self.assertNotEqual(domain1, domain2)\n\n        domain2._metas = (var1,)\n        self.assertEqual(domain1, domain2)\n\n    def test_domain_conversion_is_fast_enough(self):\n        attrs = [ContinuousVariable(\"f%i\" % i) for i in range(10000)]\n        class_vars = [ContinuousVariable(\"c%i\" % i) for i in range(10)]\n        metas = [ContinuousVariable(\"m%i\" % i) for i in range(10)]\n        source = Domain(attrs, class_vars, metas)\n\n        start = time()\n        cases = (((attrs[:1000], class_vars, metas),\n                  list(range(1000)), list(range(10000, 10010)), list(range(-1, -11, -1))),\n                 ((metas, attrs[:1000], class_vars),\n                  list(range(-1, -11, -1)), list(range(1000)), list(range(10000, 10010))),\n                 ((class_vars, metas, attrs[:1000]),\n                  list(range(10000, 10010)), list(range(-1, -11, -1)), list(range(1000))))\n\n        for domain_args, attributes, class_vars, metas in cases:\n            c1 = DomainConversion(source, Domain(*domain_args))\n            self.assertEqual(c1.attributes, attributes)\n            self.assertEqual(c1.class_vars, class_vars)\n            self.assertEqual(c1.metas, metas)\n\n        self.assertLessEqual(time() - start, 1)\n\n    def test_copy(self):\n        age.number_of_decimals = 5\n        attributes = (age, gender, income)\n\n        domain = Domain(attributes, [race], [ssn])\n\n        new_domain = domain.copy()\n        new_domain[age].number_of_decimals = 10\n\n        self.assertEqual(domain[age].number_of_decimals, 5)\n        self.assertEqual(new_domain[age].number_of_decimals, 10)\n\n    def test_domain_conversion_sparsity(self):\n        destination = Domain(\n            attributes=[\n                ContinuousVariable(name='a'),\n                ContinuousVariable(name='b'),\n                ContinuousVariable(name='c'),\n            ],\n            class_vars=[DiscreteVariable('d', values=('e', ))],\n            metas=[StringVariable('f')]\n        )\n\n        # all dense\n        source = Domain(attributes=[])\n        conversion = DomainConversion(source, destination)\n        self.assertFalse(conversion.sparse_X)\n        self.assertFalse(conversion.sparse_Y)\n        self.assertFalse(conversion.sparse_metas)\n\n        # set destination attributes as sparse\n        for a in destination.attributes:\n            a.sparse = True\n        source = Domain(attributes=[])\n        conversion = DomainConversion(source, destination)\n        self.assertTrue(conversion.sparse_X)\n        self.assertFalse(conversion.sparse_Y)\n        self.assertFalse(conversion.sparse_metas)\n\n        # set all destination variable as sparse\n        for a in chain(destination.variables, destination.metas):\n            a.sparse = True\n        source = Domain(attributes=[])\n        conversion = DomainConversion(source, destination)\n        self.assertTrue(conversion.sparse_X)\n        self.assertTrue(conversion.sparse_Y)\n        self.assertFalse(conversion.sparse_metas)\n\n    def test_get_item_similar_vars(self):\n        a = DiscreteVariable(\"Cluster\", values=[\"c\"])\n        var1 = a.renamed(\"Cluster x\")\n        var2 = DiscreteVariable(\"Cluster\", values=[\"a\", \"b\"])\n\n        domain = Domain(\n            [],\n            metas=[var1, var2]\n        )\n        # pylint: disable=protected-access\n        self.assertDictEqual(\n            {-1: -1, -2: -2, var1: -1, var2: -2, var1.name: -1, var2.name: -2},\n            domain._indices\n        )\n        self.assertIs(domain[domain.metas[0]], domain.metas[0])\n\n\nclass TestDomainFilter(unittest.TestCase):\n    def setUp(self):\n        self.iris = Table('iris')\n\n    def test_filter_visible(self):\n        n_feats = len(self.iris.domain.attributes)\n\n        self.iris.domain.attributes[0].attributes.update({'hidden': True})\n        filtered = list(filter_visible(self.iris.domain.attributes))\n        self.assertNotIn(self.iris.domain.attributes[0], filtered)\n        self.assertEqual(len(filtered), n_feats - 1)\n\n\nif __name__ == \"__main__\":\n    unittest.main()\n"
    ],
    "test_file_names": [
        "test_1.py"
    ],
    "setup_res_code": 0,
    "setup_res_stdout": "Starting Orange installation attempts...\nAttempting installation with Python 3.7...\nrunning build_ext\nCompiling Orange/classification/_tree_scorers.pyx because it changed.\nCompiling Orange/data/_contingency.pyx because it changed.\nCompiling Orange/data/_io.pyx because it changed.\nCompiling Orange/data/_valuecount.pyx because it changed.\nCompiling Orange/data/_variable.pyx because it changed.\nCompiling Orange/distance/_distance.pyx because it changed.\nCompiling Orange/preprocess/_discretize.pyx because it changed.\nCompiling Orange/preprocess/_relieff.pyx because it changed.\nCompiling Orange/projection/_som.pyx because it changed.\n[1/9] Cythonizing Orange/classification/_tree_scorers.pyx\n[2/9] Cythonizing Orange/data/_contingency.pyx\n[3/9] Cythonizing Orange/data/_io.pyx\n[4/9] Cythonizing Orange/data/_valuecount.pyx\n[5/9] Cythonizing Orange/data/_variable.pyx\n[6/9] Cythonizing Orange/distance/_distance.pyx\n[7/9] Cythonizing Orange/preprocess/_discretize.pyx\n[8/9] Cythonizing Orange/preprocess/_relieff.pyx\n[9/9] Cythonizing Orange/projection/_som.pyx\nbuilding 'Orange.classification._tree_scorers' extension\ncreating build\ncreating build/temp.linux-x86_64-3.7\ncreating build/temp.linux-x86_64-3.7/Orange\ncreating build/temp.linux-x86_64-3.7/Orange/classification\ncc -pthread -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -I/tools/deps/include -I/tools/deps/include/ncursesw -fPIC -I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_ea8c3b0ce9ff87f849b1462aab0b34bd3e35d4ed/.venv/lib/python3.7/site-packages/numpy/core/include -I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_ea8c3b0ce9ff87f849b1462aab0b34bd3e35d4ed/.venv/include -I/home/gcpuser/.local/share/uv/python/cpython-3.7.9-linux-x86_64-gnu/include/python3.7m -c Orange/classification/_tree_scorers.c -o build/temp.linux-x86_64-3.7/Orange/classification/_tree_scorers.o\ncreating build/lib.linux-x86_64-3.7\ncreating build/lib.linux-x86_64-3.7/Orange\ncreating build/lib.linux-x86_64-3.7/Orange/classification\ncc -pthread -shared -L/tools/deps/lib build/temp.linux-x86_64-3.7/Orange/classification/_tree_scorers.o -L/home/gcpuser/.local/share/uv/python/cpython-3.7.9-linux-x86_64-gnu/lib -lm -lpython3.7m -o build/lib.linux-x86_64-3.7/Orange/classification/_tree_scorers.cpython-37m-x86_64-linux-gnu.so\nbuilding 'Orange.data._contingency' extension\ncreating build/temp.linux-x86_64-3.7/Orange/data\ncc -pthread -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -I/tools/deps/include -I/tools/deps/include/ncursesw -fPIC -I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_ea8c3b0ce9ff87f849b1462aab0b34bd3e35d4ed/.venv/lib/python3.7/site-packages/numpy/core/include -I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_ea8c3b0ce9ff87f849b1462aab0b34bd3e35d4ed/.venv/include -I/home/gcpuser/.local/share/uv/python/cpython-3.7.9-linux-x86_64-gnu/include/python3.7m -c Orange/data/_contingency.c -o build/temp.linux-x86_64-3.7/Orange/data/_contingency.o\ncreating build/lib.linux-x86_64-3.7/Orange/data\ncc -pthread -shared -L/tools/deps/lib build/temp.linux-x86_64-3.7/Orange/data/_contingency.o -L/home/gcpuser/.local/share/uv/python/cpython-3.7.9-linux-x86_64-gnu/lib -lm -lpython3.7m -o build/lib.linux-x86_64-3.7/Orange/data/_contingency.cpython-37m-x86_64-linux-gnu.so\nbuilding 'Orange.data._io' extension\ncc -pthread -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -I/tools/deps/include -I/tools/deps/include/ncursesw -fPIC -I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_ea8c3b0ce9ff87f849b1462aab0b34bd3e35d4ed/.venv/lib/python3.7/site-packages/numpy/core/include -I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_ea8c3b0ce9ff87f849b1462aab0b34bd3e35d4ed/.venv/include -I/home/gcpuser/.local/share/uv/python/cpython-3.7.9-linux-x86_64-gnu/include/python3.7m -c Orange/data/_io.c -o build/temp.linux-x86_64-3.7/Orange/data/_io.o\ncc -pthread -shared -L/tools/deps/lib build/temp.linux-x86_64-3.7/Orange/data/_io.o -L/home/gcpuser/.local/share/uv/python/cpython-3.7.9-linux-x86_64-gnu/lib -lm -lpython3.7m -o build/lib.linux-x86_64-3.7/Orange/data/_io.cpython-37m-x86_64-linux-gnu.so\nbuilding 'Orange.data._valuecount' extension\ncc -pthread -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -I/tools/deps/include -I/tools/deps/include/ncursesw -fPIC -I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_ea8c3b0ce9ff87f849b1462aab0b34bd3e35d4ed/.venv/lib/python3.7/site-packages/numpy/core/include -I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_ea8c3b0ce9ff87f849b1462aab0b34bd3e35d4ed/.venv/include -I/home/gcpuser/.local/share/uv/python/cpython-3.7.9-linux-x86_64-gnu/include/python3.7m -c Orange/data/_valuecount.c -o build/temp.linux-x86_64-3.7/Orange/data/_valuecount.o\ncc -pthread -shared -L/tools/deps/lib build/temp.linux-x86_64-3.7/Orange/data/_valuecount.o -L/home/gcpuser/.local/share/uv/python/cpython-3.7.9-linux-x86_64-gnu/lib -lm -lpython3.7m -o build/lib.linux-x86_64-3.7/Orange/data/_valuecount.cpython-37m-x86_64-linux-gnu.so\nbuilding 'Orange.data._variable' extension\ncc -pthread -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -I/tools/deps/include -I/tools/deps/include/ncursesw -fPIC -I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_ea8c3b0ce9ff87f849b1462aab0b34bd3e35d4ed/.venv/lib/python3.7/site-packages/numpy/core/include -I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_ea8c3b0ce9ff87f849b1462aab0b34bd3e35d4ed/.venv/include -I/home/gcpuser/.local/share/uv/python/cpython-3.7.9-linux-x86_64-gnu/include/python3.7m -c Orange/data/_variable.c -o build/temp.linux-x86_64-3.7/Orange/data/_variable.o\ncc -pthread -shared -L/tools/deps/lib build/temp.linux-x86_64-3.7/Orange/data/_variable.o -L/home/gcpuser/.local/share/uv/python/cpython-3.7.9-linux-x86_64-gnu/lib -lm -lpython3.7m -o build/lib.linux-x86_64-3.7/Orange/data/_variable.cpython-37m-x86_64-linux-gnu.so\nbuilding 'Orange.distance._distance' extension\ncreating build/temp.linux-x86_64-3.7/Orange/distance\ncc -pthread -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -I/tools/deps/include -I/tools/deps/include/ncursesw -fPIC -I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_ea8c3b0ce9ff87f849b1462aab0b34bd3e35d4ed/.venv/lib/python3.7/site-packages/numpy/core/include -I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_ea8c3b0ce9ff87f849b1462aab0b34bd3e35d4ed/.venv/include -I/home/gcpuser/.local/share/uv/python/cpython-3.7.9-linux-x86_64-gnu/include/python3.7m -c Orange/distance/_distance.c -o build/temp.linux-x86_64-3.7/Orange/distance/_distance.o\ncreating build/lib.linux-x86_64-3.7/Orange/distance\ncc -pthread -shared -L/tools/deps/lib build/temp.linux-x86_64-3.7/Orange/distance/_distance.o -L/home/gcpuser/.local/share/uv/python/cpython-3.7.9-linux-x86_64-gnu/lib -lm -lpython3.7m -o build/lib.linux-x86_64-3.7/Orange/distance/_distance.cpython-37m-x86_64-linux-gnu.so\nbuilding 'Orange.preprocess._discretize' extension\ncreating build/temp.linux-x86_64-3.7/Orange/preprocess\ncc -pthread -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -I/tools/deps/include -I/tools/deps/include/ncursesw -fPIC -I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_ea8c3b0ce9ff87f849b1462aab0b34bd3e35d4ed/.venv/lib/python3.7/site-packages/numpy/core/include -I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_ea8c3b0ce9ff87f849b1462aab0b34bd3e35d4ed/.venv/include -I/home/gcpuser/.local/share/uv/python/cpython-3.7.9-linux-x86_64-gnu/include/python3.7m -c Orange/preprocess/_discretize.c -o build/temp.linux-x86_64-3.7/Orange/preprocess/_discretize.o\ncreating build/lib.linux-x86_64-3.7/Orange/preprocess\ncc -pthread -shared -L/tools/deps/lib build/temp.linux-x86_64-3.7/Orange/preprocess/_discretize.o -L/home/gcpuser/.local/share/uv/python/cpython-3.7.9-linux-x86_64-gnu/lib -lm -lpython3.7m -o build/lib.linux-x86_64-3.7/Orange/preprocess/_discretize.cpython-37m-x86_64-linux-gnu.so\nbuilding 'Orange.preprocess._relieff' extension\ncc -pthread -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -I/tools/deps/include -I/tools/deps/include/ncursesw -fPIC -I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_ea8c3b0ce9ff87f849b1462aab0b34bd3e35d4ed/.venv/lib/python3.7/site-packages/numpy/core/include -I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_ea8c3b0ce9ff87f849b1462aab0b34bd3e35d4ed/.venv/include -I/home/gcpuser/.local/share/uv/python/cpython-3.7.9-linux-x86_64-gnu/include/python3.7m -c Orange/preprocess/_relieff.cpp -o build/temp.linux-x86_64-3.7/Orange/preprocess/_relieff.o\nc++ -pthread -shared -L/tools/deps/lib build/temp.linux-x86_64-3.7/Orange/preprocess/_relieff.o -L/home/gcpuser/.local/share/uv/python/cpython-3.7.9-linux-x86_64-gnu/lib -lm -lpython3.7m -o build/lib.linux-x86_64-3.7/Orange/preprocess/_relieff.cpython-37m-x86_64-linux-gnu.so\nbuilding 'Orange.projection._som' extension\ncreating build/temp.linux-x86_64-3.7/Orange/projection\ncc -pthread -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -I/tools/deps/include -I/tools/deps/include/ncursesw -fPIC -I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_ea8c3b0ce9ff87f849b1462aab0b34bd3e35d4ed/.venv/lib/python3.7/site-packages/numpy/core/include -I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_ea8c3b0ce9ff87f849b1462aab0b34bd3e35d4ed/.venv/include -I/home/gcpuser/.local/share/uv/python/cpython-3.7.9-linux-x86_64-gnu/include/python3.7m -c Orange/projection/_som.c -o build/temp.linux-x86_64-3.7/Orange/projection/_som.o\ncreating build/lib.linux-x86_64-3.7/Orange/projection\ncc -pthread -shared -L/tools/deps/lib build/temp.linux-x86_64-3.7/Orange/projection/_som.o -L/home/gcpuser/.local/share/uv/python/cpython-3.7.9-linux-x86_64-gnu/lib -lm -lpython3.7m -o build/lib.linux-x86_64-3.7/Orange/projection/_som.cpython-37m-x86_64-linux-gnu.so\nbuilding 'Orange.classification._simple_tree' extension\ncc -pthread -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -I/tools/deps/include -I/tools/deps/include/ncursesw -fPIC -I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_ea8c3b0ce9ff87f849b1462aab0b34bd3e35d4ed/.venv/lib/python3.7/site-packages/numpy/core/include -I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_ea8c3b0ce9ff87f849b1462aab0b34bd3e35d4ed/.venv/include -I/home/gcpuser/.local/share/uv/python/cpython-3.7.9-linux-x86_64-gnu/include/python3.7m -c Orange/classification/_simple_tree.c -o build/temp.linux-x86_64-3.7/Orange/classification/_simple_tree.o\ncc -pthread -shared -L/tools/deps/lib build/temp.linux-x86_64-3.7/Orange/classification/_simple_tree.o -L/home/gcpuser/.local/share/uv/python/cpython-3.7.9-linux-x86_64-gnu/lib -lm -lpython3.7m -o build/lib.linux-x86_64-3.7/Orange/classification/_simple_tree.cpython-37m-x86_64-linux-gnu.so\nbuilding 'Orange.widgets.utils._grid_density' extension\ncreating build/temp.linux-x86_64-3.7/Orange/widgets\ncreating build/temp.linux-x86_64-3.7/Orange/widgets/utils\ncc -pthread -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -I/tools/deps/include -I/tools/deps/include/ncursesw -fPIC -I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_ea8c3b0ce9ff87f849b1462aab0b34bd3e35d4ed/.venv/lib/python3.7/site-packages/numpy/core/include -I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_ea8c3b0ce9ff87f849b1462aab0b34bd3e35d4ed/.venv/include -I/home/gcpuser/.local/share/uv/python/cpython-3.7.9-linux-x86_64-gnu/include/python3.7m -c Orange/widgets/utils/_grid_density.cpp -o build/temp.linux-x86_64-3.7/Orange/widgets/utils/_grid_density.o\ncreating build/lib.linux-x86_64-3.7/Orange/widgets\ncreating build/lib.linux-x86_64-3.7/Orange/widgets/utils\nc++ -pthread -shared -L/tools/deps/lib build/temp.linux-x86_64-3.7/Orange/widgets/utils/_grid_density.o -L/home/gcpuser/.local/share/uv/python/cpython-3.7.9-linux-x86_64-gnu/lib -lm -lpython3.7m -o build/lib.linux-x86_64-3.7/Orange/widgets/utils/_grid_density.cpython-37m-x86_64-linux-gnu.so\ncopying build/lib.linux-x86_64-3.7/Orange/classification/_tree_scorers.cpython-37m-x86_64-linux-gnu.so -> Orange/classification\ncopying build/lib.linux-x86_64-3.7/Orange/data/_contingency.cpython-37m-x86_64-linux-gnu.so -> Orange/data\ncopying build/lib.linux-x86_64-3.7/Orange/data/_io.cpython-37m-x86_64-linux-gnu.so -> Orange/data\ncopying build/lib.linux-x86_64-3.7/Orange/data/_valuecount.cpython-37m-x86_64-linux-gnu.so -> Orange/data\ncopying build/lib.linux-x86_64-3.7/Orange/data/_variable.cpython-37m-x86_64-linux-gnu.so -> Orange/data\ncopying build/lib.linux-x86_64-3.7/Orange/distance/_distance.cpython-37m-x86_64-linux-gnu.so -> Orange/distance\ncopying build/lib.linux-x86_64-3.7/Orange/preprocess/_discretize.cpython-37m-x86_64-linux-gnu.so -> Orange/preprocess\ncopying build/lib.linux-x86_64-3.7/Orange/preprocess/_relieff.cpython-37m-x86_64-linux-gnu.so -> Orange/preprocess\ncopying build/lib.linux-x86_64-3.7/Orange/projection/_som.cpython-37m-x86_64-linux-gnu.so -> Orange/projection\ncopying build/lib.linux-x86_64-3.7/Orange/classification/_simple_tree.cpython-37m-x86_64-linux-gnu.so -> Orange/classification\ncopying build/lib.linux-x86_64-3.7/Orange/widgets/utils/_grid_density.cpython-37m-x86_64-linux-gnu.so -> Orange/widgets/utils\nrunning develop\nrunning egg_info\ncreating Orange3.egg-info\nwriting Orange3.egg-info/PKG-INFO\nwriting dependency_links to Orange3.egg-info/dependency_links.txt\nwriting entry points to Orange3.egg-info/entry_points.txt\nwriting requirements to Orange3.egg-info/requires.txt\nwriting top-level names to Orange3.egg-info/top_level.txt\nwriting manifest file 'Orange3.egg-info/SOURCES.txt'\nreading manifest file 'Orange3.egg-info/SOURCES.txt'\nreading manifest template 'MANIFEST.in'\nadding license file 'LICENSE'\nwriting manifest file 'Orange3.egg-info/SOURCES.txt'\nrunning build_ext\ncopying build/lib.linux-x86_64-3.7/Orange/classification/_tree_scorers.cpython-37m-x86_64-linux-gnu.so -> Orange/classification\ncopying build/lib.linux-x86_64-3.7/Orange/data/_contingency.cpython-37m-x86_64-linux-gnu.so -> Orange/data\ncopying build/lib.linux-x86_64-3.7/Orange/data/_io.cpython-37m-x86_64-linux-gnu.so -> Orange/data\ncopying build/lib.linux-x86_64-3.7/Orange/data/_valuecount.cpython-37m-x86_64-linux-gnu.so -> Orange/data\ncopying build/lib.linux-x86_64-3.7/Orange/data/_variable.cpython-37m-x86_64-linux-gnu.so -> Orange/data\ncopying build/lib.linux-x86_64-3.7/Orange/distance/_distance.cpython-37m-x86_64-linux-gnu.so -> Orange/distance\ncopying build/lib.linux-x86_64-3.7/Orange/preprocess/_discretize.cpython-37m-x86_64-linux-gnu.so -> Orange/preprocess\ncopying build/lib.linux-x86_64-3.7/Orange/preprocess/_relieff.cpython-37m-x86_64-linux-gnu.so -> Orange/preprocess\ncopying build/lib.linux-x86_64-3.7/Orange/projection/_som.cpython-37m-x86_64-linux-gnu.so -> Orange/projection\ncopying build/lib.linux-x86_64-3.7/Orange/classification/_simple_tree.cpython-37m-x86_64-linux-gnu.so -> Orange/classification\ncopying build/lib.linux-x86_64-3.7/Orange/widgets/utils/_grid_density.cpython-37m-x86_64-linux-gnu.so -> Orange/widgets/utils\nCreating /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_ea8c3b0ce9ff87f849b1462aab0b34bd3e35d4ed/.venv/lib/python3.7/site-packages/Orange3.egg-link (link to .)\nAdding Orange3 3.31.0.dev0+ea8c3b0 to easy-install.pth file\nInstalling orange-canvas script to /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_ea8c3b0ce9ff87f849b1462aab0b34bd3e35d4ed/.venv/bin\n\nInstalled /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_ea8c3b0ce9ff87f849b1462aab0b34bd3e35d4ed\nProcessing dependencies for Orange3==3.31.0.dev0+ea8c3b0\nSearching for XlsxWriter==3.2.0\nBest match: XlsxWriter 3.2.0\nAdding XlsxWriter 3.2.0 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_ea8c3b0ce9ff87f849b1462aab0b34bd3e35d4ed/.venv/lib/python3.7/site-packages\nSearching for xlrd==2.0.1\nBest match: xlrd 2.0.1\nAdding xlrd 2.0.1 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_ea8c3b0ce9ff87f849b1462aab0b34bd3e35d4ed/.venv/lib/python3.7/site-packages\nSearching for setuptools==59.8.0\nBest match: setuptools 59.8.0\nAdding setuptools 59.8.0 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_ea8c3b0ce9ff87f849b1462aab0b34bd3e35d4ed/.venv/lib/python3.7/site-packages\nSearching for serverfiles==0.3.1\nBest match: serverfiles 0.3.1\nAdding serverfiles 0.3.1 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_ea8c3b0ce9ff87f849b1462aab0b34bd3e35d4ed/.venv/lib/python3.7/site-packages\nSearching for scipy==1.7.3\nBest match: scipy 1.7.3\nAdding scipy 1.7.3 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_ea8c3b0ce9ff87f849b1462aab0b34bd3e35d4ed/.venv/lib/python3.7/site-packages\nSearching for scikit-learn==1.0.2\nBest match: scikit-learn 1.0.2\nAdding scikit-learn 1.0.2 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_ea8c3b0ce9ff87f849b1462aab0b34bd3e35d4ed/.venv/lib/python3.7/site-packages\nSearching for requests==2.31.0\nBest match: requests 2.31.0\nAdding requests 2.31.0 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_ea8c3b0ce9ff87f849b1462aab0b34bd3e35d4ed/.venv/lib/python3.7/site-packages\nSearching for qtconsole==5.4.4\nBest match: qtconsole 5.4.4\nAdding qtconsole 5.4.4 to easy-install.pth file\nInstalling jupyter-qtconsole script to /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_ea8c3b0ce9ff87f849b1462aab0b34bd3e35d4ed/.venv/bin\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_ea8c3b0ce9ff87f849b1462aab0b34bd3e35d4ed/.venv/lib/python3.7/site-packages\nSearching for PyYAML==6.0.1\nBest match: PyYAML 6.0.1\nAdding PyYAML 6.0.1 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_ea8c3b0ce9ff87f849b1462aab0b34bd3e35d4ed/.venv/lib/python3.7/site-packages\nSearching for python-louvain==0.16\nBest match: python-louvain 0.16\nAdding python-louvain 0.16 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_ea8c3b0ce9ff87f849b1462aab0b34bd3e35d4ed/.venv/lib/python3.7/site-packages\nSearching for pyqtgraph==0.12.4\nBest match: pyqtgraph 0.12.4\nAdding pyqtgraph 0.12.4 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_ea8c3b0ce9ff87f849b1462aab0b34bd3e35d4ed/.venv/lib/python3.7/site-packages\nSearching for pygments==2.17.2\nBest match: pygments 2.17.2\nAdding pygments 2.17.2 to easy-install.pth file\nInstalling pygmentize script to /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_ea8c3b0ce9ff87f849b1462aab0b34bd3e35d4ed/.venv/bin\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_ea8c3b0ce9ff87f849b1462aab0b34bd3e35d4ed/.venv/lib/python3.7/site-packages\nSearching for pip==24.0\nBest match: pip 24.0\nAdding pip 24.0 to easy-install.pth file\nInstalling pip script to /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_ea8c3b0ce9ff87f849b1462aab0b34bd3e35d4ed/.venv/bin\nInstalling pip3 script to /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_ea8c3b0ce9ff87f849b1462aab0b34bd3e35d4ed/.venv/bin\nInstalling pip3.10 script to /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_ea8c3b0ce9ff87f849b1462aab0b34bd3e35d4ed/.venv/bin\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_ea8c3b0ce9ff87f849b1462aab0b34bd3e35d4ed/.venv/lib/python3.7/site-packages\nSearching for pandas==1.3.5\nBest match: pandas 1.3.5\nAdding pandas 1.3.5 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_ea8c3b0ce9ff87f849b1462aab0b34bd3e35d4ed/.venv/lib/python3.7/site-packages\nSearching for orange-widget-base==4.22.0\nBest match: orange-widget-base 4.22.0\nAdding orange-widget-base 4.22.0 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_ea8c3b0ce9ff87f849b1462aab0b34bd3e35d4ed/.venv/lib/python3.7/site-packages\nSearching for orange-canvas-core==0.1.35\nBest match: orange-canvas-core 0.1.35\nAdding orange-canvas-core 0.1.35 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_ea8c3b0ce9ff87f849b1462aab0b34bd3e35d4ed/.venv/lib/python3.7/site-packages\nSearching for openpyxl==3.1.3\nBest match: openpyxl 3.1.3\nAdding openpyxl 3.1.3 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_ea8c3b0ce9ff87f849b1462aab0b34bd3e35d4ed/.venv/lib/python3.7/site-packages\nSearching for openTSNE==1.0.1\nBest match: openTSNE 1.0.1\nAdding openTSNE 1.0.1 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_ea8c3b0ce9ff87f849b1462aab0b34bd3e35d4ed/.venv/lib/python3.7/site-packages\nSearching for numpy==1.17.5\nBest match: numpy 1.17.5\nAdding numpy 1.17.5 to easy-install.pth file\nInstalling f2py script to /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_ea8c3b0ce9ff87f849b1462aab0b34bd3e35d4ed/.venv/bin\nInstalling f2py3 script to /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_ea8c3b0ce9ff87f849b1462aab0b34bd3e35d4ed/.venv/bin\nInstalling f2py3.7 script to /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_ea8c3b0ce9ff87f849b1462aab0b34bd3e35d4ed/.venv/bin\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_ea8c3b0ce9ff87f849b1462aab0b34bd3e35d4ed/.venv/lib/python3.7/site-packages\nSearching for networkx==2.6.3\nBest match: networkx 2.6.3\nAdding networkx 2.6.3 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_ea8c3b0ce9ff87f849b1462aab0b34bd3e35d4ed/.venv/lib/python3.7/site-packages\nSearching for matplotlib==3.5.3\nBest match: matplotlib 3.5.3\nAdding matplotlib 3.5.3 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_ea8c3b0ce9ff87f849b1462aab0b34bd3e35d4ed/.venv/lib/python3.7/site-packages\nSearching for keyrings.alt==4.2.0\nBest match: keyrings.alt 4.2.0\nAdding keyrings.alt 4.2.0 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_ea8c3b0ce9ff87f849b1462aab0b34bd3e35d4ed/.venv/lib/python3.7/site-packages\nSearching for keyring==24.1.1\nBest match: keyring 24.1.1\nAdding keyring 24.1.1 to easy-install.pth file\nInstalling keyring script to /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_ea8c3b0ce9ff87f849b1462aab0b34bd3e35d4ed/.venv/bin\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_ea8c3b0ce9ff87f849b1462aab0b34bd3e35d4ed/.venv/lib/python3.7/site-packages\nSearching for joblib==1.3.2\nBest match: joblib 1.3.2\nAdding joblib 1.3.2 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_ea8c3b0ce9ff87f849b1462aab0b34bd3e35d4ed/.venv/lib/python3.7/site-packages\nSearching for httpx==0.19.0\nBest match: httpx 0.19.0\nAdding httpx 0.19.0 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_ea8c3b0ce9ff87f849b1462aab0b34bd3e35d4ed/.venv/lib/python3.7/site-packages\nSearching for chardet==5.2.0\nBest match: chardet 5.2.0\nAdding chardet 5.2.0 to easy-install.pth file\nInstalling chardetect script to /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_ea8c3b0ce9ff87f849b1462aab0b34bd3e35d4ed/.venv/bin\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_ea8c3b0ce9ff87f849b1462aab0b34bd3e35d4ed/.venv/lib/python3.7/site-packages\nSearching for Bottleneck==1.4.0\nBest match: Bottleneck 1.4.0\nAdding Bottleneck 1.4.0 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_ea8c3b0ce9ff87f849b1462aab0b34bd3e35d4ed/.venv/lib/python3.7/site-packages\nSearching for baycomp==1.0.3\nBest match: baycomp 1.0.3\nAdding baycomp 1.0.3 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_ea8c3b0ce9ff87f849b1462aab0b34bd3e35d4ed/.venv/lib/python3.7/site-packages\nSearching for PyQtWebEngine==5.15.6\nBest match: PyQtWebEngine 5.15.6\nAdding PyQtWebEngine 5.15.6 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_ea8c3b0ce9ff87f849b1462aab0b34bd3e35d4ed/.venv/lib/python3.7/site-packages\nSearching for PyQt5==5.15.10\nBest match: PyQt5 5.15.10\nAdding PyQt5 5.15.10 to easy-install.pth file\nInstalling pylupdate5 script to /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_ea8c3b0ce9ff87f849b1462aab0b34bd3e35d4ed/.venv/bin\nInstalling pyrcc5 script to /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_ea8c3b0ce9ff87f849b1462aab0b34bd3e35d4ed/.venv/bin\nInstalling pyuic5 script to /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_ea8c3b0ce9ff87f849b1462aab0b34bd3e35d4ed/.venv/bin\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_ea8c3b0ce9ff87f849b1462aab0b34bd3e35d4ed/.venv/lib/python3.7/site-packages\nSearching for AnyQt==0.2.0\nBest match: AnyQt 0.2.0\nAdding AnyQt 0.2.0 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_ea8c3b0ce9ff87f849b1462aab0b34bd3e35d4ed/.venv/lib/python3.7/site-packages\nSearching for threadpoolctl==3.1.0\nBest match: threadpoolctl 3.1.0\nAdding threadpoolctl 3.1.0 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_ea8c3b0ce9ff87f849b1462aab0b34bd3e35d4ed/.venv/lib/python3.7/site-packages\nSearching for charset-normalizer==3.4.1\nBest match: charset-normalizer 3.4.1\nAdding charset-normalizer 3.4.1 to easy-install.pth file\nInstalling normalizer script to /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_ea8c3b0ce9ff87f849b1462aab0b34bd3e35d4ed/.venv/bin\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_ea8c3b0ce9ff87f849b1462aab0b34bd3e35d4ed/.venv/lib/python3.7/site-packages\nSearching for certifi==2024.12.14\nBest match: certifi 2024.12.14\nAdding certifi 2024.12.14 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_ea8c3b0ce9ff87f849b1462aab0b34bd3e35d4ed/.venv/lib/python3.7/site-packages\nSearching for urllib3==2.0.7\nBest match: urllib3 2.0.7\nAdding urllib3 2.0.7 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_ea8c3b0ce9ff87f849b1462aab0b34bd3e35d4ed/.venv/lib/python3.7/site-packages\nSearching for idna==3.10\nBest match: idna 3.10\nAdding idna 3.10 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_ea8c3b0ce9ff87f849b1462aab0b34bd3e35d4ed/.venv/lib/python3.7/site-packages\nSearching for jupyter-core==4.12.0\nBest match: jupyter-core 4.12.0\nAdding jupyter-core 4.12.0 to easy-install.pth file\nInstalling jupyter script to /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_ea8c3b0ce9ff87f849b1462aab0b34bd3e35d4ed/.venv/bin\nInstalling jupyter-migrate script to /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_ea8c3b0ce9ff87f849b1462aab0b34bd3e35d4ed/.venv/bin\nInstalling jupyter-troubleshoot script to /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_ea8c3b0ce9ff87f849b1462aab0b34bd3e35d4ed/.venv/bin\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_ea8c3b0ce9ff87f849b1462aab0b34bd3e35d4ed/.venv/lib/python3.7/site-packages\nSearching for ipykernel==6.16.2\nBest match: ipykernel 6.16.2\nAdding ipykernel 6.16.2 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_ea8c3b0ce9ff87f849b1462aab0b34bd3e35d4ed/.venv/lib/python3.7/site-packages\nSearching for pyzmq==26.2.0\nBest match: pyzmq 26.2.0\nAdding pyzmq 26.2.0 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_ea8c3b0ce9ff87f849b1462aab0b34bd3e35d4ed/.venv/lib/python3.7/site-packages\nSearching for ipython-genutils==0.2.0\nBest match: ipython-genutils 0.2.0\nAdding ipython-genutils 0.2.0 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_ea8c3b0ce9ff87f849b1462aab0b34bd3e35d4ed/.venv/lib/python3.7/site-packages\nSearching for jupyter-client==7.4.9\nBest match: jupyter-client 7.4.9\nAdding jupyter-client 7.4.9 to easy-install.pth file\nInstalling jupyter-kernel script to /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_ea8c3b0ce9ff87f849b1462aab0b34bd3e35d4ed/.venv/bin\nInstalling jupyter-kernelspec script to /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_ea8c3b0ce9ff87f849b1462aab0b34bd3e35d4ed/.venv/bin\nInstalling jupyter-run script to /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_ea8c3b0ce9ff87f849b1462aab0b34bd3e35d4ed/.venv/bin\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_ea8c3b0ce9ff87f849b1462aab0b34bd3e35d4ed/.venv/lib/python3.7/site-packages\nSearching for QtPy==2.4.2\nBest match: QtPy 2.4.2\nAdding QtPy 2.4.2 to easy-install.pth file\nInstalling qtpy script to /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_ea8c3b0ce9ff87f849b1462aab0b34bd3e35d4ed/.venv/bin\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_ea8c3b0ce9ff87f849b1462aab0b34bd3e35d4ed/.venv/lib/python3.7/site-packages\nSearching for traitlets==5.9.0\nBest match: traitlets 5.9.0\nAdding traitlets 5.9.0 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_ea8c3b0ce9ff87f849b1462aab0b34bd3e35d4ed/.venv/lib/python3.7/site-packages\nSearching for packaging==24.0\nBest match: packaging 24.0\nAdding packaging 24.0 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_ea8c3b0ce9ff87f849b1462aab0b34bd3e35d4ed/.venv/lib/python3.7/site-packages\nSearching for python-dateutil==2.9.0.post0\nBest match: python-dateutil 2.9.0.post0\nAdding python-dateutil 2.9.0.post0 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_ea8c3b0ce9ff87f849b1462aab0b34bd3e35d4ed/.venv/lib/python3.7/site-packages\nSearching for pytz==2024.2\nBest match: pytz 2024.2\nAdding pytz 2024.2 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_ea8c3b0ce9ff87f849b1462aab0b34bd3e35d4ed/.venv/lib/python3.7/site-packages\nSearching for typing-extensions==4.7.1\nBest match: typing-extensions 4.7.1\nAdding typing-extensions 4.7.1 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_ea8c3b0ce9ff87f849b1462aab0b34bd3e35d4ed/.venv/lib/python3.7/site-packages\nSearching for importlib-metadata==6.7.0\nBest match: importlib-metadata 6.7.0\nAdding importlib-metadata 6.7.0 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_ea8c3b0ce9ff87f849b1462aab0b34bd3e35d4ed/.venv/lib/python3.7/site-packages\nSearching for qasync==0.25.0\nBest match: qasync 0.25.0\nAdding qasync 0.25.0 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_ea8c3b0ce9ff87f849b1462aab0b34bd3e35d4ed/.venv/lib/python3.7/site-packages\nSearching for commonmark==0.9.1\nBest match: commonmark 0.9.1\nAdding commonmark 0.9.1 to easy-install.pth file\nInstalling cmark script to /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_ea8c3b0ce9ff87f849b1462aab0b34bd3e35d4ed/.venv/bin\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_ea8c3b0ce9ff87f849b1462aab0b34bd3e35d4ed/.venv/lib/python3.7/site-packages\nSearching for requests-cache==1.1.1\nBest match: requests-cache 1.1.1\nAdding requests-cache 1.1.1 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_ea8c3b0ce9ff87f849b1462aab0b34bd3e35d4ed/.venv/lib/python3.7/site-packages\nSearching for docutils==0.20.1\nBest match: docutils 0.20.1\nAdding docutils 0.20.1 to easy-install.pth file\nInstalling docutils script to /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_ea8c3b0ce9ff87f849b1462aab0b34bd3e35d4ed/.venv/bin\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_ea8c3b0ce9ff87f849b1462aab0b34bd3e35d4ed/.venv/lib/python3.7/site-packages\nSearching for dictdiffer==0.9.0\nBest match: dictdiffer 0.9.0\nAdding dictdiffer 0.9.0 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_ea8c3b0ce9ff87f849b1462aab0b34bd3e35d4ed/.venv/lib/python3.7/site-packages\nSearching for et-xmlfile==1.1.0\nBest match: et-xmlfile 1.1.0\nAdding et-xmlfile 1.1.0 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_ea8c3b0ce9ff87f849b1462aab0b34bd3e35d4ed/.venv/lib/python3.7/site-packages\nSearching for cycler==0.11.0\nBest match: cycler 0.11.0\nAdding cycler 0.11.0 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_ea8c3b0ce9ff87f849b1462aab0b34bd3e35d4ed/.venv/lib/python3.7/site-packages\nSearching for Pillow==9.5.0\nBest match: Pillow 9.5.0\nAdding Pillow 9.5.0 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_ea8c3b0ce9ff87f849b1462aab0b34bd3e35d4ed/.venv/lib/python3.7/site-packages\nSearching for pyparsing==3.1.4\nBest match: pyparsing 3.1.4\nAdding pyparsing 3.1.4 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_ea8c3b0ce9ff87f849b1462aab0b34bd3e35d4ed/.venv/lib/python3.7/site-packages\nSearching for fonttools==4.38.0\nBest match: fonttools 4.38.0\nAdding fonttools 4.38.0 to easy-install.pth file\nInstalling fonttools script to /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_ea8c3b0ce9ff87f849b1462aab0b34bd3e35d4ed/.venv/bin\nInstalling pyftmerge script to /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_ea8c3b0ce9ff87f849b1462aab0b34bd3e35d4ed/.venv/bin\nInstalling pyftsubset script to /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_ea8c3b0ce9ff87f849b1462aab0b34bd3e35d4ed/.venv/bin\nInstalling ttx script to /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_ea8c3b0ce9ff87f849b1462aab0b34bd3e35d4ed/.venv/bin\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_ea8c3b0ce9ff87f849b1462aab0b34bd3e35d4ed/.venv/lib/python3.7/site-packages\nSearching for kiwisolver==1.4.5\nBest match: kiwisolver 1.4.5\nAdding kiwisolver 1.4.5 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_ea8c3b0ce9ff87f849b1462aab0b34bd3e35d4ed/.venv/lib/python3.7/site-packages\nSearching for jaraco.classes==3.2.3\nBest match: jaraco.classes 3.2.3\nAdding jaraco.classes 3.2.3 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_ea8c3b0ce9ff87f849b1462aab0b34bd3e35d4ed/.venv/lib/python3.7/site-packages\nSearching for importlib-resources==5.12.0\nBest match: importlib-resources 5.12.0\nAdding importlib-resources 5.12.0 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_ea8c3b0ce9ff87f849b1462aab0b34bd3e35d4ed/.venv/lib/python3.7/site-packages\nSearching for SecretStorage==3.3.3\nBest match: SecretStorage 3.3.3\nAdding SecretStorage 3.3.3 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_ea8c3b0ce9ff87f849b1462aab0b34bd3e35d4ed/.venv/lib/python3.7/site-packages\nSearching for jeepney==0.8.0\nBest match: jeepney 0.8.0\nAdding jeepney 0.8.0 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_ea8c3b0ce9ff87f849b1462aab0b34bd3e35d4ed/.venv/lib/python3.7/site-packages\nSearching for rfc3986==1.5.0\nBest match: rfc3986 1.5.0\nAdding rfc3986 1.5.0 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_ea8c3b0ce9ff87f849b1462aab0b34bd3e35d4ed/.venv/lib/python3.7/site-packages\nSearching for httpcore==0.13.7\nBest match: httpcore 0.13.7\nAdding httpcore 0.13.7 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_ea8c3b0ce9ff87f849b1462aab0b34bd3e35d4ed/.venv/lib/python3.7/site-packages\nSearching for sniffio==1.3.1\nBest match: sniffio 1.3.1\nAdding sniffio 1.3.1 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_ea8c3b0ce9ff87f849b1462aab0b34bd3e35d4ed/.venv/lib/python3.7/site-packages\nSearching for PyQtWebEngine-Qt5==5.15.16\nBest match: PyQtWebEngine-Qt5 5.15.16\nAdding PyQtWebEngine-Qt5 5.15.16 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_ea8c3b0ce9ff87f849b1462aab0b34bd3e35d4ed/.venv/lib/python3.7/site-packages\nSearching for PyQt5-sip==12.13.0\nBest match: PyQt5-sip 12.13.0\nAdding PyQt5-sip 12.13.0 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_ea8c3b0ce9ff87f849b1462aab0b34bd3e35d4ed/.venv/lib/python3.7/site-packages\nSearching for PyQt5-Qt5==5.15.16\nBest match: PyQt5-Qt5 5.15.16\nAdding PyQt5-Qt5 5.15.16 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_ea8c3b0ce9ff87f849b1462aab0b34bd3e35d4ed/.venv/lib/python3.7/site-packages\nSearching for matplotlib-inline==0.1.6\nBest match: matplotlib-inline 0.1.6\nAdding matplotlib-inline 0.1.6 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_ea8c3b0ce9ff87f849b1462aab0b34bd3e35d4ed/.venv/lib/python3.7/site-packages\nSearching for psutil==6.1.1\nBest match: psutil 6.1.1\nAdding psutil 6.1.1 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_ea8c3b0ce9ff87f849b1462aab0b34bd3e35d4ed/.venv/lib/python3.7/site-packages\nSearching for nest-asyncio==1.6.0\nBest match: nest-asyncio 1.6.0\nAdding nest-asyncio 1.6.0 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_ea8c3b0ce9ff87f849b1462aab0b34bd3e35d4ed/.venv/lib/python3.7/site-packages\nSearching for debugpy==1.7.0\nBest match: debugpy 1.7.0\nAdding debugpy 1.7.0 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_ea8c3b0ce9ff87f849b1462aab0b34bd3e35d4ed/.venv/lib/python3.7/site-packages\nSearching for tornado==6.2\nBest match: tornado 6.2\nAdding tornado 6.2 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_ea8c3b0ce9ff87f849b1462aab0b34bd3e35d4ed/.venv/lib/python3.7/site-packages\nSearching for ipython==7.34.0\nBest match: ipython 7.34.0\nAdding ipython 7.34.0 to easy-install.pth file\nInstalling iptest script to /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_ea8c3b0ce9ff87f849b1462aab0b34bd3e35d4ed/.venv/bin\nInstalling iptest3 script to /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_ea8c3b0ce9ff87f849b1462aab0b34bd3e35d4ed/.venv/bin\nInstalling ipython script to /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_ea8c3b0ce9ff87f849b1462aab0b34bd3e35d4ed/.venv/bin\nInstalling ipython3 script to /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_ea8c3b0ce9ff87f849b1462aab0b34bd3e35d4ed/.venv/bin\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_ea8c3b0ce9ff87f849b1462aab0b34bd3e35d4ed/.venv/lib/python3.7/site-packages\nSearching for entrypoints==0.4\nBest match: entrypoints 0.4\nAdding entrypoints 0.4 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_ea8c3b0ce9ff87f849b1462aab0b34bd3e35d4ed/.venv/lib/python3.7/site-packages\nSearching for six==1.17.0\nBest match: six 1.17.0\nAdding six 1.17.0 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_ea8c3b0ce9ff87f849b1462aab0b34bd3e35d4ed/.venv/lib/python3.7/site-packages\nSearching for zipp==3.15.0\nBest match: zipp 3.15.0\nAdding zipp 3.15.0 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_ea8c3b0ce9ff87f849b1462aab0b34bd3e35d4ed/.venv/lib/python3.7/site-packages\nSearching for attrs==24.2.0\nBest match: attrs 24.2.0\nAdding attrs 24.2.0 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_ea8c3b0ce9ff87f849b1462aab0b34bd3e35d4ed/.venv/lib/python3.7/site-packages\nSearching for platformdirs==4.0.0\nBest match: platformdirs 4.0.0\nAdding platformdirs 4.0.0 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_ea8c3b0ce9ff87f849b1462aab0b34bd3e35d4ed/.venv/lib/python3.7/site-packages\nSearching for cattrs==23.1.2\nBest match: cattrs 23.1.2\nAdding cattrs 23.1.2 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_ea8c3b0ce9ff87f849b1462aab0b34bd3e35d4ed/.venv/lib/python3.7/site-packages\nSearching for url-normalize==1.4.3\nBest match: url-normalize 1.4.3\nAdding url-normalize 1.4.3 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_ea8c3b0ce9ff87f849b1462aab0b34bd3e35d4ed/.venv/lib/python3.7/site-packages\nSearching for more-itertools==9.1.0\nBest match: more-itertools 9.1.0\nAdding more-itertools 9.1.0 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_ea8c3b0ce9ff87f849b1462aab0b34bd3e35d4ed/.venv/lib/python3.7/site-packages\nSearching for cryptography==44.0.0\nBest match: cryptography 44.0.0\nAdding cryptography 44.0.0 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_ea8c3b0ce9ff87f849b1462aab0b34bd3e35d4ed/.venv/lib/python3.7/site-packages\nSearching for anyio==3.7.1\nBest match: anyio 3.7.1\nAdding anyio 3.7.1 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_ea8c3b0ce9ff87f849b1462aab0b34bd3e35d4ed/.venv/lib/python3.7/site-packages\nSearching for h11==0.12.0\nBest match: h11 0.12.0\nAdding h11 0.12.0 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_ea8c3b0ce9ff87f849b1462aab0b34bd3e35d4ed/.venv/lib/python3.7/site-packages\nSearching for jedi==0.19.2\nBest match: jedi 0.19.2\nAdding jedi 0.19.2 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_ea8c3b0ce9ff87f849b1462aab0b34bd3e35d4ed/.venv/lib/python3.7/site-packages\nSearching for decorator==5.1.1\nBest match: decorator 5.1.1\nAdding decorator 5.1.1 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_ea8c3b0ce9ff87f849b1462aab0b34bd3e35d4ed/.venv/lib/python3.7/site-packages\nSearching for prompt-toolkit==3.0.48\nBest match: prompt-toolkit 3.0.48\nAdding prompt-toolkit 3.0.48 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_ea8c3b0ce9ff87f849b1462aab0b34bd3e35d4ed/.venv/lib/python3.7/site-packages\nSearching for pickleshare==0.7.5\nBest match: pickleshare 0.7.5\nAdding pickleshare 0.7.5 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_ea8c3b0ce9ff87f849b1462aab0b34bd3e35d4ed/.venv/lib/python3.7/site-packages\nSearching for pexpect==4.9.0\nBest match: pexpect 4.9.0\nAdding pexpect 4.9.0 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_ea8c3b0ce9ff87f849b1462aab0b34bd3e35d4ed/.venv/lib/python3.7/site-packages\nSearching for backcall==0.2.0\nBest match: backcall 0.2.0\nAdding backcall 0.2.0 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_ea8c3b0ce9ff87f849b1462aab0b34bd3e35d4ed/.venv/lib/python3.7/site-packages\nSearching for exceptiongroup==1.2.2\nBest match: exceptiongroup 1.2.2\nAdding exceptiongroup 1.2.2 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_ea8c3b0ce9ff87f849b1462aab0b34bd3e35d4ed/.venv/lib/python3.7/site-packages\nSearching for cffi==1.15.1\nBest match: cffi 1.15.1\nAdding cffi 1.15.1 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_ea8c3b0ce9ff87f849b1462aab0b34bd3e35d4ed/.venv/lib/python3.7/site-packages\nSearching for parso==0.8.4\nBest match: parso 0.8.4\nAdding parso 0.8.4 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_ea8c3b0ce9ff87f849b1462aab0b34bd3e35d4ed/.venv/lib/python3.7/site-packages\nSearching for wcwidth==0.2.13\nBest match: wcwidth 0.2.13\nAdding wcwidth 0.2.13 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_ea8c3b0ce9ff87f849b1462aab0b34bd3e35d4ed/.venv/lib/python3.7/site-packages\nSearching for ptyprocess==0.7.0\nBest match: ptyprocess 0.7.0\nAdding ptyprocess 0.7.0 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_ea8c3b0ce9ff87f849b1462aab0b34bd3e35d4ed/.venv/lib/python3.7/site-packages\nSearching for pycparser==2.21\nBest match: pycparser 2.21\nAdding pycparser 2.21 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_ea8c3b0ce9ff87f849b1462aab0b34bd3e35d4ed/.venv/lib/python3.7/site-packages\nFinished processing dependencies for Orange3==3.31.0.dev0+ea8c3b0\nVerifying Orange installation...\n✅ Orange installation successful!\nSuccessfully installed orange using Python 3.7\n",
    "setup_res_stderr": "Using CPython 3.7.9\nCreating virtual environment at: .venv\nActivate with: source .venv/bin/activate\nResolved 18 packages in 46ms\nPrepared 18 packages in 2ms\nInstalled 18 packages in 127ms\n + cython==0.29.37\n + exceptiongroup==1.2.2\n + importlib-metadata==6.7.0\n + iniconfig==2.0.0\n + numpy==1.17.5\n + packaging==24.0\n + pluggy==1.2.0\n + pyqt5==5.15.10\n + pyqt5-qt5==5.15.16\n + pyqt5-sip==12.13.0\n + pyqtwebengine==5.15.6\n + pyqtwebengine-qt5==5.15.16\n + pytest==7.4.4\n + setuptools==59.8.0\n + tomli==2.0.1\n + typing-extensions==4.7.1\n + wheel==0.42.0\n + zipp==3.15.0\nResolved 55 packages in 336ms\nInstalled 48 packages in 898ms\n + anyio==3.7.1\n + baycomp==1.0.3\n + bottleneck==1.4.0\n + certifi==2024.12.14\n + cffi==1.15.1\n + chardet==5.2.0\n + charset-normalizer==3.4.1\n + cryptography==44.0.0\n + cycler==0.11.0\n + et-xmlfile==1.1.0\n + fonttools==4.38.0\n + h11==0.12.0\n + httpcore==0.13.7\n + httpx==0.19.0\n + idna==3.10\n + importlib-resources==5.12.0\n + jaraco-classes==3.2.3\n + jeepney==0.8.0\n + joblib==1.3.2\n + keyring==24.1.1\n + keyrings-alt==4.2.0\n + kiwisolver==1.4.5\n + matplotlib==3.5.3\n + more-itertools==9.1.0\n + networkx==2.6.3\n + openpyxl==3.1.3\n + opentsne==1.0.1\n + pandas==1.3.5\n + pillow==9.5.0\n + pip==24.0\n + pycparser==2.21\n + pyparsing==3.1.4\n + python-dateutil==2.9.0.post0\n + python-louvain==0.16\n + pytz==2024.2\n + pyyaml==6.0.1\n + requests==2.31.0\n + rfc3986==1.5.0\n + scikit-learn==1.0.2\n + scipy==1.7.3\n + secretstorage==3.3.3\n + serverfiles==0.3.1\n + six==1.17.0\n + sniffio==1.3.1\n + threadpoolctl==3.1.0\n + urllib3==2.0.7\n + xlrd==2.0.1\n + xlsxwriter==3.2.0\nResolved 59 packages in 257ms\nInstalled 38 packages in 309ms\n + anyqt==0.2.0\n + attrs==24.2.0\n + backcall==0.2.0\n + cattrs==23.1.2\n + commonmark==0.9.1\n + debugpy==1.7.0\n + decorator==5.1.1\n + dictdiffer==0.9.0\n + docutils==0.20.1\n + entrypoints==0.4\n + ipykernel==6.16.2\n + ipython==7.34.0\n + ipython-genutils==0.2.0\n + jedi==0.19.2\n + jupyter-client==7.4.9\n + jupyter-core==4.12.0\n + matplotlib-inline==0.1.6\n + nest-asyncio==1.6.0\n + orange-canvas-core==0.1.35\n + orange-widget-base==4.22.0\n + parso==0.8.4\n + pexpect==4.9.0\n + pickleshare==0.7.5\n + platformdirs==4.0.0\n + prompt-toolkit==3.0.48\n + psutil==6.1.1\n + ptyprocess==0.7.0\n + pygments==2.17.2\n + pyqtgraph==0.12.4\n + pyzmq==26.2.0\n + qasync==0.25.0\n + qtconsole==5.4.4\n + qtpy==2.4.2\n + requests-cache==1.1.1\n + tornado==6.2\n + traitlets==5.9.0\n + url-normalize==1.4.3\n + wcwidth==0.2.13\nResolved 2 packages in 2ms\nInstalled 2 packages in 34ms\n + psycopg2==2.9.9\n + pymssql==2.3.2\nResolved 19 packages in 21ms\nInstalled 5 packages in 1.22s\n + catboost==1.2.7\n + graphviz==0.20.1\n + plotly==5.18.0\n + tenacity==8.2.3\n + xgboost==1.6.2\nAudited 2 packages in 3ms\nIn file included from /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_ea8c3b0ce9ff87f849b1462aab0b34bd3e35d4ed/.venv/lib/python3.7/site-packages/numpy/core/include/numpy/ndarraytypes.h:1830,\n                 from /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_ea8c3b0ce9ff87f849b1462aab0b34bd3e35d4ed/.venv/lib/python3.7/site-packages/numpy/core/include/numpy/ndarrayobject.h:12,\n                 from /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_ea8c3b0ce9ff87f849b1462aab0b34bd3e35d4ed/.venv/lib/python3.7/site-packages/numpy/core/include/numpy/arrayobject.h:4,\n                 from Orange/classification/_tree_scorers.c:775:\n/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_ea8c3b0ce9ff87f849b1462aab0b34bd3e35d4ed/.venv/lib/python3.7/site-packages/numpy/core/include/numpy/npy_1_7_deprecated_api.h:17:2: warning: #warning \"Using deprecated NumPy API, disable it with \" \"#define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION\" [-Wcpp]\n   17 | #warning \"Using deprecated NumPy API, disable it with \" \\\n      |  ^~~~~~~\nOrange/classification/_tree_scorers.c: In function ‘__pyx_pf_6Orange_14classification_13_tree_scorers_2find_threshold_entropy’:\nOrange/classification/_tree_scorers.c:3413:27: warning: comparison of integer expressions of different signedness: ‘unsigned int’ and ‘int’ [-Wsign-compare]\n 3413 |   __pyx_t_7 = ((__pyx_v_N <= __pyx_v_min_leaf) != 0);\n      |                           ^~\nOrange/classification/_tree_scorers.c: In function ‘__pyx_pf_6Orange_14classification_13_tree_scorers_6find_threshold_MSE’:\nOrange/classification/_tree_scorers.c:4869:27: warning: comparison of integer expressions of different signedness: ‘unsigned int’ and ‘int’ [-Wsign-compare]\n 4869 |   __pyx_t_1 = ((__pyx_v_N <= __pyx_v_min_leaf) != 0);\n      |                           ^~\nOrange/classification/_tree_scorers.c: In function ‘__pyx_pf_6Orange_14classification_13_tree_scorers_8find_binarization_MSE’:\nOrange/classification/_tree_scorers.c:5615:43: warning: comparison of integer expressions of different signedness: ‘unsigned int’ and ‘int’ [-Wsign-compare]\n 5615 |           for (__pyx_t_19 = 0; __pyx_t_19 < __pyx_t_18; __pyx_t_19+=1) {\n      |                                           ^\nOrange/classification/_tree_scorers.c:5736:39: warning: comparison of integer expressions of different signedness: ‘unsigned int’ and ‘int’ [-Wsign-compare]\n 5736 |           __pyx_t_20 = ((__pyx_v_left >= __pyx_v_min_leaf) != 0);\n      |                                       ^~\nOrange/classification/_tree_scorers.c:5742:53: warning: comparison of integer expressions of different signedness: ‘unsigned int’ and ‘int’ [-Wsign-compare]\n 5742 |           __pyx_t_20 = (((__pyx_v_N - __pyx_v_left) >= __pyx_v_min_leaf) != 0);\n      |                                                     ^~\nOrange/classification/_tree_scorers.c: In function ‘__pyx_pf_6Orange_14classification_13_tree_scorers_14compute_predictions_csr’:\nOrange/classification/_tree_scorers.c:7202:41: warning: comparison of integer expressions of different signedness: ‘unsigned int’ and ‘int’ [-Wsign-compare]\n 7202 |         for (__pyx_t_11 = 0; __pyx_t_11 < __pyx_t_10; __pyx_t_11+=1) {\n      |                                         ^\nOrange/classification/_tree_scorers.c: In function ‘__pyx_pf_6Orange_14classification_13_tree_scorers_16compute_predictions_csc’:\nOrange/classification/_tree_scorers.c:7857:41: warning: comparison of integer expressions of different signedness: ‘unsigned int’ and ‘int’ [-Wsign-compare]\n 7857 |         for (__pyx_t_11 = 0; __pyx_t_11 < __pyx_t_10; __pyx_t_11+=1) {\n      |                                         ^\nOrange/classification/_tree_scorers.c:7917:143: warning: comparison of integer expressions of different signedness: ‘__pyx_t_5numpy_int32_t’ {aka ‘int’} and ‘unsigned int’ [-Wsign-compare]\n 7917 |               __pyx_t_15 = (((*((__pyx_t_5numpy_int32_t *) ( /* dim=0 */ (__pyx_v_indices.data + __pyx_t_14 * __pyx_v_indices.strides[0]) ))) != __pyx_v_i) != 0);\n      |                                                                                                                                               ^~\nIn file included from /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_ea8c3b0ce9ff87f849b1462aab0b34bd3e35d4ed/.venv/lib/python3.7/site-packages/numpy/core/include/numpy/ndarraytypes.h:1830,\n                 from /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_ea8c3b0ce9ff87f849b1462aab0b34bd3e35d4ed/.venv/lib/python3.7/site-packages/numpy/core/include/numpy/ndarrayobject.h:12,\n                 from /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_ea8c3b0ce9ff87f849b1462aab0b34bd3e35d4ed/.venv/lib/python3.7/site-packages/numpy/core/include/numpy/arrayobject.h:4,\n                 from Orange/data/_contingency.c:775:\n/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_ea8c3b0ce9ff87f849b1462aab0b34bd3e35d4ed/.venv/lib/python3.7/site-packages/numpy/core/include/numpy/npy_1_7_deprecated_api.h:17:2: warning: #warning \"Using deprecated NumPy API, disable it with \" \"#define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION\" [-Wcpp]\n   17 | #warning \"Using deprecated NumPy API, disable it with \" \\\n      |  ^~~~~~~\nOrange/data/_io.c: In function ‘__pyx_pf_6Orange_4data_3_io_sparse_read_float.constprop’:\nOrange/data/_io.c:4120:43: warning: ‘__pyx_v_decs’ may be used uninitialized in this function [-Wmaybe-uninitialized]\n 4120 |           __pyx_v_value = ((__pyx_v_value * __pyx_v_decs) + (__pyx_v_c & 0xf));\n      |                            ~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~\nOrange/data/_io.c:4318:24: warning: ‘__pyx_v_value’ may be used uninitialized in this function [-Wmaybe-uninitialized]\n 4318 |           __pyx_t_10 = PyFloat_FromDouble(__pyx_v_value); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 223, __pyx_L5_error)\n      |                        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\nOrange/data/_io.c:683:40: warning: ‘__pyx_v_attr_index’ may be used uninitialized in this function [-Wmaybe-uninitialized]\n  683 |   #define PyInt_FromLong               PyLong_FromLong\n      |                                        ^~~~~~~~~~~~~~~\nOrange/data/_io.c:1590:7: note: ‘__pyx_v_attr_index’ was declared here\n 1590 |   int __pyx_v_attr_index;\n      |       ^~~~~~~~~~~~~~~~~~\nOrange/data/_io.c:3183:25: warning: ‘__pyx_v_atomp’ may be used uninitialized in this function [-Wmaybe-uninitialized]\n 3183 |           __pyx_v_atomp = (__pyx_v_atomp + 1);\n      |           ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~\nIn file included from /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_ea8c3b0ce9ff87f849b1462aab0b34bd3e35d4ed/.venv/lib/python3.7/site-packages/numpy/core/include/numpy/ndarraytypes.h:1830,\n                 from /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_ea8c3b0ce9ff87f849b1462aab0b34bd3e35d4ed/.venv/lib/python3.7/site-packages/numpy/core/include/numpy/ndarrayobject.h:12,\n                 from /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_ea8c3b0ce9ff87f849b1462aab0b34bd3e35d4ed/.venv/lib/python3.7/site-packages/numpy/core/include/numpy/arrayobject.h:4,\n                 from Orange/data/_valuecount.c:775:\n/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_ea8c3b0ce9ff87f849b1462aab0b34bd3e35d4ed/.venv/lib/python3.7/site-packages/numpy/core/include/numpy/npy_1_7_deprecated_api.h:17:2: warning: #warning \"Using deprecated NumPy API, disable it with \" \"#define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION\" [-Wcpp]\n   17 | #warning \"Using deprecated NumPy API, disable it with \" \\\n      |  ^~~~~~~\nIn file included from /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_ea8c3b0ce9ff87f849b1462aab0b34bd3e35d4ed/.venv/lib/python3.7/site-packages/numpy/core/include/numpy/ndarraytypes.h:1830,\n                 from /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_ea8c3b0ce9ff87f849b1462aab0b34bd3e35d4ed/.venv/lib/python3.7/site-packages/numpy/core/include/numpy/ndarrayobject.h:12,\n                 from /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_ea8c3b0ce9ff87f849b1462aab0b34bd3e35d4ed/.venv/lib/python3.7/site-packages/numpy/core/include/numpy/arrayobject.h:4,\n                 from Orange/distance/_distance.c:775:\n/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_ea8c3b0ce9ff87f849b1462aab0b34bd3e35d4ed/.venv/lib/python3.7/site-packages/numpy/core/include/numpy/npy_1_7_deprecated_api.h:17:2: warning: #warning \"Using deprecated NumPy API, disable it with \" \"#define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION\" [-Wcpp]\n   17 | #warning \"Using deprecated NumPy API, disable it with \" \\\n      |  ^~~~~~~\nIn file included from /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_ea8c3b0ce9ff87f849b1462aab0b34bd3e35d4ed/.venv/lib/python3.7/site-packages/numpy/core/include/numpy/ndarraytypes.h:1830,\n                 from /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_ea8c3b0ce9ff87f849b1462aab0b34bd3e35d4ed/.venv/lib/python3.7/site-packages/numpy/core/include/numpy/ndarrayobject.h:12,\n                 from /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_ea8c3b0ce9ff87f849b1462aab0b34bd3e35d4ed/.venv/lib/python3.7/site-packages/numpy/core/include/numpy/arrayobject.h:4,\n                 from Orange/preprocess/_discretize.c:774:\n/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_ea8c3b0ce9ff87f849b1462aab0b34bd3e35d4ed/.venv/lib/python3.7/site-packages/numpy/core/include/numpy/npy_1_7_deprecated_api.h:17:2: warning: #warning \"Using deprecated NumPy API, disable it with \" \"#define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION\" [-Wcpp]\n   17 | #warning \"Using deprecated NumPy API, disable it with \" \\\n      |  ^~~~~~~\nIn file included from /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_ea8c3b0ce9ff87f849b1462aab0b34bd3e35d4ed/.venv/lib/python3.7/site-packages/numpy/core/include/numpy/ndarraytypes.h:1830,\n                 from /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_ea8c3b0ce9ff87f849b1462aab0b34bd3e35d4ed/.venv/lib/python3.7/site-packages/numpy/core/include/numpy/ndarrayobject.h:12,\n                 from /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_ea8c3b0ce9ff87f849b1462aab0b34bd3e35d4ed/.venv/lib/python3.7/site-packages/numpy/core/include/numpy/arrayobject.h:4,\n                 from Orange/preprocess/_relieff.cpp:790:\n/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_ea8c3b0ce9ff87f849b1462aab0b34bd3e35d4ed/.venv/lib/python3.7/site-packages/numpy/core/include/numpy/npy_1_7_deprecated_api.h:17:2: warning: #warning \"Using deprecated NumPy API, disable it with \" \"#define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION\" [-Wcpp]\n   17 | #warning \"Using deprecated NumPy API, disable it with \" \\\n      |  ^~~~~~~\nIn file included from /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_ea8c3b0ce9ff87f849b1462aab0b34bd3e35d4ed/.venv/lib/python3.7/site-packages/numpy/core/include/numpy/ndarraytypes.h:1830,\n                 from /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_ea8c3b0ce9ff87f849b1462aab0b34bd3e35d4ed/.venv/lib/python3.7/site-packages/numpy/core/include/numpy/ndarrayobject.h:12,\n                 from /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_ea8c3b0ce9ff87f849b1462aab0b34bd3e35d4ed/.venv/lib/python3.7/site-packages/numpy/core/include/numpy/arrayobject.h:4,\n                 from Orange/projection/_som.c:775:\n/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_ea8c3b0ce9ff87f849b1462aab0b34bd3e35d4ed/.venv/lib/python3.7/site-packages/numpy/core/include/numpy/npy_1_7_deprecated_api.h:17:2: warning: #warning \"Using deprecated NumPy API, disable it with \" \"#define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION\" [-Wcpp]\n   17 | #warning \"Using deprecated NumPy API, disable it with \" \\\n      |  ^~~~~~~\nOrange/projection/_som.c: In function ‘__pyx_pw_6Orange_10projection_4_som_5update_hex’:\nOrange/projection/_som.c:3863:7: warning: ‘__pyx_v_win_y’ may be used uninitialized in this function [-Wmaybe-uninitialized]\n 3863 |   int __pyx_v_win_y;\n      |       ^~~~~~~~~~~~~\nOrange/projection/_som.c:3862:7: warning: ‘__pyx_v_win_x’ may be used uninitialized in this function [-Wmaybe-uninitialized]\n 3862 |   int __pyx_v_win_x;\n      |       ^~~~~~~~~~~~~\nOrange/projection/_som.c: In function ‘__pyx_pf_6Orange_10projection_4_som_8update_sparse.constprop’:\nOrange/projection/_som.c:4934:7: warning: ‘__pyx_v_win_y’ may be used uninitialized in this function [-Wmaybe-uninitialized]\n 4934 |   int __pyx_v_win_y;\n      |       ^~~~~~~~~~~~~\nOrange/projection/_som.c:4933:7: warning: ‘__pyx_v_win_x’ may be used uninitialized in this function [-Wmaybe-uninitialized]\n 4933 |   int __pyx_v_win_x;\n      |       ^~~~~~~~~~~~~\nOrange/projection/_som.c: In function ‘__pyx_pw_6Orange_10projection_4_som_7get_winners_sparse’:\nOrange/projection/_som.c:4732:223: warning: ‘__pyx_v_win_y’ may be used uninitialized in this function [-Wmaybe-uninitialized]\n 4732 |           *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_int16_t *, __pyx_pybuffernd_winners.rcbuffer->pybuffer.buf, __pyx_t_26, __pyx_pybuffernd_winners.diminfo[0].strides, __pyx_t_27, __pyx_pybuffernd_winners.diminfo[1].strides) = __pyx_v_win_y;\n      |           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~\nOrange/projection/_som.c:4307:7: note: ‘__pyx_v_win_y’ was declared here\n 4307 |   int __pyx_v_win_y;\n      |       ^~~~~~~~~~~~~\nOrange/projection/_som.c:4721:223: warning: ‘__pyx_v_win_x’ may be used uninitialized in this function [-Wmaybe-uninitialized]\n 4721 |           *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_int16_t *, __pyx_pybuffernd_winners.rcbuffer->pybuffer.buf, __pyx_t_27, __pyx_pybuffernd_winners.diminfo[0].strides, __pyx_t_26, __pyx_pybuffernd_winners.diminfo[1].strides) = __pyx_v_win_x;\n      |           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~\nOrange/projection/_som.c:4306:7: note: ‘__pyx_v_win_x’ was declared here\n 4306 |   int __pyx_v_win_x;\n      |       ^~~~~~~~~~~~~\nOrange/projection/_som.c: In function ‘__pyx_pf_6Orange_10projection_4_som_10update_sparse_hex.constprop’:\nOrange/projection/_som.c:5682:7: warning: ‘__pyx_v_win_y’ may be used uninitialized in this function [-Wmaybe-uninitialized]\n 5682 |   int __pyx_v_win_y;\n      |       ^~~~~~~~~~~~~\nOrange/projection/_som.c:5681:7: warning: ‘__pyx_v_win_x’ may be used uninitialized in this function [-Wmaybe-uninitialized]\n 5681 |   int __pyx_v_win_x;\n      |       ^~~~~~~~~~~~~\nOrange/projection/_som.c: In function ‘__pyx_pw_6Orange_10projection_4_som_1get_winners’:\nOrange/projection/_som.c:3184:223: warning: ‘__pyx_v_win_y’ may be used uninitialized in this function [-Wmaybe-uninitialized]\n 3184 |           *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_int16_t *, __pyx_pybuffernd_winners.rcbuffer->pybuffer.buf, __pyx_t_22, __pyx_pybuffernd_winners.diminfo[0].strides, __pyx_t_23, __pyx_pybuffernd_winners.diminfo[1].strides) = __pyx_v_win_y;\n      |           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~\nOrange/projection/_som.c:2887:7: note: ‘__pyx_v_win_y’ was declared here\n 2887 |   int __pyx_v_win_y;\n      |       ^~~~~~~~~~~~~\nOrange/projection/_som.c:3173:223: warning: ‘__pyx_v_win_x’ may be used uninitialized in this function [-Wmaybe-uninitialized]\n 3173 |           *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_int16_t *, __pyx_pybuffernd_winners.rcbuffer->pybuffer.buf, __pyx_t_23, __pyx_pybuffernd_winners.diminfo[0].strides, __pyx_t_22, __pyx_pybuffernd_winners.diminfo[1].strides) = __pyx_v_win_x;\n      |           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~\nOrange/projection/_som.c:2886:7: note: ‘__pyx_v_win_x’ was declared here\n 2886 |   int __pyx_v_win_x;\n      |       ^~~~~~~~~~~~~\nOrange/projection/_som.c: In function ‘__pyx_pw_6Orange_10projection_4_som_3update’:\nOrange/projection/_som.c:3357:7: warning: ‘__pyx_v_win_y’ may be used uninitialized in this function [-Wmaybe-uninitialized]\n 3357 |   int __pyx_v_win_y;\n      |       ^~~~~~~~~~~~~\nOrange/classification/_simple_tree.c: In function ‘gain_ratio_c’:\nOrange/classification/_simple_tree.c:63:9: warning: implicit declaration of function ‘qsort_r’; did you mean ‘qsort’? [-Wimplicit-function-declaration]\n   63 |         qsort_r(base, nel, size, compar, thunk)\n      |         ^~~~~~~\nOrange/classification/_simple_tree.c:147:9: note: in expansion of macro ‘QSORT_R_FUNC’\n  147 |         QSORT_R_FUNC(examples, size, sizeof(struct Example), (void*) &compar_attr, compar_examples);\n      |         ^~~~~~~~~~~~\n/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_ea8c3b0ce9ff87f849b1462aab0b34bd3e35d4ed/.venv/lib/python3.7/site-packages/setuptools/command/easy_install.py:159: EasyInstallDeprecationWarning: easy_install command is deprecated. Use build and pip and other standards-based tools.\n  EasyInstallDeprecationWarning,\n/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_ea8c3b0ce9ff87f849b1462aab0b34bd3e35d4ed/.venv/lib/python3.7/site-packages/setuptools/command/install.py:37: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.\n  setuptools.SetuptoolsDeprecationWarning,\nwarning: no files found matching 'README*' under directory 'Orange'\nwarning: no files found matching 'LICENSE' under directory 'Orange'\nwarning: no files found matching '*.basket' under directory 'Orange/datasets'\nwarning: no files found matching '*.js' under directory 'Orange/widgets'\nwarning: no files found matching '*.css' under directory 'Orange/widgets'\nwarning: no files found matching '*.html' under directory 'Orange/widgets'\nwarning: no files found matching 'COPYING'\n",
    "new_commit_res_code": 0,
    "new_commit_res_stdout": "============================= test session starts ==============================\nplatform linux -- Python 3.7.9, pytest-7.4.4, pluggy-1.2.0\nrootdir: /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_ea8c3b0ce9ff87f849b1462aab0b34bd3e35d4ed\nplugins: anyio-3.7.1\ncollected 45 items\n\nr2e_tests/test_1.py .............................................        [100%]\n\n==================================== PASSES ====================================\n=========================== short test summary info ============================\nPASSED r2e_tests/test_1.py::PickleDomain::test_empty_domain\nPASSED r2e_tests/test_1.py::PickleDomain::test_with_class_and_metas\nPASSED r2e_tests/test_1.py::PickleDomain::test_with_continuous_class\nPASSED r2e_tests/test_1.py::PickleDomain::test_with_continuous_variable\nPASSED r2e_tests/test_1.py::PickleDomain::test_with_discrete_class\nPASSED r2e_tests/test_1.py::PickleDomain::test_with_discrete_variable\nPASSED r2e_tests/test_1.py::PickleDomain::test_with_metas\nPASSED r2e_tests/test_1.py::PickleDomain::test_with_mixed_variables\nPASSED r2e_tests/test_1.py::PickleDomain::test_with_multiple_classes\nPASSED r2e_tests/test_1.py::TestDomainInit::test_contains\nPASSED r2e_tests/test_1.py::TestDomainInit::test_conversion\nPASSED r2e_tests/test_1.py::TestDomainInit::test_conversion_size\nPASSED r2e_tests/test_1.py::TestDomainInit::test_copy\nPASSED r2e_tests/test_1.py::TestDomainInit::test_different_domains_with_same_attributes_are_equal\nPASSED r2e_tests/test_1.py::TestDomainInit::test_domain_conversion_is_fast_enough\nPASSED r2e_tests/test_1.py::TestDomainInit::test_domain_conversion_sparsity\nPASSED r2e_tests/test_1.py::TestDomainInit::test_from_numpy_dimensions\nPASSED r2e_tests/test_1.py::TestDomainInit::test_from_numpy_names\nPASSED r2e_tests/test_1.py::TestDomainInit::test_from_numpy_values\nPASSED r2e_tests/test_1.py::TestDomainInit::test_get_conversion\nPASSED r2e_tests/test_1.py::TestDomainInit::test_get_item\nPASSED r2e_tests/test_1.py::TestDomainInit::test_get_item_error\nPASSED r2e_tests/test_1.py::TestDomainInit::test_get_item_similar_vars\nPASSED r2e_tests/test_1.py::TestDomainInit::test_get_item_slices\nPASSED r2e_tests/test_1.py::TestDomainInit::test_has_continuous\nPASSED r2e_tests/test_1.py::TestDomainInit::test_has_discrete\nPASSED r2e_tests/test_1.py::TestDomainInit::test_has_time\nPASSED r2e_tests/test_1.py::TestDomainInit::test_index\nPASSED r2e_tests/test_1.py::TestDomainInit::test_index_error\nPASSED r2e_tests/test_1.py::TestDomainInit::test_init_class\nPASSED r2e_tests/test_1.py::TestDomainInit::test_init_class_list\nPASSED r2e_tests/test_1.py::TestDomainInit::test_init_metas\nPASSED r2e_tests/test_1.py::TestDomainInit::test_init_multi_class\nPASSED r2e_tests/test_1.py::TestDomainInit::test_init_no_class\nPASSED r2e_tests/test_1.py::TestDomainInit::test_init_no_class_false\nPASSED r2e_tests/test_1.py::TestDomainInit::test_init_source\nPASSED r2e_tests/test_1.py::TestDomainInit::test_init_source_class\nPASSED r2e_tests/test_1.py::TestDomainInit::test_iter\nPASSED r2e_tests/test_1.py::TestDomainInit::test_nonunique_domain_error\nPASSED r2e_tests/test_1.py::TestDomainInit::test_preprocessor_chaining\nPASSED r2e_tests/test_1.py::TestDomainInit::test_str\nPASSED r2e_tests/test_1.py::TestDomainInit::test_wrong_types\nPASSED r2e_tests/test_1.py::TestDomainInit::test_wrong_vartypes\nPASSED r2e_tests/test_1.py::TestDomainInit::test_wrong_vartypes_w_source\nPASSED r2e_tests/test_1.py::TestDomainFilter::test_filter_visible\n============================== 45 passed in 1.94s ==============================\n",
    "new_commit_res_stderr": "",
    "old_commit_res_code": 1,
    "old_commit_res_stdout": "============================= test session starts ==============================\nplatform linux -- Python 3.7.9, pytest-7.4.4, pluggy-1.2.0\nrootdir: /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_ea8c3b0ce9ff87f849b1462aab0b34bd3e35d4ed\nplugins: anyio-3.7.1\ncollected 45 items\n\nr2e_tests/test_1.py .....................................F.......        [100%]\n\n=================================== FAILURES ===================================\n___________________________ TestDomainInit.test_iter ___________________________\n\nself = <r2e_tests.test_1.TestDomainInit testMethod=test_iter>\n\n    def test_iter(self):\n        d = Domain((age, gender, income), metas=(ssn,))\n>       self.assertEqual(list(d), [age, gender, income, ssn])\nE       AssertionError: Lists differ: [Cont[123 chars]me='income', number_of_decimals=3)] != [Cont[123 chars]me='income', number_of_decimals=3), StringVariable(name='SSN')]\nE       \nE       Second list contains 1 additional elements.\nE       First extra element 3:\nE       StringVariable(name='SSN')\nE       \nE         [ContinuousVariable(name='AGE', number_of_decimals=5),\nE          DiscreteVariable(name='Gender', values=('M', 'F')),\nE       -  ContinuousVariable(name='income', number_of_decimals=3)]\nE       ?                                                         ^\nE       \nE       +  ContinuousVariable(name='income', number_of_decimals=3),\nE       ?                                                         ^\nE       \nE       +  StringVariable(name='SSN')]\n\nr2e_tests/test_1.py:274: AssertionError\n==================================== PASSES ====================================\n=========================== short test summary info ============================\nPASSED r2e_tests/test_1.py::PickleDomain::test_empty_domain\nPASSED r2e_tests/test_1.py::PickleDomain::test_with_class_and_metas\nPASSED r2e_tests/test_1.py::PickleDomain::test_with_continuous_class\nPASSED r2e_tests/test_1.py::PickleDomain::test_with_continuous_variable\nPASSED r2e_tests/test_1.py::PickleDomain::test_with_discrete_class\nPASSED r2e_tests/test_1.py::PickleDomain::test_with_discrete_variable\nPASSED r2e_tests/test_1.py::PickleDomain::test_with_metas\nPASSED r2e_tests/test_1.py::PickleDomain::test_with_mixed_variables\nPASSED r2e_tests/test_1.py::PickleDomain::test_with_multiple_classes\nPASSED r2e_tests/test_1.py::TestDomainInit::test_contains\nPASSED r2e_tests/test_1.py::TestDomainInit::test_conversion\nPASSED r2e_tests/test_1.py::TestDomainInit::test_conversion_size\nPASSED r2e_tests/test_1.py::TestDomainInit::test_copy\nPASSED r2e_tests/test_1.py::TestDomainInit::test_different_domains_with_same_attributes_are_equal\nPASSED r2e_tests/test_1.py::TestDomainInit::test_domain_conversion_is_fast_enough\nPASSED r2e_tests/test_1.py::TestDomainInit::test_domain_conversion_sparsity\nPASSED r2e_tests/test_1.py::TestDomainInit::test_from_numpy_dimensions\nPASSED r2e_tests/test_1.py::TestDomainInit::test_from_numpy_names\nPASSED r2e_tests/test_1.py::TestDomainInit::test_from_numpy_values\nPASSED r2e_tests/test_1.py::TestDomainInit::test_get_conversion\nPASSED r2e_tests/test_1.py::TestDomainInit::test_get_item\nPASSED r2e_tests/test_1.py::TestDomainInit::test_get_item_error\nPASSED r2e_tests/test_1.py::TestDomainInit::test_get_item_similar_vars\nPASSED r2e_tests/test_1.py::TestDomainInit::test_get_item_slices\nPASSED r2e_tests/test_1.py::TestDomainInit::test_has_continuous\nPASSED r2e_tests/test_1.py::TestDomainInit::test_has_discrete\nPASSED r2e_tests/test_1.py::TestDomainInit::test_has_time\nPASSED r2e_tests/test_1.py::TestDomainInit::test_index\nPASSED r2e_tests/test_1.py::TestDomainInit::test_index_error\nPASSED r2e_tests/test_1.py::TestDomainInit::test_init_class\nPASSED r2e_tests/test_1.py::TestDomainInit::test_init_class_list\nPASSED r2e_tests/test_1.py::TestDomainInit::test_init_metas\nPASSED r2e_tests/test_1.py::TestDomainInit::test_init_multi_class\nPASSED r2e_tests/test_1.py::TestDomainInit::test_init_no_class\nPASSED r2e_tests/test_1.py::TestDomainInit::test_init_no_class_false\nPASSED r2e_tests/test_1.py::TestDomainInit::test_init_source\nPASSED r2e_tests/test_1.py::TestDomainInit::test_init_source_class\nPASSED r2e_tests/test_1.py::TestDomainInit::test_nonunique_domain_error\nPASSED r2e_tests/test_1.py::TestDomainInit::test_preprocessor_chaining\nPASSED r2e_tests/test_1.py::TestDomainInit::test_str\nPASSED r2e_tests/test_1.py::TestDomainInit::test_wrong_types\nPASSED r2e_tests/test_1.py::TestDomainInit::test_wrong_vartypes\nPASSED r2e_tests/test_1.py::TestDomainInit::test_wrong_vartypes_w_source\nPASSED r2e_tests/test_1.py::TestDomainFilter::test_filter_visible\nFAILED r2e_tests/test_1.py::TestDomainInit::test_iter - AssertionError: Lists...\n========================= 1 failed, 44 passed in 1.83s =========================\n",
    "old_commit_res_stderr": ""
}
Orange/data/domain.py Orange/tests/test_domain.py
We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
[ISSUE]

**Title:** Iterating over Domain excludes meta variables, causing incomplete results

**Description:**
When creating a `Domain` with both variables and meta variables, iterating over the `Domain` instance does not include the meta variables. This behavior is unexpected and leads to discrepancies between the expected and actual iteration results.

**Example Code:**
```python
d = Domain((age, gender, income), metas=(ssn,))
variables = list(d)
print(variables)
# Expected output: [age, gender, income, ssn]
# Actual output: [age, gender, income]
```

**Expected Behavior:**
Iterating over a `Domain` instance should include all variables, including meta variables, resulting in a complete list of all attributes.

**Actual Behavior:**
The meta variables are excluded from the iteration, resulting in an incomplete list that only contains the main variables.

[/ISSUE]
--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.

--- BEGIN FILE ---
```
### Orange/data/domain.py
import warnings

from math import log
from collections.abc import Iterable
from itertools import chain
from numbers import Integral

import numpy as np

from Orange.data import (
    Unknown, Variable, ContinuousVariable, DiscreteVariable, StringVariable
)
from Orange.util import deprecated, OrangeDeprecationWarning

__all__ = ["DomainConversion", "Domain"]


class DomainConversion:
    """
    Indices and functions for conversion between domains.

    Every list contains indices (instances of int) of variables in the
    source domain, or the variable's compute_value function if the source
    domain does not contain the variable.

    .. attribute:: source

        The source domain. The destination is not stored since destination
        domain is the one which contains the instance of DomainConversion.

    .. attribute:: attributes

        Indices for attribute values.

    .. attribute:: class_vars

        Indices for class variables

    .. attribute:: variables

        Indices for attributes and class variables
        (:obj:`attributes`+:obj:`class_vars`).

    .. attribute:: metas

        Indices for meta attributes

    .. attribute:: sparse_X

        Flag whether the resulting X matrix should be sparse.

    .. attribute:: sparse_Y

        Flag whether the resulting Y matrix should be sparse.

    .. attribute:: sparse_metas

        Flag whether the resulting metas matrix should be sparse.
    """

    def __init__(self, source, destination):
        """
        Compute the conversion indices from the given `source` to `destination`
        """
        def match(var):
            if var in source:
                sourcevar = source[var]
                sourceindex = source.index(sourcevar)
                if var.is_discrete and var is not sourcevar:
                    mapping = var.get_mapper_from(sourcevar)
                    return lambda table: mapping(table.get_column_view(sourceindex)[0])
                return source.index(var)
            return var.compute_value  # , which may also be None

        self.source = source

        self.attributes = [match(var) for var in destination.attributes]
        self.class_vars = [match(var) for var in destination.class_vars]
        self.variables = self.attributes + self.class_vars
        self.metas = [match(var) for var in destination.metas]

        def should_be_sparse(feats):
            """
            For a matrix to be stored in sparse, more than 2/3 of columns
            should be marked as sparse and there should be no string columns
            since Scipy's sparse matrices don't support dtype=object.
            """
            fraction_sparse = sum(f.sparse for f in feats) / max(len(feats), 1)
            contain_strings = any(f.is_string for f in feats)
            return fraction_sparse > 2/3 and not contain_strings

        # check whether X, Y or metas should be sparse
        self.sparse_X = should_be_sparse(destination.attributes)
        self.sparse_Y = should_be_sparse(destination.class_vars)
        self.sparse_metas = should_be_sparse(destination.metas)


def filter_visible(feats):
    """
    Args:
        feats (iterable): Features to be filtered.

    Returns: A filtered tuple of features that are visible (i.e. not hidden).
    """
    return (f for f in feats if not f.attributes.get('hidden', False))


class Domain:
    def __init__(self, attributes, class_vars=None, metas=None, source=None):
        """
        Initialize a new domain descriptor. Arguments give the features and
        the class attribute(s). They can be described by descriptors (instances
        of :class:`Variable`), or by indices or names if the source domain is
        given.

        :param attributes: a list of attributes
        :type attributes: list of :class:`Variable`
        :param class_vars: target variable or a list of target variables
        :type class_vars: :class:`Variable` or list of :class:`Variable`
        :param metas: a list of meta attributes
        :type metas: list of :class:`Variable`
        :param source: the source domain for attributes
        :type source: Orange.data.Domain
        :return: a new domain
        :rtype: :class:`Domain`
        """

        if class_vars is None:
            class_vars = []
        elif isinstance(class_vars, (Variable, Integral, str)):
            class_vars = [class_vars]
        elif isinstance(class_vars, Iterable):
            class_vars = list(class_vars)

        if not isinstance(attributes, list):
            attributes = list(attributes)
        metas = list(metas) if metas else []

        # Replace str's and int's with descriptors if 'source' is given;
        # complain otherwise
        for lst in (attributes, class_vars, metas):
            for i, var in enumerate(lst):
                if not isinstance(var, Variable):
                    if source is not None and isinstance(var, (str, int)):
                        lst[i] = source[var]
                    else:
                        raise TypeError(
                            "descriptors must be instances of Variable, "
                            "not '%s'" % type(var).__name__)

        names = [var.name for var in chain(attributes, class_vars, metas)]
        if len(names) != len(set(names)):
            raise Exception('All variables in the domain should have'
                            ' unique names.')

        # Store everything
        self.attributes = tuple(attributes)
        self.class_vars = tuple(class_vars)
        self._variables = self.attributes + self.class_vars
        self._metas = tuple(metas)
        self.class_var = \
            self.class_vars[0] if len(self.class_vars) == 1 else None
        if not all(var.is_primitive() for var in self._variables):
            raise TypeError("variables must be primitive")

        self._indices = dict(chain.from_iterable(
            ((var, idx), (var.name, idx), (idx, idx))
            for idx, var in enumerate(self._variables)))
        self._indices.update(chain.from_iterable(
            ((var, -1-idx), (var.name, -1-idx), (-1-idx, -1-idx))
            for idx, var in enumerate(self.metas)))

        self.anonymous = False

        self._hash = None  # cache for __hash__()

    # noinspection PyPep8Naming
    @classmethod
    def from_numpy(cls, X, Y=None, metas=None):
        """
        Create a domain corresponding to the given numpy arrays. This method
        is usually invoked from :meth:`Orange.data.Table.from_numpy`.

        All attributes are assumed to be continuous and are named
        "Feature <n>". Target variables are discrete if the only two values
        are 0 and 1; otherwise they are continuous. Discrete
        targets are named "Class <n>" and continuous are named "Target <n>".
        Domain is marked as :attr:`anonymous`, so data from any other domain of
        the same shape can be converted into this one and vice-versa.

        :param `numpy.ndarray` X: 2-dimensional array with data
        :param Y: 1- of 2- dimensional data for target
        :type Y: `numpy.ndarray` or None
        :param `numpy.ndarray` metas: meta attributes
        :type metas: `numpy.ndarray` or None
        :return: a new domain
        :rtype: :class:`Domain`
        """
        def get_places(max_index):
            return 0 if max_index == 1 else int(log(max_index, 10)) + 1

        def get_name(base, index, places):
            return base if not places \
                else "{} {:0{}}".format(base, index + 1, places)

        if X.ndim != 2:
            raise ValueError('X must be a 2-dimensional array')
        n_attrs = X.shape[1]
        places = get_places(n_attrs)
        attr_vars = [ContinuousVariable(name=get_name("Feature", a, places))
                     for a in range(n_attrs)]
        class_vars = []
        if Y is not None:
            if Y.ndim == 1:
                Y = Y.reshape(len(Y), 1)
            elif Y.ndim != 2:
                raise ValueError('Y has invalid shape')
            n_classes = Y.shape[1]
            places = get_places(n_classes)
            for i, values in enumerate(Y.T):
                if set(values) == {0, 1}:
                    name = get_name('Class', i, places)
                    values = ['v1', 'v2']
                    class_vars.append(DiscreteVariable(name, values))
                else:
                    name = get_name('Target', i + 1, places)
                    class_vars.append(ContinuousVariable(name))
        if metas is not None:
            n_metas = metas.shape[1]
            places = get_places(n_metas)
            meta_vars = [StringVariable(get_name("Meta", m, places))
                         for m in range(n_metas)]
        else:
            meta_vars = []

        domain = cls(attr_vars, class_vars, meta_vars)
        domain.anonymous = True
        return domain

    @property
    def variables(self):
        return self._variables

    @property
    def metas(self):
        return self._metas

    @deprecated("len(Domain.variables)")
    def __len__(self):
        """The number of variables (features and class attributes).

        The current behavior returns the length of only features and
        class attributes. In the near future, it will include the
        length of metas, too, and __iter__ will act accordingly."""
        return len(self._variables)

    def __bool__(self):
        warnings.warn(
            "Domain.__bool__ is ambiguous; use 'is None' or 'empty' instead",
            OrangeDeprecationWarning, stacklevel=2)
        return len(self) > 0  # Keep the obsolete behaviour

    def empty(self):
        """True if the domain has no variables of any kind"""
        return not self.variables and not self.metas

    def _get_equivalent(self, var):
        if isinstance(var, Variable):
            index = self._indices.get(var.name)
            if index is not None:
                if index >= 0:
                    myvar = self.variables[index]
                else:
                    myvar = self.metas[-1 - index]
                if myvar == var:
                    return myvar
        return None

    def __getitem__(self, idx):
        """
        Return a variable descriptor from the given argument, which can be
        a descriptor, index or name. If `var` is a descriptor, the function
        returns this same object.

        :param idx: index, name or descriptor
        :type idx: int, str or :class:`Variable`
        :return: an instance of :class:`Variable` described by `var`
        :rtype: :class:`Variable`
        """
        if isinstance(idx, slice):
            return self._variables[idx]

        index = self._indices.get(idx)
        if index is None:
            var = self._get_equivalent(idx)
            if var is not None:
                return var
            raise KeyError(idx)
        if index >= 0:
            return self.variables[index]
        else:
            return self.metas[-1 - index]

    def __contains__(self, item):
        """
        Return `True` if the item (`str`, `int`, :class:`Variable`) is
        in the domain.
        """
        return item in self._indices or self._get_equivalent(item) is not None

    @deprecated("Domain.variables")
    def __iter__(self):
        """
        Return an iterator through variables (features and class attributes).

        The current behaviour is confusing, as `x in domain` returns True
        for meta variables, but iter(domain) does not yield them.
        This will be consolidated eventually (in 3.12?), the code that
        currently iterates over domain should iterate over domain.variables
        instead.
        """
        return iter(self._variables)

    def __str__(self):
        """
        Return a list-like string with the domain's features, class attributes
        and meta attributes.
        """
        s = "[" + ", ".join(attr.name for attr in self.attributes)
        if self.class_vars:
            s += " | " + ", ".join(cls.name for cls in self.class_vars)
        s += "]"
        if self._metas:
            s += " {" + ", ".join(meta.name for meta in self._metas) + "}"
        return s

    __repr__ = __str__

    def index(self, var):
        """
        Return the index of the given variable or meta attribute, represented
        with an instance of :class:`Variable`, `int` or `str`.
        """

        idx = self._indices.get(var)
        if idx is not None:
            return idx
        equiv = self._get_equivalent(var)
        if equiv is not None:
            return self._indices[equiv]

        raise ValueError("'%s' is not in domain" % var)

    def has_discrete_attributes(self, include_class=False, include_metas=False):
        """
        Return `True` if domain has any discrete attributes. If
        `include_class` is set, the check includes the class attribute(s). If
        `include_metas` is set, the check includes the meta attributes.
        """
        vars = self.variables if include_class else self.attributes
        vars += self.metas if include_metas else ()
        return any(var.is_discrete for var in vars)

    def has_continuous_attributes(self, include_class=False, include_metas=False):
        """
        Return `True` if domain has any continuous attributes. If
        `include_class` is set, the check includes the class attribute(s). If
        `include_metas` is set, the check includes the meta attributes.
        """
        vars = self.variables if include_class else self.attributes
        vars += self.metas if include_metas else ()
        return any(var.is_continuous for var in vars)

    def has_time_attributes(self, include_class=False, include_metas=False):
        """
        Return `True` if domain has any time attributes. If
        `include_class` is set, the check includes the class attribute(s). If
        `include_metas` is set, the check includes the meta attributes.
        """
        vars = self.variables if include_class else self.attributes
        vars += self.metas if include_metas else ()
        return any(var.is_time for var in vars)

    @property
    def has_continuous_class(self):
        return bool(self.class_var and self.class_var.is_continuous)

    @property
    def has_discrete_class(self):
        return bool(self.class_var and self.class_var.is_discrete)

    @property
    def has_time_class(self):
        return bool(self.class_var and self.class_var.is_time)

    # noinspection PyProtectedMember
    def convert(self, inst):
        """
        Convert a data instance from another domain to this domain.

        :param inst: The data instance to be converted
        :return: The data instance in this domain
        """
        from .instance import Instance

        if isinstance(inst, Instance):
            if inst.domain == self:
                return inst._x, inst._y, inst._metas
            c = DomainConversion(inst.domain, self)
            l = len(inst.domain.attributes)
            values = [(inst._x[i] if 0 <= i < l
                       else inst._y[i - l] if i >= l
                       else inst._metas[-i - 1])
                      if isinstance(i, int)
                      else (Unknown if not i else i(inst))
                      for i in c.variables]
            metas = [(inst._x[i] if 0 <= i < l
                      else inst._y[i - l] if i >= l
                      else inst._metas[-i - 1])
                     if isinstance(i, int)
                     else (Unknown if not i else i(inst))
                     for i in c.metas]
        else:
            nvars = len(self._variables)
            nmetas = len(self._metas)
            if len(inst) != nvars and len(inst) != nvars + nmetas:
                raise ValueError("invalid data length for domain")
            values = [var.to_val(val)
                      for var, val in zip(self._variables, inst)]
            if len(inst) == nvars + nmetas:
                metas = [var.to_val(val)
                         for var, val in zip(self._metas, inst[nvars:])]
            else:
                metas = [var.Unknown for var in self._metas]
        nattrs = len(self.attributes)
        # Let np.array decide dtype for values
        return np.array(values[:nattrs]), np.array(values[nattrs:]),\
               np.array(metas, dtype=object)

    def select_columns(self, col_idx):
        attributes, col_indices = self._compute_col_indices(col_idx)
        if attributes is not None:
            n_attrs = len(self.attributes)
            r_attrs = [attributes[i]
                       for i, col in enumerate(col_indices)
                       if 0 <= col < n_attrs]
            r_classes = [attributes[i]
                         for i, col in enumerate(col_indices)
                         if col >= n_attrs]
            r_metas = [attributes[i]
                       for i, col in enumerate(col_indices) if col < 0]
            return Domain(r_attrs, r_classes, r_metas)
        else:
            return self

    def _compute_col_indices(self, col_idx):
        if col_idx is ...:
            return None, None
        if isinstance(col_idx, np.ndarray) and col_idx.dtype == bool:
            return ([attr for attr, c in zip(self, col_idx) if c],
                    np.nonzero(col_idx))
        elif isinstance(col_idx, slice):
            s = len(self.variables)
            start, end, stride = col_idx.indices(s)
            if col_idx.indices(s) == (0, s, 1):
                return None, None
            else:
                return (self[col_idx],
                        np.arange(start, end, stride))
        elif isinstance(col_idx, Iterable) and not isinstance(col_idx, str):
            attributes = [self[col] for col in col_idx]
            if attributes == self.attributes:
                return None, None
            return attributes, np.fromiter(
                (self.index(attr) for attr in attributes), int)
        elif isinstance(col_idx, Integral):
            attr = self[col_idx]
        else:
            attr = self[col_idx]
            col_idx = self.index(attr)
        return [attr], np.array([col_idx])

    def checksum(self):
        return hash(self)

    def copy(self):
        """
        Make a copy of the domain. New features are proxies of the old ones,
        hence the new domain can be used anywhere the old domain was used.

        Returns:
            Domain: a copy of the domain.
        """
        return Domain(
            attributes=[a.make_proxy() for a in self.attributes],
            class_vars=[a.make_proxy() for a in self.class_vars],
            metas=[a.make_proxy() for a in self.metas],
            source=self,
        )

    def __eq__(self, other):
        if not isinstance(other, Domain):
            return False

        return (self.attributes == other.attributes and
                self.class_vars == other.class_vars and
                self.metas == other.metas)

    def __hash__(self):
        if self._hash is None:
            self._hash = hash(self.attributes) ^ hash(self.class_vars) ^ hash(self.metas)
        return self._hash

```
--- END FILE ---

Please first localize the bug based on the issue statement, and then generate *SEARCH/REPLACE* edits to fix the issue.

Every *SEARCH/REPLACE* edit must use this format:
1. The file path
2. The start of search block: <<<<<<< SEARCH
3. A contiguous chunk of lines to search for in the existing source code
4. The dividing line: =======
5. The lines to replace into the source code
6. The end of the replace block: >>>>>>> REPLACE

Here is an example:

```python
### mathweb/flask/app.py
<<<<<<< SEARCH
from flask import Flask
=======
import math
from flask import Flask
>>>>>>> REPLACE
```
</solution>

Please note that the *SEARCH/REPLACE* edit REQUIRES PROPER INDENTATION. If you would like to add the line '        print(x)', you must fully write that out, with all those spaces before the code!
Wrap each *SEARCH/REPLACE* edit in a code block as shown in the example above. If you have multiple *SEARCH/REPLACE* edits, use a separate code block for each one.
[ISSUE]

**Title:** Iterating over Domain excludes meta variables, causing incomplete results

**Description:**
When creating a `Domain` with both variables and meta variables, iterating over the `Domain` instance does not include the meta variables. This behavior is unexpected and leads to discrepancies between the expected and actual iteration results.

**Example Code:**
```python
d = Domain((age, gender, income), metas=(ssn,))
variables = list(d)
print(variables)
# Expected output: [age, gender, income, ssn]
# Actual output: [age, gender, income]
```

**Expected Behavior:**
Iterating over a `Domain` instance should include all variables, including meta variables, resulting in a complete list of all attributes.

**Actual Behavior:**
The meta variables are excluded from the iteration, resulting in an incomplete list that only contains the main variables.

[/ISSUE]
{
    "PickleDomain.test_empty_domain": "PASSED",
    "PickleDomain.test_with_class_and_metas": "PASSED",
    "PickleDomain.test_with_continuous_class": "PASSED",
    "PickleDomain.test_with_continuous_variable": "PASSED",
    "PickleDomain.test_with_discrete_class": "PASSED",
    "PickleDomain.test_with_discrete_variable": "PASSED",
    "PickleDomain.test_with_metas": "PASSED",
    "PickleDomain.test_with_mixed_variables": "PASSED",
    "PickleDomain.test_with_multiple_classes": "PASSED",
    "TestDomainInit.test_contains": "PASSED",
    "TestDomainInit.test_conversion": "PASSED",
    "TestDomainInit.test_conversion_size": "PASSED",
    "TestDomainInit.test_copy": "PASSED",
    "TestDomainInit.test_different_domains_with_same_attributes_are_equal": "PASSED",
    "TestDomainInit.test_domain_conversion_is_fast_enough": "PASSED",
    "TestDomainInit.test_domain_conversion_sparsity": "PASSED",
    "TestDomainInit.test_from_numpy_dimensions": "PASSED",
    "TestDomainInit.test_from_numpy_names": "PASSED",
    "TestDomainInit.test_from_numpy_values": "PASSED",
    "TestDomainInit.test_get_conversion": "PASSED",
    "TestDomainInit.test_get_item": "PASSED",
    "TestDomainInit.test_get_item_error": "PASSED",
    "TestDomainInit.test_get_item_similar_vars": "PASSED",
    "TestDomainInit.test_get_item_slices": "PASSED",
    "TestDomainInit.test_has_continuous": "PASSED",
    "TestDomainInit.test_has_discrete": "PASSED",
    "TestDomainInit.test_has_time": "PASSED",
    "TestDomainInit.test_index": "PASSED",
    "TestDomainInit.test_index_error": "PASSED",
    "TestDomainInit.test_init_class": "PASSED",
    "TestDomainInit.test_init_class_list": "PASSED",
    "TestDomainInit.test_init_metas": "PASSED",
    "TestDomainInit.test_init_multi_class": "PASSED",
    "TestDomainInit.test_init_no_class": "PASSED",
    "TestDomainInit.test_init_no_class_false": "PASSED",
    "TestDomainInit.test_init_source": "PASSED",
    "TestDomainInit.test_init_source_class": "PASSED",
    "TestDomainInit.test_iter": "PASSED",
    "TestDomainInit.test_nonunique_domain_error": "PASSED",
    "TestDomainInit.test_preprocessor_chaining": "PASSED",
    "TestDomainInit.test_str": "PASSED",
    "TestDomainInit.test_wrong_types": "PASSED",
    "TestDomainInit.test_wrong_vartypes": "PASSED",
    "TestDomainInit.test_wrong_vartypes_w_source": "PASSED",
    "TestDomainFilter.test_filter_visible": "PASSED"
}
diff --git a/Orange/data/domain.py b/Orange/data/domain.py
index 35e5a0dc7..f3988a5ad 100644
--- a/Orange/data/domain.py
+++ b/Orange/data/domain.py
@@ -1,3 +1,4 @@
+import itertools
 import warnings
 
 from math import log
@@ -245,14 +246,13 @@ class Domain:
     def metas(self):
         return self._metas
 
-    @deprecated("len(Domain.variables)")
     def __len__(self):
         """The number of variables (features and class attributes).
 
         The current behavior returns the length of only features and
         class attributes. In the near future, it will include the
         length of metas, too, and __iter__ will act accordingly."""
-        return len(self._variables)
+        return len(self._variables) + len(self._metas)
 
     def __bool__(self):
         warnings.warn(
@@ -308,18 +308,11 @@ class Domain:
         """
         return item in self._indices or self._get_equivalent(item) is not None
 
-    @deprecated("Domain.variables")
     def __iter__(self):
         """
         Return an iterator through variables (features and class attributes).
-
-        The current behaviour is confusing, as `x in domain` returns True
-        for meta variables, but iter(domain) does not yield them.
-        This will be consolidated eventually (in 3.12?), the code that
-        currently iterates over domain should iterate over domain.variables
-        instead.
         """
-        return iter(self._variables)
+        return itertools.chain(self._variables, self._metas)
 
     def __str__(self):
         """

{"Orange/data/domain.py": "import warnings\n\nfrom math import log\nfrom collections.abc import Iterable\nfrom itertools import chain\nfrom numbers import Integral\n\nimport numpy as np\n\nfrom Orange.data import (\n    Unknown, Variable, ContinuousVariable, DiscreteVariable, StringVariable\n)\nfrom Orange.util import deprecated, OrangeDeprecationWarning\n\n__all__ = [\"DomainConversion\", \"Domain\"]\n\n\nclass DomainConversion:\n    \"\"\"\n    Indices and functions for conversion between domains.\n\n    Every list contains indices (instances of int) of variables in the\n    source domain, or the variable's compute_value function if the source\n    domain does not contain the variable.\n\n    .. attribute:: source\n\n        The source domain. The destination is not stored since destination\n        domain is the one which contains the instance of DomainConversion.\n\n    .. attribute:: attributes\n\n        Indices for attribute values.\n\n    .. attribute:: class_vars\n\n        Indices for class variables\n\n    .. attribute:: variables\n\n        Indices for attributes and class variables\n        (:obj:`attributes`+:obj:`class_vars`).\n\n    .. attribute:: metas\n\n        Indices for meta attributes\n\n    .. attribute:: sparse_X\n\n        Flag whether the resulting X matrix should be sparse.\n\n    .. attribute:: sparse_Y\n\n        Flag whether the resulting Y matrix should be sparse.\n\n    .. attribute:: sparse_metas\n\n        Flag whether the resulting metas matrix should be sparse.\n    \"\"\"\n\n    def __init__(self, source, destination):\n        \"\"\"\n        Compute the conversion indices from the given `source` to `destination`\n        \"\"\"\n        def match(var):\n            if var in source:\n                sourcevar = source[var]\n                sourceindex = source.index(sourcevar)\n                if var.is_discrete and var is not sourcevar:\n                    mapping = var.get_mapper_from(sourcevar)\n                    return lambda table: mapping(table.get_column_view(sourceindex)[0])\n                return source.index(var)\n            return var.compute_value  # , which may also be None\n\n        self.source = source\n\n        self.attributes = [match(var) for var in destination.attributes]\n        self.class_vars = [match(var) for var in destination.class_vars]\n        self.variables = self.attributes + self.class_vars\n        self.metas = [match(var) for var in destination.metas]\n\n        def should_be_sparse(feats):\n            \"\"\"\n            For a matrix to be stored in sparse, more than 2/3 of columns\n            should be marked as sparse and there should be no string columns\n            since Scipy's sparse matrices don't support dtype=object.\n            \"\"\"\n            fraction_sparse = sum(f.sparse for f in feats) / max(len(feats), 1)\n            contain_strings = any(f.is_string for f in feats)\n            return fraction_sparse > 2/3 and not contain_strings\n\n        # check whether X, Y or metas should be sparse\n        self.sparse_X = should_be_sparse(destination.attributes)\n        self.sparse_Y = should_be_sparse(destination.class_vars)\n        self.sparse_metas = should_be_sparse(destination.metas)\n\n\ndef filter_visible(feats):\n    \"\"\"\n    Args:\n        feats (iterable): Features to be filtered.\n\n    Returns: A filtered tuple of features that are visible (i.e. not hidden).\n    \"\"\"\n    return (f for f in feats if not f.attributes.get('hidden', False))\n\n\nclass Domain:\n    def __init__(self, attributes, class_vars=None, metas=None, source=None):\n        \"\"\"\n        Initialize a new domain descriptor. Arguments give the features and\n        the class attribute(s). They can be described by descriptors (instances\n        of :class:`Variable`), or by indices or names if the source domain is\n        given.\n\n        :param attributes: a list of attributes\n        :type attributes: list of :class:`Variable`\n        :param class_vars: target variable or a list of target variables\n        :type class_vars: :class:`Variable` or list of :class:`Variable`\n        :param metas: a list of meta attributes\n        :type metas: list of :class:`Variable`\n        :param source: the source domain for attributes\n        :type source: Orange.data.Domain\n        :return: a new domain\n        :rtype: :class:`Domain`\n        \"\"\"\n\n        if class_vars is None:\n            class_vars = []\n        elif isinstance(class_vars, (Variable, Integral, str)):\n            class_vars = [class_vars]\n        elif isinstance(class_vars, Iterable):\n            class_vars = list(class_vars)\n\n        if not isinstance(attributes, list):\n            attributes = list(attributes)\n        metas = list(metas) if metas else []\n\n        # Replace str's and int's with descriptors if 'source' is given;\n        # complain otherwise\n        for lst in (attributes, class_vars, metas):\n            for i, var in enumerate(lst):\n                if not isinstance(var, Variable):\n                    if source is not None and isinstance(var, (str, int)):\n                        lst[i] = source[var]\n                    else:\n                        raise TypeError(\n                            \"descriptors must be instances of Variable, \"\n                            \"not '%s'\" % type(var).__name__)\n\n        names = [var.name for var in chain(attributes, class_vars, metas)]\n        if len(names) != len(set(names)):\n            raise Exception('All variables in the domain should have'\n                            ' unique names.')\n\n        # Store everything\n        self.attributes = tuple(attributes)\n        self.class_vars = tuple(class_vars)\n        self._variables = self.attributes + self.class_vars\n        self._metas = tuple(metas)\n        self.class_var = \\\n            self.class_vars[0] if len(self.class_vars) == 1 else None\n        if not all(var.is_primitive() for var in self._variables):\n            raise TypeError(\"variables must be primitive\")\n\n        self._indices = dict(chain.from_iterable(\n            ((var, idx), (var.name, idx), (idx, idx))\n            for idx, var in enumerate(self._variables)))\n        self._indices.update(chain.from_iterable(\n            ((var, -1-idx), (var.name, -1-idx), (-1-idx, -1-idx))\n            for idx, var in enumerate(self.metas)))\n\n        self.anonymous = False\n\n        self._hash = None  # cache for __hash__()\n\n    # noinspection PyPep8Naming\n    @classmethod\n    def from_numpy(cls, X, Y=None, metas=None):\n        \"\"\"\n        Create a domain corresponding to the given numpy arrays. This method\n        is usually invoked from :meth:`Orange.data.Table.from_numpy`.\n\n        All attributes are assumed to be continuous and are named\n        \"Feature <n>\". Target variables are discrete if the only two values\n        are 0 and 1; otherwise they are continuous. Discrete\n        targets are named \"Class <n>\" and continuous are named \"Target <n>\".\n        Domain is marked as :attr:`anonymous`, so data from any other domain of\n        the same shape can be converted into this one and vice-versa.\n\n        :param `numpy.ndarray` X: 2-dimensional array with data\n        :param Y: 1- of 2- dimensional data for target\n        :type Y: `numpy.ndarray` or None\n        :param `numpy.ndarray` metas: meta attributes\n        :type metas: `numpy.ndarray` or None\n        :return: a new domain\n        :rtype: :class:`Domain`\n        \"\"\"\n        def get_places(max_index):\n            return 0 if max_index == 1 else int(log(max_index, 10)) + 1\n\n        def get_name(base, index, places):\n            return base if not places \\\n                else \"{} {:0{}}\".format(base, index + 1, places)\n\n        if X.ndim != 2:\n            raise ValueError('X must be a 2-dimensional array')\n        n_attrs = X.shape[1]\n        places = get_places(n_attrs)\n        attr_vars = [ContinuousVariable(name=get_name(\"Feature\", a, places))\n                     for a in range(n_attrs)]\n        class_vars = []\n        if Y is not None:\n            if Y.ndim == 1:\n                Y = Y.reshape(len(Y), 1)\n            elif Y.ndim != 2:\n                raise ValueError('Y has invalid shape')\n            n_classes = Y.shape[1]\n            places = get_places(n_classes)\n            for i, values in enumerate(Y.T):\n                if set(values) == {0, 1}:\n                    name = get_name('Class', i, places)\n                    values = ['v1', 'v2']\n                    class_vars.append(DiscreteVariable(name, values))\n                else:\n                    name = get_name('Target', i + 1, places)\n                    class_vars.append(ContinuousVariable(name))\n        if metas is not None:\n            n_metas = metas.shape[1]\n            places = get_places(n_metas)\n            meta_vars = [StringVariable(get_name(\"Meta\", m, places))\n                         for m in range(n_metas)]\n        else:\n            meta_vars = []\n\n        domain = cls(attr_vars, class_vars, meta_vars)\n        domain.anonymous = True\n        return domain\n\n    @property\n    def variables(self):\n        return self._variables\n\n    @property\n    def metas(self):\n        return self._metas\n\n    @deprecated(\"len(Domain.variables)\")\n    def __len__(self):\n        \"\"\"The number of variables (features and class attributes).\n\n        The current behavior returns the length of only features and\n        class attributes. In the near future, it will include the\n        length of metas, too, and __iter__ will act accordingly.\"\"\"\n        return len(self._variables)\n\n    def __bool__(self):\n        warnings.warn(\n            \"Domain.__bool__ is ambiguous; use 'is None' or 'empty' instead\",\n            OrangeDeprecationWarning, stacklevel=2)\n        return len(self) > 0  # Keep the obsolete behaviour\n\n    def empty(self):\n        \"\"\"True if the domain has no variables of any kind\"\"\"\n        return not self.variables and not self.metas\n\n    def _get_equivalent(self, var):\n        if isinstance(var, Variable):\n            index = self._indices.get(var.name)\n            if index is not None:\n                if index >= 0:\n                    myvar = self.variables[index]\n                else:\n                    myvar = self.metas[-1 - index]\n                if myvar == var:\n                    return myvar\n        return None\n\n    def __getitem__(self, idx):\n        \"\"\"\n        Return a variable descriptor from the given argument, which can be\n        a descriptor, index or name. If `var` is a descriptor, the function\n        returns this same object.\n\n        :param idx: index, name or descriptor\n        :type idx: int, str or :class:`Variable`\n        :return: an instance of :class:`Variable` described by `var`\n        :rtype: :class:`Variable`\n        \"\"\"\n        if isinstance(idx, slice):\n            return self._variables[idx]\n\n        index = self._indices.get(idx)\n        if index is None:\n            var = self._get_equivalent(idx)\n            if var is not None:\n                return var\n            raise KeyError(idx)\n        if index >= 0:\n            return self.variables[index]\n        else:\n            return self.metas[-1 - index]\n\n    def __contains__(self, item):\n        \"\"\"\n        Return `True` if the item (`str`, `int`, :class:`Variable`) is\n        in the domain.\n        \"\"\"\n        return item in self._indices or self._get_equivalent(item) is not None\n\n    @deprecated(\"Domain.variables\")\n    def __iter__(self):\n        \"\"\"\n        Return an iterator through variables (features and class attributes).\n\n        The current behaviour is confusing, as `x in domain` returns True\n        for meta variables, but iter(domain) does not yield them.\n        This will be consolidated eventually (in 3.12?), the code that\n        currently iterates over domain should iterate over domain.variables\n        instead.\n        \"\"\"\n        return iter(self._variables)\n\n    def __str__(self):\n        \"\"\"\n        Return a list-like string with the domain's features, class attributes\n        and meta attributes.\n        \"\"\"\n        s = \"[\" + \", \".join(attr.name for attr in self.attributes)\n        if self.class_vars:\n            s += \" | \" + \", \".join(cls.name for cls in self.class_vars)\n        s += \"]\"\n        if self._metas:\n            s += \" {\" + \", \".join(meta.name for meta in self._metas) + \"}\"\n        return s\n\n    __repr__ = __str__\n\n    def index(self, var):\n        \"\"\"\n        Return the index of the given variable or meta attribute, represented\n        with an instance of :class:`Variable`, `int` or `str`.\n        \"\"\"\n\n        idx = self._indices.get(var)\n        if idx is not None:\n            return idx\n        equiv = self._get_equivalent(var)\n        if equiv is not None:\n            return self._indices[equiv]\n\n        raise ValueError(\"'%s' is not in domain\" % var)\n\n    def has_discrete_attributes(self, include_class=False, include_metas=False):\n        \"\"\"\n        Return `True` if domain has any discrete attributes. If\n        `include_class` is set, the check includes the class attribute(s). If\n        `include_metas` is set, the check includes the meta attributes.\n        \"\"\"\n        vars = self.variables if include_class else self.attributes\n        vars += self.metas if include_metas else ()\n        return any(var.is_discrete for var in vars)\n\n    def has_continuous_attributes(self, include_class=False, include_metas=False):\n        \"\"\"\n        Return `True` if domain has any continuous attributes. If\n        `include_class` is set, the check includes the class attribute(s). If\n        `include_metas` is set, the check includes the meta attributes.\n        \"\"\"\n        vars = self.variables if include_class else self.attributes\n        vars += self.metas if include_metas else ()\n        return any(var.is_continuous for var in vars)\n\n    def has_time_attributes(self, include_class=False, include_metas=False):\n        \"\"\"\n        Return `True` if domain has any time attributes. If\n        `include_class` is set, the check includes the class attribute(s). If\n        `include_metas` is set, the check includes the meta attributes.\n        \"\"\"\n        vars = self.variables if include_class else self.attributes\n        vars += self.metas if include_metas else ()\n        return any(var.is_time for var in vars)\n\n    @property\n    def has_continuous_class(self):\n        return bool(self.class_var and self.class_var.is_continuous)\n\n    @property\n    def has_discrete_class(self):\n        return bool(self.class_var and self.class_var.is_discrete)\n\n    @property\n    def has_time_class(self):\n        return bool(self.class_var and self.class_var.is_time)\n\n    # noinspection PyProtectedMember\n    def convert(self, inst):\n        \"\"\"\n        Convert a data instance from another domain to this domain.\n\n        :param inst: The data instance to be converted\n        :return: The data instance in this domain\n        \"\"\"\n        from .instance import Instance\n\n        if isinstance(inst, Instance):\n            if inst.domain == self:\n                return inst._x, inst._y, inst._metas\n            c = DomainConversion(inst.domain, self)\n            l = len(inst.domain.attributes)\n            values = [(inst._x[i] if 0 <= i < l\n                       else inst._y[i - l] if i >= l\n                       else inst._metas[-i - 1])\n                      if isinstance(i, int)\n                      else (Unknown if not i else i(inst))\n                      for i in c.variables]\n            metas = [(inst._x[i] if 0 <= i < l\n                      else inst._y[i - l] if i >= l\n                      else inst._metas[-i - 1])\n                     if isinstance(i, int)\n                     else (Unknown if not i else i(inst))\n                     for i in c.metas]\n        else:\n            nvars = len(self._variables)\n            nmetas = len(self._metas)\n            if len(inst) != nvars and len(inst) != nvars + nmetas:\n                raise ValueError(\"invalid data length for domain\")\n            values = [var.to_val(val)\n                      for var, val in zip(self._variables, inst)]\n            if len(inst) == nvars + nmetas:\n                metas = [var.to_val(val)\n                         for var, val in zip(self._metas, inst[nvars:])]\n            else:\n                metas = [var.Unknown for var in self._metas]\n        nattrs = len(self.attributes)\n        # Let np.array decide dtype for values\n        return np.array(values[:nattrs]), np.array(values[nattrs:]),\\\n               np.array(metas, dtype=object)\n\n    def select_columns(self, col_idx):\n        attributes, col_indices = self._compute_col_indices(col_idx)\n        if attributes is not None:\n            n_attrs = len(self.attributes)\n            r_attrs = [attributes[i]\n                       for i, col in enumerate(col_indices)\n                       if 0 <= col < n_attrs]\n            r_classes = [attributes[i]\n                         for i, col in enumerate(col_indices)\n                         if col >= n_attrs]\n            r_metas = [attributes[i]\n                       for i, col in enumerate(col_indices) if col < 0]\n            return Domain(r_attrs, r_classes, r_metas)\n        else:\n            return self\n\n    def _compute_col_indices(self, col_idx):\n        if col_idx is ...:\n            return None, None\n        if isinstance(col_idx, np.ndarray) and col_idx.dtype == bool:\n            return ([attr for attr, c in zip(self, col_idx) if c],\n                    np.nonzero(col_idx))\n        elif isinstance(col_idx, slice):\n            s = len(self.variables)\n            start, end, stride = col_idx.indices(s)\n            if col_idx.indices(s) == (0, s, 1):\n                return None, None\n            else:\n                return (self[col_idx],\n                        np.arange(start, end, stride))\n        elif isinstance(col_idx, Iterable) and not isinstance(col_idx, str):\n            attributes = [self[col] for col in col_idx]\n            if attributes == self.attributes:\n                return None, None\n            return attributes, np.fromiter(\n                (self.index(attr) for attr in attributes), int)\n        elif isinstance(col_idx, Integral):\n            attr = self[col_idx]\n        else:\n            attr = self[col_idx]\n            col_idx = self.index(attr)\n        return [attr], np.array([col_idx])\n\n    def checksum(self):\n        return hash(self)\n\n    def copy(self):\n        \"\"\"\n        Make a copy of the domain. New features are proxies of the old ones,\n        hence the new domain can be used anywhere the old domain was used.\n\n        Returns:\n            Domain: a copy of the domain.\n        \"\"\"\n        return Domain(\n            attributes=[a.make_proxy() for a in self.attributes],\n            class_vars=[a.make_proxy() for a in self.class_vars],\n            metas=[a.make_proxy() for a in self.metas],\n            source=self,\n        )\n\n    def __eq__(self, other):\n        if not isinstance(other, Domain):\n            return False\n\n        return (self.attributes == other.attributes and\n                self.class_vars == other.class_vars and\n                self.metas == other.metas)\n\n    def __hash__(self):\n        if self._hash is None:\n            self._hash = hash(self.attributes) ^ hash(self.class_vars) ^ hash(self.metas)\n        return self._hash\n"}
A user will ask you to solve a task. You should first draft your thinking process (inner monologue). Then, generate the solution.

Your response format must follow the template below:
<think>
Your thoughts or/and draft, like working through an exercise on scratch paper. Be as casual and as long as you want until you are confident to generate a correct solution.
</think>
<solution>
Final solution presented to the user.
</solution>
system
We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
[ISSUE]

**Title:** Iterating over Domain excludes meta variables, causing incomplete results

**Description:**
When creating a `Domain` with both variables and meta variables, iterating over the `Domain` instance does not include the meta variables. This behavior is unexpected and leads to discrepancies between the expected and actual iteration results.

**Example Code:**
```python
d = Domain((age, gender, income), metas=(ssn,))
variables = list(d)
print(variables)
# Expected output: [age, gender, income, ssn]
# Actual output: [age, gender, income]
```

**Expected Behavior:**
Iterating over a `Domain` instance should include all variables, including meta variables, resulting in a complete list of all attributes.

**Actual Behavior:**
The meta variables are excluded from the iteration, resulting in an incomplete list that only contains the main variables.

[/ISSUE]
--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.

--- BEGIN FILE ---
```
### Orange/data/domain.py
import warnings

from math import log
from collections.abc import Iterable
from itertools import chain
from numbers import Integral

import numpy as np

from Orange.data import (
    Unknown, Variable, ContinuousVariable, DiscreteVariable, StringVariable
)
from Orange.util import deprecated, OrangeDeprecationWarning

__all__ = ["DomainConversion", "Domain"]


class DomainConversion:
    """
    Indices and functions for conversion between domains.

    Every list contains indices (instances of int) of variables in the
    source domain, or the variable's compute_value function if the source
    domain does not contain the variable.

    .. attribute:: source

        The source domain. The destination is not stored since destination
        domain is the one which contains the instance of DomainConversion.

    .. attribute:: attributes

        Indices for attribute values.

    .. attribute:: class_vars

        Indices for class variables

    .. attribute:: variables

        Indices for attributes and class variables
        (:obj:`attributes`+:obj:`class_vars`).

    .. attribute:: metas

        Indices for meta attributes

    .. attribute:: sparse_X

        Flag whether the resulting X matrix should be sparse.

    .. attribute:: sparse_Y

        Flag whether the resulting Y matrix should be sparse.

    .. attribute:: sparse_metas

        Flag whether the resulting metas matrix should be sparse.
    """

    def __init__(self, source, destination):
        """
        Compute the conversion indices from the given `source` to `destination`
        """
        def match(var):
            if var in source:
                sourcevar = source[var]
                sourceindex = source.index(sourcevar)
                if var.is_discrete and var is not sourcevar:
                    mapping = var.get_mapper_from(sourcevar)
                    return lambda table: mapping(table.get_column_view(sourceindex)[0])
                return source.index(var)
            return var.compute_value  # , which may also be None

        self.source = source

        self.attributes = [match(var) for var in destination.attributes]
        self.class_vars = [match(var) for var in destination.class_vars]
        self.variables = self.attributes + self.class_vars
        self.metas = [match(var) for var in destination.metas]

        def should_be_sparse(feats):
            """
            For a matrix to be stored in sparse, more than 2/3 of columns
            should be marked as sparse and there should be no string columns
            since Scipy's sparse matrices don't support dtype=object.
            """
            fraction_sparse = sum(f.sparse for f in feats) / max(len(feats), 1)
            contain_strings = any(f.is_string for f in feats)
            return fraction_sparse > 2/3 and not contain_strings

        # check whether X, Y or metas should be sparse
        self.sparse_X = should_be_sparse(destination.attributes)
        self.sparse_Y = should_be_sparse(destination.class_vars)
        self.sparse_metas = should_be_sparse(destination.metas)


def filter_visible(feats):
    """
    Args:
        feats (iterable): Features to be filtered.

    Returns: A filtered tuple of features that are visible (i.e. not hidden).
    """
    return (f for f in feats if not f.attributes.get('hidden', False))


class Domain:
    def __init__(self, attributes, class_vars=None, metas=None, source=None):
        """
        Initialize a new domain descriptor. Arguments give the features and
        the class attribute(s). They can be described by descriptors (instances
        of :class:`Variable`), or by indices or names if the source domain is
        given.

        :param attributes: a list of attributes
        :type attributes: list of :class:`Variable`
        :param class_vars: target variable or a list of target variables
        :type class_vars: :class:`Variable` or list of :class:`Variable`
        :param metas: a list of meta attributes
        :type metas: list of :class:`Variable`
        :param source: the source domain for attributes
        :type source: Orange.data.Domain
        :return: a new domain
        :rtype: :class:`Domain`
        """

        if class_vars is None:
            class_vars = []
        elif isinstance(class_vars, (Variable, Integral, str)):
            class_vars = [class_vars]
        elif isinstance(class_vars, Iterable):
            class_vars = list(class_vars)

        if not isinstance(attributes, list):
            attributes = list(attributes)
        metas = list(metas) if metas else []

        # Replace str's and int's with descriptors if 'source' is given;
        # complain otherwise
        for lst in (attributes, class_vars, metas):
            for i, var in enumerate(lst):
                if not isinstance(var, Variable):
                    if source is not None and isinstance(var, (str, int)):
                        lst[i] = source[var]
                    else:
                        raise TypeError(
                            "descriptors must be instances of Variable, "
                            "not '%s'" % type(var).__name__)

        names = [var.name for var in chain(attributes, class_vars, metas)]
        if len(names) != len(set(names)):
            raise Exception('All variables in the domain should have'
                            ' unique names.')

        # Store everything
        self.attributes = tuple(attributes)
        self.class_vars = tuple(class_vars)
        self._variables = self.attributes + self.class_vars
        self._metas = tuple(metas)
        self.class_var = \
            self.class_vars[0] if len(self.class_vars) == 1 else None
        if not all(var.is_primitive() for var in self._variables):
            raise TypeError("variables must be primitive")

        self._indices = dict(chain.from_iterable(
            ((var, idx), (var.name, idx), (idx, idx))
            for idx, var in enumerate(self._variables)))
        self._indices.update(chain.from_iterable(
            ((var, -1-idx), (var.name, -1-idx), (-1-idx, -1-idx))
            for idx, var in enumerate(self.metas)))

        self.anonymous = False

        self._hash = None  # cache for __hash__()

    # noinspection PyPep8Naming
    @classmethod
    def from_numpy(cls, X, Y=None, metas=None):
        """
        Create a domain corresponding to the given numpy arrays. This method
        is usually invoked from :meth:`Orange.data.Table.from_numpy`.

        All attributes are assumed to be continuous and are named
        "Feature <n>". Target variables are discrete if the only two values
        are 0 and 1; otherwise they are continuous. Discrete
        targets are named "Class <n>" and continuous are named "Target <n>".
        Domain is marked as :attr:`anonymous`, so data from any other domain of
        the same shape can be converted into this one and vice-versa.

        :param `numpy.ndarray` X: 2-dimensional array with data
        :param Y: 1- of 2- dimensional data for target
        :type Y: `numpy.ndarray` or None
        :param `numpy.ndarray` metas: meta attributes
        :type metas: `numpy.ndarray` or None
        :return: a new domain
        :rtype: :class:`Domain`
        """
        def get_places(max_index):
            return 0 if max_index == 1 else int(log(max_index, 10)) + 1

        def get_name(base, index, places):
            return base if not places \
                else "{} {:0{}}".format(base, index + 1, places)

        if X.ndim != 2:
            raise ValueError('X must be a 2-dimensional array')
        n_attrs = X.shape[1]
        places = get_places(n_attrs)
        attr_vars = [ContinuousVariable(name=get_name("Feature", a, places))
                     for a in range(n_attrs)]
        class_vars = []
        if Y is not None:
            if Y.ndim == 1:
                Y = Y.reshape(len(Y), 1)
            elif Y.ndim != 2:
                raise ValueError('Y has invalid shape')
            n_classes = Y.shape[1]
            places = get_places(n_classes)
            for i, values in enumerate(Y.T):
                if set(values) == {0, 1}:
                    name = get_name('Class', i, places)
                    values = ['v1', 'v2']
                    class_vars.append(DiscreteVariable(name, values))
                else:
                    name = get_name('Target', i + 1, places)
                    class_vars.append(ContinuousVariable(name))
        if metas is not None:
            n_metas = metas.shape[1]
            places = get_places(n_metas)
            meta_vars = [StringVariable(get_name("Meta", m, places))
                         for m in range(n_metas)]
        else:
            meta_vars = []

        domain = cls(attr_vars, class_vars, meta_vars)
        domain.anonymous = True
        return domain

    @property
    def variables(self):
        return self._variables

    @property
    def metas(self):
        return self._metas

    @deprecated("len(Domain.variables)")
    def __len__(self):
        """The number of variables (features and class attributes).

        The current behavior returns the length of only features and
        class attributes. In the near future, it will include the
        length of metas, too, and __iter__ will act accordingly."""
        return len(self._variables)

    def __bool__(self):
        warnings.warn(
            "Domain.__bool__ is ambiguous; use 'is None' or 'empty' instead",
            OrangeDeprecationWarning, stacklevel=2)
        return len(self) > 0  # Keep the obsolete behaviour

    def empty(self):
        """True if the domain has no variables of any kind"""
        return not self.variables and not self.metas

    def _get_equivalent(self, var):
        if isinstance(var, Variable):
            index = self._indices.get(var.name)
            if index is not None:
                if index >= 0:
                    myvar = self.variables[index]
                else:
                    myvar = self.metas[-1 - index]
                if myvar == var:
                    return myvar
        return None

    def __getitem__(self, idx):
        """
        Return a variable descriptor from the given argument, which can be
        a descriptor, index or name. If `var` is a descriptor, the function
        returns this same object.

        :param idx: index, name or descriptor
        :type idx: int, str or :class:`Variable`
        :return: an instance of :class:`Variable` described by `var`
        :rtype: :class:`Variable`
        """
        if isinstance(idx, slice):
            return self._variables[idx]

        index = self._indices.get(idx)
        if index is None:
            var = self._get_equivalent(idx)
            if var is not None:
                return var
            raise KeyError(idx)
        if index >= 0:
            return self.variables[index]
        else:
            return self.metas[-1 - index]

    def __contains__(self, item):
        """
        Return `True` if the item (`str`, `int`, :class:`Variable`) is
        in the domain.
        """
        return item in self._indices or self._get_equivalent(item) is not None

    @deprecated("Domain.variables")
    def __iter__(self):
        """
        Return an iterator through variables (features and class attributes).

        The current behaviour is confusing, as `x in domain` returns True
        for meta variables, but iter(domain) does not yield them.
        This will be consolidated eventually (in 3.12?), the code that
        currently iterates over domain should iterate over domain.variables
        instead.
        """
        return iter(self._variables)

    def __str__(self):
        """
        Return a list-like string with the domain's features, class attributes
        and meta attributes.
        """
        s = "[" + ", ".join(attr.name for attr in self.attributes)
        if self.class_vars:
            s += " | " + ", ".join(cls.name for cls in self.class_vars)
        s += "]"
        if self._metas:
            s += " {" + ", ".join(meta.name for meta in self._metas) + "}"
        return s

    __repr__ = __str__

    def index(self, var):
        """
        Return the index of the given variable or meta attribute, represented
        with an instance of :class:`Variable`, `int` or `str`.
        """

        idx = self._indices.get(var)
        if idx is not None:
            return idx
        equiv = self._get_equivalent(var)
        if equiv is not None:
            return self._indices[equiv]

        raise ValueError("'%s' is not in domain" % var)

    def has_discrete_attributes(self, include_class=False, include_metas=False):
        """
        Return `True` if domain has any discrete attributes. If
        `include_class` is set, the check includes the class attribute(s). If
        `include_metas` is set, the check includes the meta attributes.
        """
        vars = self.variables if include_class else self.attributes
        vars += self.metas if include_metas else ()
        return any(var.is_discrete for var in vars)

    def has_continuous_attributes(self, include_class=False, include_metas=False):
        """
        Return `True` if domain has any continuous attributes. If
        `include_class` is set, the check includes the class attribute(s). If
        `include_metas` is set, the check includes the meta attributes.
        """
        vars = self.variables if include_class else self.attributes
        vars += self.metas if include_metas else ()
        return any(var.is_continuous for var in vars)

    def has_time_attributes(self, include_class=False, include_metas=False):
        """
        Return `True` if domain has any time attributes. If
        `include_class` is set, the check includes the class attribute(s). If
        `include_metas` is set, the check includes the meta attributes.
        """
        vars = self.variables if include_class else self.attributes
        vars += self.metas if include_metas else ()
        return any(var.is_time for var in vars)

    @property
    def has_continuous_class(self):
        return bool(self.class_var and self.class_var.is_continuous)

    @property
    def has_discrete_class(self):
        return bool(self.class_var and self.class_var.is_discrete)

    @property
    def has_time_class(self):
        return bool(self.class_var and self.class_var.is_time)

    # noinspection PyProtectedMember
    def convert(self, inst):
        """
        Convert a data instance from another domain to this domain.

        :param inst: The data instance to be converted
        :return: The data instance in this domain
        """
        from .instance import Instance

        if isinstance(inst, Instance):
            if inst.domain == self:
                return inst._x, inst._y, inst._metas
            c = DomainConversion(inst.domain, self)
            l = len(inst.domain.attributes)
            values = [(inst._x[i] if 0 <= i < l
                       else inst._y[i - l] if i >= l
                       else inst._metas[-i - 1])
                      if isinstance(i, int)
                      else (Unknown if not i else i(inst))
                      for i in c.variables]
            metas = [(inst._x[i] if 0 <= i < l
                      else inst._y[i - l] if i >= l
                      else inst._metas[-i - 1])
                     if isinstance(i, int)
                     else (Unknown if not i else i(inst))
                     for i in c.metas]
        else:
            nvars = len(self._variables)
            nmetas = len(self._metas)
            if len(inst) != nvars and len(inst) != nvars + nmetas:
                raise ValueError("invalid data length for domain")
            values = [var.to_val(val)
                      for var, val in zip(self._variables, inst)]
            if len(inst) == nvars + nmetas:
                metas = [var.to_val(val)
                         for var, val in zip(self._metas, inst[nvars:])]
            else:
                metas = [var.Unknown for var in self._metas]
        nattrs = len(self.attributes)
        # Let np.array decide dtype for values
        return np.array(values[:nattrs]), np.array(values[nattrs:]),\
               np.array(metas, dtype=object)

    def select_columns(self, col_idx):
        attributes, col_indices = self._compute_col_indices(col_idx)
        if attributes is not None:
            n_attrs = len(self.attributes)
            r_attrs = [attributes[i]
                       for i, col in enumerate(col_indices)
                       if 0 <= col < n_attrs]
            r_classes = [attributes[i]
                         for i, col in enumerate(col_indices)
                         if col >= n_attrs]
            r_metas = [attributes[i]
                       for i, col in enumerate(col_indices) if col < 0]
            return Domain(r_attrs, r_classes, r_metas)
        else:
            return self

    def _compute_col_indices(self, col_idx):
        if col_idx is ...:
            return None, None
        if isinstance(col_idx, np.ndarray) and col_idx.dtype == bool:
            return ([attr for attr, c in zip(self, col_idx) if c],
                    np.nonzero(col_idx))
        elif isinstance(col_idx, slice):
            s = len(self.variables)
            start, end, stride = col_idx.indices(s)
            if col_idx.indices(s) == (0, s, 1):
                return None, None
            else:
                return (self[col_idx],
                        np.arange(start, end, stride))
        elif isinstance(col_idx, Iterable) and not isinstance(col_idx, str):
            attributes = [self[col] for col in col_idx]
            if attributes == self.attributes:
                return None, None
            return attributes, np.fromiter(
                (self.index(attr) for attr in attributes), int)
        elif isinstance(col_idx, Integral):
            attr = self[col_idx]
        else:
            attr = self[col_idx]
            col_idx = self.index(attr)
        return [attr], np.array([col_idx])

    def checksum(self):
        return hash(self)

    def copy(self):
        """
        Make a copy of the domain. New features are proxies of the old ones,
        hence the new domain can be used anywhere the old domain was used.

        Returns:
            Domain: a copy of the domain.
        """
        return Domain(
            attributes=[a.make_proxy() for a in self.attributes],
            class_vars=[a.make_proxy() for a in self.class_vars],
            metas=[a.make_proxy() for a in self.metas],
            source=self,
        )

    def __eq__(self, other):
        if not isinstance(other, Domain):
            return False

        return (self.attributes == other.attributes and
                self.class_vars == other.class_vars and
                self.metas == other.metas)

    def __hash__(self):
        if self._hash is None:
            self._hash = hash(self.attributes) ^ hash(self.class_vars) ^ hash(self.metas)
        return self._hash

```
--- END FILE ---

Please first localize the bug based on the issue statement, and then generate *SEARCH/REPLACE* edits to fix the issue.

Every *SEARCH/REPLACE* edit must use this format:
1. The file path
2. The start of search block: <<<<<<< SEARCH
3. A contiguous chunk of lines to search for in the existing source code
4. The dividing line: =======
5. The lines to replace into the source code
6. The end of the replace block: >>>>>>> REPLACE

Here is an example:

```python
### mathweb/flask/app.py
<<<<<<< SEARCH
from flask import Flask
=======
import math
from flask import Flask
>>>>>>> REPLACE
```
</solution>

Please note that the *SEARCH/REPLACE* edit REQUIRES PROPER INDENTATION. If you would like to add the line '        print(x)', you must fully write that out, with all those spaces before the code!
Wrap each *SEARCH/REPLACE* edit in a code block as shown in the example above. If you have multiple *SEARCH/REPLACE* edits, use a separate code block for each one.
user