{
    "file_diffs": [
        {
            "old_file_content": "# Test methods with long descriptive names can omit docstrings\n# pylint: disable=missing-docstring\n# pylint: disable=protected-access\n\nimport sys\nimport math\nimport unittest\nimport pickle\nimport pkgutil\nfrom datetime import datetime, timezone\nfrom distutils.version import LooseVersion\n\nfrom io import StringIO\n\nimport numpy as np\nimport scipy.sparse as sp\n\nimport Orange\nfrom Orange.data import Variable, ContinuousVariable, DiscreteVariable, \\\n    StringVariable, TimeVariable, Unknown, Value\nfrom Orange.data.io import CSVReader\nfrom Orange.preprocess.transformation import Identity\nfrom Orange.tests.base import create_pickling_tests\nfrom Orange.util import OrangeDeprecationWarning\n\n\ndef is_on_path(name):\n    \"\"\"\n    Is a top level package/module found on sys.path\n\n    Parameters\n    ----------\n    name : str\n        Top level module/package name\n\n    Returns\n    -------\n    found : bool\n    \"\"\"\n    for _, name_, _ in pkgutil.iter_modules(sys.path):\n        if name == name_:\n            return True\n    return False\n\n\n# noinspection PyPep8Naming,PyUnresolvedReferences\nclass VariableTest:\n    def test_dont_pickle_anonymous_variables(self):\n        with self.assertWarns(OrangeDeprecationWarning):\n            self.assertRaises(pickle.PickleError, pickle.dumps, self.varcls())\n\n    def test_dont_make_anonymous_variables(self):\n        self.assertWarns(OrangeDeprecationWarning, self.varcls.make, \"\")\n\n    def test_copy_copies_attributes(self):\n        var = self.varcls(\"x\")\n        var.attributes[\"a\"] = \"b\"\n        var2 = var.copy(compute_value=None)\n        self.assertIn(\"a\", var2.attributes)\n        self.assertIsInstance(var2, type(var))\n\n        var2.attributes[\"a\"] = \"c\"\n        # Attributes of original value should not change\n        self.assertEqual(var.attributes[\"a\"], \"b\")\n\n    def test_rename(self):\n        var = self.varcls_modified(\"x\")\n        var2 = var.copy(name=\"x2\")\n        self.assertIsInstance(var2, type(var))\n        self.assertIsNot(var, var2)\n        self.assertEqual(var2.name, \"x2\")\n        var.__dict__.pop(\"_name\")\n        var2.__dict__.pop(\"_name\")\n        self.assertDictEqual(var.__dict__, var2.__dict__)\n\n    def varcls_modified(self, name):\n        var = self.varcls(name)\n        var._compute_value = lambda x: x\n        var.sparse = True\n        var.attributes = {\"a\": 1}\n        return var\n\n\nclass TestVariable(unittest.TestCase):\n    @classmethod\n    def setUpClass(cls):\n        cls.var = Variable(\"x\")\n\n    def test_name(self):\n        self.assertEqual(repr(self.var), \"Variable(name='x')\")\n\n    def test_to_val(self):\n        string_var = StringVariable(\"x\")\n        self.assertEqual(string_var.to_val(\"foo\"), \"foo\")\n        self.assertEqual(string_var.to_val(42), \"42\")\n\n        cont_var = ContinuousVariable(\"x\")\n        self.assertTrue(math.isnan(cont_var.to_val(\"?\")))\n        self.assertTrue(math.isnan(Unknown))\n\n        var = Variable(\"x\")\n        self.assertEqual(var.to_val(\"x\"), \"x\")\n\n    def test_repr_is_abstract(self):\n        self.assertRaises(RuntimeError, self.var.repr_val, None)\n\n    def test_properties(self):\n        a = ContinuousVariable(\"y\")\n        self.assertTrue(a.is_continuous)\n        self.assertFalse(a.is_discrete)\n        self.assertFalse(a.is_string)\n        self.assertTrue(a.is_primitive())\n\n        a = DiscreteVariable(\"d\")\n        self.assertFalse(a.is_continuous)\n        self.assertTrue(a.is_discrete)\n        self.assertFalse(a.is_string)\n        self.assertTrue(a.is_primitive())\n\n        a = StringVariable(\"s\")\n        self.assertFalse(a.is_continuous)\n        self.assertFalse(a.is_discrete)\n        self.assertTrue(a.is_string)\n        self.assertFalse(a.is_primitive())\n\n    def test_properties_as_predicates(self):\n        a = ContinuousVariable(\"y\")\n        self.assertTrue(Variable.is_continuous(a))\n        self.assertFalse(Variable.is_discrete(a))\n        self.assertFalse(Variable.is_string(a))\n        self.assertTrue(Variable.is_primitive(a))\n\n        a = StringVariable(\"s\")\n        self.assertFalse(Variable.is_continuous(a))\n        self.assertFalse(Variable.is_discrete(a))\n        self.assertTrue(Variable.is_string(a))\n        self.assertFalse(Variable.is_primitive(a))\n\n    def test_strange_eq(self):\n        a = ContinuousVariable(\"a\")\n        b = ContinuousVariable(\"a\")\n        self.assertEqual(a, a)\n        self.assertEqual(a, b)\n        self.assertIsNot(a, b)\n        self.assertNotEqual(a, \"somestring\")\n        self.assertEqual(hash(a), hash(b))\n\n    def test_eq_with_compute_value(self):\n        a = ContinuousVariable(\"a\")\n        b = ContinuousVariable(\"a\")\n        self.assertEqual(a, a)\n        self.assertEqual(a, b)\n        self.assertIsNot(a, b)\n\n        a._compute_value = lambda x: x\n        self.assertEqual(a, a)\n        self.assertNotEqual(a, b)\n\n        a1 = ContinuousVariable(\"a\")\n        a2 = ContinuousVariable(\"a\")\n        c = ContinuousVariable(\"c\")\n\n        a._compute_value = Identity(a1)\n        self.assertEqual(a, a)\n        self.assertEqual(a, b)\n\n        b._compute_value = a.compute_value\n        self.assertEqual(a, b)\n\n        b._compute_value = Identity(a1)\n        self.assertEqual(a, b)\n\n        b._compute_value = Identity(a2)\n        self.assertEqual(a, b)\n\n        b._compute_value = Identity(c)\n        self.assertNotEqual(a, b)\n\n        b._compute_value = Identity(a2)\n        a1._compute_value = lambda x: x\n        self.assertNotEqual(a, b)\n\n        a1._compute_value = Identity(c)\n        self.assertNotEqual(a, b)\n\n        a2._compute_value = Identity(c)\n        self.assertEqual(a, b)\n\n    def test_hash(self):\n        a = ContinuousVariable(\"a\")\n        b = ContinuousVariable(\"a\")\n        self.assertEqual(hash(a), hash(b))\n\n        a._compute_value = lambda x: x\n        self.assertNotEqual(hash(a), hash(b))\n\n        b._compute_value = lambda x: x\n        self.assertNotEqual(hash(a), hash(b))\n\n        a1 = ContinuousVariable(\"a\")\n        a2 = ContinuousVariable(\"a\")\n\n        a._compute_value = Identity(a1)\n        self.assertNotEqual(hash(a), hash(b))\n\n        b._compute_value = Identity(a2)\n        self.assertEqual(hash(a), hash(b))\n\n\ndef variabletest(varcls):\n    def decorate(cls):\n        return type(cls.__name__, (cls, unittest.TestCase), {'varcls': varcls})\n    return decorate\n\n\n@variabletest(DiscreteVariable)\nclass TestDiscreteVariable(VariableTest):\n    def test_to_val(self):\n        values = [\"F\", \"M\"]\n        var = DiscreteVariable(name=\"Feature 0\", values=values)\n\n        self.assertEqual(var.to_val(0), 0)\n        self.assertEqual(var.to_val(\"F\"), 0)\n        self.assertEqual(var.to_val(0.), 0)\n        self.assertTrue(math.isnan(var.to_val(\"?\")))\n\n        # TODO: with self.assertRaises(ValueError): var.to_val(2)\n        with self.assertRaises(ValueError):\n            var.to_val(\"G\")\n\n    def test_make(self):\n        var = DiscreteVariable.make(\"a\", values=(\"F\", \"M\"))\n        self.assertIsInstance(var, DiscreteVariable)\n        self.assertEqual(var.name, \"a\")\n        self.assertEqual(var.values, (\"F\", \"M\"))\n\n    def test_val_from_str(self):\n        var = DiscreteVariable.make(\"a\", values=(\"F\", \"M\"))\n        self.assertTrue(math.isnan(var.to_val(None)))\n        self.assertEqual(var.to_val(1), 1)\n\n    def test_val_from_str_add(self):\n        var = DiscreteVariable.make(\"a\", values=(\"F\", \"M\"))\n        self.assertTrue(math.isnan(var.val_from_str_add(None)))\n        self.assertEqual(var.val_from_str_add(\"M\"), 1)\n        self.assertEqual(var.val_from_str_add(\"F\"), 0)\n        self.assertEqual(var.values, (\"F\", \"M\"))\n        self.assertEqual(var.val_from_str_add(\"N\"), 2)\n        self.assertEqual(var.values, (\"F\", \"M\", \"N\"))\n        self.assertEqual(var._value_index, {\"F\": 0, \"M\": 1, \"N\": 2})\n        self.assertEqual(var.val_from_str_add(\"M\"), 1)\n        self.assertEqual(var.val_from_str_add(\"F\"), 0)\n        self.assertEqual(var.val_from_str_add(\"N\"), 2)\n\n\n    def test_repr(self):\n        var = DiscreteVariable.make(\"a\", values=(\"F\", \"M\"))\n        self.assertEqual(\n            repr(var),\n            \"DiscreteVariable(name='a', values=('F', 'M'))\")\n        var.ordered = True\n        self.assertEqual(\n            repr(var),\n            \"DiscreteVariable(name='a', values=('F', 'M'), ordered=True)\")\n\n        var = DiscreteVariable.make(\"a\", values=\"1234567\")\n        self.assertEqual(\n            repr(var),\n            \"DiscreteVariable(name='a', values=('1', '2', '3', '4', '5', '6', '7'))\")\n\n    def test_no_nonstringvalues(self):\n        self.assertRaises(TypeError, DiscreteVariable, \"foo\", values=(\"a\", 42))\n        a = DiscreteVariable(\"foo\", values=(\"a\", \"b\", \"c\"))\n        self.assertRaises(TypeError, a.add_value, 42)\n\n    def test_no_duplicated_values(self):\n        a = DiscreteVariable(\"foo\", values=[\"a\", \"b\", \"c\"])\n        a.add_value(\"b\")\n        self.assertEqual(list(a.values), [\"a\", \"b\", \"c\"])\n        self.assertEqual(list(a._value_index), [\"a\", \"b\", \"c\"])\n\n    def test_tuple_list_warning(self):\n        if LooseVersion(Orange.version.short_version) >= LooseVersion(\"3.27\"):\n            self.fail(\"Remove class TupleList; replace it with tuple.\")\n\n        d1 = DiscreteVariable(\"A\", values=(\"one\", \"two\"))\n        with self.assertWarns(DeprecationWarning):\n            val = d1.values + [\"three\", ]\n        self.assertEqual(val, [\"one\", \"two\", \"three\"])\n        with self.assertWarns(DeprecationWarning):\n            val = d1.values.copy()\n        self.assertIsInstance(val, list)\n        self.assertSequenceEqual(val, d1.values)\n\n    def test_unpickle(self):\n        d1 = DiscreteVariable(\"A\", values=(\"two\", \"one\"))\n        s = pickle.dumps(d1)\n        d2 = DiscreteVariable.make(\"A\", values=(\"one\", \"two\", \"three\"))\n        d2_values = tuple(d2.values)\n        d1c = pickle.loads(s)\n        # See: gh-3238\n        # The unpickle reconstruction picks an existing variable (d2), on which\n        # __setstate__ or __dict__.update is called\n        self.assertSequenceEqual(d2.values, d2_values)\n        self.assertSequenceEqual(d1c.values, d1.values)\n        s = pickle.dumps(d2)\n        d1 = DiscreteVariable(\"A\", values=(\"one\", \"two\"))\n        d2 = pickle.loads(s)\n        self.assertSequenceEqual(d2.values, (\"one\", \"two\", \"three\"))\n        self.assertSequenceEqual(d1.values, (\"one\", \"two\"))\n\n    def test_mapper_dense(self):\n        abc = DiscreteVariable(\"a\", values=tuple(\"abc\"))\n        dca = DiscreteVariable(\"a\", values=tuple(\"dca\"))\n        mapper = dca.get_mapper_from(abc)\n\n        self.assertEqual(mapper(0), 2)\n        self.assertTrue(np.isnan(mapper(1)))\n        self.assertEqual(mapper(2), 1)\n\n        self.assertEqual(mapper(0.), 2)\n        self.assertTrue(np.isnan(mapper(1.)))\n        self.assertEqual(mapper(2.), 1)\n        self.assertTrue(np.isnan(mapper(np.nan)))\n\n        self.assertEqual(mapper(\"a\"), 2)\n        self.assertTrue(np.isnan(mapper(\"b\")))\n        self.assertEqual(mapper(\"c\"), 1)\n\n        arr = np.array([0, 0, 2, 1, 0, 1, np.nan])\n        self.assertIsNot(mapper(arr), arr)\n        np.testing.assert_array_equal(\n            mapper(arr), np.array([2, 2, 1, np.nan, 2, np.nan, np.nan]))\n        # dtype=int can have no nans; isnan shouldn't crash the mapper\n\n        arr_int = arr[:-1].astype(int)\n        self.assertIsNot(mapper(arr_int), arr_int)\n        np.testing.assert_array_equal(\n            mapper(arr_int), np.array([2, 2, 1, np.nan, 2, np.nan]))\n\n        arr_obj = arr.astype(object)\n        self.assertIsNot(mapper(arr_obj), arr_obj)\n        np.testing.assert_array_equal(\n            mapper(arr_obj), np.array([2, 2, 1, np.nan, 2, np.nan, np.nan]))\n\n        arr_list = list(arr)\n        self.assertIsNot(mapper(arr_list), arr_list)\n        self.assertTrue(\n            all(x == y or (np.isnan(x) and np.isnan(y))\n                for x, y in zip(mapper(arr_list),\n                                [2, 2, 1, np.nan, 2, np.nan, np.nan])))\n\n        self.assertTrue(\n            x == y or (np.isnan(x) and np.isnan(y))\n            for x, y in zip(mapper(tuple(arr)),\n                            (2, 2, 1, np.nan, 2, np.nan, np.nan)))\n\n        self.assertRaises(ValueError, mapper, object())\n\n    def test_mapper_sparse(self):\n        abc = DiscreteVariable(\"a\", values=tuple(\"abc\"))\n        dca = DiscreteVariable(\"a\", values=tuple(\"dca\"))\n        mapper = dca.get_mapper_from(abc)\n\n        arr = np.array([0, 0, 2, 1, 0, 1, np.nan])\n\n        # 0 does map to 0 -> convert to dense\n        marr = mapper(sp.csr_matrix(arr))\n        self.assertIsInstance(marr, np.ndarray)\n        np.testing.assert_array_equal(\n            marr,\n            np.array([2, 2, 1, np.nan, 2, np.nan, np.nan]))\n\n        marr = mapper(sp.csr_matrix(arr))\n        self.assertIsInstance(marr, np.ndarray)\n        np.testing.assert_array_equal(\n            marr,\n            np.array([2, 2, 1, np.nan, 2, np.nan, np.nan]))\n\n        # 0 maps to 0 -> keep sparse\n        acd = DiscreteVariable(\"a\", values=tuple(\"acd\"))\n        mapper = acd.get_mapper_from(abc)\n\n        arr_csr = sp.csr_matrix(arr)\n        marr = mapper(arr_csr)\n        self.assertIsNot(arr_csr, marr)\n        self.assertTrue(sp.isspmatrix_csr(marr))\n        np.testing.assert_array_equal(\n            marr.todense(),\n            np.array([[0, 0, 1, np.nan, 0, np.nan, np.nan]]))\n\n        arr_csc = sp.csc_matrix(arr)\n        marr = mapper(arr_csc)\n        self.assertIsNot(arr_csc, marr)\n        self.assertTrue(sp.isspmatrix_csc(marr))\n        np.testing.assert_array_equal(\n            marr.todense(),\n            np.array([[0, 0, 1, np.nan, 0, np.nan, np.nan]]))\n\n    def test_mapper_inplace(self):\n        s = list(range(7))\n        abc = DiscreteVariable(\"a\", values=tuple(\"abc\"))\n        dca = DiscreteVariable(\"a\", values=tuple(\"dca\"))\n        mapper = dca.get_mapper_from(abc)\n\n        arr = np.array([[0, 0, 2, 1, 0, 1, np.nan], s]).T\n        mapper(arr, 0)\n        np.testing.assert_array_equal(\n            arr, np.array([[2, 2, 1, np.nan, 2, np.nan, np.nan], s]).T)\n\n        self.assertRaises(ValueError, mapper, sp.csr_matrix(arr), 0)\n        self.assertRaises(ValueError, mapper, [1, 2, 3], 0)\n        self.assertRaises(ValueError, mapper, 1, 0)\n\n        acd = DiscreteVariable(\"a\", values=tuple(\"acd\"))\n        mapper = acd.get_mapper_from(abc)\n\n        arr = np.array([[0, 0, 2, 1, 0, 1, np.nan], s]).T\n        mapper(arr, 0)\n        np.testing.assert_array_equal(\n            arr, np.array([[0, 0, 1, np.nan, 0, np.nan, np.nan], s]).T)\n\n        arr = sp.csr_matrix(np.array([[0, 0, 2, 1, 0, 1, np.nan], s]).T)\n        mapper(arr, 0)\n        np.testing.assert_array_equal(\n            arr.todense(),\n            np.array([[0, 0, 1, np.nan, 0, np.nan, np.nan], s]).T)\n\n        arr = sp.csc_matrix(np.array([[0, 0, 2, 1, 0, 1, np.nan], s]).T)\n        mapper(arr, 0)\n        np.testing.assert_array_equal(\n            arr.todense(),\n            np.array([[0, 0, 1, np.nan, 0, np.nan, np.nan], s]).T)\n\n    def test_mapper_dim_check(self):\n        abc = DiscreteVariable(\"a\", values=tuple(\"abc\"))\n        dca = DiscreteVariable(\"a\", values=tuple(\"dca\"))\n        mapper = dca.get_mapper_from(abc)\n\n        self.assertRaises(ValueError, mapper, np.zeros((7, 2)))\n        self.assertRaises(ValueError, mapper, sp.csr_matrix(np.zeros((7, 2))))\n        self.assertRaises(ValueError, mapper, sp.csc_matrix(np.zeros((7, 2))))\n\n    def test_mapper_from_no_values(self):\n        abc = DiscreteVariable(\"a\", values=())\n        dca = DiscreteVariable(\"a\", values=tuple(\"dca\"))\n        mapper = dca.get_mapper_from(abc)\n\n        arr = np.full(7, np.nan)\n        self.assertIsNot(mapper(arr), arr)\n        np.testing.assert_array_equal(mapper(arr), arr)\n\n        arr_csr = sp.csr_matrix(arr)\n        self.assertIsNot(arr_csr, mapper(arr_csr))\n        np.testing.assert_array_equal(\n            mapper(arr_csr).todense(), np.atleast_2d(arr))\n\n        arr_csc = sp.csc_matrix(arr)\n        self.assertIsNot(arr_csc, mapper(arr_csc))\n        np.testing.assert_array_equal(\n            mapper(arr_csc).todense(), np.atleast_2d(arr))\n\n        self.assertRaises(ValueError, mapper, sp.csr_matrix(arr), 0)\n        self.assertRaises(ValueError, mapper, sp.csc_matrix(arr), 0)\n\n    def varcls_modified(self, name):\n        var = super().varcls_modified(name)\n        var.add_value(\"A\")\n        var.add_value(\"B\")\n        var.ordered = True\n        return var\n\n    def test_copy_checks_len_values(self):\n        var = DiscreteVariable(\"gender\", values=(\"F\", \"M\"))\n        self.assertEqual(var.values, (\"F\", \"M\"))\n\n        self.assertRaises(ValueError, var.copy, values=(\"F\", \"M\", \"N\"))\n        self.assertRaises(ValueError, var.copy, values=(\"F\",))\n        self.assertRaises(ValueError, var.copy, values=())\n\n        var2 = var.copy()\n        self.assertEqual(var2.values, (\"F\", \"M\"))\n\n        var2 = var.copy(values=None)\n        self.assertEqual(var2.values, (\"F\", \"M\"))\n\n        var2 = var.copy(values=(\"W\", \"M\"))\n        self.assertEqual(var2.values, (\"W\", \"M\"))\n\n\n@variabletest(ContinuousVariable)\nclass TestContinuousVariable(VariableTest):\n    def test_make(self):\n        age1 = ContinuousVariable.make(\"age\")\n        age2 = ContinuousVariable.make(\"age\")\n        self.assertEqual(age1, age2)\n        self.assertIsNot(age1, age2)\n\n    def test_decimals(self):\n        a = ContinuousVariable(\"a\", 4)\n        self.assertEqual(a.str_val(4.6543), \"4.6543\")\n        self.assertEqual(a.str_val(4.25), \"4.2500\")\n        self.assertEqual(a.str_val(Unknown), \"?\")\n        a = ContinuousVariable(\"a\", 5)\n        self.assertEqual(a.str_val(0.000000000001), \"0.00000\")\n        a = ContinuousVariable(\"a\", 10)\n        self.assertEqual(a.str_val(0.000000000001), \"1e-12\")\n\n    def test_more_decimals(self):\n        a = ContinuousVariable(\"a\", 0)\n        self.assertEqual(a.str_val(4), \"4\")\n        self.assertEqual(a.str_val(4.1234), \"4.12\")\n\n        a = ContinuousVariable(\"a\", 2)\n        self.assertEqual(a.str_val(4), \"4.00\")\n        self.assertEqual(a.str_val(4.25), \"4.25\")\n        self.assertEqual(a.str_val(4.1234123), \"4.1234\")\n\n        for cca4 in (4 + 1e-9, 4 - 1e-9):\n            assert cca4 != 4\n            self.assertEqual(a.str_val(cca4), \"4.00\")\n\n    def test_adjust_decimals(self):\n        # Default is 3 decimals, but format is %g\n        a = ContinuousVariable(\"a\")\n        self.assertEqual(a.str_val(5), \"5\")\n        self.assertEqual(a.str_val(4.65432), \"4.65432\")\n\n        # Change to no decimals\n        a.val_from_str_add(\"5\")\n        self.assertEqual(a.str_val(5), \"5\")\n\n        # Change to two decimals\n        a.val_from_str_add(\"  5.12    \")\n        self.assertEqual(a.str_val(4.65), \"4.65\")\n        self.assertEqual(a.str_val(5), \"5.00\")\n\n    def varcls_modified(self, name):\n        var = super().varcls_modified(name)\n        var.number_of_decimals = 5\n        return var\n\n\n@variabletest(StringVariable)\nclass TestStringVariable(VariableTest):\n    def test_val(self):\n        a = StringVariable(\"a\")\n        self.assertEqual(a.to_val(None), \"\")\n        self.assertEqual(a.str_val(\"\"), \"?\")\n        self.assertEqual(a.str_val(Value(a, \"\")), \"?\")\n        self.assertEqual(a.repr_val(Value(a, \"foo\")), '\"foo\"')\n\n\n@variabletest(TimeVariable)\nclass TestTimeVariable(VariableTest):\n    TESTS = [\n        # in str, UTC timestamp, out str (in UTC)\n        ('2015-10-12 14:13:11.01+0200', 1444651991.01, '2015-10-12 14:13:11.010000+0200'),\n        ('2015-10-12T14:13:11.81+0200', 1444651991.81, '2015-10-12 14:13:11.810000+0200'),\n        ('2015-10-12 14:13:11.81', 1444659191.81, '2015-10-12 14:13:11.810000'),\n        ('2015-10-12T14:13:11.81', 1444659191.81, '2015-10-12 14:13:11.810000'),\n        ('2015-10-12 14:13:11+0200', 1444651991, '2015-10-12 14:13:11+0200'),\n        ('2015-10-12T14:13:11+0200', 1444651991, '2015-10-12 14:13:11+0200'),\n        ('20151012T141311+0200', 1444651991, '2015-10-12 14:13:11+0200'),\n        ('20151012141311+0200', 1444651991, '2015-10-12 14:13:11+0200'),\n        ('2015-10-12 14:13:11', 1444659191, '2015-10-12 14:13:11'),\n        ('2015-10-12T14:13:11', 1444659191, '2015-10-12 14:13:11'),\n        ('2015-10-12 14:13', 1444659180, '2015-10-12 14:13:00'),\n        ('20151012T141311', 1444659191, '2015-10-12 14:13:11'),\n        ('20151012141311', 1444659191, '2015-10-12 14:13:11'),\n        ('2015-10-12', 1444608000, '2015-10-12'),\n        ('20151012', 1444608000, '2015-10-12'),\n        ('2015-285', 1444608000, '2015-10-12'),\n        ('2015-10', 1443657600, '2015-10-01'),\n        ('2015', 1420070400, '2015-01-01'),\n        ('01:01:01.01', 3661.01, '01:01:01.010000'),\n        ('010101.01', 3661.01, '01:01:01.010000'),\n        ('01:01:01', 3661, '01:01:01'),\n        ('01:01', 3660, '01:01:00'),\n        ('1970-01-01 00:00:00', 0, '1970-01-01 00:00:00'),\n        ('1969-12-31 23:59:59', -1, '1969-12-31 23:59:59'),\n        ('1969-12-31 23:59:58.9', -1.1, '1969-12-31 23:59:58.900000'),\n        ('1900-01-01', -2208988800, '1900-01-01'),\n        ('nan', np.nan, '?'),\n        ('1444651991.81', 1444651991.81, '2015-10-12 12:13:11.810000'),\n    ]\n\n    def test_parse_repr(self):\n        for datestr, timestamp, outstr in self.TESTS:\n            var = TimeVariable('time')\n            ts = var.to_val(datestr)  # calls parse for strings\n            if not np.isnan(ts):\n                self.assertEqual(ts, timestamp, msg=datestr)\n            self.assertEqual(var.repr_val(ts), outstr, msg=datestr)\n\n    def test_parse_utc(self):\n        var = TimeVariable('time')\n        datestr, offset = '2015-10-18 22:48:20', '+0200'\n        ts1 = var.parse(datestr + offset)\n        self.assertEqual(var.repr_val(ts1), datestr + offset)\n        # Once a value is without a TZ, all the values lose it\n        ts2 = var.parse(datestr)\n        self.assertEqual(var.repr_val(ts2), datestr)\n        self.assertEqual(var.repr_val(ts1), '2015-10-18 20:48:20')\n\n    def test_parse_timestamp(self):\n        var = TimeVariable(\"time\")\n        datestr = str(datetime(2016, 6, 14, 23, 8, tzinfo=timezone.utc).timestamp())\n        ts1 = var.parse(datestr)\n        self.assertEqual(var.repr_val(ts1), '2016-06-14 23:08:00')\n\n    def test_parse_invalid(self):\n        var = TimeVariable('var')\n        with self.assertRaises(ValueError):\n            var.parse('123')\n\n    def test_have_date(self):\n        var = TimeVariable('time')\n        ts = var.parse('1937-08-02')  # parse date\n        self.assertEqual(var.repr_val(ts), '1937-08-02')\n        ts = var.parse('16:20')  # parse time\n        # observe have datetime\n        self.assertEqual(var.repr_val(ts), '1970-01-01 16:20:00')\n\n    def test_no_date_no_time(self):\n        self.assertEqual(TimeVariable('relative time').repr_val(1.6), '1.6')\n\n    def test_readwrite_timevariable(self):\n        output_csv = StringIO()\n        input_csv = StringIO(\"\"\"\\\nDate,Feature\ntime,continuous\n,\n1920-12-12,1.0\n1920-12-13,3.0\n1920-12-14,5.5\n\"\"\")\n        for stream in (output_csv, input_csv):\n            stream.close = lambda: None  # HACK: Prevent closing of streams\n\n        table = CSVReader(input_csv).read()\n        self.assertIsInstance(table.domain['Date'], TimeVariable)\n        self.assertEqual(table[0, 'Date'], '1920-12-12')\n        # Dates before 1970 are negative\n        self.assertTrue(all(inst['Date'] < 0 for inst in table))\n\n        CSVReader.write_file(output_csv, table)\n        self.assertEqual(input_csv.getvalue().splitlines(),\n                         output_csv.getvalue().splitlines())\n\n    def test_repr_value(self):\n        # https://github.com/biolab/orange3/pull/1760\n        var = TimeVariable('time')\n        self.assertEqual(var.repr_val(Value(var, 416.3)), '416.3')\n\n    def test_have_date_have_time_in_construct(self):\n        \"\"\"Test if have_time and have_date is correctly set\"\"\"\n        var = TimeVariable('time', have_date=1)\n        self.assertTrue(var.have_date)\n        self.assertFalse(var.have_time)\n\n    def varcls_modified(self, name):\n        var = super().varcls_modified(name)\n        var.number_of_decimals = 5\n        var.have_date = 1\n        var.have_time = 1\n        return var\n\n\nPickleContinuousVariable = create_pickling_tests(\n    \"PickleContinuousVariable\",\n    (\"with_name\", lambda: ContinuousVariable(name=\"Feature 0\")),\n)\n\nPickleDiscreteVariable = create_pickling_tests(\n    \"PickleDiscreteVariable\",\n    (\"with_name\", lambda: DiscreteVariable(name=\"Feature 0\")),\n    (\"with_str_value\", lambda: DiscreteVariable(name=\"Feature 0\",\n                                                values=(\"F\", \"M\"))),\n    (\"ordered\", lambda: DiscreteVariable(name=\"Feature 0\",\n                                         values=(\"F\", \"M\"),\n                                         ordered=True)),\n)\n\n\nPickleStringVariable = create_pickling_tests(\n    \"PickleStringVariable\",\n    (\"with_name\", lambda: StringVariable(name=\"Feature 0\"))\n)\n\n\nclass VariableTestMakeProxy(unittest.TestCase):\n    def test_make_proxy_disc(self):\n        abc = DiscreteVariable(\"abc\", values=\"abc\", ordered=True)\n        abc1 = abc.make_proxy()\n        abc2 = abc1.make_proxy()\n        self.assertEqual(abc, abc1)\n        self.assertEqual(abc, abc2)\n        self.assertEqual(abc1, abc2)\n        self.assertEqual(hash(abc), hash(abc1))\n        self.assertEqual(hash(abc1), hash(abc2))\n\n        abcx = DiscreteVariable(\"abc\", values=\"abc\", ordered=True)\n        self.assertEqual(abc, abcx)\n        self.assertIsNot(abc, abcx)\n\n        abc1p = pickle.loads(pickle.dumps(abc1))\n        self.assertEqual(abc1p, abc)\n\n        abcp, abc1p, abc2p = pickle.loads(pickle.dumps((abc, abc1, abc2)))\n        self.assertEqual(abcp, abc1p)\n        self.assertEqual(abcp, abc2p)\n        self.assertEqual(abc1p, abc2p)\n\n    def test_make_proxy_cont(self):\n        abc = ContinuousVariable(\"abc\")\n        abc1 = abc.make_proxy()\n        abc2 = abc1.make_proxy()\n        self.assertEqual(abc, abc1)\n        self.assertEqual(abc, abc2)\n        self.assertEqual(abc1, abc2)\n        self.assertEqual(hash(abc), hash(abc1))\n        self.assertEqual(hash(abc1), hash(abc2))\n\n    def test_proxy_has_separate_attributes(self):\n        image = StringVariable(\"image\")\n        image1 = image.make_proxy()\n        image2 = image1.make_proxy()\n\n        image.attributes[\"origin\"] = \"a\"\n        image1.attributes[\"origin\"] = \"b\"\n        image2.attributes[\"origin\"] = \"c\"\n\n        self.assertEqual(image.attributes[\"origin\"], \"a\")\n        self.assertEqual(image1.attributes[\"origin\"], \"b\")\n        self.assertEqual(image2.attributes[\"origin\"], \"c\")\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\n# pylint: disable=protected-access\n\nimport sys\nimport math\nimport unittest\nimport pickle\nimport pkgutil\nfrom datetime import datetime, timezone\nfrom distutils.version import LooseVersion\n\nfrom io import StringIO\n\nimport numpy as np\nimport scipy.sparse as sp\n\nimport Orange\nfrom Orange.data import Variable, ContinuousVariable, DiscreteVariable, \\\n    StringVariable, TimeVariable, Unknown, Value\nfrom Orange.data.io import CSVReader\nfrom Orange.preprocess.transformation import Identity\nfrom Orange.tests.base import create_pickling_tests\nfrom Orange.util import OrangeDeprecationWarning\n\n\ndef is_on_path(name):\n    \"\"\"\n    Is a top level package/module found on sys.path\n\n    Parameters\n    ----------\n    name : str\n        Top level module/package name\n\n    Returns\n    -------\n    found : bool\n    \"\"\"\n    for _, name_, _ in pkgutil.iter_modules(sys.path):\n        if name == name_:\n            return True\n    return False\n\n\n# noinspection PyPep8Naming,PyUnresolvedReferences\nclass VariableTest:\n    def test_dont_pickle_anonymous_variables(self):\n        with self.assertWarns(OrangeDeprecationWarning):\n            self.assertRaises(pickle.PickleError, pickle.dumps, self.varcls())\n\n    def test_dont_make_anonymous_variables(self):\n        self.assertWarns(OrangeDeprecationWarning, self.varcls.make, \"\")\n\n    def test_copy_copies_attributes(self):\n        var = self.varcls(\"x\")\n        var.attributes[\"a\"] = \"b\"\n        var2 = var.copy(compute_value=None)\n        self.assertIn(\"a\", var2.attributes)\n        self.assertIsInstance(var2, type(var))\n\n        var2.attributes[\"a\"] = \"c\"\n        # Attributes of original value should not change\n        self.assertEqual(var.attributes[\"a\"], \"b\")\n\n    def test_rename(self):\n        var = self.varcls_modified(\"x\")\n        var2 = var.copy(name=\"x2\")\n        self.assertIsInstance(var2, type(var))\n        self.assertIsNot(var, var2)\n        self.assertEqual(var2.name, \"x2\")\n        var.__dict__.pop(\"_name\")\n        var2.__dict__.pop(\"_name\")\n        self.assertDictEqual(var.__dict__, var2.__dict__)\n\n    def varcls_modified(self, name):\n        var = self.varcls(name)\n        var._compute_value = lambda x: x\n        var.sparse = True\n        var.attributes = {\"a\": 1}\n        return var\n\n\nclass TestVariable(unittest.TestCase):\n    @classmethod\n    def setUpClass(cls):\n        cls.var = Variable(\"x\")\n\n    def test_name(self):\n        self.assertEqual(repr(self.var), \"Variable(name='x')\")\n\n    def test_to_val(self):\n        string_var = StringVariable(\"x\")\n        self.assertEqual(string_var.to_val(\"foo\"), \"foo\")\n        self.assertEqual(string_var.to_val(42), \"42\")\n\n        cont_var = ContinuousVariable(\"x\")\n        self.assertTrue(math.isnan(cont_var.to_val(\"?\")))\n        self.assertTrue(math.isnan(Unknown))\n\n        var = Variable(\"x\")\n        self.assertEqual(var.to_val(\"x\"), \"x\")\n\n    def test_repr_is_abstract(self):\n        self.assertRaises(RuntimeError, self.var.repr_val, None)\n\n    def test_properties(self):\n        a = ContinuousVariable(\"y\")\n        self.assertTrue(a.is_continuous)\n        self.assertFalse(a.is_discrete)\n        self.assertFalse(a.is_string)\n        self.assertTrue(a.is_primitive())\n\n        a = DiscreteVariable(\"d\")\n        self.assertFalse(a.is_continuous)\n        self.assertTrue(a.is_discrete)\n        self.assertFalse(a.is_string)\n        self.assertTrue(a.is_primitive())\n\n        a = StringVariable(\"s\")\n        self.assertFalse(a.is_continuous)\n        self.assertFalse(a.is_discrete)\n        self.assertTrue(a.is_string)\n        self.assertFalse(a.is_primitive())\n\n    def test_properties_as_predicates(self):\n        a = ContinuousVariable(\"y\")\n        self.assertTrue(Variable.is_continuous(a))\n        self.assertFalse(Variable.is_discrete(a))\n        self.assertFalse(Variable.is_string(a))\n        self.assertTrue(Variable.is_primitive(a))\n\n        a = StringVariable(\"s\")\n        self.assertFalse(Variable.is_continuous(a))\n        self.assertFalse(Variable.is_discrete(a))\n        self.assertTrue(Variable.is_string(a))\n        self.assertFalse(Variable.is_primitive(a))\n\n    def test_strange_eq(self):\n        a = ContinuousVariable(\"a\")\n        b = ContinuousVariable(\"a\")\n        self.assertEqual(a, a)\n        self.assertEqual(a, b)\n        self.assertIsNot(a, b)\n        self.assertNotEqual(a, \"somestring\")\n        self.assertEqual(hash(a), hash(b))\n\n    def test_eq_with_compute_value(self):\n        a = ContinuousVariable(\"a\")\n        b = ContinuousVariable(\"a\")\n        self.assertEqual(a, a)\n        self.assertEqual(a, b)\n        self.assertIsNot(a, b)\n\n        a._compute_value = lambda x: x\n        self.assertEqual(a, a)\n        self.assertNotEqual(a, b)\n\n        a1 = ContinuousVariable(\"a\")\n        a2 = ContinuousVariable(\"a\")\n        c = ContinuousVariable(\"c\")\n\n        a._compute_value = Identity(a1)\n        self.assertEqual(a, a)\n        self.assertEqual(a, b)\n        self.assertEqual(hash(a), hash(b))\n\n        b._compute_value = a.compute_value\n        self.assertEqual(a, b)\n\n        b._compute_value = Identity(a1)\n        self.assertEqual(a, b)\n\n        b._compute_value = Identity(a2)\n        self.assertEqual(a, b)\n\n        b._compute_value = Identity(c)\n        self.assertNotEqual(a, b)\n\n        b._compute_value = Identity(a2)\n        a1._compute_value = lambda x: x\n        self.assertNotEqual(a, b)\n\n        a1._compute_value = Identity(c)\n        self.assertNotEqual(a, b)\n\n        a2._compute_value = Identity(c)\n        self.assertEqual(a, b)\n\n    def test_hash(self):\n        a = ContinuousVariable(\"a\")\n        b = ContinuousVariable(\"a\")\n        self.assertEqual(hash(a), hash(b))\n\n        a._compute_value = lambda x: x\n        self.assertNotEqual(hash(a), hash(b))\n\n        b._compute_value = lambda x: x\n        self.assertNotEqual(hash(a), hash(b))\n\n        a1 = ContinuousVariable(\"a\")\n        a2 = ContinuousVariable(\"a\")\n\n        a._compute_value = Identity(a1)\n        self.assertNotEqual(hash(a), hash(b))\n\n        b._compute_value = Identity(a2)\n        self.assertEqual(hash(a), hash(b))\n\n        at = TimeVariable(\"a\")\n        b = ContinuousVariable(\"b\")\n        self.assertEqual(hash(a1), hash(a2))\n        self.assertNotEqual(hash(a1), hash(b))\n        self.assertNotEqual(hash(a1), hash(at))\n\n    def test_hash_eq(self):\n        a = ContinuousVariable(\"a\")\n        b1 = ContinuousVariable(\"b\", compute_value=Identity(a))\n        b2 = ContinuousVariable(\"b2\", compute_value=Identity(b1))\n        b3 = ContinuousVariable(\"b\")\n        self.assertEqual(a, b2)\n        self.assertEqual(b1, b2)\n        self.assertEqual(a, b1)\n        self.assertNotEqual(b1, b3)\n\n        self.assertEqual(hash(a), hash(b2))\n        self.assertEqual(hash(b1), hash(b2))\n        self.assertEqual(hash(a), hash(b1))\n        self.assertNotEqual(hash(b1), hash(b3))\n\n\ndef variabletest(varcls):\n    def decorate(cls):\n        return type(cls.__name__, (cls, unittest.TestCase), {'varcls': varcls})\n    return decorate\n\n\n@variabletest(DiscreteVariable)\nclass TestDiscreteVariable(VariableTest):\n    def test_to_val(self):\n        values = [\"F\", \"M\"]\n        var = DiscreteVariable(name=\"Feature 0\", values=values)\n\n        self.assertEqual(var.to_val(0), 0)\n        self.assertEqual(var.to_val(\"F\"), 0)\n        self.assertEqual(var.to_val(0.), 0)\n        self.assertTrue(math.isnan(var.to_val(\"?\")))\n\n        # TODO: with self.assertRaises(ValueError): var.to_val(2)\n        with self.assertRaises(ValueError):\n            var.to_val(\"G\")\n\n    def test_make(self):\n        var = DiscreteVariable.make(\"a\", values=(\"F\", \"M\"))\n        self.assertIsInstance(var, DiscreteVariable)\n        self.assertEqual(var.name, \"a\")\n        self.assertEqual(var.values, (\"F\", \"M\"))\n\n    def test_val_from_str(self):\n        var = DiscreteVariable.make(\"a\", values=(\"F\", \"M\"))\n        self.assertTrue(math.isnan(var.to_val(None)))\n        self.assertEqual(var.to_val(1), 1)\n\n    def test_val_from_str_add(self):\n        var = DiscreteVariable.make(\"a\", values=(\"F\", \"M\"))\n        self.assertTrue(math.isnan(var.val_from_str_add(None)))\n        self.assertEqual(var.val_from_str_add(\"M\"), 1)\n        self.assertEqual(var.val_from_str_add(\"F\"), 0)\n        self.assertEqual(var.values, (\"F\", \"M\"))\n        self.assertEqual(var.val_from_str_add(\"N\"), 2)\n        self.assertEqual(var.values, (\"F\", \"M\", \"N\"))\n        self.assertEqual(var._value_index, {\"F\": 0, \"M\": 1, \"N\": 2})\n        self.assertEqual(var.val_from_str_add(\"M\"), 1)\n        self.assertEqual(var.val_from_str_add(\"F\"), 0)\n        self.assertEqual(var.val_from_str_add(\"N\"), 2)\n\n    def test_repr(self):\n        var = DiscreteVariable.make(\"a\", values=(\"F\", \"M\"))\n        self.assertEqual(\n            repr(var),\n            \"DiscreteVariable(name='a', values=('F', 'M'))\")\n        var.ordered = True\n        self.assertEqual(\n            repr(var),\n            \"DiscreteVariable(name='a', values=('F', 'M'), ordered=True)\")\n\n        var = DiscreteVariable.make(\"a\", values=\"1234567\")\n        self.assertEqual(\n            repr(var),\n            \"DiscreteVariable(name='a', values=('1', '2', '3', '4', '5', '6', '7'))\")\n\n    def test_no_nonstringvalues(self):\n        self.assertRaises(TypeError, DiscreteVariable, \"foo\", values=(\"a\", 42))\n        a = DiscreteVariable(\"foo\", values=(\"a\", \"b\", \"c\"))\n        self.assertRaises(TypeError, a.add_value, 42)\n\n    def test_no_duplicated_values(self):\n        a = DiscreteVariable(\"foo\", values=[\"a\", \"b\", \"c\"])\n        a.add_value(\"b\")\n        self.assertEqual(list(a.values), [\"a\", \"b\", \"c\"])\n        self.assertEqual(list(a._value_index), [\"a\", \"b\", \"c\"])\n\n    def test_tuple_list_warning(self):\n        if LooseVersion(Orange.version.short_version) >= LooseVersion(\"3.27\"):\n            self.fail(\"Remove class TupleList; replace it with tuple.\")\n\n        d1 = DiscreteVariable(\"A\", values=(\"one\", \"two\"))\n        with self.assertWarns(DeprecationWarning):\n            val = d1.values + [\"three\", ]\n        self.assertEqual(val, [\"one\", \"two\", \"three\"])\n        with self.assertWarns(DeprecationWarning):\n            val = d1.values.copy()\n        self.assertIsInstance(val, list)\n        self.assertSequenceEqual(val, d1.values)\n\n    def test_unpickle(self):\n        d1 = DiscreteVariable(\"A\", values=(\"two\", \"one\"))\n        s = pickle.dumps(d1)\n        d2 = DiscreteVariable.make(\"A\", values=(\"one\", \"two\", \"three\"))\n        d2_values = tuple(d2.values)\n        d1c = pickle.loads(s)\n        # See: gh-3238\n        # The unpickle reconstruction picks an existing variable (d2), on which\n        # __setstate__ or __dict__.update is called\n        self.assertSequenceEqual(d2.values, d2_values)\n        self.assertSequenceEqual(d1c.values, d1.values)\n        s = pickle.dumps(d2)\n        d1 = DiscreteVariable(\"A\", values=(\"one\", \"two\"))\n        d2 = pickle.loads(s)\n        self.assertSequenceEqual(d2.values, (\"one\", \"two\", \"three\"))\n        self.assertSequenceEqual(d1.values, (\"one\", \"two\"))\n\n    def test_mapper_dense(self):\n        abc = DiscreteVariable(\"a\", values=tuple(\"abc\"))\n        dca = DiscreteVariable(\"a\", values=tuple(\"dca\"))\n        mapper = dca.get_mapper_from(abc)\n\n        self.assertEqual(mapper(0), 2)\n        self.assertTrue(np.isnan(mapper(1)))\n        self.assertEqual(mapper(2), 1)\n\n        self.assertEqual(mapper(0.), 2)\n        self.assertTrue(np.isnan(mapper(1.)))\n        self.assertEqual(mapper(2.), 1)\n        self.assertTrue(np.isnan(mapper(np.nan)))\n\n        self.assertEqual(mapper(\"a\"), 2)\n        self.assertTrue(np.isnan(mapper(\"b\")))\n        self.assertEqual(mapper(\"c\"), 1)\n\n        arr = np.array([0, 0, 2, 1, 0, 1, np.nan])\n        self.assertIsNot(mapper(arr), arr)\n        np.testing.assert_array_equal(\n            mapper(arr), np.array([2, 2, 1, np.nan, 2, np.nan, np.nan]))\n        # dtype=int can have no nans; isnan shouldn't crash the mapper\n\n        arr_int = arr[:-1].astype(int)\n        self.assertIsNot(mapper(arr_int), arr_int)\n        np.testing.assert_array_equal(\n            mapper(arr_int), np.array([2, 2, 1, np.nan, 2, np.nan]))\n\n        arr_obj = arr.astype(object)\n        self.assertIsNot(mapper(arr_obj), arr_obj)\n        np.testing.assert_array_equal(\n            mapper(arr_obj), np.array([2, 2, 1, np.nan, 2, np.nan, np.nan]))\n\n        arr_list = list(arr)\n        self.assertIsNot(mapper(arr_list), arr_list)\n        self.assertTrue(\n            all(x == y or (np.isnan(x) and np.isnan(y))\n                for x, y in zip(mapper(arr_list),\n                                [2, 2, 1, np.nan, 2, np.nan, np.nan])))\n\n        self.assertTrue(\n            x == y or (np.isnan(x) and np.isnan(y))\n            for x, y in zip(mapper(tuple(arr)),\n                            (2, 2, 1, np.nan, 2, np.nan, np.nan)))\n\n        self.assertRaises(ValueError, mapper, object())\n\n    def test_mapper_sparse(self):\n        abc = DiscreteVariable(\"a\", values=tuple(\"abc\"))\n        dca = DiscreteVariable(\"a\", values=tuple(\"dca\"))\n        mapper = dca.get_mapper_from(abc)\n\n        arr = np.array([0, 0, 2, 1, 0, 1, np.nan])\n\n        # 0 does map to 0 -> convert to dense\n        marr = mapper(sp.csr_matrix(arr))\n        self.assertIsInstance(marr, np.ndarray)\n        np.testing.assert_array_equal(\n            marr,\n            np.array([2, 2, 1, np.nan, 2, np.nan, np.nan]))\n\n        marr = mapper(sp.csr_matrix(arr))\n        self.assertIsInstance(marr, np.ndarray)\n        np.testing.assert_array_equal(\n            marr,\n            np.array([2, 2, 1, np.nan, 2, np.nan, np.nan]))\n\n        # 0 maps to 0 -> keep sparse\n        acd = DiscreteVariable(\"a\", values=tuple(\"acd\"))\n        mapper = acd.get_mapper_from(abc)\n\n        arr_csr = sp.csr_matrix(arr)\n        marr = mapper(arr_csr)\n        self.assertIsNot(arr_csr, marr)\n        self.assertTrue(sp.isspmatrix_csr(marr))\n        np.testing.assert_array_equal(\n            marr.todense(),\n            np.array([[0, 0, 1, np.nan, 0, np.nan, np.nan]]))\n\n        arr_csc = sp.csc_matrix(arr)\n        marr = mapper(arr_csc)\n        self.assertIsNot(arr_csc, marr)\n        self.assertTrue(sp.isspmatrix_csc(marr))\n        np.testing.assert_array_equal(\n            marr.todense(),\n            np.array([[0, 0, 1, np.nan, 0, np.nan, np.nan]]))\n\n    def test_mapper_inplace(self):\n        s = list(range(7))\n        abc = DiscreteVariable(\"a\", values=tuple(\"abc\"))\n        dca = DiscreteVariable(\"a\", values=tuple(\"dca\"))\n        mapper = dca.get_mapper_from(abc)\n\n        arr = np.array([[0, 0, 2, 1, 0, 1, np.nan], s]).T\n        mapper(arr, 0)\n        np.testing.assert_array_equal(\n            arr, np.array([[2, 2, 1, np.nan, 2, np.nan, np.nan], s]).T)\n\n        self.assertRaises(ValueError, mapper, sp.csr_matrix(arr), 0)\n        self.assertRaises(ValueError, mapper, [1, 2, 3], 0)\n        self.assertRaises(ValueError, mapper, 1, 0)\n\n        acd = DiscreteVariable(\"a\", values=tuple(\"acd\"))\n        mapper = acd.get_mapper_from(abc)\n\n        arr = np.array([[0, 0, 2, 1, 0, 1, np.nan], s]).T\n        mapper(arr, 0)\n        np.testing.assert_array_equal(\n            arr, np.array([[0, 0, 1, np.nan, 0, np.nan, np.nan], s]).T)\n\n        arr = sp.csr_matrix(np.array([[0, 0, 2, 1, 0, 1, np.nan], s]).T)\n        mapper(arr, 0)\n        np.testing.assert_array_equal(\n            arr.todense(),\n            np.array([[0, 0, 1, np.nan, 0, np.nan, np.nan], s]).T)\n\n        arr = sp.csc_matrix(np.array([[0, 0, 2, 1, 0, 1, np.nan], s]).T)\n        mapper(arr, 0)\n        np.testing.assert_array_equal(\n            arr.todense(),\n            np.array([[0, 0, 1, np.nan, 0, np.nan, np.nan], s]).T)\n\n    def test_mapper_dim_check(self):\n        abc = DiscreteVariable(\"a\", values=tuple(\"abc\"))\n        dca = DiscreteVariable(\"a\", values=tuple(\"dca\"))\n        mapper = dca.get_mapper_from(abc)\n\n        self.assertRaises(ValueError, mapper, np.zeros((7, 2)))\n        self.assertRaises(ValueError, mapper, sp.csr_matrix(np.zeros((7, 2))))\n        self.assertRaises(ValueError, mapper, sp.csc_matrix(np.zeros((7, 2))))\n\n    def test_mapper_from_no_values(self):\n        abc = DiscreteVariable(\"a\", values=())\n        dca = DiscreteVariable(\"a\", values=tuple(\"dca\"))\n        mapper = dca.get_mapper_from(abc)\n\n        arr = np.full(7, np.nan)\n        self.assertIsNot(mapper(arr), arr)\n        np.testing.assert_array_equal(mapper(arr), arr)\n\n        arr_csr = sp.csr_matrix(arr)\n        self.assertIsNot(arr_csr, mapper(arr_csr))\n        np.testing.assert_array_equal(\n            mapper(arr_csr).todense(), np.atleast_2d(arr))\n\n        arr_csc = sp.csc_matrix(arr)\n        self.assertIsNot(arr_csc, mapper(arr_csc))\n        np.testing.assert_array_equal(\n            mapper(arr_csc).todense(), np.atleast_2d(arr))\n\n        self.assertRaises(ValueError, mapper, sp.csr_matrix(arr), 0)\n        self.assertRaises(ValueError, mapper, sp.csc_matrix(arr), 0)\n\n    def varcls_modified(self, name):\n        var = super().varcls_modified(name)\n        var.add_value(\"A\")\n        var.add_value(\"B\")\n        var.ordered = True\n        return var\n\n    def test_copy_checks_len_values(self):\n        var = DiscreteVariable(\"gender\", values=(\"F\", \"M\"))\n        self.assertEqual(var.values, (\"F\", \"M\"))\n\n        self.assertRaises(ValueError, var.copy, values=(\"F\", \"M\", \"N\"))\n        self.assertRaises(ValueError, var.copy, values=(\"F\",))\n        self.assertRaises(ValueError, var.copy, values=())\n\n        var2 = var.copy()\n        self.assertEqual(var2.values, (\"F\", \"M\"))\n\n        var2 = var.copy(values=None)\n        self.assertEqual(var2.values, (\"F\", \"M\"))\n\n        var2 = var.copy(values=(\"W\", \"M\"))\n        self.assertEqual(var2.values, (\"W\", \"M\"))\n\n\n@variabletest(ContinuousVariable)\nclass TestContinuousVariable(VariableTest):\n    def test_make(self):\n        age1 = ContinuousVariable.make(\"age\")\n        age2 = ContinuousVariable.make(\"age\")\n        self.assertEqual(age1, age2)\n        self.assertIsNot(age1, age2)\n\n    def test_decimals(self):\n        a = ContinuousVariable(\"a\", 4)\n        self.assertEqual(a.str_val(4.6543), \"4.6543\")\n        self.assertEqual(a.str_val(4.25), \"4.2500\")\n        self.assertEqual(a.str_val(Unknown), \"?\")\n        a = ContinuousVariable(\"a\", 5)\n        self.assertEqual(a.str_val(0.000000000001), \"0.00000\")\n        a = ContinuousVariable(\"a\", 10)\n        self.assertEqual(a.str_val(0.000000000001), \"1e-12\")\n\n    def test_more_decimals(self):\n        a = ContinuousVariable(\"a\", 0)\n        self.assertEqual(a.str_val(4), \"4\")\n        self.assertEqual(a.str_val(4.1234), \"4.12\")\n\n        a = ContinuousVariable(\"a\", 2)\n        self.assertEqual(a.str_val(4), \"4.00\")\n        self.assertEqual(a.str_val(4.25), \"4.25\")\n        self.assertEqual(a.str_val(4.1234123), \"4.1234\")\n\n        for cca4 in (4 + 1e-9, 4 - 1e-9):\n            assert cca4 != 4\n            self.assertEqual(a.str_val(cca4), \"4.00\")\n\n    def test_adjust_decimals(self):\n        # Default is 3 decimals, but format is %g\n        a = ContinuousVariable(\"a\")\n        self.assertEqual(a.str_val(5), \"5\")\n        self.assertEqual(a.str_val(4.65432), \"4.65432\")\n\n        # Change to no decimals\n        a.val_from_str_add(\"5\")\n        self.assertEqual(a.str_val(5), \"5\")\n\n        # Change to two decimals\n        a.val_from_str_add(\"  5.12    \")\n        self.assertEqual(a.str_val(4.65), \"4.65\")\n        self.assertEqual(a.str_val(5), \"5.00\")\n\n    def varcls_modified(self, name):\n        var = super().varcls_modified(name)\n        var.number_of_decimals = 5\n        return var\n\n\n@variabletest(StringVariable)\nclass TestStringVariable(VariableTest):\n    def test_val(self):\n        a = StringVariable(\"a\")\n        self.assertEqual(a.to_val(None), \"\")\n        self.assertEqual(a.str_val(\"\"), \"?\")\n        self.assertEqual(a.str_val(Value(a, \"\")), \"?\")\n        self.assertEqual(a.repr_val(Value(a, \"foo\")), '\"foo\"')\n\n\n@variabletest(TimeVariable)\nclass TestTimeVariable(VariableTest):\n    TESTS = [\n        # in str, UTC timestamp, out str (in UTC)\n        ('2015-10-12 14:13:11.01+0200', 1444651991.01, '2015-10-12 14:13:11.010000+0200'),\n        ('2015-10-12T14:13:11.81+0200', 1444651991.81, '2015-10-12 14:13:11.810000+0200'),\n        ('2015-10-12 14:13:11.81', 1444659191.81, '2015-10-12 14:13:11.810000'),\n        ('2015-10-12T14:13:11.81', 1444659191.81, '2015-10-12 14:13:11.810000'),\n        ('2015-10-12 14:13:11+0200', 1444651991, '2015-10-12 14:13:11+0200'),\n        ('2015-10-12T14:13:11+0200', 1444651991, '2015-10-12 14:13:11+0200'),\n        ('20151012T141311+0200', 1444651991, '2015-10-12 14:13:11+0200'),\n        ('20151012141311+0200', 1444651991, '2015-10-12 14:13:11+0200'),\n        ('2015-10-12 14:13:11', 1444659191, '2015-10-12 14:13:11'),\n        ('2015-10-12T14:13:11', 1444659191, '2015-10-12 14:13:11'),\n        ('2015-10-12 14:13', 1444659180, '2015-10-12 14:13:00'),\n        ('20151012T141311', 1444659191, '2015-10-12 14:13:11'),\n        ('20151012141311', 1444659191, '2015-10-12 14:13:11'),\n        ('2015-10-12', 1444608000, '2015-10-12'),\n        ('20151012', 1444608000, '2015-10-12'),\n        ('2015-285', 1444608000, '2015-10-12'),\n        ('2015-10', 1443657600, '2015-10-01'),\n        ('2015', 1420070400, '2015-01-01'),\n        ('01:01:01.01', 3661.01, '01:01:01.010000'),\n        ('010101.01', 3661.01, '01:01:01.010000'),\n        ('01:01:01', 3661, '01:01:01'),\n        ('01:01', 3660, '01:01:00'),\n        ('1970-01-01 00:00:00', 0, '1970-01-01 00:00:00'),\n        ('1969-12-31 23:59:59', -1, '1969-12-31 23:59:59'),\n        ('1969-12-31 23:59:58.9', -1.1, '1969-12-31 23:59:58.900000'),\n        ('1900-01-01', -2208988800, '1900-01-01'),\n        ('nan', np.nan, '?'),\n        ('1444651991.81', 1444651991.81, '2015-10-12 12:13:11.810000'),\n    ]\n\n    def test_parse_repr(self):\n        for datestr, timestamp, outstr in self.TESTS:\n            var = TimeVariable('time')\n            ts = var.to_val(datestr)  # calls parse for strings\n            if not np.isnan(ts):\n                self.assertEqual(ts, timestamp, msg=datestr)\n            self.assertEqual(var.repr_val(ts), outstr, msg=datestr)\n\n    def test_parse_utc(self):\n        var = TimeVariable('time')\n        datestr, offset = '2015-10-18 22:48:20', '+0200'\n        ts1 = var.parse(datestr + offset)\n        self.assertEqual(var.repr_val(ts1), datestr + offset)\n        # Once a value is without a TZ, all the values lose it\n        ts2 = var.parse(datestr)\n        self.assertEqual(var.repr_val(ts2), datestr)\n        self.assertEqual(var.repr_val(ts1), '2015-10-18 20:48:20')\n\n    def test_parse_timestamp(self):\n        var = TimeVariable(\"time\")\n        datestr = str(datetime(2016, 6, 14, 23, 8, tzinfo=timezone.utc).timestamp())\n        ts1 = var.parse(datestr)\n        self.assertEqual(var.repr_val(ts1), '2016-06-14 23:08:00')\n\n    def test_parse_invalid(self):\n        var = TimeVariable('var')\n        with self.assertRaises(ValueError):\n            var.parse('123')\n\n    def test_have_date(self):\n        var = TimeVariable('time')\n        ts = var.parse('1937-08-02')  # parse date\n        self.assertEqual(var.repr_val(ts), '1937-08-02')\n        ts = var.parse('16:20')  # parse time\n        # observe have datetime\n        self.assertEqual(var.repr_val(ts), '1970-01-01 16:20:00')\n\n    def test_no_date_no_time(self):\n        self.assertEqual(TimeVariable('relative time').repr_val(1.6), '1.6')\n\n    def test_readwrite_timevariable(self):\n        output_csv = StringIO()\n        input_csv = StringIO(\"\"\"\\\nDate,Feature\ntime,continuous\n,\n1920-12-12,1.0\n1920-12-13,3.0\n1920-12-14,5.5\n\"\"\")\n        for stream in (output_csv, input_csv):\n            stream.close = lambda: None  # HACK: Prevent closing of streams\n\n        table = CSVReader(input_csv).read()\n        self.assertIsInstance(table.domain['Date'], TimeVariable)\n        self.assertEqual(table[0, 'Date'], '1920-12-12')\n        # Dates before 1970 are negative\n        self.assertTrue(all(inst['Date'] < 0 for inst in table))\n\n        CSVReader.write_file(output_csv, table)\n        self.assertEqual(input_csv.getvalue().splitlines(),\n                         output_csv.getvalue().splitlines())\n\n    def test_repr_value(self):\n        # https://github.com/biolab/orange3/pull/1760\n        var = TimeVariable('time')\n        self.assertEqual(var.repr_val(Value(var, 416.3)), '416.3')\n\n    def test_have_date_have_time_in_construct(self):\n        \"\"\"Test if have_time and have_date is correctly set\"\"\"\n        var = TimeVariable('time', have_date=1)\n        self.assertTrue(var.have_date)\n        self.assertFalse(var.have_time)\n\n    def varcls_modified(self, name):\n        var = super().varcls_modified(name)\n        var.number_of_decimals = 5\n        var.have_date = 1\n        var.have_time = 1\n        return var\n\n\nPickleContinuousVariable = create_pickling_tests(\n    \"PickleContinuousVariable\",\n    (\"with_name\", lambda: ContinuousVariable(name=\"Feature 0\")),\n)\n\nPickleDiscreteVariable = create_pickling_tests(\n    \"PickleDiscreteVariable\",\n    (\"with_name\", lambda: DiscreteVariable(name=\"Feature 0\")),\n    (\"with_str_value\", lambda: DiscreteVariable(name=\"Feature 0\",\n                                                values=(\"F\", \"M\"))),\n    (\"ordered\", lambda: DiscreteVariable(name=\"Feature 0\",\n                                         values=(\"F\", \"M\"),\n                                         ordered=True)),\n)\n\n\nPickleStringVariable = create_pickling_tests(\n    \"PickleStringVariable\",\n    (\"with_name\", lambda: StringVariable(name=\"Feature 0\"))\n)\n\n\nclass VariableTestMakeProxy(unittest.TestCase):\n    def test_make_proxy_disc(self):\n        abc = DiscreteVariable(\"abc\", values=\"abc\", ordered=True)\n        abc1 = abc.make_proxy()\n        abc2 = abc1.make_proxy()\n        self.assertEqual(abc, abc1)\n        self.assertEqual(abc, abc2)\n        self.assertEqual(abc1, abc2)\n        self.assertEqual(hash(abc), hash(abc1))\n        self.assertEqual(hash(abc1), hash(abc2))\n\n        abcx = DiscreteVariable(\"abc\", values=\"abc\", ordered=True)\n        self.assertEqual(abc, abcx)\n        self.assertIsNot(abc, abcx)\n\n        abc1p = pickle.loads(pickle.dumps(abc1))\n        self.assertEqual(abc1p, abc)\n\n        abcp, abc1p, abc2p = pickle.loads(pickle.dumps((abc, abc1, abc2)))\n        self.assertEqual(abcp, abc1p)\n        self.assertEqual(abcp, abc2p)\n        self.assertEqual(abc1p, abc2p)\n\n    def test_make_proxy_cont(self):\n        abc = ContinuousVariable(\"abc\")\n        abc1 = abc.make_proxy()\n        abc2 = abc1.make_proxy()\n        self.assertEqual(abc, abc1)\n        self.assertEqual(abc, abc2)\n        self.assertEqual(abc1, abc2)\n        self.assertEqual(hash(abc), hash(abc1))\n        self.assertEqual(hash(abc1), hash(abc2))\n\n    def test_proxy_has_separate_attributes(self):\n        image = StringVariable(\"image\")\n        image1 = image.make_proxy()\n        image2 = image1.make_proxy()\n\n        image.attributes[\"origin\"] = \"a\"\n        image1.attributes[\"origin\"] = \"b\"\n        image2.attributes[\"origin\"] = \"c\"\n\n        self.assertEqual(image.attributes[\"origin\"], \"a\")\n        self.assertEqual(image1.attributes[\"origin\"], \"b\")\n        self.assertEqual(image2.attributes[\"origin\"], \"c\")\n\n\nif __name__ == \"__main__\":\n    unittest.main()\n",
            "header": {
                "file": {
                    "path": "Orange/data/tests/test_variable.py"
                },
                "misc_line": null
            },
            "index_line": {
                "old_commit_hash": "2afa27e74",
                "new_commit_hash": "489f3283b",
                "mode": "100644"
            },
            "is_binary_file": false,
            "binary_line": null,
            "minus_file": {
                "path": "a/Orange/data/tests/test_variable.py"
            },
            "plus_file": {
                "path": "b/Orange/data/tests/test_variable.py"
            },
            "hunks": [
                {
                    "descriptor": {
                        "old_range": {
                            "start": 163,
                            "length": 6
                        },
                        "new_range": {
                            "start": 163,
                            "length": 7
                        },
                        "section": "class TestVariable(unittest.TestCase):"
                    },
                    "line_group": {
                        "all_lines": [
                            {
                                "content": "        a._compute_value = Identity(a1)",
                                "type": "context"
                            },
                            {
                                "content": "        self.assertEqual(a, a)",
                                "type": "context"
                            },
                            {
                                "content": "        self.assertEqual(a, b)",
                                "type": "context"
                            },
                            {
                                "content": "        self.assertEqual(hash(a), hash(b))",
                                "type": "added"
                            },
                            {
                                "content": "",
                                "type": "context"
                            },
                            {
                                "content": "        b._compute_value = a.compute_value",
                                "type": "context"
                            },
                            {
                                "content": "        self.assertEqual(a, b)",
                                "type": "context"
                            }
                        ]
                    },
                    "modified_entities": [
                        {
                            "file_name": "Orange/data/tests/test_variable.py",
                            "type": "method",
                            "name": "TestVariable.test_eq_with_compute_value",
                            "content": "class TestVariable(unittest.TestCase):\n    @classmethod\n    def setUpClass(cls):\n        cls.var = Variable(\"x\")\n\n    def test_name(self):\n        self.assertEqual(repr(self.var), \"Variable(name='x')\")\n\n    def test_to_val(self):\n        string_var = StringVariable(\"x\")\n        self.assertEqual(string_var.to_val(\"foo\"), \"foo\")\n        self.assertEqual(string_var.to_val(42), \"42\")\n\n        cont_var = ContinuousVariable(\"x\")\n        self.assertTrue(math.isnan(cont_var.to_val(\"?\")))\n        self.assertTrue(math.isnan(Unknown))\n\n        var = Variable(\"x\")\n        self.assertEqual(var.to_val(\"x\"), \"x\")\n\n    def test_repr_is_abstract(self):\n        self.assertRaises(RuntimeError, self.var.repr_val, None)\n\n    def test_properties(self):\n        a = ContinuousVariable(\"y\")\n        self.assertTrue(a.is_continuous)\n        self.assertFalse(a.is_discrete)\n        self.assertFalse(a.is_string)\n        self.assertTrue(a.is_primitive())\n\n        a = DiscreteVariable(\"d\")\n        self.assertFalse(a.is_continuous)\n        self.assertTrue(a.is_discrete)\n        self.assertFalse(a.is_string)\n        self.assertTrue(a.is_primitive())\n\n        a = StringVariable(\"s\")\n        self.assertFalse(a.is_continuous)\n        self.assertFalse(a.is_discrete)\n        self.assertTrue(a.is_string)\n        self.assertFalse(a.is_primitive())\n\n    def test_properties_as_predicates(self):\n        a = ContinuousVariable(\"y\")\n        self.assertTrue(Variable.is_continuous(a))\n        self.assertFalse(Variable.is_discrete(a))\n        self.assertFalse(Variable.is_string(a))\n        self.assertTrue(Variable.is_primitive(a))\n\n        a = StringVariable(\"s\")\n        self.assertFalse(Variable.is_continuous(a))\n        self.assertFalse(Variable.is_discrete(a))\n        self.assertTrue(Variable.is_string(a))\n        self.assertFalse(Variable.is_primitive(a))\n\n    def test_strange_eq(self):\n        a = ContinuousVariable(\"a\")\n        b = ContinuousVariable(\"a\")\n        self.assertEqual(a, a)\n        self.assertEqual(a, b)\n        self.assertIsNot(a, b)\n        self.assertNotEqual(a, \"somestring\")\n        self.assertEqual(hash(a), hash(b))\n\n    def test_eq_with_compute_value(self):\n        a = ContinuousVariable(\"a\")\n        b = ContinuousVariable(\"a\")\n        self.assertEqual(a, a)\n        self.assertEqual(a, b)\n        self.assertIsNot(a, b)\n\n        a._compute_value = lambda x: x\n        self.assertEqual(a, a)\n        self.assertNotEqual(a, b)\n\n        a1 = ContinuousVariable(\"a\")\n        a2 = ContinuousVariable(\"a\")\n        c = ContinuousVariable(\"c\")\n\n        a._compute_value = Identity(a1)\n        self.assertEqual(a, a)\n        self.assertEqual(a, b)\n        self.assertEqual(hash(a), hash(b))\n\n        b._compute_value = a.compute_value\n        self.assertEqual(a, b)\n\n        b._compute_value = Identity(a1)\n        self.assertEqual(a, b)\n\n        b._compute_value = Identity(a2)\n        self.assertEqual(a, b)\n\n        b._compute_value = Identity(c)\n        self.assertNotEqual(a, b)\n\n        b._compute_value = Identity(a2)\n        a1._compute_value = lambda x: x\n        self.assertNotEqual(a, b)\n\n        a1._compute_value = Identity(c)\n        self.assertNotEqual(a, b)\n\n        a2._compute_value = Identity(c)\n        self.assertEqual(a, b)\n\n    def test_hash(self):\n        a = ContinuousVariable(\"a\")\n        b = ContinuousVariable(\"a\")\n        self.assertEqual(hash(a), hash(b))\n\n        a._compute_value = lambda x: x\n        self.assertNotEqual(hash(a), hash(b))\n\n        b._compute_value = lambda x: x\n        self.assertNotEqual(hash(a), hash(b))\n\n        a1 = ContinuousVariable(\"a\")\n        a2 = ContinuousVariable(\"a\")\n\n        a._compute_value = Identity(a1)\n        self.assertNotEqual(hash(a), hash(b))\n\n        b._compute_value = Identity(a2)\n        self.assertEqual(hash(a), hash(b))\n\n        at = TimeVariable(\"a\")\n        b = ContinuousVariable(\"b\")\n        self.assertEqual(hash(a1), hash(a2))\n        self.assertNotEqual(hash(a1), hash(b))\n        self.assertNotEqual(hash(a1), hash(at))\n\n    def test_hash_eq(self):\n        a = ContinuousVariable(\"a\")\n        b1 = ContinuousVariable(\"b\", compute_value=Identity(a))\n        b2 = ContinuousVariable(\"b2\", compute_value=Identity(b1))\n        b3 = ContinuousVariable(\"b\")\n        self.assertEqual(a, b2)\n        self.assertEqual(b1, b2)\n        self.assertEqual(a, b1)\n        self.assertNotEqual(b1, b3)\n\n        self.assertEqual(hash(a), hash(b2))\n        self.assertEqual(hash(b1), hash(b2))\n        self.assertEqual(hash(a), hash(b1))\n        self.assertNotEqual(hash(b1), hash(b3))",
                            "ast_type_str": "ClassDef",
                            "start_lineno": 148,
                            "end_lineno": 188,
                            "parent": {
                                "file_name": "Orange/data/tests/test_variable.py",
                                "type": "class",
                                "name": "TestVariable",
                                "content": "class TestVariable(unittest.TestCase):\n    @classmethod\n    def setUpClass(cls):\n        cls.var = Variable(\"x\")\n\n    def test_name(self):\n        self.assertEqual(repr(self.var), \"Variable(name='x')\")\n\n    def test_to_val(self):\n        string_var = StringVariable(\"x\")\n        self.assertEqual(string_var.to_val(\"foo\"), \"foo\")\n        self.assertEqual(string_var.to_val(42), \"42\")\n\n        cont_var = ContinuousVariable(\"x\")\n        self.assertTrue(math.isnan(cont_var.to_val(\"?\")))\n        self.assertTrue(math.isnan(Unknown))\n\n        var = Variable(\"x\")\n        self.assertEqual(var.to_val(\"x\"), \"x\")\n\n    def test_repr_is_abstract(self):\n        self.assertRaises(RuntimeError, self.var.repr_val, None)\n\n    def test_properties(self):\n        a = ContinuousVariable(\"y\")\n        self.assertTrue(a.is_continuous)\n        self.assertFalse(a.is_discrete)\n        self.assertFalse(a.is_string)\n        self.assertTrue(a.is_primitive())\n\n        a = DiscreteVariable(\"d\")\n        self.assertFalse(a.is_continuous)\n        self.assertTrue(a.is_discrete)\n        self.assertFalse(a.is_string)\n        self.assertTrue(a.is_primitive())\n\n        a = StringVariable(\"s\")\n        self.assertFalse(a.is_continuous)\n        self.assertFalse(a.is_discrete)\n        self.assertTrue(a.is_string)\n        self.assertFalse(a.is_primitive())\n\n    def test_properties_as_predicates(self):\n        a = ContinuousVariable(\"y\")\n        self.assertTrue(Variable.is_continuous(a))\n        self.assertFalse(Variable.is_discrete(a))\n        self.assertFalse(Variable.is_string(a))\n        self.assertTrue(Variable.is_primitive(a))\n\n        a = StringVariable(\"s\")\n        self.assertFalse(Variable.is_continuous(a))\n        self.assertFalse(Variable.is_discrete(a))\n        self.assertTrue(Variable.is_string(a))\n        self.assertFalse(Variable.is_primitive(a))\n\n    def test_strange_eq(self):\n        a = ContinuousVariable(\"a\")\n        b = ContinuousVariable(\"a\")\n        self.assertEqual(a, a)\n        self.assertEqual(a, b)\n        self.assertIsNot(a, b)\n        self.assertNotEqual(a, \"somestring\")\n        self.assertEqual(hash(a), hash(b))\n\n    def test_eq_with_compute_value(self):\n        a = ContinuousVariable(\"a\")\n        b = ContinuousVariable(\"a\")\n        self.assertEqual(a, a)\n        self.assertEqual(a, b)\n        self.assertIsNot(a, b)\n\n        a._compute_value = lambda x: x\n        self.assertEqual(a, a)\n        self.assertNotEqual(a, b)\n\n        a1 = ContinuousVariable(\"a\")\n        a2 = ContinuousVariable(\"a\")\n        c = ContinuousVariable(\"c\")\n\n        a._compute_value = Identity(a1)\n        self.assertEqual(a, a)\n        self.assertEqual(a, b)\n        self.assertEqual(hash(a), hash(b))\n\n        b._compute_value = a.compute_value\n        self.assertEqual(a, b)\n\n        b._compute_value = Identity(a1)\n        self.assertEqual(a, b)\n\n        b._compute_value = Identity(a2)\n        self.assertEqual(a, b)\n\n        b._compute_value = Identity(c)\n        self.assertNotEqual(a, b)\n\n        b._compute_value = Identity(a2)\n        a1._compute_value = lambda x: x\n        self.assertNotEqual(a, b)\n\n        a1._compute_value = Identity(c)\n        self.assertNotEqual(a, b)\n\n        a2._compute_value = Identity(c)\n        self.assertEqual(a, b)\n\n    def test_hash(self):\n        a = ContinuousVariable(\"a\")\n        b = ContinuousVariable(\"a\")\n        self.assertEqual(hash(a), hash(b))\n\n        a._compute_value = lambda x: x\n        self.assertNotEqual(hash(a), hash(b))\n\n        b._compute_value = lambda x: x\n        self.assertNotEqual(hash(a), hash(b))\n\n        a1 = ContinuousVariable(\"a\")\n        a2 = ContinuousVariable(\"a\")\n\n        a._compute_value = Identity(a1)\n        self.assertNotEqual(hash(a), hash(b))\n\n        b._compute_value = Identity(a2)\n        self.assertEqual(hash(a), hash(b))\n\n        at = TimeVariable(\"a\")\n        b = ContinuousVariable(\"b\")\n        self.assertEqual(hash(a1), hash(a2))\n        self.assertNotEqual(hash(a1), hash(b))\n        self.assertNotEqual(hash(a1), hash(at))\n\n    def test_hash_eq(self):\n        a = ContinuousVariable(\"a\")\n        b1 = ContinuousVariable(\"b\", compute_value=Identity(a))\n        b2 = ContinuousVariable(\"b2\", compute_value=Identity(b1))\n        b3 = ContinuousVariable(\"b\")\n        self.assertEqual(a, b2)\n        self.assertEqual(b1, b2)\n        self.assertEqual(a, b1)\n        self.assertNotEqual(b1, b3)\n\n        self.assertEqual(hash(a), hash(b2))\n        self.assertEqual(hash(b1), hash(b2))\n        self.assertEqual(hash(a), hash(b1))\n        self.assertNotEqual(hash(b1), hash(b3))",
                                "ast_type_str": "ClassDef",
                                "start_lineno": 84,
                                "end_lineno": 229,
                                "parent": null
                            }
                        },
                        {
                            "file_name": "Orange/data/tests/test_variable.py",
                            "type": "class",
                            "name": "TestVariable",
                            "content": "class TestVariable(unittest.TestCase):\n    @classmethod\n    def setUpClass(cls):\n        cls.var = Variable(\"x\")\n\n    def test_name(self):\n        self.assertEqual(repr(self.var), \"Variable(name='x')\")\n\n    def test_to_val(self):\n        string_var = StringVariable(\"x\")\n        self.assertEqual(string_var.to_val(\"foo\"), \"foo\")\n        self.assertEqual(string_var.to_val(42), \"42\")\n\n        cont_var = ContinuousVariable(\"x\")\n        self.assertTrue(math.isnan(cont_var.to_val(\"?\")))\n        self.assertTrue(math.isnan(Unknown))\n\n        var = Variable(\"x\")\n        self.assertEqual(var.to_val(\"x\"), \"x\")\n\n    def test_repr_is_abstract(self):\n        self.assertRaises(RuntimeError, self.var.repr_val, None)\n\n    def test_properties(self):\n        a = ContinuousVariable(\"y\")\n        self.assertTrue(a.is_continuous)\n        self.assertFalse(a.is_discrete)\n        self.assertFalse(a.is_string)\n        self.assertTrue(a.is_primitive())\n\n        a = DiscreteVariable(\"d\")\n        self.assertFalse(a.is_continuous)\n        self.assertTrue(a.is_discrete)\n        self.assertFalse(a.is_string)\n        self.assertTrue(a.is_primitive())\n\n        a = StringVariable(\"s\")\n        self.assertFalse(a.is_continuous)\n        self.assertFalse(a.is_discrete)\n        self.assertTrue(a.is_string)\n        self.assertFalse(a.is_primitive())\n\n    def test_properties_as_predicates(self):\n        a = ContinuousVariable(\"y\")\n        self.assertTrue(Variable.is_continuous(a))\n        self.assertFalse(Variable.is_discrete(a))\n        self.assertFalse(Variable.is_string(a))\n        self.assertTrue(Variable.is_primitive(a))\n\n        a = StringVariable(\"s\")\n        self.assertFalse(Variable.is_continuous(a))\n        self.assertFalse(Variable.is_discrete(a))\n        self.assertTrue(Variable.is_string(a))\n        self.assertFalse(Variable.is_primitive(a))\n\n    def test_strange_eq(self):\n        a = ContinuousVariable(\"a\")\n        b = ContinuousVariable(\"a\")\n        self.assertEqual(a, a)\n        self.assertEqual(a, b)\n        self.assertIsNot(a, b)\n        self.assertNotEqual(a, \"somestring\")\n        self.assertEqual(hash(a), hash(b))\n\n    def test_eq_with_compute_value(self):\n        a = ContinuousVariable(\"a\")\n        b = ContinuousVariable(\"a\")\n        self.assertEqual(a, a)\n        self.assertEqual(a, b)\n        self.assertIsNot(a, b)\n\n        a._compute_value = lambda x: x\n        self.assertEqual(a, a)\n        self.assertNotEqual(a, b)\n\n        a1 = ContinuousVariable(\"a\")\n        a2 = ContinuousVariable(\"a\")\n        c = ContinuousVariable(\"c\")\n\n        a._compute_value = Identity(a1)\n        self.assertEqual(a, a)\n        self.assertEqual(a, b)\n        self.assertEqual(hash(a), hash(b))\n\n        b._compute_value = a.compute_value\n        self.assertEqual(a, b)\n\n        b._compute_value = Identity(a1)\n        self.assertEqual(a, b)\n\n        b._compute_value = Identity(a2)\n        self.assertEqual(a, b)\n\n        b._compute_value = Identity(c)\n        self.assertNotEqual(a, b)\n\n        b._compute_value = Identity(a2)\n        a1._compute_value = lambda x: x\n        self.assertNotEqual(a, b)\n\n        a1._compute_value = Identity(c)\n        self.assertNotEqual(a, b)\n\n        a2._compute_value = Identity(c)\n        self.assertEqual(a, b)\n\n    def test_hash(self):\n        a = ContinuousVariable(\"a\")\n        b = ContinuousVariable(\"a\")\n        self.assertEqual(hash(a), hash(b))\n\n        a._compute_value = lambda x: x\n        self.assertNotEqual(hash(a), hash(b))\n\n        b._compute_value = lambda x: x\n        self.assertNotEqual(hash(a), hash(b))\n\n        a1 = ContinuousVariable(\"a\")\n        a2 = ContinuousVariable(\"a\")\n\n        a._compute_value = Identity(a1)\n        self.assertNotEqual(hash(a), hash(b))\n\n        b._compute_value = Identity(a2)\n        self.assertEqual(hash(a), hash(b))\n\n        at = TimeVariable(\"a\")\n        b = ContinuousVariable(\"b\")\n        self.assertEqual(hash(a1), hash(a2))\n        self.assertNotEqual(hash(a1), hash(b))\n        self.assertNotEqual(hash(a1), hash(at))\n\n    def test_hash_eq(self):\n        a = ContinuousVariable(\"a\")\n        b1 = ContinuousVariable(\"b\", compute_value=Identity(a))\n        b2 = ContinuousVariable(\"b2\", compute_value=Identity(b1))\n        b3 = ContinuousVariable(\"b\")\n        self.assertEqual(a, b2)\n        self.assertEqual(b1, b2)\n        self.assertEqual(a, b1)\n        self.assertNotEqual(b1, b3)\n\n        self.assertEqual(hash(a), hash(b2))\n        self.assertEqual(hash(b1), hash(b2))\n        self.assertEqual(hash(a), hash(b1))\n        self.assertNotEqual(hash(b1), hash(b3))",
                            "ast_type_str": "ClassDef",
                            "start_lineno": 84,
                            "end_lineno": 229,
                            "parent": null
                        }
                    ],
                    "added_entities": [],
                    "deleted_entities": []
                },
                {
                    "descriptor": {
                        "old_range": {
                            "start": 206,
                            "length": 6
                        },
                        "new_range": {
                            "start": 207,
                            "length": 27
                        },
                        "section": "class TestVariable(unittest.TestCase):"
                    },
                    "line_group": {
                        "all_lines": [
                            {
                                "content": "        b._compute_value = Identity(a2)",
                                "type": "context"
                            },
                            {
                                "content": "        self.assertEqual(hash(a), hash(b))",
                                "type": "context"
                            },
                            {
                                "content": "",
                                "type": "context"
                            },
                            {
                                "content": "        at = TimeVariable(\"a\")",
                                "type": "added"
                            },
                            {
                                "content": "        b = ContinuousVariable(\"b\")",
                                "type": "added"
                            },
                            {
                                "content": "        self.assertEqual(hash(a1), hash(a2))",
                                "type": "added"
                            },
                            {
                                "content": "        self.assertNotEqual(hash(a1), hash(b))",
                                "type": "added"
                            },
                            {
                                "content": "        self.assertNotEqual(hash(a1), hash(at))",
                                "type": "added"
                            },
                            {
                                "content": "",
                                "type": "added"
                            },
                            {
                                "content": "    def test_hash_eq(self):",
                                "type": "added"
                            },
                            {
                                "content": "        a = ContinuousVariable(\"a\")",
                                "type": "added"
                            },
                            {
                                "content": "        b1 = ContinuousVariable(\"b\", compute_value=Identity(a))",
                                "type": "added"
                            },
                            {
                                "content": "        b2 = ContinuousVariable(\"b2\", compute_value=Identity(b1))",
                                "type": "added"
                            },
                            {
                                "content": "        b3 = ContinuousVariable(\"b\")",
                                "type": "added"
                            },
                            {
                                "content": "        self.assertEqual(a, b2)",
                                "type": "added"
                            },
                            {
                                "content": "        self.assertEqual(b1, b2)",
                                "type": "added"
                            },
                            {
                                "content": "        self.assertEqual(a, b1)",
                                "type": "added"
                            },
                            {
                                "content": "        self.assertNotEqual(b1, b3)",
                                "type": "added"
                            },
                            {
                                "content": "",
                                "type": "added"
                            },
                            {
                                "content": "        self.assertEqual(hash(a), hash(b2))",
                                "type": "added"
                            },
                            {
                                "content": "        self.assertEqual(hash(b1), hash(b2))",
                                "type": "added"
                            },
                            {
                                "content": "        self.assertEqual(hash(a), hash(b1))",
                                "type": "added"
                            },
                            {
                                "content": "        self.assertNotEqual(hash(b1), hash(b3))",
                                "type": "added"
                            },
                            {
                                "content": "",
                                "type": "added"
                            },
                            {
                                "content": "",
                                "type": "context"
                            },
                            {
                                "content": "def variabletest(varcls):",
                                "type": "context"
                            },
                            {
                                "content": "    def decorate(cls):",
                                "type": "context"
                            }
                        ]
                    },
                    "modified_entities": [
                        {
                            "file_name": "Orange/data/tests/test_variable.py",
                            "type": "method",
                            "name": "TestVariable.test_hash",
                            "content": "class TestVariable(unittest.TestCase):\n    @classmethod\n    def setUpClass(cls):\n        cls.var = Variable(\"x\")\n\n    def test_name(self):\n        self.assertEqual(repr(self.var), \"Variable(name='x')\")\n\n    def test_to_val(self):\n        string_var = StringVariable(\"x\")\n        self.assertEqual(string_var.to_val(\"foo\"), \"foo\")\n        self.assertEqual(string_var.to_val(42), \"42\")\n\n        cont_var = ContinuousVariable(\"x\")\n        self.assertTrue(math.isnan(cont_var.to_val(\"?\")))\n        self.assertTrue(math.isnan(Unknown))\n\n        var = Variable(\"x\")\n        self.assertEqual(var.to_val(\"x\"), \"x\")\n\n    def test_repr_is_abstract(self):\n        self.assertRaises(RuntimeError, self.var.repr_val, None)\n\n    def test_properties(self):\n        a = ContinuousVariable(\"y\")\n        self.assertTrue(a.is_continuous)\n        self.assertFalse(a.is_discrete)\n        self.assertFalse(a.is_string)\n        self.assertTrue(a.is_primitive())\n\n        a = DiscreteVariable(\"d\")\n        self.assertFalse(a.is_continuous)\n        self.assertTrue(a.is_discrete)\n        self.assertFalse(a.is_string)\n        self.assertTrue(a.is_primitive())\n\n        a = StringVariable(\"s\")\n        self.assertFalse(a.is_continuous)\n        self.assertFalse(a.is_discrete)\n        self.assertTrue(a.is_string)\n        self.assertFalse(a.is_primitive())\n\n    def test_properties_as_predicates(self):\n        a = ContinuousVariable(\"y\")\n        self.assertTrue(Variable.is_continuous(a))\n        self.assertFalse(Variable.is_discrete(a))\n        self.assertFalse(Variable.is_string(a))\n        self.assertTrue(Variable.is_primitive(a))\n\n        a = StringVariable(\"s\")\n        self.assertFalse(Variable.is_continuous(a))\n        self.assertFalse(Variable.is_discrete(a))\n        self.assertTrue(Variable.is_string(a))\n        self.assertFalse(Variable.is_primitive(a))\n\n    def test_strange_eq(self):\n        a = ContinuousVariable(\"a\")\n        b = ContinuousVariable(\"a\")\n        self.assertEqual(a, a)\n        self.assertEqual(a, b)\n        self.assertIsNot(a, b)\n        self.assertNotEqual(a, \"somestring\")\n        self.assertEqual(hash(a), hash(b))\n\n    def test_eq_with_compute_value(self):\n        a = ContinuousVariable(\"a\")\n        b = ContinuousVariable(\"a\")\n        self.assertEqual(a, a)\n        self.assertEqual(a, b)\n        self.assertIsNot(a, b)\n\n        a._compute_value = lambda x: x\n        self.assertEqual(a, a)\n        self.assertNotEqual(a, b)\n\n        a1 = ContinuousVariable(\"a\")\n        a2 = ContinuousVariable(\"a\")\n        c = ContinuousVariable(\"c\")\n\n        a._compute_value = Identity(a1)\n        self.assertEqual(a, a)\n        self.assertEqual(a, b)\n        self.assertEqual(hash(a), hash(b))\n\n        b._compute_value = a.compute_value\n        self.assertEqual(a, b)\n\n        b._compute_value = Identity(a1)\n        self.assertEqual(a, b)\n\n        b._compute_value = Identity(a2)\n        self.assertEqual(a, b)\n\n        b._compute_value = Identity(c)\n        self.assertNotEqual(a, b)\n\n        b._compute_value = Identity(a2)\n        a1._compute_value = lambda x: x\n        self.assertNotEqual(a, b)\n\n        a1._compute_value = Identity(c)\n        self.assertNotEqual(a, b)\n\n        a2._compute_value = Identity(c)\n        self.assertEqual(a, b)\n\n    def test_hash(self):\n        a = ContinuousVariable(\"a\")\n        b = ContinuousVariable(\"a\")\n        self.assertEqual(hash(a), hash(b))\n\n        a._compute_value = lambda x: x\n        self.assertNotEqual(hash(a), hash(b))\n\n        b._compute_value = lambda x: x\n        self.assertNotEqual(hash(a), hash(b))\n\n        a1 = ContinuousVariable(\"a\")\n        a2 = ContinuousVariable(\"a\")\n\n        a._compute_value = Identity(a1)\n        self.assertNotEqual(hash(a), hash(b))\n\n        b._compute_value = Identity(a2)\n        self.assertEqual(hash(a), hash(b))\n\n        at = TimeVariable(\"a\")\n        b = ContinuousVariable(\"b\")\n        self.assertEqual(hash(a1), hash(a2))\n        self.assertNotEqual(hash(a1), hash(b))\n        self.assertNotEqual(hash(a1), hash(at))\n\n    def test_hash_eq(self):\n        a = ContinuousVariable(\"a\")\n        b1 = ContinuousVariable(\"b\", compute_value=Identity(a))\n        b2 = ContinuousVariable(\"b2\", compute_value=Identity(b1))\n        b3 = ContinuousVariable(\"b\")\n        self.assertEqual(a, b2)\n        self.assertEqual(b1, b2)\n        self.assertEqual(a, b1)\n        self.assertNotEqual(b1, b3)\n\n        self.assertEqual(hash(a), hash(b2))\n        self.assertEqual(hash(b1), hash(b2))\n        self.assertEqual(hash(a), hash(b1))\n        self.assertNotEqual(hash(b1), hash(b3))",
                            "ast_type_str": "ClassDef",
                            "start_lineno": 190,
                            "end_lineno": 214,
                            "parent": {
                                "file_name": "Orange/data/tests/test_variable.py",
                                "type": "class",
                                "name": "TestVariable",
                                "content": "class TestVariable(unittest.TestCase):\n    @classmethod\n    def setUpClass(cls):\n        cls.var = Variable(\"x\")\n\n    def test_name(self):\n        self.assertEqual(repr(self.var), \"Variable(name='x')\")\n\n    def test_to_val(self):\n        string_var = StringVariable(\"x\")\n        self.assertEqual(string_var.to_val(\"foo\"), \"foo\")\n        self.assertEqual(string_var.to_val(42), \"42\")\n\n        cont_var = ContinuousVariable(\"x\")\n        self.assertTrue(math.isnan(cont_var.to_val(\"?\")))\n        self.assertTrue(math.isnan(Unknown))\n\n        var = Variable(\"x\")\n        self.assertEqual(var.to_val(\"x\"), \"x\")\n\n    def test_repr_is_abstract(self):\n        self.assertRaises(RuntimeError, self.var.repr_val, None)\n\n    def test_properties(self):\n        a = ContinuousVariable(\"y\")\n        self.assertTrue(a.is_continuous)\n        self.assertFalse(a.is_discrete)\n        self.assertFalse(a.is_string)\n        self.assertTrue(a.is_primitive())\n\n        a = DiscreteVariable(\"d\")\n        self.assertFalse(a.is_continuous)\n        self.assertTrue(a.is_discrete)\n        self.assertFalse(a.is_string)\n        self.assertTrue(a.is_primitive())\n\n        a = StringVariable(\"s\")\n        self.assertFalse(a.is_continuous)\n        self.assertFalse(a.is_discrete)\n        self.assertTrue(a.is_string)\n        self.assertFalse(a.is_primitive())\n\n    def test_properties_as_predicates(self):\n        a = ContinuousVariable(\"y\")\n        self.assertTrue(Variable.is_continuous(a))\n        self.assertFalse(Variable.is_discrete(a))\n        self.assertFalse(Variable.is_string(a))\n        self.assertTrue(Variable.is_primitive(a))\n\n        a = StringVariable(\"s\")\n        self.assertFalse(Variable.is_continuous(a))\n        self.assertFalse(Variable.is_discrete(a))\n        self.assertTrue(Variable.is_string(a))\n        self.assertFalse(Variable.is_primitive(a))\n\n    def test_strange_eq(self):\n        a = ContinuousVariable(\"a\")\n        b = ContinuousVariable(\"a\")\n        self.assertEqual(a, a)\n        self.assertEqual(a, b)\n        self.assertIsNot(a, b)\n        self.assertNotEqual(a, \"somestring\")\n        self.assertEqual(hash(a), hash(b))\n\n    def test_eq_with_compute_value(self):\n        a = ContinuousVariable(\"a\")\n        b = ContinuousVariable(\"a\")\n        self.assertEqual(a, a)\n        self.assertEqual(a, b)\n        self.assertIsNot(a, b)\n\n        a._compute_value = lambda x: x\n        self.assertEqual(a, a)\n        self.assertNotEqual(a, b)\n\n        a1 = ContinuousVariable(\"a\")\n        a2 = ContinuousVariable(\"a\")\n        c = ContinuousVariable(\"c\")\n\n        a._compute_value = Identity(a1)\n        self.assertEqual(a, a)\n        self.assertEqual(a, b)\n        self.assertEqual(hash(a), hash(b))\n\n        b._compute_value = a.compute_value\n        self.assertEqual(a, b)\n\n        b._compute_value = Identity(a1)\n        self.assertEqual(a, b)\n\n        b._compute_value = Identity(a2)\n        self.assertEqual(a, b)\n\n        b._compute_value = Identity(c)\n        self.assertNotEqual(a, b)\n\n        b._compute_value = Identity(a2)\n        a1._compute_value = lambda x: x\n        self.assertNotEqual(a, b)\n\n        a1._compute_value = Identity(c)\n        self.assertNotEqual(a, b)\n\n        a2._compute_value = Identity(c)\n        self.assertEqual(a, b)\n\n    def test_hash(self):\n        a = ContinuousVariable(\"a\")\n        b = ContinuousVariable(\"a\")\n        self.assertEqual(hash(a), hash(b))\n\n        a._compute_value = lambda x: x\n        self.assertNotEqual(hash(a), hash(b))\n\n        b._compute_value = lambda x: x\n        self.assertNotEqual(hash(a), hash(b))\n\n        a1 = ContinuousVariable(\"a\")\n        a2 = ContinuousVariable(\"a\")\n\n        a._compute_value = Identity(a1)\n        self.assertNotEqual(hash(a), hash(b))\n\n        b._compute_value = Identity(a2)\n        self.assertEqual(hash(a), hash(b))\n\n        at = TimeVariable(\"a\")\n        b = ContinuousVariable(\"b\")\n        self.assertEqual(hash(a1), hash(a2))\n        self.assertNotEqual(hash(a1), hash(b))\n        self.assertNotEqual(hash(a1), hash(at))\n\n    def test_hash_eq(self):\n        a = ContinuousVariable(\"a\")\n        b1 = ContinuousVariable(\"b\", compute_value=Identity(a))\n        b2 = ContinuousVariable(\"b2\", compute_value=Identity(b1))\n        b3 = ContinuousVariable(\"b\")\n        self.assertEqual(a, b2)\n        self.assertEqual(b1, b2)\n        self.assertEqual(a, b1)\n        self.assertNotEqual(b1, b3)\n\n        self.assertEqual(hash(a), hash(b2))\n        self.assertEqual(hash(b1), hash(b2))\n        self.assertEqual(hash(a), hash(b1))\n        self.assertNotEqual(hash(b1), hash(b3))",
                                "ast_type_str": "ClassDef",
                                "start_lineno": 84,
                                "end_lineno": 229,
                                "parent": null
                            }
                        },
                        {
                            "file_name": "Orange/data/tests/test_variable.py",
                            "type": "class",
                            "name": "TestVariable",
                            "content": "class TestVariable(unittest.TestCase):\n    @classmethod\n    def setUpClass(cls):\n        cls.var = Variable(\"x\")\n\n    def test_name(self):\n        self.assertEqual(repr(self.var), \"Variable(name='x')\")\n\n    def test_to_val(self):\n        string_var = StringVariable(\"x\")\n        self.assertEqual(string_var.to_val(\"foo\"), \"foo\")\n        self.assertEqual(string_var.to_val(42), \"42\")\n\n        cont_var = ContinuousVariable(\"x\")\n        self.assertTrue(math.isnan(cont_var.to_val(\"?\")))\n        self.assertTrue(math.isnan(Unknown))\n\n        var = Variable(\"x\")\n        self.assertEqual(var.to_val(\"x\"), \"x\")\n\n    def test_repr_is_abstract(self):\n        self.assertRaises(RuntimeError, self.var.repr_val, None)\n\n    def test_properties(self):\n        a = ContinuousVariable(\"y\")\n        self.assertTrue(a.is_continuous)\n        self.assertFalse(a.is_discrete)\n        self.assertFalse(a.is_string)\n        self.assertTrue(a.is_primitive())\n\n        a = DiscreteVariable(\"d\")\n        self.assertFalse(a.is_continuous)\n        self.assertTrue(a.is_discrete)\n        self.assertFalse(a.is_string)\n        self.assertTrue(a.is_primitive())\n\n        a = StringVariable(\"s\")\n        self.assertFalse(a.is_continuous)\n        self.assertFalse(a.is_discrete)\n        self.assertTrue(a.is_string)\n        self.assertFalse(a.is_primitive())\n\n    def test_properties_as_predicates(self):\n        a = ContinuousVariable(\"y\")\n        self.assertTrue(Variable.is_continuous(a))\n        self.assertFalse(Variable.is_discrete(a))\n        self.assertFalse(Variable.is_string(a))\n        self.assertTrue(Variable.is_primitive(a))\n\n        a = StringVariable(\"s\")\n        self.assertFalse(Variable.is_continuous(a))\n        self.assertFalse(Variable.is_discrete(a))\n        self.assertTrue(Variable.is_string(a))\n        self.assertFalse(Variable.is_primitive(a))\n\n    def test_strange_eq(self):\n        a = ContinuousVariable(\"a\")\n        b = ContinuousVariable(\"a\")\n        self.assertEqual(a, a)\n        self.assertEqual(a, b)\n        self.assertIsNot(a, b)\n        self.assertNotEqual(a, \"somestring\")\n        self.assertEqual(hash(a), hash(b))\n\n    def test_eq_with_compute_value(self):\n        a = ContinuousVariable(\"a\")\n        b = ContinuousVariable(\"a\")\n        self.assertEqual(a, a)\n        self.assertEqual(a, b)\n        self.assertIsNot(a, b)\n\n        a._compute_value = lambda x: x\n        self.assertEqual(a, a)\n        self.assertNotEqual(a, b)\n\n        a1 = ContinuousVariable(\"a\")\n        a2 = ContinuousVariable(\"a\")\n        c = ContinuousVariable(\"c\")\n\n        a._compute_value = Identity(a1)\n        self.assertEqual(a, a)\n        self.assertEqual(a, b)\n        self.assertEqual(hash(a), hash(b))\n\n        b._compute_value = a.compute_value\n        self.assertEqual(a, b)\n\n        b._compute_value = Identity(a1)\n        self.assertEqual(a, b)\n\n        b._compute_value = Identity(a2)\n        self.assertEqual(a, b)\n\n        b._compute_value = Identity(c)\n        self.assertNotEqual(a, b)\n\n        b._compute_value = Identity(a2)\n        a1._compute_value = lambda x: x\n        self.assertNotEqual(a, b)\n\n        a1._compute_value = Identity(c)\n        self.assertNotEqual(a, b)\n\n        a2._compute_value = Identity(c)\n        self.assertEqual(a, b)\n\n    def test_hash(self):\n        a = ContinuousVariable(\"a\")\n        b = ContinuousVariable(\"a\")\n        self.assertEqual(hash(a), hash(b))\n\n        a._compute_value = lambda x: x\n        self.assertNotEqual(hash(a), hash(b))\n\n        b._compute_value = lambda x: x\n        self.assertNotEqual(hash(a), hash(b))\n\n        a1 = ContinuousVariable(\"a\")\n        a2 = ContinuousVariable(\"a\")\n\n        a._compute_value = Identity(a1)\n        self.assertNotEqual(hash(a), hash(b))\n\n        b._compute_value = Identity(a2)\n        self.assertEqual(hash(a), hash(b))\n\n        at = TimeVariable(\"a\")\n        b = ContinuousVariable(\"b\")\n        self.assertEqual(hash(a1), hash(a2))\n        self.assertNotEqual(hash(a1), hash(b))\n        self.assertNotEqual(hash(a1), hash(at))\n\n    def test_hash_eq(self):\n        a = ContinuousVariable(\"a\")\n        b1 = ContinuousVariable(\"b\", compute_value=Identity(a))\n        b2 = ContinuousVariable(\"b2\", compute_value=Identity(b1))\n        b3 = ContinuousVariable(\"b\")\n        self.assertEqual(a, b2)\n        self.assertEqual(b1, b2)\n        self.assertEqual(a, b1)\n        self.assertNotEqual(b1, b3)\n\n        self.assertEqual(hash(a), hash(b2))\n        self.assertEqual(hash(b1), hash(b2))\n        self.assertEqual(hash(a), hash(b1))\n        self.assertNotEqual(hash(b1), hash(b3))",
                            "ast_type_str": "ClassDef",
                            "start_lineno": 84,
                            "end_lineno": 229,
                            "parent": null
                        }
                    ],
                    "added_entities": [
                        {
                            "file_name": "Orange/data/tests/test_variable.py",
                            "type": "method",
                            "name": "TestVariable.test_hash_eq",
                            "content": "class TestVariable(unittest.TestCase):\n    @classmethod\n    def setUpClass(cls):\n        cls.var = Variable(\"x\")\n\n    def test_name(self):\n        self.assertEqual(repr(self.var), \"Variable(name='x')\")\n\n    def test_to_val(self):\n        string_var = StringVariable(\"x\")\n        self.assertEqual(string_var.to_val(\"foo\"), \"foo\")\n        self.assertEqual(string_var.to_val(42), \"42\")\n\n        cont_var = ContinuousVariable(\"x\")\n        self.assertTrue(math.isnan(cont_var.to_val(\"?\")))\n        self.assertTrue(math.isnan(Unknown))\n\n        var = Variable(\"x\")\n        self.assertEqual(var.to_val(\"x\"), \"x\")\n\n    def test_repr_is_abstract(self):\n        self.assertRaises(RuntimeError, self.var.repr_val, None)\n\n    def test_properties(self):\n        a = ContinuousVariable(\"y\")\n        self.assertTrue(a.is_continuous)\n        self.assertFalse(a.is_discrete)\n        self.assertFalse(a.is_string)\n        self.assertTrue(a.is_primitive())\n\n        a = DiscreteVariable(\"d\")\n        self.assertFalse(a.is_continuous)\n        self.assertTrue(a.is_discrete)\n        self.assertFalse(a.is_string)\n        self.assertTrue(a.is_primitive())\n\n        a = StringVariable(\"s\")\n        self.assertFalse(a.is_continuous)\n        self.assertFalse(a.is_discrete)\n        self.assertTrue(a.is_string)\n        self.assertFalse(a.is_primitive())\n\n    def test_properties_as_predicates(self):\n        a = ContinuousVariable(\"y\")\n        self.assertTrue(Variable.is_continuous(a))\n        self.assertFalse(Variable.is_discrete(a))\n        self.assertFalse(Variable.is_string(a))\n        self.assertTrue(Variable.is_primitive(a))\n\n        a = StringVariable(\"s\")\n        self.assertFalse(Variable.is_continuous(a))\n        self.assertFalse(Variable.is_discrete(a))\n        self.assertTrue(Variable.is_string(a))\n        self.assertFalse(Variable.is_primitive(a))\n\n    def test_strange_eq(self):\n        a = ContinuousVariable(\"a\")\n        b = ContinuousVariable(\"a\")\n        self.assertEqual(a, a)\n        self.assertEqual(a, b)\n        self.assertIsNot(a, b)\n        self.assertNotEqual(a, \"somestring\")\n        self.assertEqual(hash(a), hash(b))\n\n    def test_eq_with_compute_value(self):\n        a = ContinuousVariable(\"a\")\n        b = ContinuousVariable(\"a\")\n        self.assertEqual(a, a)\n        self.assertEqual(a, b)\n        self.assertIsNot(a, b)\n\n        a._compute_value = lambda x: x\n        self.assertEqual(a, a)\n        self.assertNotEqual(a, b)\n\n        a1 = ContinuousVariable(\"a\")\n        a2 = ContinuousVariable(\"a\")\n        c = ContinuousVariable(\"c\")\n\n        a._compute_value = Identity(a1)\n        self.assertEqual(a, a)\n        self.assertEqual(a, b)\n        self.assertEqual(hash(a), hash(b))\n\n        b._compute_value = a.compute_value\n        self.assertEqual(a, b)\n\n        b._compute_value = Identity(a1)\n        self.assertEqual(a, b)\n\n        b._compute_value = Identity(a2)\n        self.assertEqual(a, b)\n\n        b._compute_value = Identity(c)\n        self.assertNotEqual(a, b)\n\n        b._compute_value = Identity(a2)\n        a1._compute_value = lambda x: x\n        self.assertNotEqual(a, b)\n\n        a1._compute_value = Identity(c)\n        self.assertNotEqual(a, b)\n\n        a2._compute_value = Identity(c)\n        self.assertEqual(a, b)\n\n    def test_hash(self):\n        a = ContinuousVariable(\"a\")\n        b = ContinuousVariable(\"a\")\n        self.assertEqual(hash(a), hash(b))\n\n        a._compute_value = lambda x: x\n        self.assertNotEqual(hash(a), hash(b))\n\n        b._compute_value = lambda x: x\n        self.assertNotEqual(hash(a), hash(b))\n\n        a1 = ContinuousVariable(\"a\")\n        a2 = ContinuousVariable(\"a\")\n\n        a._compute_value = Identity(a1)\n        self.assertNotEqual(hash(a), hash(b))\n\n        b._compute_value = Identity(a2)\n        self.assertEqual(hash(a), hash(b))\n\n        at = TimeVariable(\"a\")\n        b = ContinuousVariable(\"b\")\n        self.assertEqual(hash(a1), hash(a2))\n        self.assertNotEqual(hash(a1), hash(b))\n        self.assertNotEqual(hash(a1), hash(at))\n\n    def test_hash_eq(self):\n        a = ContinuousVariable(\"a\")\n        b1 = ContinuousVariable(\"b\", compute_value=Identity(a))\n        b2 = ContinuousVariable(\"b2\", compute_value=Identity(b1))\n        b3 = ContinuousVariable(\"b\")\n        self.assertEqual(a, b2)\n        self.assertEqual(b1, b2)\n        self.assertEqual(a, b1)\n        self.assertNotEqual(b1, b3)\n\n        self.assertEqual(hash(a), hash(b2))\n        self.assertEqual(hash(b1), hash(b2))\n        self.assertEqual(hash(a), hash(b1))\n        self.assertNotEqual(hash(b1), hash(b3))",
                            "ast_type_str": "ClassDef",
                            "start_lineno": 216,
                            "end_lineno": 229,
                            "parent": {
                                "file_name": "Orange/data/tests/test_variable.py",
                                "type": "class",
                                "name": "TestVariable",
                                "content": "class TestVariable(unittest.TestCase):\n    @classmethod\n    def setUpClass(cls):\n        cls.var = Variable(\"x\")\n\n    def test_name(self):\n        self.assertEqual(repr(self.var), \"Variable(name='x')\")\n\n    def test_to_val(self):\n        string_var = StringVariable(\"x\")\n        self.assertEqual(string_var.to_val(\"foo\"), \"foo\")\n        self.assertEqual(string_var.to_val(42), \"42\")\n\n        cont_var = ContinuousVariable(\"x\")\n        self.assertTrue(math.isnan(cont_var.to_val(\"?\")))\n        self.assertTrue(math.isnan(Unknown))\n\n        var = Variable(\"x\")\n        self.assertEqual(var.to_val(\"x\"), \"x\")\n\n    def test_repr_is_abstract(self):\n        self.assertRaises(RuntimeError, self.var.repr_val, None)\n\n    def test_properties(self):\n        a = ContinuousVariable(\"y\")\n        self.assertTrue(a.is_continuous)\n        self.assertFalse(a.is_discrete)\n        self.assertFalse(a.is_string)\n        self.assertTrue(a.is_primitive())\n\n        a = DiscreteVariable(\"d\")\n        self.assertFalse(a.is_continuous)\n        self.assertTrue(a.is_discrete)\n        self.assertFalse(a.is_string)\n        self.assertTrue(a.is_primitive())\n\n        a = StringVariable(\"s\")\n        self.assertFalse(a.is_continuous)\n        self.assertFalse(a.is_discrete)\n        self.assertTrue(a.is_string)\n        self.assertFalse(a.is_primitive())\n\n    def test_properties_as_predicates(self):\n        a = ContinuousVariable(\"y\")\n        self.assertTrue(Variable.is_continuous(a))\n        self.assertFalse(Variable.is_discrete(a))\n        self.assertFalse(Variable.is_string(a))\n        self.assertTrue(Variable.is_primitive(a))\n\n        a = StringVariable(\"s\")\n        self.assertFalse(Variable.is_continuous(a))\n        self.assertFalse(Variable.is_discrete(a))\n        self.assertTrue(Variable.is_string(a))\n        self.assertFalse(Variable.is_primitive(a))\n\n    def test_strange_eq(self):\n        a = ContinuousVariable(\"a\")\n        b = ContinuousVariable(\"a\")\n        self.assertEqual(a, a)\n        self.assertEqual(a, b)\n        self.assertIsNot(a, b)\n        self.assertNotEqual(a, \"somestring\")\n        self.assertEqual(hash(a), hash(b))\n\n    def test_eq_with_compute_value(self):\n        a = ContinuousVariable(\"a\")\n        b = ContinuousVariable(\"a\")\n        self.assertEqual(a, a)\n        self.assertEqual(a, b)\n        self.assertIsNot(a, b)\n\n        a._compute_value = lambda x: x\n        self.assertEqual(a, a)\n        self.assertNotEqual(a, b)\n\n        a1 = ContinuousVariable(\"a\")\n        a2 = ContinuousVariable(\"a\")\n        c = ContinuousVariable(\"c\")\n\n        a._compute_value = Identity(a1)\n        self.assertEqual(a, a)\n        self.assertEqual(a, b)\n        self.assertEqual(hash(a), hash(b))\n\n        b._compute_value = a.compute_value\n        self.assertEqual(a, b)\n\n        b._compute_value = Identity(a1)\n        self.assertEqual(a, b)\n\n        b._compute_value = Identity(a2)\n        self.assertEqual(a, b)\n\n        b._compute_value = Identity(c)\n        self.assertNotEqual(a, b)\n\n        b._compute_value = Identity(a2)\n        a1._compute_value = lambda x: x\n        self.assertNotEqual(a, b)\n\n        a1._compute_value = Identity(c)\n        self.assertNotEqual(a, b)\n\n        a2._compute_value = Identity(c)\n        self.assertEqual(a, b)\n\n    def test_hash(self):\n        a = ContinuousVariable(\"a\")\n        b = ContinuousVariable(\"a\")\n        self.assertEqual(hash(a), hash(b))\n\n        a._compute_value = lambda x: x\n        self.assertNotEqual(hash(a), hash(b))\n\n        b._compute_value = lambda x: x\n        self.assertNotEqual(hash(a), hash(b))\n\n        a1 = ContinuousVariable(\"a\")\n        a2 = ContinuousVariable(\"a\")\n\n        a._compute_value = Identity(a1)\n        self.assertNotEqual(hash(a), hash(b))\n\n        b._compute_value = Identity(a2)\n        self.assertEqual(hash(a), hash(b))\n\n        at = TimeVariable(\"a\")\n        b = ContinuousVariable(\"b\")\n        self.assertEqual(hash(a1), hash(a2))\n        self.assertNotEqual(hash(a1), hash(b))\n        self.assertNotEqual(hash(a1), hash(at))\n\n    def test_hash_eq(self):\n        a = ContinuousVariable(\"a\")\n        b1 = ContinuousVariable(\"b\", compute_value=Identity(a))\n        b2 = ContinuousVariable(\"b2\", compute_value=Identity(b1))\n        b3 = ContinuousVariable(\"b\")\n        self.assertEqual(a, b2)\n        self.assertEqual(b1, b2)\n        self.assertEqual(a, b1)\n        self.assertNotEqual(b1, b3)\n\n        self.assertEqual(hash(a), hash(b2))\n        self.assertEqual(hash(b1), hash(b2))\n        self.assertEqual(hash(a), hash(b1))\n        self.assertNotEqual(hash(b1), hash(b3))",
                                "ast_type_str": "ClassDef",
                                "start_lineno": 84,
                                "end_lineno": 229,
                                "parent": null
                            }
                        }
                    ],
                    "deleted_entities": []
                },
                {
                    "descriptor": {
                        "old_range": {
                            "start": 252,
                            "length": 7
                        },
                        "new_range": {
                            "start": 274,
                            "length": 6
                        },
                        "section": "class TestDiscreteVariable(VariableTest):"
                    },
                    "line_group": {
                        "all_lines": [
                            {
                                "content": "        self.assertEqual(var.val_from_str_add(\"F\"), 0)",
                                "type": "context"
                            },
                            {
                                "content": "        self.assertEqual(var.val_from_str_add(\"N\"), 2)",
                                "type": "context"
                            },
                            {
                                "content": "",
                                "type": "context"
                            },
                            {
                                "content": "",
                                "type": "deleted"
                            },
                            {
                                "content": "    def test_repr(self):",
                                "type": "context"
                            },
                            {
                                "content": "        var = DiscreteVariable.make(\"a\", values=(\"F\", \"M\"))",
                                "type": "context"
                            },
                            {
                                "content": "        self.assertEqual(",
                                "type": "context"
                            }
                        ]
                    },
                    "modified_entities": [
                        {
                            "file_name": "Orange/data/tests/test_variable.py",
                            "type": "class",
                            "name": "TestDiscreteVariable",
                            "content": "class TestDiscreteVariable(VariableTest):\n    def test_to_val(self):\n        values = [\"F\", \"M\"]\n        var = DiscreteVariable(name=\"Feature 0\", values=values)\n\n        self.assertEqual(var.to_val(0), 0)\n        self.assertEqual(var.to_val(\"F\"), 0)\n        self.assertEqual(var.to_val(0.), 0)\n        self.assertTrue(math.isnan(var.to_val(\"?\")))\n\n        # TODO: with self.assertRaises(ValueError): var.to_val(2)\n        with self.assertRaises(ValueError):\n            var.to_val(\"G\")\n\n    def test_make(self):\n        var = DiscreteVariable.make(\"a\", values=(\"F\", \"M\"))\n        self.assertIsInstance(var, DiscreteVariable)\n        self.assertEqual(var.name, \"a\")\n        self.assertEqual(var.values, (\"F\", \"M\"))\n\n    def test_val_from_str(self):\n        var = DiscreteVariable.make(\"a\", values=(\"F\", \"M\"))\n        self.assertTrue(math.isnan(var.to_val(None)))\n        self.assertEqual(var.to_val(1), 1)\n\n    def test_val_from_str_add(self):\n        var = DiscreteVariable.make(\"a\", values=(\"F\", \"M\"))\n        self.assertTrue(math.isnan(var.val_from_str_add(None)))\n        self.assertEqual(var.val_from_str_add(\"M\"), 1)\n        self.assertEqual(var.val_from_str_add(\"F\"), 0)\n        self.assertEqual(var.values, (\"F\", \"M\"))\n        self.assertEqual(var.val_from_str_add(\"N\"), 2)\n        self.assertEqual(var.values, (\"F\", \"M\", \"N\"))\n        self.assertEqual(var._value_index, {\"F\": 0, \"M\": 1, \"N\": 2})\n        self.assertEqual(var.val_from_str_add(\"M\"), 1)\n        self.assertEqual(var.val_from_str_add(\"F\"), 0)\n        self.assertEqual(var.val_from_str_add(\"N\"), 2)\n\n\n    def test_repr(self):\n        var = DiscreteVariable.make(\"a\", values=(\"F\", \"M\"))\n        self.assertEqual(\n            repr(var),\n            \"DiscreteVariable(name='a', values=('F', 'M'))\")\n        var.ordered = True\n        self.assertEqual(\n            repr(var),\n            \"DiscreteVariable(name='a', values=('F', 'M'), ordered=True)\")\n\n        var = DiscreteVariable.make(\"a\", values=\"1234567\")\n        self.assertEqual(\n            repr(var),\n            \"DiscreteVariable(name='a', values=('1', '2', '3', '4', '5', '6', '7'))\")\n\n    def test_no_nonstringvalues(self):\n        self.assertRaises(TypeError, DiscreteVariable, \"foo\", values=(\"a\", 42))\n        a = DiscreteVariable(\"foo\", values=(\"a\", \"b\", \"c\"))\n        self.assertRaises(TypeError, a.add_value, 42)\n\n    def test_no_duplicated_values(self):\n        a = DiscreteVariable(\"foo\", values=[\"a\", \"b\", \"c\"])\n        a.add_value(\"b\")\n        self.assertEqual(list(a.values), [\"a\", \"b\", \"c\"])\n        self.assertEqual(list(a._value_index), [\"a\", \"b\", \"c\"])\n\n    def test_tuple_list_warning(self):\n        if LooseVersion(Orange.version.short_version) >= LooseVersion(\"3.27\"):\n            self.fail(\"Remove class TupleList; replace it with tuple.\")\n\n        d1 = DiscreteVariable(\"A\", values=(\"one\", \"two\"))\n        with self.assertWarns(DeprecationWarning):\n            val = d1.values + [\"three\", ]\n        self.assertEqual(val, [\"one\", \"two\", \"three\"])\n        with self.assertWarns(DeprecationWarning):\n            val = d1.values.copy()\n        self.assertIsInstance(val, list)\n        self.assertSequenceEqual(val, d1.values)\n\n    def test_unpickle(self):\n        d1 = DiscreteVariable(\"A\", values=(\"two\", \"one\"))\n        s = pickle.dumps(d1)\n        d2 = DiscreteVariable.make(\"A\", values=(\"one\", \"two\", \"three\"))\n        d2_values = tuple(d2.values)\n        d1c = pickle.loads(s)\n        # See: gh-3238\n        # The unpickle reconstruction picks an existing variable (d2), on which\n        # __setstate__ or __dict__.update is called\n        self.assertSequenceEqual(d2.values, d2_values)\n        self.assertSequenceEqual(d1c.values, d1.values)\n        s = pickle.dumps(d2)\n        d1 = DiscreteVariable(\"A\", values=(\"one\", \"two\"))\n        d2 = pickle.loads(s)\n        self.assertSequenceEqual(d2.values, (\"one\", \"two\", \"three\"))\n        self.assertSequenceEqual(d1.values, (\"one\", \"two\"))\n\n    def test_mapper_dense(self):\n        abc = DiscreteVariable(\"a\", values=tuple(\"abc\"))\n        dca = DiscreteVariable(\"a\", values=tuple(\"dca\"))\n        mapper = dca.get_mapper_from(abc)\n\n        self.assertEqual(mapper(0), 2)\n        self.assertTrue(np.isnan(mapper(1)))\n        self.assertEqual(mapper(2), 1)\n\n        self.assertEqual(mapper(0.), 2)\n        self.assertTrue(np.isnan(mapper(1.)))\n        self.assertEqual(mapper(2.), 1)\n        self.assertTrue(np.isnan(mapper(np.nan)))\n\n        self.assertEqual(mapper(\"a\"), 2)\n        self.assertTrue(np.isnan(mapper(\"b\")))\n        self.assertEqual(mapper(\"c\"), 1)\n\n        arr = np.array([0, 0, 2, 1, 0, 1, np.nan])\n        self.assertIsNot(mapper(arr), arr)\n        np.testing.assert_array_equal(\n            mapper(arr), np.array([2, 2, 1, np.nan, 2, np.nan, np.nan]))\n        # dtype=int can have no nans; isnan shouldn't crash the mapper\n\n        arr_int = arr[:-1].astype(int)\n        self.assertIsNot(mapper(arr_int), arr_int)\n        np.testing.assert_array_equal(\n            mapper(arr_int), np.array([2, 2, 1, np.nan, 2, np.nan]))\n\n        arr_obj = arr.astype(object)\n        self.assertIsNot(mapper(arr_obj), arr_obj)\n        np.testing.assert_array_equal(\n            mapper(arr_obj), np.array([2, 2, 1, np.nan, 2, np.nan, np.nan]))\n\n        arr_list = list(arr)\n        self.assertIsNot(mapper(arr_list), arr_list)\n        self.assertTrue(\n            all(x == y or (np.isnan(x) and np.isnan(y))\n                for x, y in zip(mapper(arr_list),\n                                [2, 2, 1, np.nan, 2, np.nan, np.nan])))\n\n        self.assertTrue(\n            x == y or (np.isnan(x) and np.isnan(y))\n            for x, y in zip(mapper(tuple(arr)),\n                            (2, 2, 1, np.nan, 2, np.nan, np.nan)))\n\n        self.assertRaises(ValueError, mapper, object())\n\n    def test_mapper_sparse(self):\n        abc = DiscreteVariable(\"a\", values=tuple(\"abc\"))\n        dca = DiscreteVariable(\"a\", values=tuple(\"dca\"))\n        mapper = dca.get_mapper_from(abc)\n\n        arr = np.array([0, 0, 2, 1, 0, 1, np.nan])\n\n        # 0 does map to 0 -> convert to dense\n        marr = mapper(sp.csr_matrix(arr))\n        self.assertIsInstance(marr, np.ndarray)\n        np.testing.assert_array_equal(\n            marr,\n            np.array([2, 2, 1, np.nan, 2, np.nan, np.nan]))\n\n        marr = mapper(sp.csr_matrix(arr))\n        self.assertIsInstance(marr, np.ndarray)\n        np.testing.assert_array_equal(\n            marr,\n            np.array([2, 2, 1, np.nan, 2, np.nan, np.nan]))\n\n        # 0 maps to 0 -> keep sparse\n        acd = DiscreteVariable(\"a\", values=tuple(\"acd\"))\n        mapper = acd.get_mapper_from(abc)\n\n        arr_csr = sp.csr_matrix(arr)\n        marr = mapper(arr_csr)\n        self.assertIsNot(arr_csr, marr)\n        self.assertTrue(sp.isspmatrix_csr(marr))\n        np.testing.assert_array_equal(\n            marr.todense(),\n            np.array([[0, 0, 1, np.nan, 0, np.nan, np.nan]]))\n\n        arr_csc = sp.csc_matrix(arr)\n        marr = mapper(arr_csc)\n        self.assertIsNot(arr_csc, marr)\n        self.assertTrue(sp.isspmatrix_csc(marr))\n        np.testing.assert_array_equal(\n            marr.todense(),\n            np.array([[0, 0, 1, np.nan, 0, np.nan, np.nan]]))\n\n    def test_mapper_inplace(self):\n        s = list(range(7))\n        abc = DiscreteVariable(\"a\", values=tuple(\"abc\"))\n        dca = DiscreteVariable(\"a\", values=tuple(\"dca\"))\n        mapper = dca.get_mapper_from(abc)\n\n        arr = np.array([[0, 0, 2, 1, 0, 1, np.nan], s]).T\n        mapper(arr, 0)\n        np.testing.assert_array_equal(\n            arr, np.array([[2, 2, 1, np.nan, 2, np.nan, np.nan], s]).T)\n\n        self.assertRaises(ValueError, mapper, sp.csr_matrix(arr), 0)\n        self.assertRaises(ValueError, mapper, [1, 2, 3], 0)\n        self.assertRaises(ValueError, mapper, 1, 0)\n\n        acd = DiscreteVariable(\"a\", values=tuple(\"acd\"))\n        mapper = acd.get_mapper_from(abc)\n\n        arr = np.array([[0, 0, 2, 1, 0, 1, np.nan], s]).T\n        mapper(arr, 0)\n        np.testing.assert_array_equal(\n            arr, np.array([[0, 0, 1, np.nan, 0, np.nan, np.nan], s]).T)\n\n        arr = sp.csr_matrix(np.array([[0, 0, 2, 1, 0, 1, np.nan], s]).T)\n        mapper(arr, 0)\n        np.testing.assert_array_equal(\n            arr.todense(),\n            np.array([[0, 0, 1, np.nan, 0, np.nan, np.nan], s]).T)\n\n        arr = sp.csc_matrix(np.array([[0, 0, 2, 1, 0, 1, np.nan], s]).T)\n        mapper(arr, 0)\n        np.testing.assert_array_equal(\n            arr.todense(),\n            np.array([[0, 0, 1, np.nan, 0, np.nan, np.nan], s]).T)\n\n    def test_mapper_dim_check(self):\n        abc = DiscreteVariable(\"a\", values=tuple(\"abc\"))\n        dca = DiscreteVariable(\"a\", values=tuple(\"dca\"))\n        mapper = dca.get_mapper_from(abc)\n\n        self.assertRaises(ValueError, mapper, np.zeros((7, 2)))\n        self.assertRaises(ValueError, mapper, sp.csr_matrix(np.zeros((7, 2))))\n        self.assertRaises(ValueError, mapper, sp.csc_matrix(np.zeros((7, 2))))\n\n    def test_mapper_from_no_values(self):\n        abc = DiscreteVariable(\"a\", values=())\n        dca = DiscreteVariable(\"a\", values=tuple(\"dca\"))\n        mapper = dca.get_mapper_from(abc)\n\n        arr = np.full(7, np.nan)\n        self.assertIsNot(mapper(arr), arr)\n        np.testing.assert_array_equal(mapper(arr), arr)\n\n        arr_csr = sp.csr_matrix(arr)\n        self.assertIsNot(arr_csr, mapper(arr_csr))\n        np.testing.assert_array_equal(\n            mapper(arr_csr).todense(), np.atleast_2d(arr))\n\n        arr_csc = sp.csc_matrix(arr)\n        self.assertIsNot(arr_csc, mapper(arr_csc))\n        np.testing.assert_array_equal(\n            mapper(arr_csc).todense(), np.atleast_2d(arr))\n\n        self.assertRaises(ValueError, mapper, sp.csr_matrix(arr), 0)\n        self.assertRaises(ValueError, mapper, sp.csc_matrix(arr), 0)\n\n    def varcls_modified(self, name):\n        var = super().varcls_modified(name)\n        var.add_value(\"A\")\n        var.add_value(\"B\")\n        var.ordered = True\n        return var\n\n    def test_copy_checks_len_values(self):\n        var = DiscreteVariable(\"gender\", values=(\"F\", \"M\"))\n        self.assertEqual(var.values, (\"F\", \"M\"))\n\n        self.assertRaises(ValueError, var.copy, values=(\"F\", \"M\", \"N\"))\n        self.assertRaises(ValueError, var.copy, values=(\"F\",))\n        self.assertRaises(ValueError, var.copy, values=())\n\n        var2 = var.copy()\n        self.assertEqual(var2.values, (\"F\", \"M\"))\n\n        var2 = var.copy(values=None)\n        self.assertEqual(var2.values, (\"F\", \"M\"))\n\n        var2 = var.copy(values=(\"W\", \"M\"))\n        self.assertEqual(var2.values, (\"W\", \"M\"))",
                            "ast_type_str": "ClassDef",
                            "start_lineno": 217,
                            "end_lineno": 488,
                            "parent": null
                        }
                    ],
                    "added_entities": [],
                    "deleted_entities": []
                }
            ]
        },
        {
            "old_file_content": "import re\nimport warnings\nfrom collections import Iterable\n\nfrom datetime import datetime, timedelta, timezone\nfrom numbers import Number, Real, Integral\nfrom math import isnan, floor\nfrom pickle import PickleError\n\nimport numpy as np\nimport scipy.sparse as sp\n\nfrom Orange.data import _variable\nfrom Orange.util import Registry, Reprable, OrangeDeprecationWarning\n\n\n__all__ = [\"Unknown\", \"MISSING_VALUES\", \"make_variable\", \"is_discrete_values\",\n           \"Value\", \"Variable\", \"ContinuousVariable\", \"DiscreteVariable\",\n           \"StringVariable\", \"TimeVariable\"]\n\n\n# For storing unknowns\nUnknown = ValueUnknown = float(\"nan\")\n# For checking for unknowns\nMISSING_VALUES = {np.nan, \"?\", \"nan\", \".\", \"\", \"NA\", \"~\", None}\n\nDISCRETE_MAX_VALUES = 3  # == 2 + nan\nMAX_NUM_OF_DECIMALS = 5\n# the variable with more than 100 different values should not be StringVariable\nDISCRETE_MAX_ALLOWED_VALUES = 100\n\n\ndef make_variable(cls, compute_value, *args):\n    if compute_value is not None:\n        return cls(*args, compute_value=compute_value)\n    else:\n        # For compatibility with old pickles\n        return cls(*args)\n\n\ndef is_discrete_values(values):\n    \"\"\"\n    Return set of uniques if `values` is an iterable of discrete values\n    else False if non-discrete, or None if indeterminate.\n\n    Note\n    ----\n    Assumes consistent type of items of `values`.\n    \"\"\"\n    if len(values) == 0:\n        return None\n    # If the first few values are, or can be converted to, floats,\n    # the type is numeric\n    try:\n        isinstance(next(iter(values)), Number) or \\\n        [float(v) for _, v in zip(range(min(3, len(values))), values)]\n    except ValueError:\n        is_numeric = False\n        max_values = int(round(len(values)**.7))\n    else:\n        is_numeric = True\n        max_values = DISCRETE_MAX_VALUES\n\n    # If more than max values => not discrete\n    unique = set()\n    for i in values:\n        unique.add(i)\n        if (len(unique) > max_values or\n                len(unique) > DISCRETE_MAX_ALLOWED_VALUES):\n            return False\n\n    # Strip NaN from unique\n    unique = {i for i in unique\n              if (not i in MISSING_VALUES and\n                  not (isinstance(i, Number) and np.isnan(i)))}\n\n    # All NaNs => indeterminate\n    if not unique:\n        return None\n\n    # Strings with |values| < max_unique\n    if not is_numeric:\n        return unique\n\n    # Handle numbers\n    try:\n        unique_float = set(map(float, unique))\n    except ValueError:\n        # Converting all the values to floats resulted in an error.\n        # Since the values have enough unique values, they are probably\n        # string values and discrete.\n        return unique\n\n    # If only values are {0, 1} or {1, 2} (or a subset of those sets) => discrete\n    return (not (unique_float - {0, 1}) or\n            not (unique_float - {1, 2})) and unique\n\n\nclass Value(float):\n    \"\"\"\n    The class representing a value. The class is not used to store values but\n    only to return them in contexts in which we want the value to be accompanied\n    with the descriptor, for instance to print the symbolic value of discrete\n    variables.\n\n    The class is derived from `float`, with an additional attribute `variable`\n    which holds the descriptor of type :obj:`Orange.data.Variable`. If the\n    value continuous or discrete, it is stored as a float. Other types of\n    values, like strings, are stored in the attribute `value`.\n\n    The class overloads the methods for printing out the value:\n    `variable.repr_val` and `variable.str_val` are used to get a suitable\n    representation of the value.\n\n    Equivalence operator is overloaded as follows:\n\n    - unknown values are equal; if one value is unknown and the other is not,\n      they are different;\n\n    - if the value is compared with the string, the value is converted to a\n      string using `variable.str_val` and the two strings are compared\n\n    - if the value is stored in attribute `value`, it is compared with the\n      given other value\n\n    - otherwise, the inherited comparison operator for `float` is called.\n\n    Finally, value defines a hash, so values can be put in sets and appear as\n    keys in dictionaries.\n\n    .. attribute:: variable (:obj:`Orange.data.Variable`)\n\n        Descriptor; used for printing out and for comparing with strings\n\n    .. attribute:: value\n\n        Value; the value can be of arbitrary type and is used only for variables\n        that are neither discrete nor continuous. If `value` is `None`, the\n        derived `float` value is used.\n    \"\"\"\n    __slots__ = \"variable\", \"_value\"\n\n    def __new__(cls, variable, value=Unknown):\n        \"\"\"\n        Construct a new instance of Value with the given descriptor and value.\n        If the argument `value` can be converted to float, it is stored as\n        `float` and the attribute `value` is set to `None`. Otherwise, the\n        inherited float is set to `Unknown` and the value is held by the\n        attribute `value`.\n\n        :param variable: descriptor\n        :type variable: Orange.data.Variable\n        :param value: value\n        \"\"\"\n        if variable.is_primitive():\n            self = super().__new__(cls, value)\n            self.variable = variable\n            self._value = None\n        else:\n            isunknown = value == variable.Unknown\n            self = super().__new__(\n                cls, np.nan if isunknown else np.finfo(float).min)\n            self.variable = variable\n            self._value = value\n        return self\n\n    def __init__(self, _, __=Unknown):\n        # __new__ does the job, pylint: disable=super-init-not-called\n        pass\n\n    def __repr__(self):\n        return \"Value('%s', %s)\" % (self.variable.name,\n                                    self.variable.repr_val(self))\n\n    def __str__(self):\n        return self.variable.str_val(self)\n\n    def __eq__(self, other):\n        if isinstance(self, Real) and isnan(self):\n            if isinstance(other, Real):\n                return isnan(other)\n            else:\n                return other in self.variable.unknown_str\n        if isinstance(other, str):\n            return self.variable.str_val(self) == other\n        if isinstance(other, Value):\n            return self.value == other.value\n        return super().__eq__(other)\n\n    def __ne__(self, other):\n        return not self.__eq__(other)\n\n    def __lt__(self, other):\n        if self.variable.is_primitive():\n            if isinstance(other, str):\n                return super().__lt__(self.variable.to_val(other))\n            else:\n                return super().__lt__(other)\n        else:\n            if isinstance(other, str):\n                return self.value < other\n            else:\n                return self.value < other.value\n\n    def __le__(self, other):\n        return self.__lt__(other) or self.__eq__(other)\n\n    def __gt__(self, other):\n        return not self.__le__(other)\n\n    def __ge__(self, other):\n        return not self.__lt__(other)\n\n    def __contains__(self, other):\n        if (self._value is not None\n                and isinstance(self._value, str)\n                and isinstance(other, str)):\n            return other in self._value\n        raise TypeError(\"invalid operation on Value()\")\n\n    def __hash__(self):\n        if self.variable.is_discrete:\n            # It is not possible to hash the id and the domain value to the\n            # same number as required by __eq__.\n            # hash(1)\n            # == hash(Value(DiscreteVariable(\"var\", [\"red\", \"green\", \"blue\"]), 1))\n            # == hash(\"green\")\n            # User should hash directly ids or domain values instead.\n            raise TypeError(\"unhashable type - cannot hash values of discrete variables!\")\n        if self._value is None:\n            return super().__hash__()\n        else:\n            return hash(self._value)\n\n    @property\n    def value(self):\n        if self.variable.is_discrete:\n            return Unknown if isnan(self) else self.variable.values[int(self)]\n        if self.variable.is_string:\n            return self._value\n        return float(self)\n\n    def __getnewargs__(self):\n        return self.variable, float(self)\n\n    def __getstate__(self):\n        return dict(value=getattr(self, '_value', None))\n\n    def __setstate__(self, state):\n        # defined in __new__, pylint: disable=attribute-defined-outside-init\n        self._value = state.get('value', None)\n\n\nclass VariableMeta(Registry):\n    pass\n\n\nclass _predicatedescriptor(property):\n    \"\"\"\n    A property that behaves as a class method if accessed via a class\n    >>> class A:\n    ...     foo = False\n    ...     @_predicatedescriptor\n    ...     def is_foo(self):\n    ...         return self.foo\n    ...\n    >>> a = A()\n    >>> a.is_foo\n    False\n    >>> A.is_foo(a)\n    False\n    \"\"\"\n    def __get__(self, instance, objtype=None):\n        if instance is None:\n            return self.fget\n        else:\n            return super().__get__(instance, objtype)\n\n\nclass Variable(Reprable, metaclass=VariableMeta):\n    \"\"\"\n    The base class for variable descriptors contains the variable's\n    name and some basic properties.\n\n    .. attribute:: name\n\n        The name of the variable.\n\n    .. attribute:: unknown_str\n\n        A set of values that represent unknowns in conversion from textual\n        formats. Default is `{\"?\", \".\", \"\", \"NA\", \"~\", None}`.\n\n    .. attribute:: compute_value\n\n        A function for computing the variable's value when converting from\n        another domain which does not contain this variable. The function will\n        be called with a data set (`Orange.data.Table`) and has to return\n        an array of computed values for all its instances. The base class\n        defines a static method `compute_value`, which returns `Unknown`.\n        Non-primitive variables must redefine it to return `None`.\n\n    .. attribute:: sparse\n\n        A flag about sparsity of the variable. When set, the variable suggests\n        it should be stored in a sparse matrix.\n\n    .. attribute:: source_variable\n\n        An optional descriptor of the source variable - if any - from which\n        this variable is derived and computed via :obj:`compute_value`.\n\n    .. attribute:: attributes\n\n        A dictionary with user-defined attributes of the variable\n    \"\"\"\n    Unknown = ValueUnknown\n\n    def __init__(self, name=\"\", compute_value=None, *, sparse=False):\n        \"\"\"\n        Construct a variable descriptor.\n        \"\"\"\n        if not name:\n            warnings.warn(\"Variable must have a name\", OrangeDeprecationWarning,\n                          stacklevel=3)\n        self._name = name\n        self._compute_value = compute_value\n        self.unknown_str = MISSING_VALUES\n        self.source_variable = None\n        self.sparse = sparse\n        self.attributes = {}\n\n    @property\n    def name(self):\n        return self._name\n\n    def make_proxy(self):\n        \"\"\"\n        Copy the variable and set the master to `self.master` or to `self`.\n\n        :return: copy of self\n        :rtype: Variable\n        \"\"\"\n        var = self.__class__(self.name)\n        var.__dict__.update(self.__dict__)\n        var.attributes = dict(self.attributes)\n        return var\n\n    def __eq__(self, other):\n        # pylint: disable=protected-access,import-outside-toplevel\n\n        def to_match(var):\n            if var._compute_value is None:\n                return var\n            elif isinstance(var._compute_value, Identity):\n                return var._compute_value.variable\n            return None\n\n        from Orange.preprocess.transformation import Identity\n        return type(self) is type(other) and (\n            self.name == other.name\n            and self._compute_value == other._compute_value\n            or\n            (self.compute_value or other.compute_value)\n            and to_match(self) == to_match(other) != None)\n\n    def __hash__(self):\n        # Two variables that are not equal can have the same hash.\n        # This happens if one has compute_value == Identity and the other\n        # doesn't have compute_value, or they have a different Identity.\n        # Having the same hash while not being equal is of course allowed.\n        # pylint: disable=import-outside-toplevel\n        from Orange.preprocess.transformation import Identity\n        compute_value = self._compute_value\n        if isinstance(self._compute_value, Identity):\n            compute_value = None\n        return hash((self.name, type(self), compute_value))\n\n    @classmethod\n    def make(cls, name, *args, **kwargs):\n        \"\"\"\n        Return an existing continuous variable with the given name, or\n        construct and return a new one.\n        \"\"\"\n        return cls(name, *args, **kwargs)\n\n    @classmethod\n    def _clear_cache(cls):\n        warnings.warn(\n            \"_clear_cache is no longer needed and thus deprecated\")\n\n    @staticmethod\n    def _clear_all_caches():\n        warnings.warn(\n            \"_clear_all_caches is no longer needed and thus deprecated\")\n\n    @classmethod\n    def is_primitive(cls, var=None):\n        \"\"\"\n        `True` if the variable's values are stored as floats.\n        Non-primitive variables can appear in the data only as meta attributes.\n        \"\"\"\n        to_check = cls if var is None else type(var)\n        return issubclass(to_check, (DiscreteVariable, ContinuousVariable))\n\n    @_predicatedescriptor\n    def is_discrete(self):\n        return isinstance(self, DiscreteVariable)\n\n    @_predicatedescriptor\n    def is_continuous(self):\n        return isinstance(self, ContinuousVariable)\n\n    @_predicatedescriptor\n    def is_string(self):\n        return isinstance(self, StringVariable)\n\n    @_predicatedescriptor\n    def is_time(self):\n        return isinstance(self, TimeVariable)\n\n    @staticmethod\n    def repr_val(val):\n        \"\"\"\n        Return a textual representation of variable's value `val`. Argument\n        `val` must be a float (for primitive variables) or an arbitrary\n        Python object (for non-primitives).\n\n        Derived classes must overload the function.\n        \"\"\"\n        raise RuntimeError(\"variable descriptors must overload repr_val()\")\n\n    str_val = repr_val\n\n    def to_val(self, s):\n        \"\"\"\n        Convert the given argument to a value of the variable. The\n        argument can be a string, a number or `None`. For primitive variables,\n        the base class provides a method that returns\n        :obj:`~Orange.data.Unknown` if `s` is found in\n        :obj:`~Orange.data.Variable.unknown_str`, and raises an exception\n        otherwise. For non-primitive variables it returns the argument itself.\n\n        Derived classes of primitive variables must overload the function.\n\n        :param s: value, represented as a number, string or `None`\n        :type s: str, float or None\n        :rtype: float or object\n        \"\"\"\n        if not self.is_primitive():\n            return s\n        if s in self.unknown_str:\n            return Unknown\n        raise RuntimeError(\n            \"primitive variable descriptors must overload to_val()\")\n\n    def val_from_str_add(self, s):\n        \"\"\"\n        Convert the given string to a value of the variable. The method\n        is similar to :obj:`to_val` except that it only accepts strings and\n        that it adds new values to the variable's domain where applicable.\n\n        The base class method calls `to_val`.\n\n        :param s: symbolic representation of the value\n        :type s: str\n        :rtype: float or object\n        \"\"\"\n        return self.to_val(s)\n\n    def __str__(self):\n        return self.name\n\n    @property\n    def compute_value(self):\n        return self._compute_value\n\n    def __reduce__(self):\n        if not self.name:\n            raise PickleError(\"Variables without names cannot be pickled\")\n\n        # Use make to unpickle variables.\n        return make_variable, (self.__class__, self._compute_value, self.name), self.__dict__\n\n    _CopyComputeValue = object()\n\n    def copy(self, compute_value=_CopyComputeValue, *, name=None, **kwargs):\n        if compute_value is self._CopyComputeValue:\n            compute_value = self.compute_value\n        var = type(self)(name=name or self.name,\n                         compute_value=compute_value,\n                         sparse=self.sparse, **kwargs)\n        var.attributes = dict(self.attributes)\n        return var\n\n    def renamed(self, new_name):\n        # prevent cyclic import, pylint: disable=import-outside-toplevel\n        from Orange.preprocess.transformation import Identity\n        return self.copy(name=new_name, compute_value=Identity(variable=self))\n\ndel _predicatedescriptor\n\n\nclass ContinuousVariable(Variable):\n    \"\"\"\n    Descriptor for continuous variables.\n\n    .. attribute:: number_of_decimals\n\n        The number of decimals when the value is printed out (default: 3).\n\n    .. attribute:: adjust_decimals\n\n        A flag regulating whether the `number_of_decimals` is being adjusted\n        by :obj:`to_val`.\n\n    The value of `number_of_decimals` is set to 3 and `adjust_decimals`\n    is set to 2. When :obj:`val_from_str_add` is called for the first\n    time with a string as an argument, `number_of_decimals` is set to the\n    number of decimals in the string and `adjust_decimals` is set to 1.\n    In the subsequent calls of `to_val`, the nubmer of decimals is\n    increased if the string argument has a larger number of decimals.\n\n    If the `number_of_decimals` is set manually, `adjust_decimals` is\n    set to 0 to prevent changes by `to_val`.\n    \"\"\"\n\n    TYPE_HEADERS = ('continuous', 'c', 'numeric', 'n')\n\n    def __init__(self, name=\"\", number_of_decimals=None, compute_value=None, *, sparse=False):\n        \"\"\"\n        Construct a new continuous variable. The number of decimals is set to\n        three, but adjusted at the first call of :obj:`to_val`.\n        \"\"\"\n        super().__init__(name, compute_value, sparse=sparse)\n        self._max_round_diff = 0\n        self.number_of_decimals = number_of_decimals\n\n    @property\n    def number_of_decimals(self):\n        return self._number_of_decimals\n\n    @property\n    def format_str(self):\n        return self._format_str\n\n    @format_str.setter\n    def format_str(self, value):\n        self._format_str = value\n\n    # noinspection PyAttributeOutsideInit\n    @number_of_decimals.setter\n    def number_of_decimals(self, x):\n        if x is None:\n            self._number_of_decimals = 3\n            self.adjust_decimals = 2\n            self._format_str = \"%g\"\n            return\n\n        self._number_of_decimals = x\n        self._max_round_diff = 10 ** (-x - 6)\n        self.adjust_decimals = 0\n        if self._number_of_decimals <= MAX_NUM_OF_DECIMALS:\n            self._format_str = \"%.{}f\".format(self.number_of_decimals)\n        else:\n            self._format_str = \"%g\"\n\n    def to_val(self, s):\n        \"\"\"\n        Convert a value, given as an instance of an arbitrary type, to a float.\n        \"\"\"\n        if s in self.unknown_str:\n            return Unknown\n        return float(s)\n\n    def val_from_str_add(self, s):\n        \"\"\"\n        Convert a value from a string and adjust the number of decimals if\n        `adjust_decimals` is non-zero.\n        \"\"\"\n        return _variable.val_from_str_add_cont(self, s)\n\n    def repr_val(self, val):\n        \"\"\"\n        Return the value as a string with the prescribed number of decimals.\n        \"\"\"\n        if isnan(val):\n            return \"?\"\n        if self.format_str != \"%g\" \\\n                and abs(round(val, self._number_of_decimals) - val) \\\n                > self._max_round_diff:\n            return f\"{val:.{self._number_of_decimals + 2}f}\"\n        return self._format_str % val\n\n    str_val = repr_val\n\n    def copy(self, compute_value=Variable._CopyComputeValue,\n             *, name=None, **kwargs):\n        # pylint understand not that `var` is `DiscreteVariable`:\n        # pylint: disable=protected-access\n        number_of_decimals = kwargs.pop(\"number_of_decimals\", None)\n        var = super().copy(compute_value=compute_value, name=name, **kwargs)\n        if number_of_decimals is not None:\n            var.number_of_decimals = number_of_decimals\n        else:\n            var._number_of_decimals = self._number_of_decimals\n            var._max_round_diff = self._max_round_diff\n            var.adjust_decimals = self.adjust_decimals\n            var.format_str = self._format_str\n        return var\n\n\nclass TupleList(tuple):\n    def __add__(self, other):\n        if isinstance(other, list):\n            warnings.warn(\n                \"DiscreteVariable.values is a tuple; \"\n                \"support for adding a list will be dropped in Orange 3.27\",\n                DeprecationWarning)\n            return list(self) + other\n        return super().__add__(other)\n\n    def copy(self):\n        warnings.warn(\n            \"DiscreteVariable.values is a tuple;\"\n            \"method copy will be dropped in Orange 3.27\",\n            DeprecationWarning)\n        return list(self)\n\n\nclass DiscreteVariable(Variable):\n    \"\"\"\n    Descriptor for symbolic, discrete variables. Values of discrete variables\n    are stored as floats; the numbers corresponds to indices in the list of\n    values.\n\n    .. attribute:: values\n\n        A list of variable's values.\n\n    .. attribute:: ordered\n\n        Some algorithms (and, in particular, visualizations) may\n        sometime reorder the values of the variable, e.g. alphabetically.\n        This flag hints that the given order of values is \"natural\"\n        (e.g. \"small\", \"middle\", \"large\") and should not be changed.\n    \"\"\"\n\n    TYPE_HEADERS = ('discrete', 'd', 'categorical')\n\n    presorted_values = []\n\n    def __init__(self, name=\"\", values=(), ordered=False, compute_value=None,\n                 *, sparse=False):\n        \"\"\" Construct a discrete variable descriptor with the given values. \"\"\"\n        values = TupleList(values)  # some people (including me) pass a generator\n        if not all(isinstance(value, str) for value in values):\n            raise TypeError(\"values of DiscreteVariables must be strings\")\n\n        super().__init__(name, compute_value, sparse=sparse)\n        self._values = values\n        self._value_index = {value: i for i, value in enumerate(values)}\n        self.ordered = ordered\n\n    @property\n    def values(self):\n        return self._values\n\n    def get_mapping_from(self, other):\n        return np.array(\n            [self._value_index.get(value, np.nan) for value in other.values],\n            dtype=float)\n\n    def get_mapper_from(self, other):\n        mapping = self.get_mapping_from(other)\n        if not mapping.size:\n            # Nans in data are temporarily replaced with 0, mapped and changed\n            # back to nans. This would fail is mapping[0] is out of range.\n            mapping = np.array([np.nan])\n\n        def mapper(value, col_idx=None):\n\n            # In-place mapping\n            if col_idx is not None:\n                if sp.issparse(value) and mapping[0] != 0:\n                    raise ValueError(\n                        \"In-place mapping of sparse matrices must map 0 to 0\")\n\n                # CSR requires mapping of non-contiguous area\n                if sp.isspmatrix_csr(value):\n                    col = value.indices == col_idx\n                    nans = np.isnan(value.data) * col\n                    value.data[nans] = 0\n                    value.data[col] = mapping[value.data[col].astype(int)]\n                    value.data[nans] = np.nan\n                    return None\n\n                # Dense and CSC map a contiguous area\n                if isinstance(value, np.ndarray) and value.ndim == 2:\n                    col = value[:, col_idx]\n                elif sp.isspmatrix_csc(value):\n                    col = value.data[value.indptr[col_idx]\n                                     :value.indptr[col_idx + 1]]\n                else:\n                    raise ValueError(\n                        \"In-place column mapping requires a 2d array or\"\n                        \"a csc or csr matrix.\")\n\n                nans = np.isnan(col)\n                col[nans] = 0\n                col[:] = mapping[col.astype(int)]\n                col[nans] = np.nan\n                return None\n\n            # Mapping into a copy\n            if isinstance(value, (int, float)):\n                return value if np.isnan(value) else mapping[int(value)]\n            if isinstance(value, str):\n                return mapping[other.values.index(value)]\n            if isinstance(value, np.ndarray):\n                if not (value.ndim == 1\n                        or value.ndim != 2 and min(value.shape) != 1):\n                    raise ValueError(\n                        f\"Column mapping can't map {value.ndim}-d objects\")\n\n                if value.dtype == object:\n                    value = value.astype(float)  # this happens with metas\n                try:\n                    nans = np.isnan(value)\n                except TypeError:  # suppose it's already an integer type\n                    return mapping[value]\n                value = value.astype(int)\n                value[nans] = 0\n                value = mapping[value]\n                value[nans] = np.nan\n                return value\n            if sp.issparse(value):\n                if min(value.shape) != 1:\n                    raise ValueError(\"Column mapping can't map \"\n                                     f\"{value.ndim}-dimensional objects\")\n                if mapping[0] != 0 and not np.isnan(mapping[0]):\n                    return mapper(np.array(value.todense()).flatten())\n                value = value.copy()\n                value.data = mapper(value.data)\n                return value\n            if isinstance(value, Iterable):\n                return type(value)(val if np.isnan(val) else mapping[int(val)]\n                                   for val in value)\n            raise ValueError(\n                f\"invalid type for value(s): {type(value).__name__}\")\n\n        return mapper\n\n    def to_val(self, s):\n        \"\"\"\n        Convert the given argument to a value of the variable (`float`).\n        If the argument is numeric, its value is returned without checking\n        whether it is integer and within bounds. `Unknown` is returned if the\n        argument is one of the representations for unknown values. Otherwise,\n        the argument must be a string and the method returns its index in\n        :obj:`values`.\n\n        :param s: values, represented as a number, string or `None`\n        :rtype: float\n        \"\"\"\n        if s is None:\n            return ValueUnknown\n\n        if isinstance(s, Integral):\n            return s\n        if isinstance(s, Real):\n            return s if isnan(s) else floor(s + 0.25)\n        if s in self.unknown_str:\n            return ValueUnknown\n        if not isinstance(s, str):\n            raise TypeError('Cannot convert {} to value of \"{}\"'.format(\n                type(s).__name__, self.name))\n        if s not in self._value_index:\n            raise ValueError(f\"Value {s} does not exist\")\n        return self._value_index[s]\n\n    def add_value(self, s):\n        \"\"\" Add a value `s` to the list of values.\n        \"\"\"\n        if not isinstance(s, str):\n            raise TypeError(\"values of DiscreteVariables must be strings\")\n        if s in self._value_index:\n            return\n        self._value_index[s] = len(self.values)\n        self._values += (s, )\n\n    def val_from_str_add(self, s):\n        \"\"\"\n        Similar to :obj:`to_val`, except that it accepts only strings and that\n        it adds the value to the list if it does not exist yet.\n\n        :param s: symbolic representation of the value\n        :type s: str\n        :rtype: float\n        \"\"\"\n        s = str(s) if s is not None else s\n        if s in self.unknown_str:\n            return ValueUnknown\n        val = self._value_index.get(s)\n        if val is None:\n            self.add_value(s)\n            val = len(self.values) - 1\n        return val\n\n    def repr_val(self, val):\n        \"\"\"\n        Return a textual representation of the value (`self.values[int(val)]`)\n        or \"?\" if the value is unknown.\n\n        :param val: value\n        :type val: float (should be whole number)\n        :rtype: str\n        \"\"\"\n        if isnan(val):\n            return \"?\"\n        return '{}'.format(self.values[int(val)])\n\n    str_val = repr_val\n\n    def __reduce__(self):\n        if not self.name:\n            raise PickleError(\"Variables without names cannot be pickled\")\n        __dict__ = dict(self.__dict__)\n        __dict__.pop(\"_values\")\n        return make_variable, (self.__class__, self._compute_value, self.name,\n                               self.values, self.ordered), \\\n            __dict__\n\n    def copy(self, compute_value=Variable._CopyComputeValue,\n             *, name=None, values=None, **_):\n        # pylint: disable=arguments-differ\n        if values is not None and len(values) != len(self.values):\n            raise ValueError(\n                \"number of values must match the number of original values\")\n        return super().copy(compute_value=compute_value, name=name,\n                            values=values or self.values, ordered=self.ordered)\n\n\nclass StringVariable(Variable):\n    \"\"\"\n    Descriptor for string variables. String variables can only appear as\n    meta attributes.\n    \"\"\"\n    Unknown = \"\"\n    TYPE_HEADERS = ('string', 's', 'text')\n\n    def to_val(self, s):\n        \"\"\"\n        Return the value as a string. If it is already a string, the same\n        object is returned.\n        \"\"\"\n        if s is None:\n            return \"\"\n        if isinstance(s, str):\n            return s\n        return str(s)\n\n    val_from_str_add = to_val\n\n    @staticmethod\n    def str_val(val):\n        \"\"\"Return a string representation of the value.\"\"\"\n        if isinstance(val, str) and val == \"\":\n            return \"?\"\n        if isinstance(val, Value):\n            if not val.value:\n                return \"?\"\n            val = val.value\n        return str(val)\n\n    def repr_val(self, val):\n        \"\"\"Return a string representation of the value.\"\"\"\n        return '\"{}\"'.format(self.str_val(val))\n\n\nclass TimeVariable(ContinuousVariable):\n    \"\"\"\n    TimeVariable is a continuous variable with Unix epoch\n    (1970-01-01 00:00:00+0000) as the origin (0.0). Later dates are positive\n    real numbers (equivalent to Unix timestamp, with microseconds in the\n    fraction part), and the dates before it map to the negative real numbers.\n\n    Unfortunately due to limitation of Python datetime, only dates\n    with year >= 1 (A.D.) are supported.\n\n    If time is specified without a date, Unix epoch is assumed.\n\n    If time is specified wihout an UTC offset, localtime is assumed.\n    \"\"\"\n    _all_vars = {}\n    TYPE_HEADERS = ('time', 't')\n    UNIX_EPOCH = datetime(1970, 1, 1)\n    _ISO_FORMATS = (\n        # have_date, have_time, format_str\n        # in order of decreased probability\n        (1, 1, '%Y-%m-%d %H:%M:%S%z'),\n        (1, 1, '%Y-%m-%d %H:%M:%S'),\n        (1, 1, '%Y-%m-%d %H:%M'),\n        (1, 1, '%Y-%m-%dT%H:%M:%S%z'),\n        (1, 1, '%Y-%m-%dT%H:%M:%S'),\n\n        (1, 0, '%Y-%m-%d'),\n\n        (1, 1, '%Y-%m-%d %H:%M:%S.%f'),\n        (1, 1, '%Y-%m-%dT%H:%M:%S.%f'),\n        (1, 1, '%Y-%m-%d %H:%M:%S.%f%z'),\n        (1, 1, '%Y-%m-%dT%H:%M:%S.%f%z'),\n\n        (1, 1, '%Y%m%dT%H%M%S%z'),\n        (1, 1, '%Y%m%d%H%M%S%z'),\n\n        (0, 1, '%H:%M:%S.%f'),\n        (0, 1, '%H:%M:%S'),\n        (0, 1, '%H:%M'),\n\n        # These parse as continuous features (plain numbers)\n        (1, 1, '%Y%m%dT%H%M%S'),\n        (1, 1, '%Y%m%d%H%M%S'),\n        (1, 0, '%Y%m%d'),\n        (1, 0, '%Y%j'),\n        (1, 0, '%Y'),\n        (0, 1, '%H%M%S.%f'),\n\n        # BUG: In Python as in C, %j doesn't necessitate 0-padding,\n        # so these two lines must be in this order\n        (1, 0, '%Y-%m'),\n        (1, 0, '%Y-%j'),\n    )\n    # Order in which `_ISO_FORMATS` are tried. Must never change order of\n    # last 2 items. Only modified via assignment in `parse`.\n    __ISO_FORMATS_PROBE_SEQ = list(range(len(_ISO_FORMATS)))\n    # The regex that matches all above formats\n    REGEX = (r'^('\n             r'\\d{1,4}-\\d{2}-\\d{2}([ T]\\d{2}:\\d{2}(:\\d{2}(\\.\\d+)?([+-]\\d{4})?)?)?|'\n             r'\\d{1,4}\\d{2}\\d{2}(T?\\d{2}\\d{2}\\d{2}([+-]\\d{4})?)?|'\n             r'\\d{2}:\\d{2}(:\\d{2}(\\.\\d+)?)?|'\n             r'\\d{2}\\d{2}\\d{2}\\.\\d+|'\n             r'\\d{1,4}(-?\\d{2,3})?'\n             r')$')\n\n    class InvalidDateTimeFormatError(ValueError):\n        def __init__(self, date_string):\n            super().__init__(\n                \"Invalid datetime format '{}'. \"\n                \"Only ISO 8601 supported.\".format(date_string))\n\n    _matches_iso_format = re.compile(REGEX).match\n\n    # UTC offset and associated timezone. If parsed datetime values provide an\n    # offset, it is used for display. If not all values have the same offset,\n    # +0000 (=UTC) timezone is used and utc_offset is set to False.\n    utc_offset = None\n    timezone = timezone.utc\n\n    def __init__(self, *args, have_date=0, have_time=0, **kwargs):\n        super().__init__(*args, **kwargs)\n        self.have_date = have_date\n        self.have_time = have_time\n\n    def copy(self, compute_value=Variable._CopyComputeValue, *, name=None, **_):\n        return super().copy(compute_value=compute_value, name=name,\n                            have_date=self.have_date, have_time=self.have_time)\n\n    @staticmethod\n    def _tzre_sub(s, _subtz=re.compile(r'([+-])(\\d\\d):(\\d\\d)$').sub):\n        # Replace +ZZ:ZZ with ISO-compatible +ZZZZ, or strip +0000\n        return s[:-6] if s.endswith(('+00:00', '-00:00')) else _subtz(r'\\1\\2\\3', s)\n\n    def repr_val(self, val):\n        if isnan(val):\n            return '?'\n        if not self.have_date and not self.have_time:\n            # The time is relative, unitless. The value is absolute.\n            return str(val.value) if isinstance(val, Value) else str(val)\n\n        # If you know how to simplify this, be my guest\n        seconds = int(val)\n        microseconds = int(round((val - seconds) * 1e6))\n        if val < 0:\n            if microseconds:\n                seconds, microseconds = seconds - 1, int(1e6) + microseconds\n            date = datetime.fromtimestamp(0, tz=self.timezone) + timedelta(seconds=seconds)\n        else:\n            date = datetime.fromtimestamp(seconds, tz=self.timezone)\n        date = str(date.replace(microsecond=microseconds))\n\n        if self.have_date and not self.have_time:\n            date = date.split()[0]\n        elif not self.have_date and self.have_time:\n            date = date.split()[1]\n        date = self._tzre_sub(date)\n        return date\n\n    str_val = repr_val\n\n    def parse(self, datestr):\n        \"\"\"\n        Return `datestr`, a datetime provided in one of ISO 8601 formats,\n        parsed as a real number. Value 0 marks the Unix epoch, positive values\n        are the dates after it, negative before.\n\n        If date is unspecified, epoch date is assumed.\n\n        If time is unspecified, 00:00:00.0 is assumed.\n\n        If timezone is unspecified, local time is assumed.\n        \"\"\"\n        if datestr in MISSING_VALUES:\n            return Unknown\n        datestr = datestr.strip().rstrip('Z')\n\n        if not self._matches_iso_format(datestr):\n            try:\n                # If it is a number, assume it is a unix timestamp\n                value = float(datestr)\n                self.have_date = self.have_time = 1\n                return value\n            except ValueError:\n                raise self.InvalidDateTimeFormatError(datestr)\n\n        try_order = self.__ISO_FORMATS_PROBE_SEQ\n        for i, (have_date, have_time, fmt) in enumerate(\n                map(self._ISO_FORMATS.__getitem__, try_order)):\n            try:\n                dt = datetime.strptime(datestr, fmt)\n            except ValueError:\n                continue\n            else:\n                # Pop this most-recently-used format index to front,\n                # excluding last 2\n                if 0 < i < len(try_order) - 2:\n                    try_order = try_order.copy()\n                    try_order[i], try_order[0] = try_order[0], try_order[i]\n                    TimeVariable.__ISO_FORMATS_PROBE_SEQ = try_order\n                self.have_date |= have_date\n                self.have_time |= have_time\n                if not have_date:\n                    dt = dt.replace(self.UNIX_EPOCH.year,\n                                    self.UNIX_EPOCH.month,\n                                    self.UNIX_EPOCH.day)\n                break\n        else:\n            raise self.InvalidDateTimeFormatError(datestr)\n\n        # Remember UTC offset. If not all parsed values share the same offset,\n        # remember none of it.\n        offset = dt.utcoffset()\n        if self.utc_offset is not False:\n            if offset and self.utc_offset is None:\n                self.utc_offset = offset\n                self.timezone = timezone(offset)\n            elif self.utc_offset != offset:\n                self.utc_offset = False\n                self.timezone = timezone.utc\n\n        # Convert time to UTC timezone. In dates without timezone,\n        # localtime is assumed. See also:\n        # https://docs.python.org/3.4/library/datetime.html#datetime.datetime.timestamp\n        if dt.tzinfo:\n            dt -= dt.utcoffset()\n        dt = dt.replace(tzinfo=timezone.utc)\n\n        # Unix epoch is the origin, older dates are negative\n        try:\n            return dt.timestamp()\n        except OverflowError:\n            return -(self.UNIX_EPOCH - dt).total_seconds()\n\n    def parse_exact_iso(self, datestr):\n        \"\"\"\n        This function is a meta function to `parse` function. It checks\n        whether the date is of the iso format - it does not accept float-like\n        date.\n        \"\"\"\n        if not self._matches_iso_format(datestr):\n            raise self.InvalidDateTimeFormatError(datestr)\n        return self.parse(datestr)\n\n    def to_val(self, s):\n        \"\"\"\n        Convert a value, given as an instance of an arbitrary type, to a float.\n        \"\"\"\n        if isinstance(s, str):\n            return self.parse(s)\n        else:\n            return super().to_val(s)\n",
            "new_file_content": "import re\nimport warnings\nfrom collections import Iterable\n\nfrom datetime import datetime, timedelta, timezone\nfrom numbers import Number, Real, Integral\nfrom math import isnan, floor\nfrom pickle import PickleError\n\nimport numpy as np\nimport scipy.sparse as sp\n\nfrom Orange.data import _variable\nfrom Orange.util import Registry, Reprable, OrangeDeprecationWarning\n\n\n__all__ = [\"Unknown\", \"MISSING_VALUES\", \"make_variable\", \"is_discrete_values\",\n           \"Value\", \"Variable\", \"ContinuousVariable\", \"DiscreteVariable\",\n           \"StringVariable\", \"TimeVariable\"]\n\n\n# For storing unknowns\nUnknown = ValueUnknown = float(\"nan\")\n# For checking for unknowns\nMISSING_VALUES = {np.nan, \"?\", \"nan\", \".\", \"\", \"NA\", \"~\", None}\n\nDISCRETE_MAX_VALUES = 3  # == 2 + nan\nMAX_NUM_OF_DECIMALS = 5\n# the variable with more than 100 different values should not be StringVariable\nDISCRETE_MAX_ALLOWED_VALUES = 100\n\n\ndef make_variable(cls, compute_value, *args):\n    if compute_value is not None:\n        return cls(*args, compute_value=compute_value)\n    else:\n        # For compatibility with old pickles\n        return cls(*args)\n\n\ndef is_discrete_values(values):\n    \"\"\"\n    Return set of uniques if `values` is an iterable of discrete values\n    else False if non-discrete, or None if indeterminate.\n\n    Note\n    ----\n    Assumes consistent type of items of `values`.\n    \"\"\"\n    if len(values) == 0:\n        return None\n    # If the first few values are, or can be converted to, floats,\n    # the type is numeric\n    try:\n        isinstance(next(iter(values)), Number) or \\\n        [float(v) for _, v in zip(range(min(3, len(values))), values)]\n    except ValueError:\n        is_numeric = False\n        max_values = int(round(len(values)**.7))\n    else:\n        is_numeric = True\n        max_values = DISCRETE_MAX_VALUES\n\n    # If more than max values => not discrete\n    unique = set()\n    for i in values:\n        unique.add(i)\n        if (len(unique) > max_values or\n                len(unique) > DISCRETE_MAX_ALLOWED_VALUES):\n            return False\n\n    # Strip NaN from unique\n    unique = {i for i in unique\n              if (not i in MISSING_VALUES and\n                  not (isinstance(i, Number) and np.isnan(i)))}\n\n    # All NaNs => indeterminate\n    if not unique:\n        return None\n\n    # Strings with |values| < max_unique\n    if not is_numeric:\n        return unique\n\n    # Handle numbers\n    try:\n        unique_float = set(map(float, unique))\n    except ValueError:\n        # Converting all the values to floats resulted in an error.\n        # Since the values have enough unique values, they are probably\n        # string values and discrete.\n        return unique\n\n    # If only values are {0, 1} or {1, 2} (or a subset of those sets) => discrete\n    return (not (unique_float - {0, 1}) or\n            not (unique_float - {1, 2})) and unique\n\n\nclass Value(float):\n    \"\"\"\n    The class representing a value. The class is not used to store values but\n    only to return them in contexts in which we want the value to be accompanied\n    with the descriptor, for instance to print the symbolic value of discrete\n    variables.\n\n    The class is derived from `float`, with an additional attribute `variable`\n    which holds the descriptor of type :obj:`Orange.data.Variable`. If the\n    value continuous or discrete, it is stored as a float. Other types of\n    values, like strings, are stored in the attribute `value`.\n\n    The class overloads the methods for printing out the value:\n    `variable.repr_val` and `variable.str_val` are used to get a suitable\n    representation of the value.\n\n    Equivalence operator is overloaded as follows:\n\n    - unknown values are equal; if one value is unknown and the other is not,\n      they are different;\n\n    - if the value is compared with the string, the value is converted to a\n      string using `variable.str_val` and the two strings are compared\n\n    - if the value is stored in attribute `value`, it is compared with the\n      given other value\n\n    - otherwise, the inherited comparison operator for `float` is called.\n\n    Finally, value defines a hash, so values can be put in sets and appear as\n    keys in dictionaries.\n\n    .. attribute:: variable (:obj:`Orange.data.Variable`)\n\n        Descriptor; used for printing out and for comparing with strings\n\n    .. attribute:: value\n\n        Value; the value can be of arbitrary type and is used only for variables\n        that are neither discrete nor continuous. If `value` is `None`, the\n        derived `float` value is used.\n    \"\"\"\n    __slots__ = \"variable\", \"_value\"\n\n    def __new__(cls, variable, value=Unknown):\n        \"\"\"\n        Construct a new instance of Value with the given descriptor and value.\n        If the argument `value` can be converted to float, it is stored as\n        `float` and the attribute `value` is set to `None`. Otherwise, the\n        inherited float is set to `Unknown` and the value is held by the\n        attribute `value`.\n\n        :param variable: descriptor\n        :type variable: Orange.data.Variable\n        :param value: value\n        \"\"\"\n        if variable.is_primitive():\n            self = super().__new__(cls, value)\n            self.variable = variable\n            self._value = None\n        else:\n            isunknown = value == variable.Unknown\n            self = super().__new__(\n                cls, np.nan if isunknown else np.finfo(float).min)\n            self.variable = variable\n            self._value = value\n        return self\n\n    def __init__(self, _, __=Unknown):\n        # __new__ does the job, pylint: disable=super-init-not-called\n        pass\n\n    def __repr__(self):\n        return \"Value('%s', %s)\" % (self.variable.name,\n                                    self.variable.repr_val(self))\n\n    def __str__(self):\n        return self.variable.str_val(self)\n\n    def __eq__(self, other):\n        if isinstance(self, Real) and isnan(self):\n            if isinstance(other, Real):\n                return isnan(other)\n            else:\n                return other in self.variable.unknown_str\n        if isinstance(other, str):\n            return self.variable.str_val(self) == other\n        if isinstance(other, Value):\n            return self.value == other.value\n        return super().__eq__(other)\n\n    def __ne__(self, other):\n        return not self.__eq__(other)\n\n    def __lt__(self, other):\n        if self.variable.is_primitive():\n            if isinstance(other, str):\n                return super().__lt__(self.variable.to_val(other))\n            else:\n                return super().__lt__(other)\n        else:\n            if isinstance(other, str):\n                return self.value < other\n            else:\n                return self.value < other.value\n\n    def __le__(self, other):\n        return self.__lt__(other) or self.__eq__(other)\n\n    def __gt__(self, other):\n        return not self.__le__(other)\n\n    def __ge__(self, other):\n        return not self.__lt__(other)\n\n    def __contains__(self, other):\n        if (self._value is not None\n                and isinstance(self._value, str)\n                and isinstance(other, str)):\n            return other in self._value\n        raise TypeError(\"invalid operation on Value()\")\n\n    def __hash__(self):\n        if self.variable.is_discrete:\n            # It is not possible to hash the id and the domain value to the\n            # same number as required by __eq__.\n            # hash(1)\n            # == hash(Value(DiscreteVariable(\"var\", [\"red\", \"green\", \"blue\"]), 1))\n            # == hash(\"green\")\n            # User should hash directly ids or domain values instead.\n            raise TypeError(\"unhashable type - cannot hash values of discrete variables!\")\n        if self._value is None:\n            return super().__hash__()\n        else:\n            return hash(self._value)\n\n    @property\n    def value(self):\n        if self.variable.is_discrete:\n            return Unknown if isnan(self) else self.variable.values[int(self)]\n        if self.variable.is_string:\n            return self._value\n        return float(self)\n\n    def __getnewargs__(self):\n        return self.variable, float(self)\n\n    def __getstate__(self):\n        return dict(value=getattr(self, '_value', None))\n\n    def __setstate__(self, state):\n        # defined in __new__, pylint: disable=attribute-defined-outside-init\n        self._value = state.get('value', None)\n\n\nclass VariableMeta(Registry):\n    pass\n\n\nclass _predicatedescriptor(property):\n    \"\"\"\n    A property that behaves as a class method if accessed via a class\n    >>> class A:\n    ...     foo = False\n    ...     @_predicatedescriptor\n    ...     def is_foo(self):\n    ...         return self.foo\n    ...\n    >>> a = A()\n    >>> a.is_foo\n    False\n    >>> A.is_foo(a)\n    False\n    \"\"\"\n    def __get__(self, instance, objtype=None):\n        if instance is None:\n            return self.fget\n        else:\n            return super().__get__(instance, objtype)\n\n\nclass Variable(Reprable, metaclass=VariableMeta):\n    \"\"\"\n    The base class for variable descriptors contains the variable's\n    name and some basic properties.\n\n    .. attribute:: name\n\n        The name of the variable.\n\n    .. attribute:: unknown_str\n\n        A set of values that represent unknowns in conversion from textual\n        formats. Default is `{\"?\", \".\", \"\", \"NA\", \"~\", None}`.\n\n    .. attribute:: compute_value\n\n        A function for computing the variable's value when converting from\n        another domain which does not contain this variable. The function will\n        be called with a data set (`Orange.data.Table`) and has to return\n        an array of computed values for all its instances. The base class\n        defines a static method `compute_value`, which returns `Unknown`.\n        Non-primitive variables must redefine it to return `None`.\n\n    .. attribute:: sparse\n\n        A flag about sparsity of the variable. When set, the variable suggests\n        it should be stored in a sparse matrix.\n\n    .. attribute:: source_variable\n\n        An optional descriptor of the source variable - if any - from which\n        this variable is derived and computed via :obj:`compute_value`.\n\n    .. attribute:: attributes\n\n        A dictionary with user-defined attributes of the variable\n    \"\"\"\n    Unknown = ValueUnknown\n\n    def __init__(self, name=\"\", compute_value=None, *, sparse=False):\n        \"\"\"\n        Construct a variable descriptor.\n        \"\"\"\n        if not name:\n            warnings.warn(\"Variable must have a name\", OrangeDeprecationWarning,\n                          stacklevel=3)\n        self._name = name\n        self._compute_value = compute_value\n        self.unknown_str = MISSING_VALUES\n        self.source_variable = None\n        self.sparse = sparse\n        self.attributes = {}\n\n    @property\n    def name(self):\n        return self._name\n\n    def make_proxy(self):\n        \"\"\"\n        Copy the variable and set the master to `self.master` or to `self`.\n\n        :return: copy of self\n        :rtype: Variable\n        \"\"\"\n        var = self.__class__(self.name)\n        var.__dict__.update(self.__dict__)\n        var.attributes = dict(self.attributes)\n        return var\n\n    def __eq__(self, other):\n        if type(self) is not type(other):\n            return False\n\n        var1 = self._get_identical_source(self)\n        var2 = self._get_identical_source(other)\n        # pylint: disable=protected-access\n        return var1.name == var2.name \\\n               and var1._compute_value == var2._compute_value\n\n    def __hash__(self):\n        var = self._get_identical_source(self)\n        return hash((var.name, type(self), var._compute_value))\n\n    @staticmethod\n    def _get_identical_source(var):\n        # pylint: disable=protected-access,import-outside-toplevel\n        from Orange.preprocess.transformation import Identity\n        while isinstance(var._compute_value, Identity):\n            var = var._compute_value.variable\n        return var\n\n    @classmethod\n    def make(cls, name, *args, **kwargs):\n        \"\"\"\n        Return an existing continuous variable with the given name, or\n        construct and return a new one.\n        \"\"\"\n        return cls(name, *args, **kwargs)\n\n    @classmethod\n    def _clear_cache(cls):\n        warnings.warn(\n            \"_clear_cache is no longer needed and thus deprecated\")\n\n    @staticmethod\n    def _clear_all_caches():\n        warnings.warn(\n            \"_clear_all_caches is no longer needed and thus deprecated\")\n\n    @classmethod\n    def is_primitive(cls, var=None):\n        \"\"\"\n        `True` if the variable's values are stored as floats.\n        Non-primitive variables can appear in the data only as meta attributes.\n        \"\"\"\n        to_check = cls if var is None else type(var)\n        return issubclass(to_check, (DiscreteVariable, ContinuousVariable))\n\n    @_predicatedescriptor\n    def is_discrete(self):\n        return isinstance(self, DiscreteVariable)\n\n    @_predicatedescriptor\n    def is_continuous(self):\n        return isinstance(self, ContinuousVariable)\n\n    @_predicatedescriptor\n    def is_string(self):\n        return isinstance(self, StringVariable)\n\n    @_predicatedescriptor\n    def is_time(self):\n        return isinstance(self, TimeVariable)\n\n    @staticmethod\n    def repr_val(val):\n        \"\"\"\n        Return a textual representation of variable's value `val`. Argument\n        `val` must be a float (for primitive variables) or an arbitrary\n        Python object (for non-primitives).\n\n        Derived classes must overload the function.\n        \"\"\"\n        raise RuntimeError(\"variable descriptors must overload repr_val()\")\n\n    str_val = repr_val\n\n    def to_val(self, s):\n        \"\"\"\n        Convert the given argument to a value of the variable. The\n        argument can be a string, a number or `None`. For primitive variables,\n        the base class provides a method that returns\n        :obj:`~Orange.data.Unknown` if `s` is found in\n        :obj:`~Orange.data.Variable.unknown_str`, and raises an exception\n        otherwise. For non-primitive variables it returns the argument itself.\n\n        Derived classes of primitive variables must overload the function.\n\n        :param s: value, represented as a number, string or `None`\n        :type s: str, float or None\n        :rtype: float or object\n        \"\"\"\n        if not self.is_primitive():\n            return s\n        if s in self.unknown_str:\n            return Unknown\n        raise RuntimeError(\n            \"primitive variable descriptors must overload to_val()\")\n\n    def val_from_str_add(self, s):\n        \"\"\"\n        Convert the given string to a value of the variable. The method\n        is similar to :obj:`to_val` except that it only accepts strings and\n        that it adds new values to the variable's domain where applicable.\n\n        The base class method calls `to_val`.\n\n        :param s: symbolic representation of the value\n        :type s: str\n        :rtype: float or object\n        \"\"\"\n        return self.to_val(s)\n\n    def __str__(self):\n        return self.name\n\n    @property\n    def compute_value(self):\n        return self._compute_value\n\n    def __reduce__(self):\n        if not self.name:\n            raise PickleError(\"Variables without names cannot be pickled\")\n\n        # Use make to unpickle variables.\n        return make_variable, (self.__class__, self._compute_value, self.name), self.__dict__\n\n    _CopyComputeValue = object()\n\n    def copy(self, compute_value=_CopyComputeValue, *, name=None, **kwargs):\n        if compute_value is self._CopyComputeValue:\n            compute_value = self.compute_value\n        var = type(self)(name=name or self.name,\n                         compute_value=compute_value,\n                         sparse=self.sparse, **kwargs)\n        var.attributes = dict(self.attributes)\n        return var\n\n    def renamed(self, new_name):\n        # prevent cyclic import, pylint: disable=import-outside-toplevel\n        from Orange.preprocess.transformation import Identity\n        return self.copy(name=new_name, compute_value=Identity(variable=self))\n\ndel _predicatedescriptor\n\n\nclass ContinuousVariable(Variable):\n    \"\"\"\n    Descriptor for continuous variables.\n\n    .. attribute:: number_of_decimals\n\n        The number of decimals when the value is printed out (default: 3).\n\n    .. attribute:: adjust_decimals\n\n        A flag regulating whether the `number_of_decimals` is being adjusted\n        by :obj:`to_val`.\n\n    The value of `number_of_decimals` is set to 3 and `adjust_decimals`\n    is set to 2. When :obj:`val_from_str_add` is called for the first\n    time with a string as an argument, `number_of_decimals` is set to the\n    number of decimals in the string and `adjust_decimals` is set to 1.\n    In the subsequent calls of `to_val`, the nubmer of decimals is\n    increased if the string argument has a larger number of decimals.\n\n    If the `number_of_decimals` is set manually, `adjust_decimals` is\n    set to 0 to prevent changes by `to_val`.\n    \"\"\"\n\n    TYPE_HEADERS = ('continuous', 'c', 'numeric', 'n')\n\n    def __init__(self, name=\"\", number_of_decimals=None, compute_value=None, *, sparse=False):\n        \"\"\"\n        Construct a new continuous variable. The number of decimals is set to\n        three, but adjusted at the first call of :obj:`to_val`.\n        \"\"\"\n        super().__init__(name, compute_value, sparse=sparse)\n        self._max_round_diff = 0\n        self.number_of_decimals = number_of_decimals\n\n    @property\n    def number_of_decimals(self):\n        return self._number_of_decimals\n\n    @property\n    def format_str(self):\n        return self._format_str\n\n    @format_str.setter\n    def format_str(self, value):\n        self._format_str = value\n\n    # noinspection PyAttributeOutsideInit\n    @number_of_decimals.setter\n    def number_of_decimals(self, x):\n        if x is None:\n            self._number_of_decimals = 3\n            self.adjust_decimals = 2\n            self._format_str = \"%g\"\n            return\n\n        self._number_of_decimals = x\n        self._max_round_diff = 10 ** (-x - 6)\n        self.adjust_decimals = 0\n        if self._number_of_decimals <= MAX_NUM_OF_DECIMALS:\n            self._format_str = \"%.{}f\".format(self.number_of_decimals)\n        else:\n            self._format_str = \"%g\"\n\n    def to_val(self, s):\n        \"\"\"\n        Convert a value, given as an instance of an arbitrary type, to a float.\n        \"\"\"\n        if s in self.unknown_str:\n            return Unknown\n        return float(s)\n\n    def val_from_str_add(self, s):\n        \"\"\"\n        Convert a value from a string and adjust the number of decimals if\n        `adjust_decimals` is non-zero.\n        \"\"\"\n        return _variable.val_from_str_add_cont(self, s)\n\n    def repr_val(self, val):\n        \"\"\"\n        Return the value as a string with the prescribed number of decimals.\n        \"\"\"\n        if isnan(val):\n            return \"?\"\n        if self.format_str != \"%g\" \\\n                and abs(round(val, self._number_of_decimals) - val) \\\n                > self._max_round_diff:\n            return f\"{val:.{self._number_of_decimals + 2}f}\"\n        return self._format_str % val\n\n    str_val = repr_val\n\n    def copy(self, compute_value=Variable._CopyComputeValue,\n             *, name=None, **kwargs):\n        # pylint understand not that `var` is `DiscreteVariable`:\n        # pylint: disable=protected-access\n        number_of_decimals = kwargs.pop(\"number_of_decimals\", None)\n        var = super().copy(compute_value=compute_value, name=name, **kwargs)\n        if number_of_decimals is not None:\n            var.number_of_decimals = number_of_decimals\n        else:\n            var._number_of_decimals = self._number_of_decimals\n            var._max_round_diff = self._max_round_diff\n            var.adjust_decimals = self.adjust_decimals\n            var.format_str = self._format_str\n        return var\n\n\nclass TupleList(tuple):\n    def __add__(self, other):\n        if isinstance(other, list):\n            warnings.warn(\n                \"DiscreteVariable.values is a tuple; \"\n                \"support for adding a list will be dropped in Orange 3.27\",\n                DeprecationWarning)\n            return list(self) + other\n        return super().__add__(other)\n\n    def copy(self):\n        warnings.warn(\n            \"DiscreteVariable.values is a tuple;\"\n            \"method copy will be dropped in Orange 3.27\",\n            DeprecationWarning)\n        return list(self)\n\n\nclass DiscreteVariable(Variable):\n    \"\"\"\n    Descriptor for symbolic, discrete variables. Values of discrete variables\n    are stored as floats; the numbers corresponds to indices in the list of\n    values.\n\n    .. attribute:: values\n\n        A list of variable's values.\n\n    .. attribute:: ordered\n\n        Some algorithms (and, in particular, visualizations) may\n        sometime reorder the values of the variable, e.g. alphabetically.\n        This flag hints that the given order of values is \"natural\"\n        (e.g. \"small\", \"middle\", \"large\") and should not be changed.\n    \"\"\"\n\n    TYPE_HEADERS = ('discrete', 'd', 'categorical')\n\n    presorted_values = []\n\n    def __init__(self, name=\"\", values=(), ordered=False, compute_value=None,\n                 *, sparse=False):\n        \"\"\" Construct a discrete variable descriptor with the given values. \"\"\"\n        values = TupleList(values)  # some people (including me) pass a generator\n        if not all(isinstance(value, str) for value in values):\n            raise TypeError(\"values of DiscreteVariables must be strings\")\n\n        super().__init__(name, compute_value, sparse=sparse)\n        self._values = values\n        self._value_index = {value: i for i, value in enumerate(values)}\n        self.ordered = ordered\n\n    @property\n    def values(self):\n        return self._values\n\n    def get_mapping_from(self, other):\n        return np.array(\n            [self._value_index.get(value, np.nan) for value in other.values],\n            dtype=float)\n\n    def get_mapper_from(self, other):\n        mapping = self.get_mapping_from(other)\n        if not mapping.size:\n            # Nans in data are temporarily replaced with 0, mapped and changed\n            # back to nans. This would fail is mapping[0] is out of range.\n            mapping = np.array([np.nan])\n\n        def mapper(value, col_idx=None):\n\n            # In-place mapping\n            if col_idx is not None:\n                if sp.issparse(value) and mapping[0] != 0:\n                    raise ValueError(\n                        \"In-place mapping of sparse matrices must map 0 to 0\")\n\n                # CSR requires mapping of non-contiguous area\n                if sp.isspmatrix_csr(value):\n                    col = value.indices == col_idx\n                    nans = np.isnan(value.data) * col\n                    value.data[nans] = 0\n                    value.data[col] = mapping[value.data[col].astype(int)]\n                    value.data[nans] = np.nan\n                    return None\n\n                # Dense and CSC map a contiguous area\n                if isinstance(value, np.ndarray) and value.ndim == 2:\n                    col = value[:, col_idx]\n                elif sp.isspmatrix_csc(value):\n                    col = value.data[value.indptr[col_idx]\n                                     :value.indptr[col_idx + 1]]\n                else:\n                    raise ValueError(\n                        \"In-place column mapping requires a 2d array or\"\n                        \"a csc or csr matrix.\")\n\n                nans = np.isnan(col)\n                col[nans] = 0\n                col[:] = mapping[col.astype(int)]\n                col[nans] = np.nan\n                return None\n\n            # Mapping into a copy\n            if isinstance(value, (int, float)):\n                return value if np.isnan(value) else mapping[int(value)]\n            if isinstance(value, str):\n                return mapping[other.values.index(value)]\n            if isinstance(value, np.ndarray):\n                if not (value.ndim == 1\n                        or value.ndim != 2 and min(value.shape) != 1):\n                    raise ValueError(\n                        f\"Column mapping can't map {value.ndim}-d objects\")\n\n                if value.dtype == object:\n                    value = value.astype(float)  # this happens with metas\n                try:\n                    nans = np.isnan(value)\n                except TypeError:  # suppose it's already an integer type\n                    return mapping[value]\n                value = value.astype(int)\n                value[nans] = 0\n                value = mapping[value]\n                value[nans] = np.nan\n                return value\n            if sp.issparse(value):\n                if min(value.shape) != 1:\n                    raise ValueError(\"Column mapping can't map \"\n                                     f\"{value.ndim}-dimensional objects\")\n                if mapping[0] != 0 and not np.isnan(mapping[0]):\n                    return mapper(np.array(value.todense()).flatten())\n                value = value.copy()\n                value.data = mapper(value.data)\n                return value\n            if isinstance(value, Iterable):\n                return type(value)(val if np.isnan(val) else mapping[int(val)]\n                                   for val in value)\n            raise ValueError(\n                f\"invalid type for value(s): {type(value).__name__}\")\n\n        return mapper\n\n    def to_val(self, s):\n        \"\"\"\n        Convert the given argument to a value of the variable (`float`).\n        If the argument is numeric, its value is returned without checking\n        whether it is integer and within bounds. `Unknown` is returned if the\n        argument is one of the representations for unknown values. Otherwise,\n        the argument must be a string and the method returns its index in\n        :obj:`values`.\n\n        :param s: values, represented as a number, string or `None`\n        :rtype: float\n        \"\"\"\n        if s is None:\n            return ValueUnknown\n\n        if isinstance(s, Integral):\n            return s\n        if isinstance(s, Real):\n            return s if isnan(s) else floor(s + 0.25)\n        if s in self.unknown_str:\n            return ValueUnknown\n        if not isinstance(s, str):\n            raise TypeError('Cannot convert {} to value of \"{}\"'.format(\n                type(s).__name__, self.name))\n        if s not in self._value_index:\n            raise ValueError(f\"Value {s} does not exist\")\n        return self._value_index[s]\n\n    def add_value(self, s):\n        \"\"\" Add a value `s` to the list of values.\n        \"\"\"\n        if not isinstance(s, str):\n            raise TypeError(\"values of DiscreteVariables must be strings\")\n        if s in self._value_index:\n            return\n        self._value_index[s] = len(self.values)\n        self._values += (s, )\n\n    def val_from_str_add(self, s):\n        \"\"\"\n        Similar to :obj:`to_val`, except that it accepts only strings and that\n        it adds the value to the list if it does not exist yet.\n\n        :param s: symbolic representation of the value\n        :type s: str\n        :rtype: float\n        \"\"\"\n        s = str(s) if s is not None else s\n        if s in self.unknown_str:\n            return ValueUnknown\n        val = self._value_index.get(s)\n        if val is None:\n            self.add_value(s)\n            val = len(self.values) - 1\n        return val\n\n    def repr_val(self, val):\n        \"\"\"\n        Return a textual representation of the value (`self.values[int(val)]`)\n        or \"?\" if the value is unknown.\n\n        :param val: value\n        :type val: float (should be whole number)\n        :rtype: str\n        \"\"\"\n        if isnan(val):\n            return \"?\"\n        return '{}'.format(self.values[int(val)])\n\n    str_val = repr_val\n\n    def __reduce__(self):\n        if not self.name:\n            raise PickleError(\"Variables without names cannot be pickled\")\n        __dict__ = dict(self.__dict__)\n        __dict__.pop(\"_values\")\n        return make_variable, (self.__class__, self._compute_value, self.name,\n                               self.values, self.ordered), \\\n            __dict__\n\n    def copy(self, compute_value=Variable._CopyComputeValue,\n             *, name=None, values=None, **_):\n        # pylint: disable=arguments-differ\n        if values is not None and len(values) != len(self.values):\n            raise ValueError(\n                \"number of values must match the number of original values\")\n        return super().copy(compute_value=compute_value, name=name,\n                            values=values or self.values, ordered=self.ordered)\n\n\nclass StringVariable(Variable):\n    \"\"\"\n    Descriptor for string variables. String variables can only appear as\n    meta attributes.\n    \"\"\"\n    Unknown = \"\"\n    TYPE_HEADERS = ('string', 's', 'text')\n\n    def to_val(self, s):\n        \"\"\"\n        Return the value as a string. If it is already a string, the same\n        object is returned.\n        \"\"\"\n        if s is None:\n            return \"\"\n        if isinstance(s, str):\n            return s\n        return str(s)\n\n    val_from_str_add = to_val\n\n    @staticmethod\n    def str_val(val):\n        \"\"\"Return a string representation of the value.\"\"\"\n        if isinstance(val, str) and val == \"\":\n            return \"?\"\n        if isinstance(val, Value):\n            if not val.value:\n                return \"?\"\n            val = val.value\n        return str(val)\n\n    def repr_val(self, val):\n        \"\"\"Return a string representation of the value.\"\"\"\n        return '\"{}\"'.format(self.str_val(val))\n\n\nclass TimeVariable(ContinuousVariable):\n    \"\"\"\n    TimeVariable is a continuous variable with Unix epoch\n    (1970-01-01 00:00:00+0000) as the origin (0.0). Later dates are positive\n    real numbers (equivalent to Unix timestamp, with microseconds in the\n    fraction part), and the dates before it map to the negative real numbers.\n\n    Unfortunately due to limitation of Python datetime, only dates\n    with year >= 1 (A.D.) are supported.\n\n    If time is specified without a date, Unix epoch is assumed.\n\n    If time is specified wihout an UTC offset, localtime is assumed.\n    \"\"\"\n    _all_vars = {}\n    TYPE_HEADERS = ('time', 't')\n    UNIX_EPOCH = datetime(1970, 1, 1)\n    _ISO_FORMATS = (\n        # have_date, have_time, format_str\n        # in order of decreased probability\n        (1, 1, '%Y-%m-%d %H:%M:%S%z'),\n        (1, 1, '%Y-%m-%d %H:%M:%S'),\n        (1, 1, '%Y-%m-%d %H:%M'),\n        (1, 1, '%Y-%m-%dT%H:%M:%S%z'),\n        (1, 1, '%Y-%m-%dT%H:%M:%S'),\n\n        (1, 0, '%Y-%m-%d'),\n\n        (1, 1, '%Y-%m-%d %H:%M:%S.%f'),\n        (1, 1, '%Y-%m-%dT%H:%M:%S.%f'),\n        (1, 1, '%Y-%m-%d %H:%M:%S.%f%z'),\n        (1, 1, '%Y-%m-%dT%H:%M:%S.%f%z'),\n\n        (1, 1, '%Y%m%dT%H%M%S%z'),\n        (1, 1, '%Y%m%d%H%M%S%z'),\n\n        (0, 1, '%H:%M:%S.%f'),\n        (0, 1, '%H:%M:%S'),\n        (0, 1, '%H:%M'),\n\n        # These parse as continuous features (plain numbers)\n        (1, 1, '%Y%m%dT%H%M%S'),\n        (1, 1, '%Y%m%d%H%M%S'),\n        (1, 0, '%Y%m%d'),\n        (1, 0, '%Y%j'),\n        (1, 0, '%Y'),\n        (0, 1, '%H%M%S.%f'),\n\n        # BUG: In Python as in C, %j doesn't necessitate 0-padding,\n        # so these two lines must be in this order\n        (1, 0, '%Y-%m'),\n        (1, 0, '%Y-%j'),\n    )\n    # Order in which `_ISO_FORMATS` are tried. Must never change order of\n    # last 2 items. Only modified via assignment in `parse`.\n    __ISO_FORMATS_PROBE_SEQ = list(range(len(_ISO_FORMATS)))\n    # The regex that matches all above formats\n    REGEX = (r'^('\n             r'\\d{1,4}-\\d{2}-\\d{2}([ T]\\d{2}:\\d{2}(:\\d{2}(\\.\\d+)?([+-]\\d{4})?)?)?|'\n             r'\\d{1,4}\\d{2}\\d{2}(T?\\d{2}\\d{2}\\d{2}([+-]\\d{4})?)?|'\n             r'\\d{2}:\\d{2}(:\\d{2}(\\.\\d+)?)?|'\n             r'\\d{2}\\d{2}\\d{2}\\.\\d+|'\n             r'\\d{1,4}(-?\\d{2,3})?'\n             r')$')\n\n    class InvalidDateTimeFormatError(ValueError):\n        def __init__(self, date_string):\n            super().__init__(\n                \"Invalid datetime format '{}'. \"\n                \"Only ISO 8601 supported.\".format(date_string))\n\n    _matches_iso_format = re.compile(REGEX).match\n\n    # UTC offset and associated timezone. If parsed datetime values provide an\n    # offset, it is used for display. If not all values have the same offset,\n    # +0000 (=UTC) timezone is used and utc_offset is set to False.\n    utc_offset = None\n    timezone = timezone.utc\n\n    def __init__(self, *args, have_date=0, have_time=0, **kwargs):\n        super().__init__(*args, **kwargs)\n        self.have_date = have_date\n        self.have_time = have_time\n\n    def copy(self, compute_value=Variable._CopyComputeValue, *, name=None, **_):\n        return super().copy(compute_value=compute_value, name=name,\n                            have_date=self.have_date, have_time=self.have_time)\n\n    @staticmethod\n    def _tzre_sub(s, _subtz=re.compile(r'([+-])(\\d\\d):(\\d\\d)$').sub):\n        # Replace +ZZ:ZZ with ISO-compatible +ZZZZ, or strip +0000\n        return s[:-6] if s.endswith(('+00:00', '-00:00')) else _subtz(r'\\1\\2\\3', s)\n\n    def repr_val(self, val):\n        if isnan(val):\n            return '?'\n        if not self.have_date and not self.have_time:\n            # The time is relative, unitless. The value is absolute.\n            return str(val.value) if isinstance(val, Value) else str(val)\n\n        # If you know how to simplify this, be my guest\n        seconds = int(val)\n        microseconds = int(round((val - seconds) * 1e6))\n        if val < 0:\n            if microseconds:\n                seconds, microseconds = seconds - 1, int(1e6) + microseconds\n            date = datetime.fromtimestamp(0, tz=self.timezone) + timedelta(seconds=seconds)\n        else:\n            date = datetime.fromtimestamp(seconds, tz=self.timezone)\n        date = str(date.replace(microsecond=microseconds))\n\n        if self.have_date and not self.have_time:\n            date = date.split()[0]\n        elif not self.have_date and self.have_time:\n            date = date.split()[1]\n        date = self._tzre_sub(date)\n        return date\n\n    str_val = repr_val\n\n    def parse(self, datestr):\n        \"\"\"\n        Return `datestr`, a datetime provided in one of ISO 8601 formats,\n        parsed as a real number. Value 0 marks the Unix epoch, positive values\n        are the dates after it, negative before.\n\n        If date is unspecified, epoch date is assumed.\n\n        If time is unspecified, 00:00:00.0 is assumed.\n\n        If timezone is unspecified, local time is assumed.\n        \"\"\"\n        if datestr in MISSING_VALUES:\n            return Unknown\n        datestr = datestr.strip().rstrip('Z')\n\n        if not self._matches_iso_format(datestr):\n            try:\n                # If it is a number, assume it is a unix timestamp\n                value = float(datestr)\n                self.have_date = self.have_time = 1\n                return value\n            except ValueError:\n                raise self.InvalidDateTimeFormatError(datestr)\n\n        try_order = self.__ISO_FORMATS_PROBE_SEQ\n        for i, (have_date, have_time, fmt) in enumerate(\n                map(self._ISO_FORMATS.__getitem__, try_order)):\n            try:\n                dt = datetime.strptime(datestr, fmt)\n            except ValueError:\n                continue\n            else:\n                # Pop this most-recently-used format index to front,\n                # excluding last 2\n                if 0 < i < len(try_order) - 2:\n                    try_order = try_order.copy()\n                    try_order[i], try_order[0] = try_order[0], try_order[i]\n                    TimeVariable.__ISO_FORMATS_PROBE_SEQ = try_order\n                self.have_date |= have_date\n                self.have_time |= have_time\n                if not have_date:\n                    dt = dt.replace(self.UNIX_EPOCH.year,\n                                    self.UNIX_EPOCH.month,\n                                    self.UNIX_EPOCH.day)\n                break\n        else:\n            raise self.InvalidDateTimeFormatError(datestr)\n\n        # Remember UTC offset. If not all parsed values share the same offset,\n        # remember none of it.\n        offset = dt.utcoffset()\n        if self.utc_offset is not False:\n            if offset and self.utc_offset is None:\n                self.utc_offset = offset\n                self.timezone = timezone(offset)\n            elif self.utc_offset != offset:\n                self.utc_offset = False\n                self.timezone = timezone.utc\n\n        # Convert time to UTC timezone. In dates without timezone,\n        # localtime is assumed. See also:\n        # https://docs.python.org/3.4/library/datetime.html#datetime.datetime.timestamp\n        if dt.tzinfo:\n            dt -= dt.utcoffset()\n        dt = dt.replace(tzinfo=timezone.utc)\n\n        # Unix epoch is the origin, older dates are negative\n        try:\n            return dt.timestamp()\n        except OverflowError:\n            return -(self.UNIX_EPOCH - dt).total_seconds()\n\n    def parse_exact_iso(self, datestr):\n        \"\"\"\n        This function is a meta function to `parse` function. It checks\n        whether the date is of the iso format - it does not accept float-like\n        date.\n        \"\"\"\n        if not self._matches_iso_format(datestr):\n            raise self.InvalidDateTimeFormatError(datestr)\n        return self.parse(datestr)\n\n    def to_val(self, s):\n        \"\"\"\n        Convert a value, given as an instance of an arbitrary type, to a float.\n        \"\"\"\n        if isinstance(s, str):\n            return self.parse(s)\n        else:\n            return super().to_val(s)\n",
            "header": {
                "file": {
                    "path": "Orange/data/variable.py"
                },
                "misc_line": null
            },
            "index_line": {
                "old_commit_hash": "9c2d90977",
                "new_commit_hash": "c5ac2cecb",
                "mode": "100644"
            },
            "is_binary_file": false,
            "binary_line": null,
            "minus_file": {
                "path": "a/Orange/data/variable.py"
            },
            "plus_file": {
                "path": "b/Orange/data/variable.py"
            },
            "hunks": [
                {
                    "descriptor": {
                        "old_range": {
                            "start": 347,
                            "length": 34
                        },
                        "new_range": {
                            "start": 347,
                            "length": 26
                        },
                        "section": "class Variable(Reprable, metaclass=VariableMeta):"
                    },
                    "line_group": {
                        "all_lines": [
                            {
                                "content": "        return var",
                                "type": "context"
                            },
                            {
                                "content": "",
                                "type": "context"
                            },
                            {
                                "content": "    def __eq__(self, other):",
                                "type": "context"
                            },
                            {
                                "content": "        # pylint: disable=protected-access,import-outside-toplevel",
                                "type": "deleted"
                            },
                            {
                                "content": "",
                                "type": "deleted"
                            },
                            {
                                "content": "        def to_match(var):",
                                "type": "deleted"
                            },
                            {
                                "content": "            if var._compute_value is None:",
                                "type": "deleted"
                            },
                            {
                                "content": "                return var",
                                "type": "deleted"
                            },
                            {
                                "content": "            elif isinstance(var._compute_value, Identity):",
                                "type": "deleted"
                            },
                            {
                                "content": "                return var._compute_value.variable",
                                "type": "deleted"
                            },
                            {
                                "content": "            return None",
                                "type": "deleted"
                            },
                            {
                                "content": "        if type(self) is not type(other):",
                                "type": "added"
                            },
                            {
                                "content": "            return False",
                                "type": "added"
                            },
                            {
                                "content": "",
                                "type": "context"
                            },
                            {
                                "content": "        from Orange.preprocess.transformation import Identity",
                                "type": "deleted"
                            },
                            {
                                "content": "        return type(self) is type(other) and (",
                                "type": "deleted"
                            },
                            {
                                "content": "            self.name == other.name",
                                "type": "deleted"
                            },
                            {
                                "content": "            and self._compute_value == other._compute_value",
                                "type": "deleted"
                            },
                            {
                                "content": "            or",
                                "type": "deleted"
                            },
                            {
                                "content": "            (self.compute_value or other.compute_value)",
                                "type": "deleted"
                            },
                            {
                                "content": "            and to_match(self) == to_match(other) != None)",
                                "type": "deleted"
                            },
                            {
                                "content": "        var1 = self._get_identical_source(self)",
                                "type": "added"
                            },
                            {
                                "content": "        var2 = self._get_identical_source(other)",
                                "type": "added"
                            },
                            {
                                "content": "        # pylint: disable=protected-access",
                                "type": "added"
                            },
                            {
                                "content": "        return var1.name == var2.name \\",
                                "type": "added"
                            },
                            {
                                "content": "               and var1._compute_value == var2._compute_value",
                                "type": "added"
                            },
                            {
                                "content": "",
                                "type": "context"
                            },
                            {
                                "content": "    def __hash__(self):",
                                "type": "context"
                            },
                            {
                                "content": "        # Two variables that are not equal can have the same hash.",
                                "type": "deleted"
                            },
                            {
                                "content": "        # This happens if one has compute_value == Identity and the other",
                                "type": "deleted"
                            },
                            {
                                "content": "        # doesn't have compute_value, or they have a different Identity.",
                                "type": "deleted"
                            },
                            {
                                "content": "        # Having the same hash while not being equal is of course allowed.",
                                "type": "deleted"
                            },
                            {
                                "content": "        # pylint: disable=import-outside-toplevel",
                                "type": "deleted"
                            },
                            {
                                "content": "        var = self._get_identical_source(self)",
                                "type": "added"
                            },
                            {
                                "content": "        return hash((var.name, type(self), var._compute_value))",
                                "type": "added"
                            },
                            {
                                "content": "",
                                "type": "added"
                            },
                            {
                                "content": "    @staticmethod",
                                "type": "added"
                            },
                            {
                                "content": "    def _get_identical_source(var):",
                                "type": "added"
                            },
                            {
                                "content": "        # pylint: disable=protected-access,import-outside-toplevel",
                                "type": "added"
                            },
                            {
                                "content": "        from Orange.preprocess.transformation import Identity",
                                "type": "context"
                            },
                            {
                                "content": "        compute_value = self._compute_value",
                                "type": "deleted"
                            },
                            {
                                "content": "        if isinstance(self._compute_value, Identity):",
                                "type": "deleted"
                            },
                            {
                                "content": "            compute_value = None",
                                "type": "deleted"
                            },
                            {
                                "content": "        return hash((self.name, type(self), compute_value))",
                                "type": "deleted"
                            },
                            {
                                "content": "        while isinstance(var._compute_value, Identity):",
                                "type": "added"
                            },
                            {
                                "content": "            var = var._compute_value.variable",
                                "type": "added"
                            },
                            {
                                "content": "        return var",
                                "type": "added"
                            },
                            {
                                "content": "",
                                "type": "context"
                            },
                            {
                                "content": "    @classmethod",
                                "type": "context"
                            },
                            {
                                "content": "    def make(cls, name, *args, **kwargs):",
                                "type": "context"
                            },
                            {
                                "content": "",
                                "type": "context"
                            }
                        ]
                    },
                    "modified_entities": [
                        {
                            "file_name": "Orange/data/variable.py",
                            "type": "class",
                            "name": "Variable",
                            "content": "class Variable(Reprable, metaclass=VariableMeta):\n    \"\"\"\n    The base class for variable descriptors contains the variable's\n    name and some basic properties.\n\n    .. attribute:: name\n\n        The name of the variable.\n\n    .. attribute:: unknown_str\n\n        A set of values that represent unknowns in conversion from textual\n        formats. Default is `{\"?\", \".\", \"\", \"NA\", \"~\", None}`.\n\n    .. attribute:: compute_value\n\n        A function for computing the variable's value when converting from\n        another domain which does not contain this variable. The function will\n        be called with a data set (`Orange.data.Table`) and has to return\n        an array of computed values for all its instances. The base class\n        defines a static method `compute_value`, which returns `Unknown`.\n        Non-primitive variables must redefine it to return `None`.\n\n    .. attribute:: sparse\n\n        A flag about sparsity of the variable. When set, the variable suggests\n        it should be stored in a sparse matrix.\n\n    .. attribute:: source_variable\n\n        An optional descriptor of the source variable - if any - from which\n        this variable is derived and computed via :obj:`compute_value`.\n\n    .. attribute:: attributes\n\n        A dictionary with user-defined attributes of the variable\n    \"\"\"\n    Unknown = ValueUnknown\n\n    def __init__(self, name=\"\", compute_value=None, *, sparse=False):\n        \"\"\"\n        Construct a variable descriptor.\n        \"\"\"\n        if not name:\n            warnings.warn(\"Variable must have a name\", OrangeDeprecationWarning,\n                          stacklevel=3)\n        self._name = name\n        self._compute_value = compute_value\n        self.unknown_str = MISSING_VALUES\n        self.source_variable = None\n        self.sparse = sparse\n        self.attributes = {}\n\n    @property\n    def name(self):\n        return self._name\n\n    def make_proxy(self):\n        \"\"\"\n        Copy the variable and set the master to `self.master` or to `self`.\n\n        :return: copy of self\n        :rtype: Variable\n        \"\"\"\n        var = self.__class__(self.name)\n        var.__dict__.update(self.__dict__)\n        var.attributes = dict(self.attributes)\n        return var\n\n    def __eq__(self, other):\n        # pylint: disable=protected-access,import-outside-toplevel\n\n        def to_match(var):\n            if var._compute_value is None:\n                return var\n            elif isinstance(var._compute_value, Identity):\n                return var._compute_value.variable\n            return None\n\n        from Orange.preprocess.transformation import Identity\n        return type(self) is type(other) and (\n            self.name == other.name\n            and self._compute_value == other._compute_value\n            or\n            (self.compute_value or other.compute_value)\n            and to_match(self) == to_match(other) != None)\n\n    def __hash__(self):\n        # Two variables that are not equal can have the same hash.\n        # This happens if one has compute_value == Identity and the other\n        # doesn't have compute_value, or they have a different Identity.\n        # Having the same hash while not being equal is of course allowed.\n        # pylint: disable=import-outside-toplevel\n        from Orange.preprocess.transformation import Identity\n        compute_value = self._compute_value\n        if isinstance(self._compute_value, Identity):\n            compute_value = None\n        return hash((self.name, type(self), compute_value))\n\n    @classmethod\n    def make(cls, name, *args, **kwargs):\n        \"\"\"\n        Return an existing continuous variable with the given name, or\n        construct and return a new one.\n        \"\"\"\n        return cls(name, *args, **kwargs)\n\n    @classmethod\n    def _clear_cache(cls):\n        warnings.warn(\n            \"_clear_cache is no longer needed and thus deprecated\")\n\n    @staticmethod\n    def _clear_all_caches():\n        warnings.warn(\n            \"_clear_all_caches is no longer needed and thus deprecated\")\n\n    @classmethod\n    def is_primitive(cls, var=None):\n        \"\"\"\n        `True` if the variable's values are stored as floats.\n        Non-primitive variables can appear in the data only as meta attributes.\n        \"\"\"\n        to_check = cls if var is None else type(var)\n        return issubclass(to_check, (DiscreteVariable, ContinuousVariable))\n\n    @_predicatedescriptor\n    def is_discrete(self):\n        return isinstance(self, DiscreteVariable)\n\n    @_predicatedescriptor\n    def is_continuous(self):\n        return isinstance(self, ContinuousVariable)\n\n    @_predicatedescriptor\n    def is_string(self):\n        return isinstance(self, StringVariable)\n\n    @_predicatedescriptor\n    def is_time(self):\n        return isinstance(self, TimeVariable)\n\n    @staticmethod\n    def repr_val(val):\n        \"\"\"\n        Return a textual representation of variable's value `val`. Argument\n        `val` must be a float (for primitive variables) or an arbitrary\n        Python object (for non-primitives).\n\n        Derived classes must overload the function.\n        \"\"\"\n        raise RuntimeError(\"variable descriptors must overload repr_val()\")\n\n    str_val = repr_val\n\n    def to_val(self, s):\n        \"\"\"\n        Convert the given argument to a value of the variable. The\n        argument can be a string, a number or `None`. For primitive variables,\n        the base class provides a method that returns\n        :obj:`~Orange.data.Unknown` if `s` is found in\n        :obj:`~Orange.data.Variable.unknown_str`, and raises an exception\n        otherwise. For non-primitive variables it returns the argument itself.\n\n        Derived classes of primitive variables must overload the function.\n\n        :param s: value, represented as a number, string or `None`\n        :type s: str, float or None\n        :rtype: float or object\n        \"\"\"\n        if not self.is_primitive():\n            return s\n        if s in self.unknown_str:\n            return Unknown\n        raise RuntimeError(\n            \"primitive variable descriptors must overload to_val()\")\n\n    def val_from_str_add(self, s):\n        \"\"\"\n        Convert the given string to a value of the variable. The method\n        is similar to :obj:`to_val` except that it only accepts strings and\n        that it adds new values to the variable's domain where applicable.\n\n        The base class method calls `to_val`.\n\n        :param s: symbolic representation of the value\n        :type s: str\n        :rtype: float or object\n        \"\"\"\n        return self.to_val(s)\n\n    def __str__(self):\n        return self.name\n\n    @property\n    def compute_value(self):\n        return self._compute_value\n\n    def __reduce__(self):\n        if not self.name:\n            raise PickleError(\"Variables without names cannot be pickled\")\n\n        # Use make to unpickle variables.\n        return make_variable, (self.__class__, self._compute_value, self.name), self.__dict__\n\n    _CopyComputeValue = object()\n\n    def copy(self, compute_value=_CopyComputeValue, *, name=None, **kwargs):\n        if compute_value is self._CopyComputeValue:\n            compute_value = self.compute_value\n        var = type(self)(name=name or self.name,\n                         compute_value=compute_value,\n                         sparse=self.sparse, **kwargs)\n        var.attributes = dict(self.attributes)\n        return var\n\n    def renamed(self, new_name):\n        # prevent cyclic import, pylint: disable=import-outside-toplevel\n        from Orange.preprocess.transformation import Identity\n        return self.copy(name=new_name, compute_value=Identity(variable=self))",
                            "ast_type_str": "ClassDef",
                            "start_lineno": 280,
                            "end_lineno": 499,
                            "parent": null
                        },
                        {
                            "file_name": "Orange/data/variable.py",
                            "type": "method",
                            "name": "Variable.__eq__",
                            "content": "class Variable(Reprable, metaclass=VariableMeta):\n    \"\"\"\n    The base class for variable descriptors contains the variable's\n    name and some basic properties.\n\n    .. attribute:: name\n\n        The name of the variable.\n\n    .. attribute:: unknown_str\n\n        A set of values that represent unknowns in conversion from textual\n        formats. Default is `{\"?\", \".\", \"\", \"NA\", \"~\", None}`.\n\n    .. attribute:: compute_value\n\n        A function for computing the variable's value when converting from\n        another domain which does not contain this variable. The function will\n        be called with a data set (`Orange.data.Table`) and has to return\n        an array of computed values for all its instances. The base class\n        defines a static method `compute_value`, which returns `Unknown`.\n        Non-primitive variables must redefine it to return `None`.\n\n    .. attribute:: sparse\n\n        A flag about sparsity of the variable. When set, the variable suggests\n        it should be stored in a sparse matrix.\n\n    .. attribute:: source_variable\n\n        An optional descriptor of the source variable - if any - from which\n        this variable is derived and computed via :obj:`compute_value`.\n\n    .. attribute:: attributes\n\n        A dictionary with user-defined attributes of the variable\n    \"\"\"\n    Unknown = ValueUnknown\n\n    def __init__(self, name=\"\", compute_value=None, *, sparse=False):\n        \"\"\"\n        Construct a variable descriptor.\n        \"\"\"\n        if not name:\n            warnings.warn(\"Variable must have a name\", OrangeDeprecationWarning,\n                          stacklevel=3)\n        self._name = name\n        self._compute_value = compute_value\n        self.unknown_str = MISSING_VALUES\n        self.source_variable = None\n        self.sparse = sparse\n        self.attributes = {}\n\n    @property\n    def name(self):\n        return self._name\n\n    def make_proxy(self):\n        \"\"\"\n        Copy the variable and set the master to `self.master` or to `self`.\n\n        :return: copy of self\n        :rtype: Variable\n        \"\"\"\n        var = self.__class__(self.name)\n        var.__dict__.update(self.__dict__)\n        var.attributes = dict(self.attributes)\n        return var\n\n    def __eq__(self, other):\n        # pylint: disable=protected-access,import-outside-toplevel\n\n        def to_match(var):\n            if var._compute_value is None:\n                return var\n            elif isinstance(var._compute_value, Identity):\n                return var._compute_value.variable\n            return None\n\n        from Orange.preprocess.transformation import Identity\n        return type(self) is type(other) and (\n            self.name == other.name\n            and self._compute_value == other._compute_value\n            or\n            (self.compute_value or other.compute_value)\n            and to_match(self) == to_match(other) != None)\n\n    def __hash__(self):\n        # Two variables that are not equal can have the same hash.\n        # This happens if one has compute_value == Identity and the other\n        # doesn't have compute_value, or they have a different Identity.\n        # Having the same hash while not being equal is of course allowed.\n        # pylint: disable=import-outside-toplevel\n        from Orange.preprocess.transformation import Identity\n        compute_value = self._compute_value\n        if isinstance(self._compute_value, Identity):\n            compute_value = None\n        return hash((self.name, type(self), compute_value))\n\n    @classmethod\n    def make(cls, name, *args, **kwargs):\n        \"\"\"\n        Return an existing continuous variable with the given name, or\n        construct and return a new one.\n        \"\"\"\n        return cls(name, *args, **kwargs)\n\n    @classmethod\n    def _clear_cache(cls):\n        warnings.warn(\n            \"_clear_cache is no longer needed and thus deprecated\")\n\n    @staticmethod\n    def _clear_all_caches():\n        warnings.warn(\n            \"_clear_all_caches is no longer needed and thus deprecated\")\n\n    @classmethod\n    def is_primitive(cls, var=None):\n        \"\"\"\n        `True` if the variable's values are stored as floats.\n        Non-primitive variables can appear in the data only as meta attributes.\n        \"\"\"\n        to_check = cls if var is None else type(var)\n        return issubclass(to_check, (DiscreteVariable, ContinuousVariable))\n\n    @_predicatedescriptor\n    def is_discrete(self):\n        return isinstance(self, DiscreteVariable)\n\n    @_predicatedescriptor\n    def is_continuous(self):\n        return isinstance(self, ContinuousVariable)\n\n    @_predicatedescriptor\n    def is_string(self):\n        return isinstance(self, StringVariable)\n\n    @_predicatedescriptor\n    def is_time(self):\n        return isinstance(self, TimeVariable)\n\n    @staticmethod\n    def repr_val(val):\n        \"\"\"\n        Return a textual representation of variable's value `val`. Argument\n        `val` must be a float (for primitive variables) or an arbitrary\n        Python object (for non-primitives).\n\n        Derived classes must overload the function.\n        \"\"\"\n        raise RuntimeError(\"variable descriptors must overload repr_val()\")\n\n    str_val = repr_val\n\n    def to_val(self, s):\n        \"\"\"\n        Convert the given argument to a value of the variable. The\n        argument can be a string, a number or `None`. For primitive variables,\n        the base class provides a method that returns\n        :obj:`~Orange.data.Unknown` if `s` is found in\n        :obj:`~Orange.data.Variable.unknown_str`, and raises an exception\n        otherwise. For non-primitive variables it returns the argument itself.\n\n        Derived classes of primitive variables must overload the function.\n\n        :param s: value, represented as a number, string or `None`\n        :type s: str, float or None\n        :rtype: float or object\n        \"\"\"\n        if not self.is_primitive():\n            return s\n        if s in self.unknown_str:\n            return Unknown\n        raise RuntimeError(\n            \"primitive variable descriptors must overload to_val()\")\n\n    def val_from_str_add(self, s):\n        \"\"\"\n        Convert the given string to a value of the variable. The method\n        is similar to :obj:`to_val` except that it only accepts strings and\n        that it adds new values to the variable's domain where applicable.\n\n        The base class method calls `to_val`.\n\n        :param s: symbolic representation of the value\n        :type s: str\n        :rtype: float or object\n        \"\"\"\n        return self.to_val(s)\n\n    def __str__(self):\n        return self.name\n\n    @property\n    def compute_value(self):\n        return self._compute_value\n\n    def __reduce__(self):\n        if not self.name:\n            raise PickleError(\"Variables without names cannot be pickled\")\n\n        # Use make to unpickle variables.\n        return make_variable, (self.__class__, self._compute_value, self.name), self.__dict__\n\n    _CopyComputeValue = object()\n\n    def copy(self, compute_value=_CopyComputeValue, *, name=None, **kwargs):\n        if compute_value is self._CopyComputeValue:\n            compute_value = self.compute_value\n        var = type(self)(name=name or self.name,\n                         compute_value=compute_value,\n                         sparse=self.sparse, **kwargs)\n        var.attributes = dict(self.attributes)\n        return var\n\n    def renamed(self, new_name):\n        # prevent cyclic import, pylint: disable=import-outside-toplevel\n        from Orange.preprocess.transformation import Identity\n        return self.copy(name=new_name, compute_value=Identity(variable=self))",
                            "ast_type_str": "ClassDef",
                            "start_lineno": 349,
                            "end_lineno": 365,
                            "parent": {
                                "file_name": "Orange/data/variable.py",
                                "type": "class",
                                "name": "Variable",
                                "content": "class Variable(Reprable, metaclass=VariableMeta):\n    \"\"\"\n    The base class for variable descriptors contains the variable's\n    name and some basic properties.\n\n    .. attribute:: name\n\n        The name of the variable.\n\n    .. attribute:: unknown_str\n\n        A set of values that represent unknowns in conversion from textual\n        formats. Default is `{\"?\", \".\", \"\", \"NA\", \"~\", None}`.\n\n    .. attribute:: compute_value\n\n        A function for computing the variable's value when converting from\n        another domain which does not contain this variable. The function will\n        be called with a data set (`Orange.data.Table`) and has to return\n        an array of computed values for all its instances. The base class\n        defines a static method `compute_value`, which returns `Unknown`.\n        Non-primitive variables must redefine it to return `None`.\n\n    .. attribute:: sparse\n\n        A flag about sparsity of the variable. When set, the variable suggests\n        it should be stored in a sparse matrix.\n\n    .. attribute:: source_variable\n\n        An optional descriptor of the source variable - if any - from which\n        this variable is derived and computed via :obj:`compute_value`.\n\n    .. attribute:: attributes\n\n        A dictionary with user-defined attributes of the variable\n    \"\"\"\n    Unknown = ValueUnknown\n\n    def __init__(self, name=\"\", compute_value=None, *, sparse=False):\n        \"\"\"\n        Construct a variable descriptor.\n        \"\"\"\n        if not name:\n            warnings.warn(\"Variable must have a name\", OrangeDeprecationWarning,\n                          stacklevel=3)\n        self._name = name\n        self._compute_value = compute_value\n        self.unknown_str = MISSING_VALUES\n        self.source_variable = None\n        self.sparse = sparse\n        self.attributes = {}\n\n    @property\n    def name(self):\n        return self._name\n\n    def make_proxy(self):\n        \"\"\"\n        Copy the variable and set the master to `self.master` or to `self`.\n\n        :return: copy of self\n        :rtype: Variable\n        \"\"\"\n        var = self.__class__(self.name)\n        var.__dict__.update(self.__dict__)\n        var.attributes = dict(self.attributes)\n        return var\n\n    def __eq__(self, other):\n        # pylint: disable=protected-access,import-outside-toplevel\n\n        def to_match(var):\n            if var._compute_value is None:\n                return var\n            elif isinstance(var._compute_value, Identity):\n                return var._compute_value.variable\n            return None\n\n        from Orange.preprocess.transformation import Identity\n        return type(self) is type(other) and (\n            self.name == other.name\n            and self._compute_value == other._compute_value\n            or\n            (self.compute_value or other.compute_value)\n            and to_match(self) == to_match(other) != None)\n\n    def __hash__(self):\n        # Two variables that are not equal can have the same hash.\n        # This happens if one has compute_value == Identity and the other\n        # doesn't have compute_value, or they have a different Identity.\n        # Having the same hash while not being equal is of course allowed.\n        # pylint: disable=import-outside-toplevel\n        from Orange.preprocess.transformation import Identity\n        compute_value = self._compute_value\n        if isinstance(self._compute_value, Identity):\n            compute_value = None\n        return hash((self.name, type(self), compute_value))\n\n    @classmethod\n    def make(cls, name, *args, **kwargs):\n        \"\"\"\n        Return an existing continuous variable with the given name, or\n        construct and return a new one.\n        \"\"\"\n        return cls(name, *args, **kwargs)\n\n    @classmethod\n    def _clear_cache(cls):\n        warnings.warn(\n            \"_clear_cache is no longer needed and thus deprecated\")\n\n    @staticmethod\n    def _clear_all_caches():\n        warnings.warn(\n            \"_clear_all_caches is no longer needed and thus deprecated\")\n\n    @classmethod\n    def is_primitive(cls, var=None):\n        \"\"\"\n        `True` if the variable's values are stored as floats.\n        Non-primitive variables can appear in the data only as meta attributes.\n        \"\"\"\n        to_check = cls if var is None else type(var)\n        return issubclass(to_check, (DiscreteVariable, ContinuousVariable))\n\n    @_predicatedescriptor\n    def is_discrete(self):\n        return isinstance(self, DiscreteVariable)\n\n    @_predicatedescriptor\n    def is_continuous(self):\n        return isinstance(self, ContinuousVariable)\n\n    @_predicatedescriptor\n    def is_string(self):\n        return isinstance(self, StringVariable)\n\n    @_predicatedescriptor\n    def is_time(self):\n        return isinstance(self, TimeVariable)\n\n    @staticmethod\n    def repr_val(val):\n        \"\"\"\n        Return a textual representation of variable's value `val`. Argument\n        `val` must be a float (for primitive variables) or an arbitrary\n        Python object (for non-primitives).\n\n        Derived classes must overload the function.\n        \"\"\"\n        raise RuntimeError(\"variable descriptors must overload repr_val()\")\n\n    str_val = repr_val\n\n    def to_val(self, s):\n        \"\"\"\n        Convert the given argument to a value of the variable. The\n        argument can be a string, a number or `None`. For primitive variables,\n        the base class provides a method that returns\n        :obj:`~Orange.data.Unknown` if `s` is found in\n        :obj:`~Orange.data.Variable.unknown_str`, and raises an exception\n        otherwise. For non-primitive variables it returns the argument itself.\n\n        Derived classes of primitive variables must overload the function.\n\n        :param s: value, represented as a number, string or `None`\n        :type s: str, float or None\n        :rtype: float or object\n        \"\"\"\n        if not self.is_primitive():\n            return s\n        if s in self.unknown_str:\n            return Unknown\n        raise RuntimeError(\n            \"primitive variable descriptors must overload to_val()\")\n\n    def val_from_str_add(self, s):\n        \"\"\"\n        Convert the given string to a value of the variable. The method\n        is similar to :obj:`to_val` except that it only accepts strings and\n        that it adds new values to the variable's domain where applicable.\n\n        The base class method calls `to_val`.\n\n        :param s: symbolic representation of the value\n        :type s: str\n        :rtype: float or object\n        \"\"\"\n        return self.to_val(s)\n\n    def __str__(self):\n        return self.name\n\n    @property\n    def compute_value(self):\n        return self._compute_value\n\n    def __reduce__(self):\n        if not self.name:\n            raise PickleError(\"Variables without names cannot be pickled\")\n\n        # Use make to unpickle variables.\n        return make_variable, (self.__class__, self._compute_value, self.name), self.__dict__\n\n    _CopyComputeValue = object()\n\n    def copy(self, compute_value=_CopyComputeValue, *, name=None, **kwargs):\n        if compute_value is self._CopyComputeValue:\n            compute_value = self.compute_value\n        var = type(self)(name=name or self.name,\n                         compute_value=compute_value,\n                         sparse=self.sparse, **kwargs)\n        var.attributes = dict(self.attributes)\n        return var\n\n    def renamed(self, new_name):\n        # prevent cyclic import, pylint: disable=import-outside-toplevel\n        from Orange.preprocess.transformation import Identity\n        return self.copy(name=new_name, compute_value=Identity(variable=self))",
                                "ast_type_str": "ClassDef",
                                "start_lineno": 280,
                                "end_lineno": 499,
                                "parent": null
                            }
                        },
                        {
                            "file_name": "Orange/data/variable.py",
                            "type": "method",
                            "name": "Variable.__hash__",
                            "content": "class Variable(Reprable, metaclass=VariableMeta):\n    \"\"\"\n    The base class for variable descriptors contains the variable's\n    name and some basic properties.\n\n    .. attribute:: name\n\n        The name of the variable.\n\n    .. attribute:: unknown_str\n\n        A set of values that represent unknowns in conversion from textual\n        formats. Default is `{\"?\", \".\", \"\", \"NA\", \"~\", None}`.\n\n    .. attribute:: compute_value\n\n        A function for computing the variable's value when converting from\n        another domain which does not contain this variable. The function will\n        be called with a data set (`Orange.data.Table`) and has to return\n        an array of computed values for all its instances. The base class\n        defines a static method `compute_value`, which returns `Unknown`.\n        Non-primitive variables must redefine it to return `None`.\n\n    .. attribute:: sparse\n\n        A flag about sparsity of the variable. When set, the variable suggests\n        it should be stored in a sparse matrix.\n\n    .. attribute:: source_variable\n\n        An optional descriptor of the source variable - if any - from which\n        this variable is derived and computed via :obj:`compute_value`.\n\n    .. attribute:: attributes\n\n        A dictionary with user-defined attributes of the variable\n    \"\"\"\n    Unknown = ValueUnknown\n\n    def __init__(self, name=\"\", compute_value=None, *, sparse=False):\n        \"\"\"\n        Construct a variable descriptor.\n        \"\"\"\n        if not name:\n            warnings.warn(\"Variable must have a name\", OrangeDeprecationWarning,\n                          stacklevel=3)\n        self._name = name\n        self._compute_value = compute_value\n        self.unknown_str = MISSING_VALUES\n        self.source_variable = None\n        self.sparse = sparse\n        self.attributes = {}\n\n    @property\n    def name(self):\n        return self._name\n\n    def make_proxy(self):\n        \"\"\"\n        Copy the variable and set the master to `self.master` or to `self`.\n\n        :return: copy of self\n        :rtype: Variable\n        \"\"\"\n        var = self.__class__(self.name)\n        var.__dict__.update(self.__dict__)\n        var.attributes = dict(self.attributes)\n        return var\n\n    def __eq__(self, other):\n        # pylint: disable=protected-access,import-outside-toplevel\n\n        def to_match(var):\n            if var._compute_value is None:\n                return var\n            elif isinstance(var._compute_value, Identity):\n                return var._compute_value.variable\n            return None\n\n        from Orange.preprocess.transformation import Identity\n        return type(self) is type(other) and (\n            self.name == other.name\n            and self._compute_value == other._compute_value\n            or\n            (self.compute_value or other.compute_value)\n            and to_match(self) == to_match(other) != None)\n\n    def __hash__(self):\n        # Two variables that are not equal can have the same hash.\n        # This happens if one has compute_value == Identity and the other\n        # doesn't have compute_value, or they have a different Identity.\n        # Having the same hash while not being equal is of course allowed.\n        # pylint: disable=import-outside-toplevel\n        from Orange.preprocess.transformation import Identity\n        compute_value = self._compute_value\n        if isinstance(self._compute_value, Identity):\n            compute_value = None\n        return hash((self.name, type(self), compute_value))\n\n    @classmethod\n    def make(cls, name, *args, **kwargs):\n        \"\"\"\n        Return an existing continuous variable with the given name, or\n        construct and return a new one.\n        \"\"\"\n        return cls(name, *args, **kwargs)\n\n    @classmethod\n    def _clear_cache(cls):\n        warnings.warn(\n            \"_clear_cache is no longer needed and thus deprecated\")\n\n    @staticmethod\n    def _clear_all_caches():\n        warnings.warn(\n            \"_clear_all_caches is no longer needed and thus deprecated\")\n\n    @classmethod\n    def is_primitive(cls, var=None):\n        \"\"\"\n        `True` if the variable's values are stored as floats.\n        Non-primitive variables can appear in the data only as meta attributes.\n        \"\"\"\n        to_check = cls if var is None else type(var)\n        return issubclass(to_check, (DiscreteVariable, ContinuousVariable))\n\n    @_predicatedescriptor\n    def is_discrete(self):\n        return isinstance(self, DiscreteVariable)\n\n    @_predicatedescriptor\n    def is_continuous(self):\n        return isinstance(self, ContinuousVariable)\n\n    @_predicatedescriptor\n    def is_string(self):\n        return isinstance(self, StringVariable)\n\n    @_predicatedescriptor\n    def is_time(self):\n        return isinstance(self, TimeVariable)\n\n    @staticmethod\n    def repr_val(val):\n        \"\"\"\n        Return a textual representation of variable's value `val`. Argument\n        `val` must be a float (for primitive variables) or an arbitrary\n        Python object (for non-primitives).\n\n        Derived classes must overload the function.\n        \"\"\"\n        raise RuntimeError(\"variable descriptors must overload repr_val()\")\n\n    str_val = repr_val\n\n    def to_val(self, s):\n        \"\"\"\n        Convert the given argument to a value of the variable. The\n        argument can be a string, a number or `None`. For primitive variables,\n        the base class provides a method that returns\n        :obj:`~Orange.data.Unknown` if `s` is found in\n        :obj:`~Orange.data.Variable.unknown_str`, and raises an exception\n        otherwise. For non-primitive variables it returns the argument itself.\n\n        Derived classes of primitive variables must overload the function.\n\n        :param s: value, represented as a number, string or `None`\n        :type s: str, float or None\n        :rtype: float or object\n        \"\"\"\n        if not self.is_primitive():\n            return s\n        if s in self.unknown_str:\n            return Unknown\n        raise RuntimeError(\n            \"primitive variable descriptors must overload to_val()\")\n\n    def val_from_str_add(self, s):\n        \"\"\"\n        Convert the given string to a value of the variable. The method\n        is similar to :obj:`to_val` except that it only accepts strings and\n        that it adds new values to the variable's domain where applicable.\n\n        The base class method calls `to_val`.\n\n        :param s: symbolic representation of the value\n        :type s: str\n        :rtype: float or object\n        \"\"\"\n        return self.to_val(s)\n\n    def __str__(self):\n        return self.name\n\n    @property\n    def compute_value(self):\n        return self._compute_value\n\n    def __reduce__(self):\n        if not self.name:\n            raise PickleError(\"Variables without names cannot be pickled\")\n\n        # Use make to unpickle variables.\n        return make_variable, (self.__class__, self._compute_value, self.name), self.__dict__\n\n    _CopyComputeValue = object()\n\n    def copy(self, compute_value=_CopyComputeValue, *, name=None, **kwargs):\n        if compute_value is self._CopyComputeValue:\n            compute_value = self.compute_value\n        var = type(self)(name=name or self.name,\n                         compute_value=compute_value,\n                         sparse=self.sparse, **kwargs)\n        var.attributes = dict(self.attributes)\n        return var\n\n    def renamed(self, new_name):\n        # prevent cyclic import, pylint: disable=import-outside-toplevel\n        from Orange.preprocess.transformation import Identity\n        return self.copy(name=new_name, compute_value=Identity(variable=self))",
                            "ast_type_str": "ClassDef",
                            "start_lineno": 367,
                            "end_lineno": 377,
                            "parent": {
                                "file_name": "Orange/data/variable.py",
                                "type": "class",
                                "name": "Variable",
                                "content": "class Variable(Reprable, metaclass=VariableMeta):\n    \"\"\"\n    The base class for variable descriptors contains the variable's\n    name and some basic properties.\n\n    .. attribute:: name\n\n        The name of the variable.\n\n    .. attribute:: unknown_str\n\n        A set of values that represent unknowns in conversion from textual\n        formats. Default is `{\"?\", \".\", \"\", \"NA\", \"~\", None}`.\n\n    .. attribute:: compute_value\n\n        A function for computing the variable's value when converting from\n        another domain which does not contain this variable. The function will\n        be called with a data set (`Orange.data.Table`) and has to return\n        an array of computed values for all its instances. The base class\n        defines a static method `compute_value`, which returns `Unknown`.\n        Non-primitive variables must redefine it to return `None`.\n\n    .. attribute:: sparse\n\n        A flag about sparsity of the variable. When set, the variable suggests\n        it should be stored in a sparse matrix.\n\n    .. attribute:: source_variable\n\n        An optional descriptor of the source variable - if any - from which\n        this variable is derived and computed via :obj:`compute_value`.\n\n    .. attribute:: attributes\n\n        A dictionary with user-defined attributes of the variable\n    \"\"\"\n    Unknown = ValueUnknown\n\n    def __init__(self, name=\"\", compute_value=None, *, sparse=False):\n        \"\"\"\n        Construct a variable descriptor.\n        \"\"\"\n        if not name:\n            warnings.warn(\"Variable must have a name\", OrangeDeprecationWarning,\n                          stacklevel=3)\n        self._name = name\n        self._compute_value = compute_value\n        self.unknown_str = MISSING_VALUES\n        self.source_variable = None\n        self.sparse = sparse\n        self.attributes = {}\n\n    @property\n    def name(self):\n        return self._name\n\n    def make_proxy(self):\n        \"\"\"\n        Copy the variable and set the master to `self.master` or to `self`.\n\n        :return: copy of self\n        :rtype: Variable\n        \"\"\"\n        var = self.__class__(self.name)\n        var.__dict__.update(self.__dict__)\n        var.attributes = dict(self.attributes)\n        return var\n\n    def __eq__(self, other):\n        # pylint: disable=protected-access,import-outside-toplevel\n\n        def to_match(var):\n            if var._compute_value is None:\n                return var\n            elif isinstance(var._compute_value, Identity):\n                return var._compute_value.variable\n            return None\n\n        from Orange.preprocess.transformation import Identity\n        return type(self) is type(other) and (\n            self.name == other.name\n            and self._compute_value == other._compute_value\n            or\n            (self.compute_value or other.compute_value)\n            and to_match(self) == to_match(other) != None)\n\n    def __hash__(self):\n        # Two variables that are not equal can have the same hash.\n        # This happens if one has compute_value == Identity and the other\n        # doesn't have compute_value, or they have a different Identity.\n        # Having the same hash while not being equal is of course allowed.\n        # pylint: disable=import-outside-toplevel\n        from Orange.preprocess.transformation import Identity\n        compute_value = self._compute_value\n        if isinstance(self._compute_value, Identity):\n            compute_value = None\n        return hash((self.name, type(self), compute_value))\n\n    @classmethod\n    def make(cls, name, *args, **kwargs):\n        \"\"\"\n        Return an existing continuous variable with the given name, or\n        construct and return a new one.\n        \"\"\"\n        return cls(name, *args, **kwargs)\n\n    @classmethod\n    def _clear_cache(cls):\n        warnings.warn(\n            \"_clear_cache is no longer needed and thus deprecated\")\n\n    @staticmethod\n    def _clear_all_caches():\n        warnings.warn(\n            \"_clear_all_caches is no longer needed and thus deprecated\")\n\n    @classmethod\n    def is_primitive(cls, var=None):\n        \"\"\"\n        `True` if the variable's values are stored as floats.\n        Non-primitive variables can appear in the data only as meta attributes.\n        \"\"\"\n        to_check = cls if var is None else type(var)\n        return issubclass(to_check, (DiscreteVariable, ContinuousVariable))\n\n    @_predicatedescriptor\n    def is_discrete(self):\n        return isinstance(self, DiscreteVariable)\n\n    @_predicatedescriptor\n    def is_continuous(self):\n        return isinstance(self, ContinuousVariable)\n\n    @_predicatedescriptor\n    def is_string(self):\n        return isinstance(self, StringVariable)\n\n    @_predicatedescriptor\n    def is_time(self):\n        return isinstance(self, TimeVariable)\n\n    @staticmethod\n    def repr_val(val):\n        \"\"\"\n        Return a textual representation of variable's value `val`. Argument\n        `val` must be a float (for primitive variables) or an arbitrary\n        Python object (for non-primitives).\n\n        Derived classes must overload the function.\n        \"\"\"\n        raise RuntimeError(\"variable descriptors must overload repr_val()\")\n\n    str_val = repr_val\n\n    def to_val(self, s):\n        \"\"\"\n        Convert the given argument to a value of the variable. The\n        argument can be a string, a number or `None`. For primitive variables,\n        the base class provides a method that returns\n        :obj:`~Orange.data.Unknown` if `s` is found in\n        :obj:`~Orange.data.Variable.unknown_str`, and raises an exception\n        otherwise. For non-primitive variables it returns the argument itself.\n\n        Derived classes of primitive variables must overload the function.\n\n        :param s: value, represented as a number, string or `None`\n        :type s: str, float or None\n        :rtype: float or object\n        \"\"\"\n        if not self.is_primitive():\n            return s\n        if s in self.unknown_str:\n            return Unknown\n        raise RuntimeError(\n            \"primitive variable descriptors must overload to_val()\")\n\n    def val_from_str_add(self, s):\n        \"\"\"\n        Convert the given string to a value of the variable. The method\n        is similar to :obj:`to_val` except that it only accepts strings and\n        that it adds new values to the variable's domain where applicable.\n\n        The base class method calls `to_val`.\n\n        :param s: symbolic representation of the value\n        :type s: str\n        :rtype: float or object\n        \"\"\"\n        return self.to_val(s)\n\n    def __str__(self):\n        return self.name\n\n    @property\n    def compute_value(self):\n        return self._compute_value\n\n    def __reduce__(self):\n        if not self.name:\n            raise PickleError(\"Variables without names cannot be pickled\")\n\n        # Use make to unpickle variables.\n        return make_variable, (self.__class__, self._compute_value, self.name), self.__dict__\n\n    _CopyComputeValue = object()\n\n    def copy(self, compute_value=_CopyComputeValue, *, name=None, **kwargs):\n        if compute_value is self._CopyComputeValue:\n            compute_value = self.compute_value\n        var = type(self)(name=name or self.name,\n                         compute_value=compute_value,\n                         sparse=self.sparse, **kwargs)\n        var.attributes = dict(self.attributes)\n        return var\n\n    def renamed(self, new_name):\n        # prevent cyclic import, pylint: disable=import-outside-toplevel\n        from Orange.preprocess.transformation import Identity\n        return self.copy(name=new_name, compute_value=Identity(variable=self))",
                                "ast_type_str": "ClassDef",
                                "start_lineno": 280,
                                "end_lineno": 499,
                                "parent": null
                            }
                        }
                    ],
                    "added_entities": [
                        {
                            "file_name": "Orange/data/variable.py",
                            "type": "method",
                            "name": "Variable._get_identical_source",
                            "content": "class Variable(Reprable, metaclass=VariableMeta):\n    \"\"\"\n    The base class for variable descriptors contains the variable's\n    name and some basic properties.\n\n    .. attribute:: name\n\n        The name of the variable.\n\n    .. attribute:: unknown_str\n\n        A set of values that represent unknowns in conversion from textual\n        formats. Default is `{\"?\", \".\", \"\", \"NA\", \"~\", None}`.\n\n    .. attribute:: compute_value\n\n        A function for computing the variable's value when converting from\n        another domain which does not contain this variable. The function will\n        be called with a data set (`Orange.data.Table`) and has to return\n        an array of computed values for all its instances. The base class\n        defines a static method `compute_value`, which returns `Unknown`.\n        Non-primitive variables must redefine it to return `None`.\n\n    .. attribute:: sparse\n\n        A flag about sparsity of the variable. When set, the variable suggests\n        it should be stored in a sparse matrix.\n\n    .. attribute:: source_variable\n\n        An optional descriptor of the source variable - if any - from which\n        this variable is derived and computed via :obj:`compute_value`.\n\n    .. attribute:: attributes\n\n        A dictionary with user-defined attributes of the variable\n    \"\"\"\n    Unknown = ValueUnknown\n\n    def __init__(self, name=\"\", compute_value=None, *, sparse=False):\n        \"\"\"\n        Construct a variable descriptor.\n        \"\"\"\n        if not name:\n            warnings.warn(\"Variable must have a name\", OrangeDeprecationWarning,\n                          stacklevel=3)\n        self._name = name\n        self._compute_value = compute_value\n        self.unknown_str = MISSING_VALUES\n        self.source_variable = None\n        self.sparse = sparse\n        self.attributes = {}\n\n    @property\n    def name(self):\n        return self._name\n\n    def make_proxy(self):\n        \"\"\"\n        Copy the variable and set the master to `self.master` or to `self`.\n\n        :return: copy of self\n        :rtype: Variable\n        \"\"\"\n        var = self.__class__(self.name)\n        var.__dict__.update(self.__dict__)\n        var.attributes = dict(self.attributes)\n        return var\n\n    def __eq__(self, other):\n        if type(self) is not type(other):\n            return False\n\n        var1 = self._get_identical_source(self)\n        var2 = self._get_identical_source(other)\n        # pylint: disable=protected-access\n        return var1.name == var2.name \\\n               and var1._compute_value == var2._compute_value\n\n    def __hash__(self):\n        var = self._get_identical_source(self)\n        return hash((var.name, type(self), var._compute_value))\n\n    @staticmethod\n    def _get_identical_source(var):\n        # pylint: disable=protected-access,import-outside-toplevel\n        from Orange.preprocess.transformation import Identity\n        while isinstance(var._compute_value, Identity):\n            var = var._compute_value.variable\n        return var\n\n    @classmethod\n    def make(cls, name, *args, **kwargs):\n        \"\"\"\n        Return an existing continuous variable with the given name, or\n        construct and return a new one.\n        \"\"\"\n        return cls(name, *args, **kwargs)\n\n    @classmethod\n    def _clear_cache(cls):\n        warnings.warn(\n            \"_clear_cache is no longer needed and thus deprecated\")\n\n    @staticmethod\n    def _clear_all_caches():\n        warnings.warn(\n            \"_clear_all_caches is no longer needed and thus deprecated\")\n\n    @classmethod\n    def is_primitive(cls, var=None):\n        \"\"\"\n        `True` if the variable's values are stored as floats.\n        Non-primitive variables can appear in the data only as meta attributes.\n        \"\"\"\n        to_check = cls if var is None else type(var)\n        return issubclass(to_check, (DiscreteVariable, ContinuousVariable))\n\n    @_predicatedescriptor\n    def is_discrete(self):\n        return isinstance(self, DiscreteVariable)\n\n    @_predicatedescriptor\n    def is_continuous(self):\n        return isinstance(self, ContinuousVariable)\n\n    @_predicatedescriptor\n    def is_string(self):\n        return isinstance(self, StringVariable)\n\n    @_predicatedescriptor\n    def is_time(self):\n        return isinstance(self, TimeVariable)\n\n    @staticmethod\n    def repr_val(val):\n        \"\"\"\n        Return a textual representation of variable's value `val`. Argument\n        `val` must be a float (for primitive variables) or an arbitrary\n        Python object (for non-primitives).\n\n        Derived classes must overload the function.\n        \"\"\"\n        raise RuntimeError(\"variable descriptors must overload repr_val()\")\n\n    str_val = repr_val\n\n    def to_val(self, s):\n        \"\"\"\n        Convert the given argument to a value of the variable. The\n        argument can be a string, a number or `None`. For primitive variables,\n        the base class provides a method that returns\n        :obj:`~Orange.data.Unknown` if `s` is found in\n        :obj:`~Orange.data.Variable.unknown_str`, and raises an exception\n        otherwise. For non-primitive variables it returns the argument itself.\n\n        Derived classes of primitive variables must overload the function.\n\n        :param s: value, represented as a number, string or `None`\n        :type s: str, float or None\n        :rtype: float or object\n        \"\"\"\n        if not self.is_primitive():\n            return s\n        if s in self.unknown_str:\n            return Unknown\n        raise RuntimeError(\n            \"primitive variable descriptors must overload to_val()\")\n\n    def val_from_str_add(self, s):\n        \"\"\"\n        Convert the given string to a value of the variable. The method\n        is similar to :obj:`to_val` except that it only accepts strings and\n        that it adds new values to the variable's domain where applicable.\n\n        The base class method calls `to_val`.\n\n        :param s: symbolic representation of the value\n        :type s: str\n        :rtype: float or object\n        \"\"\"\n        return self.to_val(s)\n\n    def __str__(self):\n        return self.name\n\n    @property\n    def compute_value(self):\n        return self._compute_value\n\n    def __reduce__(self):\n        if not self.name:\n            raise PickleError(\"Variables without names cannot be pickled\")\n\n        # Use make to unpickle variables.\n        return make_variable, (self.__class__, self._compute_value, self.name), self.__dict__\n\n    _CopyComputeValue = object()\n\n    def copy(self, compute_value=_CopyComputeValue, *, name=None, **kwargs):\n        if compute_value is self._CopyComputeValue:\n            compute_value = self.compute_value\n        var = type(self)(name=name or self.name,\n                         compute_value=compute_value,\n                         sparse=self.sparse, **kwargs)\n        var.attributes = dict(self.attributes)\n        return var\n\n    def renamed(self, new_name):\n        # prevent cyclic import, pylint: disable=import-outside-toplevel\n        from Orange.preprocess.transformation import Identity\n        return self.copy(name=new_name, compute_value=Identity(variable=self))",
                            "ast_type_str": "ClassDef",
                            "start_lineno": 364,
                            "end_lineno": 369,
                            "parent": {
                                "file_name": "Orange/data/variable.py",
                                "type": "class",
                                "name": "Variable",
                                "content": "class Variable(Reprable, metaclass=VariableMeta):\n    \"\"\"\n    The base class for variable descriptors contains the variable's\n    name and some basic properties.\n\n    .. attribute:: name\n\n        The name of the variable.\n\n    .. attribute:: unknown_str\n\n        A set of values that represent unknowns in conversion from textual\n        formats. Default is `{\"?\", \".\", \"\", \"NA\", \"~\", None}`.\n\n    .. attribute:: compute_value\n\n        A function for computing the variable's value when converting from\n        another domain which does not contain this variable. The function will\n        be called with a data set (`Orange.data.Table`) and has to return\n        an array of computed values for all its instances. The base class\n        defines a static method `compute_value`, which returns `Unknown`.\n        Non-primitive variables must redefine it to return `None`.\n\n    .. attribute:: sparse\n\n        A flag about sparsity of the variable. When set, the variable suggests\n        it should be stored in a sparse matrix.\n\n    .. attribute:: source_variable\n\n        An optional descriptor of the source variable - if any - from which\n        this variable is derived and computed via :obj:`compute_value`.\n\n    .. attribute:: attributes\n\n        A dictionary with user-defined attributes of the variable\n    \"\"\"\n    Unknown = ValueUnknown\n\n    def __init__(self, name=\"\", compute_value=None, *, sparse=False):\n        \"\"\"\n        Construct a variable descriptor.\n        \"\"\"\n        if not name:\n            warnings.warn(\"Variable must have a name\", OrangeDeprecationWarning,\n                          stacklevel=3)\n        self._name = name\n        self._compute_value = compute_value\n        self.unknown_str = MISSING_VALUES\n        self.source_variable = None\n        self.sparse = sparse\n        self.attributes = {}\n\n    @property\n    def name(self):\n        return self._name\n\n    def make_proxy(self):\n        \"\"\"\n        Copy the variable and set the master to `self.master` or to `self`.\n\n        :return: copy of self\n        :rtype: Variable\n        \"\"\"\n        var = self.__class__(self.name)\n        var.__dict__.update(self.__dict__)\n        var.attributes = dict(self.attributes)\n        return var\n\n    def __eq__(self, other):\n        if type(self) is not type(other):\n            return False\n\n        var1 = self._get_identical_source(self)\n        var2 = self._get_identical_source(other)\n        # pylint: disable=protected-access\n        return var1.name == var2.name \\\n               and var1._compute_value == var2._compute_value\n\n    def __hash__(self):\n        var = self._get_identical_source(self)\n        return hash((var.name, type(self), var._compute_value))\n\n    @staticmethod\n    def _get_identical_source(var):\n        # pylint: disable=protected-access,import-outside-toplevel\n        from Orange.preprocess.transformation import Identity\n        while isinstance(var._compute_value, Identity):\n            var = var._compute_value.variable\n        return var\n\n    @classmethod\n    def make(cls, name, *args, **kwargs):\n        \"\"\"\n        Return an existing continuous variable with the given name, or\n        construct and return a new one.\n        \"\"\"\n        return cls(name, *args, **kwargs)\n\n    @classmethod\n    def _clear_cache(cls):\n        warnings.warn(\n            \"_clear_cache is no longer needed and thus deprecated\")\n\n    @staticmethod\n    def _clear_all_caches():\n        warnings.warn(\n            \"_clear_all_caches is no longer needed and thus deprecated\")\n\n    @classmethod\n    def is_primitive(cls, var=None):\n        \"\"\"\n        `True` if the variable's values are stored as floats.\n        Non-primitive variables can appear in the data only as meta attributes.\n        \"\"\"\n        to_check = cls if var is None else type(var)\n        return issubclass(to_check, (DiscreteVariable, ContinuousVariable))\n\n    @_predicatedescriptor\n    def is_discrete(self):\n        return isinstance(self, DiscreteVariable)\n\n    @_predicatedescriptor\n    def is_continuous(self):\n        return isinstance(self, ContinuousVariable)\n\n    @_predicatedescriptor\n    def is_string(self):\n        return isinstance(self, StringVariable)\n\n    @_predicatedescriptor\n    def is_time(self):\n        return isinstance(self, TimeVariable)\n\n    @staticmethod\n    def repr_val(val):\n        \"\"\"\n        Return a textual representation of variable's value `val`. Argument\n        `val` must be a float (for primitive variables) or an arbitrary\n        Python object (for non-primitives).\n\n        Derived classes must overload the function.\n        \"\"\"\n        raise RuntimeError(\"variable descriptors must overload repr_val()\")\n\n    str_val = repr_val\n\n    def to_val(self, s):\n        \"\"\"\n        Convert the given argument to a value of the variable. The\n        argument can be a string, a number or `None`. For primitive variables,\n        the base class provides a method that returns\n        :obj:`~Orange.data.Unknown` if `s` is found in\n        :obj:`~Orange.data.Variable.unknown_str`, and raises an exception\n        otherwise. For non-primitive variables it returns the argument itself.\n\n        Derived classes of primitive variables must overload the function.\n\n        :param s: value, represented as a number, string or `None`\n        :type s: str, float or None\n        :rtype: float or object\n        \"\"\"\n        if not self.is_primitive():\n            return s\n        if s in self.unknown_str:\n            return Unknown\n        raise RuntimeError(\n            \"primitive variable descriptors must overload to_val()\")\n\n    def val_from_str_add(self, s):\n        \"\"\"\n        Convert the given string to a value of the variable. The method\n        is similar to :obj:`to_val` except that it only accepts strings and\n        that it adds new values to the variable's domain where applicable.\n\n        The base class method calls `to_val`.\n\n        :param s: symbolic representation of the value\n        :type s: str\n        :rtype: float or object\n        \"\"\"\n        return self.to_val(s)\n\n    def __str__(self):\n        return self.name\n\n    @property\n    def compute_value(self):\n        return self._compute_value\n\n    def __reduce__(self):\n        if not self.name:\n            raise PickleError(\"Variables without names cannot be pickled\")\n\n        # Use make to unpickle variables.\n        return make_variable, (self.__class__, self._compute_value, self.name), self.__dict__\n\n    _CopyComputeValue = object()\n\n    def copy(self, compute_value=_CopyComputeValue, *, name=None, **kwargs):\n        if compute_value is self._CopyComputeValue:\n            compute_value = self.compute_value\n        var = type(self)(name=name or self.name,\n                         compute_value=compute_value,\n                         sparse=self.sparse, **kwargs)\n        var.attributes = dict(self.attributes)\n        return var\n\n    def renamed(self, new_name):\n        # prevent cyclic import, pylint: disable=import-outside-toplevel\n        from Orange.preprocess.transformation import Identity\n        return self.copy(name=new_name, compute_value=Identity(variable=self))",
                                "ast_type_str": "ClassDef",
                                "start_lineno": 280,
                                "end_lineno": 491,
                                "parent": null
                            }
                        }
                    ],
                    "deleted_entities": []
                }
            ]
        }
    ],
    "old_commit_hash": "6061f2da1073d58ddc0fc946daba26030d9f0e2f^",
    "new_commit_hash": "6061f2da1073d58ddc0fc946daba26030d9f0e2f",
    "commit_message": "Merge pull request #4843 from janezd/variable-fix-hash\n\n[FIX] Variable: Fix cases when equal variables had different hashes",
    "commit_date": "2020-06-09T10:53:38+02:00",
    "metadata": {}
}
{
    "repo_name": "orange3",
    "new_commit_hash": "6061f2da1073d58ddc0fc946daba26030d9f0e2f",
    "test_file_codes": [
        "# Test methods with long descriptive names can omit docstrings\n# pylint: disable=missing-docstring\n# pylint: disable=protected-access\n\nimport sys\nimport math\nimport unittest\nimport pickle\nimport pkgutil\nfrom datetime import datetime, timezone\nfrom distutils.version import LooseVersion\n\nfrom io import StringIO\n\nimport numpy as np\nimport scipy.sparse as sp\n\nimport Orange\nfrom Orange.data import Variable, ContinuousVariable, DiscreteVariable, \\\n    StringVariable, TimeVariable, Unknown, Value\nfrom Orange.data.io import CSVReader\nfrom Orange.preprocess.transformation import Identity\nfrom Orange.tests.base import create_pickling_tests\nfrom Orange.util import OrangeDeprecationWarning\n\n\ndef is_on_path(name):\n    \"\"\"\n    Is a top level package/module found on sys.path\n\n    Parameters\n    ----------\n    name : str\n        Top level module/package name\n\n    Returns\n    -------\n    found : bool\n    \"\"\"\n    for _, name_, _ in pkgutil.iter_modules(sys.path):\n        if name == name_:\n            return True\n    return False\n\n\n# noinspection PyPep8Naming,PyUnresolvedReferences\nclass VariableTest:\n    def test_dont_pickle_anonymous_variables(self):\n        with self.assertWarns(OrangeDeprecationWarning):\n            self.assertRaises(pickle.PickleError, pickle.dumps, self.varcls())\n\n    def test_dont_make_anonymous_variables(self):\n        self.assertWarns(OrangeDeprecationWarning, self.varcls.make, \"\")\n\n    def test_copy_copies_attributes(self):\n        var = self.varcls(\"x\")\n        var.attributes[\"a\"] = \"b\"\n        var2 = var.copy(compute_value=None)\n        self.assertIn(\"a\", var2.attributes)\n        self.assertIsInstance(var2, type(var))\n\n        var2.attributes[\"a\"] = \"c\"\n        # Attributes of original value should not change\n        self.assertEqual(var.attributes[\"a\"], \"b\")\n\n    def test_rename(self):\n        var = self.varcls_modified(\"x\")\n        var2 = var.copy(name=\"x2\")\n        self.assertIsInstance(var2, type(var))\n        self.assertIsNot(var, var2)\n        self.assertEqual(var2.name, \"x2\")\n        var.__dict__.pop(\"_name\")\n        var2.__dict__.pop(\"_name\")\n        self.assertDictEqual(var.__dict__, var2.__dict__)\n\n    def varcls_modified(self, name):\n        var = self.varcls(name)\n        var._compute_value = lambda x: x\n        var.sparse = True\n        var.attributes = {\"a\": 1}\n        return var\n\n\nclass TestVariable(unittest.TestCase):\n    @classmethod\n    def setUpClass(cls):\n        cls.var = Variable(\"x\")\n\n    def test_name(self):\n        self.assertEqual(repr(self.var), \"Variable(name='x')\")\n\n    def test_to_val(self):\n        string_var = StringVariable(\"x\")\n        self.assertEqual(string_var.to_val(\"foo\"), \"foo\")\n        self.assertEqual(string_var.to_val(42), \"42\")\n\n        cont_var = ContinuousVariable(\"x\")\n        self.assertTrue(math.isnan(cont_var.to_val(\"?\")))\n        self.assertTrue(math.isnan(Unknown))\n\n        var = Variable(\"x\")\n        self.assertEqual(var.to_val(\"x\"), \"x\")\n\n    def test_repr_is_abstract(self):\n        self.assertRaises(RuntimeError, self.var.repr_val, None)\n\n    def test_properties(self):\n        a = ContinuousVariable(\"y\")\n        self.assertTrue(a.is_continuous)\n        self.assertFalse(a.is_discrete)\n        self.assertFalse(a.is_string)\n        self.assertTrue(a.is_primitive())\n\n        a = DiscreteVariable(\"d\")\n        self.assertFalse(a.is_continuous)\n        self.assertTrue(a.is_discrete)\n        self.assertFalse(a.is_string)\n        self.assertTrue(a.is_primitive())\n\n        a = StringVariable(\"s\")\n        self.assertFalse(a.is_continuous)\n        self.assertFalse(a.is_discrete)\n        self.assertTrue(a.is_string)\n        self.assertFalse(a.is_primitive())\n\n    def test_properties_as_predicates(self):\n        a = ContinuousVariable(\"y\")\n        self.assertTrue(Variable.is_continuous(a))\n        self.assertFalse(Variable.is_discrete(a))\n        self.assertFalse(Variable.is_string(a))\n        self.assertTrue(Variable.is_primitive(a))\n\n        a = StringVariable(\"s\")\n        self.assertFalse(Variable.is_continuous(a))\n        self.assertFalse(Variable.is_discrete(a))\n        self.assertTrue(Variable.is_string(a))\n        self.assertFalse(Variable.is_primitive(a))\n\n    def test_strange_eq(self):\n        a = ContinuousVariable(\"a\")\n        b = ContinuousVariable(\"a\")\n        self.assertEqual(a, a)\n        self.assertEqual(a, b)\n        self.assertIsNot(a, b)\n        self.assertNotEqual(a, \"somestring\")\n        self.assertEqual(hash(a), hash(b))\n\n    def test_eq_with_compute_value(self):\n        a = ContinuousVariable(\"a\")\n        b = ContinuousVariable(\"a\")\n        self.assertEqual(a, a)\n        self.assertEqual(a, b)\n        self.assertIsNot(a, b)\n\n        a._compute_value = lambda x: x\n        self.assertEqual(a, a)\n        self.assertNotEqual(a, b)\n\n        a1 = ContinuousVariable(\"a\")\n        a2 = ContinuousVariable(\"a\")\n        c = ContinuousVariable(\"c\")\n\n        a._compute_value = Identity(a1)\n        self.assertEqual(a, a)\n        self.assertEqual(a, b)\n        self.assertEqual(hash(a), hash(b))\n\n        b._compute_value = a.compute_value\n        self.assertEqual(a, b)\n\n        b._compute_value = Identity(a1)\n        self.assertEqual(a, b)\n\n        b._compute_value = Identity(a2)\n        self.assertEqual(a, b)\n\n        b._compute_value = Identity(c)\n        self.assertNotEqual(a, b)\n\n        b._compute_value = Identity(a2)\n        a1._compute_value = lambda x: x\n        self.assertNotEqual(a, b)\n\n        a1._compute_value = Identity(c)\n        self.assertNotEqual(a, b)\n\n        a2._compute_value = Identity(c)\n        self.assertEqual(a, b)\n\n    def test_hash(self):\n        a = ContinuousVariable(\"a\")\n        b = ContinuousVariable(\"a\")\n        self.assertEqual(hash(a), hash(b))\n\n        a._compute_value = lambda x: x\n        self.assertNotEqual(hash(a), hash(b))\n\n        b._compute_value = lambda x: x\n        self.assertNotEqual(hash(a), hash(b))\n\n        a1 = ContinuousVariable(\"a\")\n        a2 = ContinuousVariable(\"a\")\n\n        a._compute_value = Identity(a1)\n        self.assertNotEqual(hash(a), hash(b))\n\n        b._compute_value = Identity(a2)\n        self.assertEqual(hash(a), hash(b))\n\n        at = TimeVariable(\"a\")\n        b = ContinuousVariable(\"b\")\n        self.assertEqual(hash(a1), hash(a2))\n        self.assertNotEqual(hash(a1), hash(b))\n        self.assertNotEqual(hash(a1), hash(at))\n\n    def test_hash_eq(self):\n        a = ContinuousVariable(\"a\")\n        b1 = ContinuousVariable(\"b\", compute_value=Identity(a))\n        b2 = ContinuousVariable(\"b2\", compute_value=Identity(b1))\n        b3 = ContinuousVariable(\"b\")\n        self.assertEqual(a, b2)\n        self.assertEqual(b1, b2)\n        self.assertEqual(a, b1)\n        self.assertNotEqual(b1, b3)\n\n        self.assertEqual(hash(a), hash(b2))\n        self.assertEqual(hash(b1), hash(b2))\n        self.assertEqual(hash(a), hash(b1))\n        self.assertNotEqual(hash(b1), hash(b3))\n\n\ndef variabletest(varcls):\n    def decorate(cls):\n        return type(cls.__name__, (cls, unittest.TestCase), {'varcls': varcls})\n    return decorate\n\n\n@variabletest(DiscreteVariable)\nclass TestDiscreteVariable(VariableTest):\n    def test_to_val(self):\n        values = [\"F\", \"M\"]\n        var = DiscreteVariable(name=\"Feature 0\", values=values)\n\n        self.assertEqual(var.to_val(0), 0)\n        self.assertEqual(var.to_val(\"F\"), 0)\n        self.assertEqual(var.to_val(0.), 0)\n        self.assertTrue(math.isnan(var.to_val(\"?\")))\n\n        # TODO: with self.assertRaises(ValueError): var.to_val(2)\n        with self.assertRaises(ValueError):\n            var.to_val(\"G\")\n\n    def test_make(self):\n        var = DiscreteVariable.make(\"a\", values=(\"F\", \"M\"))\n        self.assertIsInstance(var, DiscreteVariable)\n        self.assertEqual(var.name, \"a\")\n        self.assertEqual(var.values, (\"F\", \"M\"))\n\n    def test_val_from_str(self):\n        var = DiscreteVariable.make(\"a\", values=(\"F\", \"M\"))\n        self.assertTrue(math.isnan(var.to_val(None)))\n        self.assertEqual(var.to_val(1), 1)\n\n    def test_val_from_str_add(self):\n        var = DiscreteVariable.make(\"a\", values=(\"F\", \"M\"))\n        self.assertTrue(math.isnan(var.val_from_str_add(None)))\n        self.assertEqual(var.val_from_str_add(\"M\"), 1)\n        self.assertEqual(var.val_from_str_add(\"F\"), 0)\n        self.assertEqual(var.values, (\"F\", \"M\"))\n        self.assertEqual(var.val_from_str_add(\"N\"), 2)\n        self.assertEqual(var.values, (\"F\", \"M\", \"N\"))\n        self.assertEqual(var._value_index, {\"F\": 0, \"M\": 1, \"N\": 2})\n        self.assertEqual(var.val_from_str_add(\"M\"), 1)\n        self.assertEqual(var.val_from_str_add(\"F\"), 0)\n        self.assertEqual(var.val_from_str_add(\"N\"), 2)\n\n    def test_repr(self):\n        var = DiscreteVariable.make(\"a\", values=(\"F\", \"M\"))\n        self.assertEqual(\n            repr(var),\n            \"DiscreteVariable(name='a', values=('F', 'M'))\")\n        var.ordered = True\n        self.assertEqual(\n            repr(var),\n            \"DiscreteVariable(name='a', values=('F', 'M'), ordered=True)\")\n\n        var = DiscreteVariable.make(\"a\", values=\"1234567\")\n        self.assertEqual(\n            repr(var),\n            \"DiscreteVariable(name='a', values=('1', '2', '3', '4', '5', '6', '7'))\")\n\n    def test_no_nonstringvalues(self):\n        self.assertRaises(TypeError, DiscreteVariable, \"foo\", values=(\"a\", 42))\n        a = DiscreteVariable(\"foo\", values=(\"a\", \"b\", \"c\"))\n        self.assertRaises(TypeError, a.add_value, 42)\n\n    def test_no_duplicated_values(self):\n        a = DiscreteVariable(\"foo\", values=[\"a\", \"b\", \"c\"])\n        a.add_value(\"b\")\n        self.assertEqual(list(a.values), [\"a\", \"b\", \"c\"])\n        self.assertEqual(list(a._value_index), [\"a\", \"b\", \"c\"])\n\n    def test_tuple_list_warning(self):\n        if LooseVersion(Orange.version.short_version) >= LooseVersion(\"3.27\"):\n            self.fail(\"Remove class TupleList; replace it with tuple.\")\n\n        d1 = DiscreteVariable(\"A\", values=(\"one\", \"two\"))\n        with self.assertWarns(DeprecationWarning):\n            val = d1.values + [\"three\", ]\n        self.assertEqual(val, [\"one\", \"two\", \"three\"])\n        with self.assertWarns(DeprecationWarning):\n            val = d1.values.copy()\n        self.assertIsInstance(val, list)\n        self.assertSequenceEqual(val, d1.values)\n\n    def test_unpickle(self):\n        d1 = DiscreteVariable(\"A\", values=(\"two\", \"one\"))\n        s = pickle.dumps(d1)\n        d2 = DiscreteVariable.make(\"A\", values=(\"one\", \"two\", \"three\"))\n        d2_values = tuple(d2.values)\n        d1c = pickle.loads(s)\n        # See: gh-3238\n        # The unpickle reconstruction picks an existing variable (d2), on which\n        # __setstate__ or __dict__.update is called\n        self.assertSequenceEqual(d2.values, d2_values)\n        self.assertSequenceEqual(d1c.values, d1.values)\n        s = pickle.dumps(d2)\n        d1 = DiscreteVariable(\"A\", values=(\"one\", \"two\"))\n        d2 = pickle.loads(s)\n        self.assertSequenceEqual(d2.values, (\"one\", \"two\", \"three\"))\n        self.assertSequenceEqual(d1.values, (\"one\", \"two\"))\n\n    def test_mapper_dense(self):\n        abc = DiscreteVariable(\"a\", values=tuple(\"abc\"))\n        dca = DiscreteVariable(\"a\", values=tuple(\"dca\"))\n        mapper = dca.get_mapper_from(abc)\n\n        self.assertEqual(mapper(0), 2)\n        self.assertTrue(np.isnan(mapper(1)))\n        self.assertEqual(mapper(2), 1)\n\n        self.assertEqual(mapper(0.), 2)\n        self.assertTrue(np.isnan(mapper(1.)))\n        self.assertEqual(mapper(2.), 1)\n        self.assertTrue(np.isnan(mapper(np.nan)))\n\n        self.assertEqual(mapper(\"a\"), 2)\n        self.assertTrue(np.isnan(mapper(\"b\")))\n        self.assertEqual(mapper(\"c\"), 1)\n\n        arr = np.array([0, 0, 2, 1, 0, 1, np.nan])\n        self.assertIsNot(mapper(arr), arr)\n        np.testing.assert_array_equal(\n            mapper(arr), np.array([2, 2, 1, np.nan, 2, np.nan, np.nan]))\n        # dtype=int can have no nans; isnan shouldn't crash the mapper\n\n        arr_int = arr[:-1].astype(int)\n        self.assertIsNot(mapper(arr_int), arr_int)\n        np.testing.assert_array_equal(\n            mapper(arr_int), np.array([2, 2, 1, np.nan, 2, np.nan]))\n\n        arr_obj = arr.astype(object)\n        self.assertIsNot(mapper(arr_obj), arr_obj)\n        np.testing.assert_array_equal(\n            mapper(arr_obj), np.array([2, 2, 1, np.nan, 2, np.nan, np.nan]))\n\n        arr_list = list(arr)\n        self.assertIsNot(mapper(arr_list), arr_list)\n        self.assertTrue(\n            all(x == y or (np.isnan(x) and np.isnan(y))\n                for x, y in zip(mapper(arr_list),\n                                [2, 2, 1, np.nan, 2, np.nan, np.nan])))\n\n        self.assertTrue(\n            x == y or (np.isnan(x) and np.isnan(y))\n            for x, y in zip(mapper(tuple(arr)),\n                            (2, 2, 1, np.nan, 2, np.nan, np.nan)))\n\n        self.assertRaises(ValueError, mapper, object())\n\n    def test_mapper_sparse(self):\n        abc = DiscreteVariable(\"a\", values=tuple(\"abc\"))\n        dca = DiscreteVariable(\"a\", values=tuple(\"dca\"))\n        mapper = dca.get_mapper_from(abc)\n\n        arr = np.array([0, 0, 2, 1, 0, 1, np.nan])\n\n        # 0 does map to 0 -> convert to dense\n        marr = mapper(sp.csr_matrix(arr))\n        self.assertIsInstance(marr, np.ndarray)\n        np.testing.assert_array_equal(\n            marr,\n            np.array([2, 2, 1, np.nan, 2, np.nan, np.nan]))\n\n        marr = mapper(sp.csr_matrix(arr))\n        self.assertIsInstance(marr, np.ndarray)\n        np.testing.assert_array_equal(\n            marr,\n            np.array([2, 2, 1, np.nan, 2, np.nan, np.nan]))\n\n        # 0 maps to 0 -> keep sparse\n        acd = DiscreteVariable(\"a\", values=tuple(\"acd\"))\n        mapper = acd.get_mapper_from(abc)\n\n        arr_csr = sp.csr_matrix(arr)\n        marr = mapper(arr_csr)\n        self.assertIsNot(arr_csr, marr)\n        self.assertTrue(sp.isspmatrix_csr(marr))\n        np.testing.assert_array_equal(\n            marr.todense(),\n            np.array([[0, 0, 1, np.nan, 0, np.nan, np.nan]]))\n\n        arr_csc = sp.csc_matrix(arr)\n        marr = mapper(arr_csc)\n        self.assertIsNot(arr_csc, marr)\n        self.assertTrue(sp.isspmatrix_csc(marr))\n        np.testing.assert_array_equal(\n            marr.todense(),\n            np.array([[0, 0, 1, np.nan, 0, np.nan, np.nan]]))\n\n    def test_mapper_inplace(self):\n        s = list(range(7))\n        abc = DiscreteVariable(\"a\", values=tuple(\"abc\"))\n        dca = DiscreteVariable(\"a\", values=tuple(\"dca\"))\n        mapper = dca.get_mapper_from(abc)\n\n        arr = np.array([[0, 0, 2, 1, 0, 1, np.nan], s]).T\n        mapper(arr, 0)\n        np.testing.assert_array_equal(\n            arr, np.array([[2, 2, 1, np.nan, 2, np.nan, np.nan], s]).T)\n\n        self.assertRaises(ValueError, mapper, sp.csr_matrix(arr), 0)\n        self.assertRaises(ValueError, mapper, [1, 2, 3], 0)\n        self.assertRaises(ValueError, mapper, 1, 0)\n\n        acd = DiscreteVariable(\"a\", values=tuple(\"acd\"))\n        mapper = acd.get_mapper_from(abc)\n\n        arr = np.array([[0, 0, 2, 1, 0, 1, np.nan], s]).T\n        mapper(arr, 0)\n        np.testing.assert_array_equal(\n            arr, np.array([[0, 0, 1, np.nan, 0, np.nan, np.nan], s]).T)\n\n        arr = sp.csr_matrix(np.array([[0, 0, 2, 1, 0, 1, np.nan], s]).T)\n        mapper(arr, 0)\n        np.testing.assert_array_equal(\n            arr.todense(),\n            np.array([[0, 0, 1, np.nan, 0, np.nan, np.nan], s]).T)\n\n        arr = sp.csc_matrix(np.array([[0, 0, 2, 1, 0, 1, np.nan], s]).T)\n        mapper(arr, 0)\n        np.testing.assert_array_equal(\n            arr.todense(),\n            np.array([[0, 0, 1, np.nan, 0, np.nan, np.nan], s]).T)\n\n    def test_mapper_dim_check(self):\n        abc = DiscreteVariable(\"a\", values=tuple(\"abc\"))\n        dca = DiscreteVariable(\"a\", values=tuple(\"dca\"))\n        mapper = dca.get_mapper_from(abc)\n\n        self.assertRaises(ValueError, mapper, np.zeros((7, 2)))\n        self.assertRaises(ValueError, mapper, sp.csr_matrix(np.zeros((7, 2))))\n        self.assertRaises(ValueError, mapper, sp.csc_matrix(np.zeros((7, 2))))\n\n    def test_mapper_from_no_values(self):\n        abc = DiscreteVariable(\"a\", values=())\n        dca = DiscreteVariable(\"a\", values=tuple(\"dca\"))\n        mapper = dca.get_mapper_from(abc)\n\n        arr = np.full(7, np.nan)\n        self.assertIsNot(mapper(arr), arr)\n        np.testing.assert_array_equal(mapper(arr), arr)\n\n        arr_csr = sp.csr_matrix(arr)\n        self.assertIsNot(arr_csr, mapper(arr_csr))\n        np.testing.assert_array_equal(\n            mapper(arr_csr).todense(), np.atleast_2d(arr))\n\n        arr_csc = sp.csc_matrix(arr)\n        self.assertIsNot(arr_csc, mapper(arr_csc))\n        np.testing.assert_array_equal(\n            mapper(arr_csc).todense(), np.atleast_2d(arr))\n\n        self.assertRaises(ValueError, mapper, sp.csr_matrix(arr), 0)\n        self.assertRaises(ValueError, mapper, sp.csc_matrix(arr), 0)\n\n    def varcls_modified(self, name):\n        var = super().varcls_modified(name)\n        var.add_value(\"A\")\n        var.add_value(\"B\")\n        var.ordered = True\n        return var\n\n    def test_copy_checks_len_values(self):\n        var = DiscreteVariable(\"gender\", values=(\"F\", \"M\"))\n        self.assertEqual(var.values, (\"F\", \"M\"))\n\n        self.assertRaises(ValueError, var.copy, values=(\"F\", \"M\", \"N\"))\n        self.assertRaises(ValueError, var.copy, values=(\"F\",))\n        self.assertRaises(ValueError, var.copy, values=())\n\n        var2 = var.copy()\n        self.assertEqual(var2.values, (\"F\", \"M\"))\n\n        var2 = var.copy(values=None)\n        self.assertEqual(var2.values, (\"F\", \"M\"))\n\n        var2 = var.copy(values=(\"W\", \"M\"))\n        self.assertEqual(var2.values, (\"W\", \"M\"))\n\n\n@variabletest(ContinuousVariable)\nclass TestContinuousVariable(VariableTest):\n    def test_make(self):\n        age1 = ContinuousVariable.make(\"age\")\n        age2 = ContinuousVariable.make(\"age\")\n        self.assertEqual(age1, age2)\n        self.assertIsNot(age1, age2)\n\n    def test_decimals(self):\n        a = ContinuousVariable(\"a\", 4)\n        self.assertEqual(a.str_val(4.6543), \"4.6543\")\n        self.assertEqual(a.str_val(4.25), \"4.2500\")\n        self.assertEqual(a.str_val(Unknown), \"?\")\n        a = ContinuousVariable(\"a\", 5)\n        self.assertEqual(a.str_val(0.000000000001), \"0.00000\")\n        a = ContinuousVariable(\"a\", 10)\n        self.assertEqual(a.str_val(0.000000000001), \"1e-12\")\n\n    def test_more_decimals(self):\n        a = ContinuousVariable(\"a\", 0)\n        self.assertEqual(a.str_val(4), \"4\")\n        self.assertEqual(a.str_val(4.1234), \"4.12\")\n\n        a = ContinuousVariable(\"a\", 2)\n        self.assertEqual(a.str_val(4), \"4.00\")\n        self.assertEqual(a.str_val(4.25), \"4.25\")\n        self.assertEqual(a.str_val(4.1234123), \"4.1234\")\n\n        for cca4 in (4 + 1e-9, 4 - 1e-9):\n            assert cca4 != 4\n            self.assertEqual(a.str_val(cca4), \"4.00\")\n\n    def test_adjust_decimals(self):\n        # Default is 3 decimals, but format is %g\n        a = ContinuousVariable(\"a\")\n        self.assertEqual(a.str_val(5), \"5\")\n        self.assertEqual(a.str_val(4.65432), \"4.65432\")\n\n        # Change to no decimals\n        a.val_from_str_add(\"5\")\n        self.assertEqual(a.str_val(5), \"5\")\n\n        # Change to two decimals\n        a.val_from_str_add(\"  5.12    \")\n        self.assertEqual(a.str_val(4.65), \"4.65\")\n        self.assertEqual(a.str_val(5), \"5.00\")\n\n    def varcls_modified(self, name):\n        var = super().varcls_modified(name)\n        var.number_of_decimals = 5\n        return var\n\n\n@variabletest(StringVariable)\nclass TestStringVariable(VariableTest):\n    def test_val(self):\n        a = StringVariable(\"a\")\n        self.assertEqual(a.to_val(None), \"\")\n        self.assertEqual(a.str_val(\"\"), \"?\")\n        self.assertEqual(a.str_val(Value(a, \"\")), \"?\")\n        self.assertEqual(a.repr_val(Value(a, \"foo\")), '\"foo\"')\n\n\n@variabletest(TimeVariable)\nclass TestTimeVariable(VariableTest):\n    TESTS = [\n        # in str, UTC timestamp, out str (in UTC)\n        ('2015-10-12 14:13:11.01+0200', 1444651991.01, '2015-10-12 14:13:11.010000+0200'),\n        ('2015-10-12T14:13:11.81+0200', 1444651991.81, '2015-10-12 14:13:11.810000+0200'),\n        ('2015-10-12 14:13:11.81', 1444659191.81, '2015-10-12 14:13:11.810000'),\n        ('2015-10-12T14:13:11.81', 1444659191.81, '2015-10-12 14:13:11.810000'),\n        ('2015-10-12 14:13:11+0200', 1444651991, '2015-10-12 14:13:11+0200'),\n        ('2015-10-12T14:13:11+0200', 1444651991, '2015-10-12 14:13:11+0200'),\n        ('20151012T141311+0200', 1444651991, '2015-10-12 14:13:11+0200'),\n        ('20151012141311+0200', 1444651991, '2015-10-12 14:13:11+0200'),\n        ('2015-10-12 14:13:11', 1444659191, '2015-10-12 14:13:11'),\n        ('2015-10-12T14:13:11', 1444659191, '2015-10-12 14:13:11'),\n        ('2015-10-12 14:13', 1444659180, '2015-10-12 14:13:00'),\n        ('20151012T141311', 1444659191, '2015-10-12 14:13:11'),\n        ('20151012141311', 1444659191, '2015-10-12 14:13:11'),\n        ('2015-10-12', 1444608000, '2015-10-12'),\n        ('20151012', 1444608000, '2015-10-12'),\n        ('2015-285', 1444608000, '2015-10-12'),\n        ('2015-10', 1443657600, '2015-10-01'),\n        ('2015', 1420070400, '2015-01-01'),\n        ('01:01:01.01', 3661.01, '01:01:01.010000'),\n        ('010101.01', 3661.01, '01:01:01.010000'),\n        ('01:01:01', 3661, '01:01:01'),\n        ('01:01', 3660, '01:01:00'),\n        ('1970-01-01 00:00:00', 0, '1970-01-01 00:00:00'),\n        ('1969-12-31 23:59:59', -1, '1969-12-31 23:59:59'),\n        ('1969-12-31 23:59:58.9', -1.1, '1969-12-31 23:59:58.900000'),\n        ('1900-01-01', -2208988800, '1900-01-01'),\n        ('nan', np.nan, '?'),\n        ('1444651991.81', 1444651991.81, '2015-10-12 12:13:11.810000'),\n    ]\n\n    def test_parse_repr(self):\n        for datestr, timestamp, outstr in self.TESTS:\n            var = TimeVariable('time')\n            ts = var.to_val(datestr)  # calls parse for strings\n            if not np.isnan(ts):\n                self.assertEqual(ts, timestamp, msg=datestr)\n            self.assertEqual(var.repr_val(ts), outstr, msg=datestr)\n\n    def test_parse_utc(self):\n        var = TimeVariable('time')\n        datestr, offset = '2015-10-18 22:48:20', '+0200'\n        ts1 = var.parse(datestr + offset)\n        self.assertEqual(var.repr_val(ts1), datestr + offset)\n        # Once a value is without a TZ, all the values lose it\n        ts2 = var.parse(datestr)\n        self.assertEqual(var.repr_val(ts2), datestr)\n        self.assertEqual(var.repr_val(ts1), '2015-10-18 20:48:20')\n\n    def test_parse_timestamp(self):\n        var = TimeVariable(\"time\")\n        datestr = str(datetime(2016, 6, 14, 23, 8, tzinfo=timezone.utc).timestamp())\n        ts1 = var.parse(datestr)\n        self.assertEqual(var.repr_val(ts1), '2016-06-14 23:08:00')\n\n    def test_parse_invalid(self):\n        var = TimeVariable('var')\n        with self.assertRaises(ValueError):\n            var.parse('123')\n\n    def test_have_date(self):\n        var = TimeVariable('time')\n        ts = var.parse('1937-08-02')  # parse date\n        self.assertEqual(var.repr_val(ts), '1937-08-02')\n        ts = var.parse('16:20')  # parse time\n        # observe have datetime\n        self.assertEqual(var.repr_val(ts), '1970-01-01 16:20:00')\n\n    def test_no_date_no_time(self):\n        self.assertEqual(TimeVariable('relative time').repr_val(1.6), '1.6')\n\n    def test_readwrite_timevariable(self):\n        output_csv = StringIO()\n        input_csv = StringIO(\"\"\"\\\nDate,Feature\ntime,continuous\n,\n1920-12-12,1.0\n1920-12-13,3.0\n1920-12-14,5.5\n\"\"\")\n        for stream in (output_csv, input_csv):\n            stream.close = lambda: None  # HACK: Prevent closing of streams\n\n        table = CSVReader(input_csv).read()\n        self.assertIsInstance(table.domain['Date'], TimeVariable)\n        self.assertEqual(table[0, 'Date'], '1920-12-12')\n        # Dates before 1970 are negative\n        self.assertTrue(all(inst['Date'] < 0 for inst in table))\n\n        CSVReader.write_file(output_csv, table)\n        self.assertEqual(input_csv.getvalue().splitlines(),\n                         output_csv.getvalue().splitlines())\n\n    def test_repr_value(self):\n        # https://github.com/biolab/orange3/pull/1760\n        var = TimeVariable('time')\n        self.assertEqual(var.repr_val(Value(var, 416.3)), '416.3')\n\n    def test_have_date_have_time_in_construct(self):\n        \"\"\"Test if have_time and have_date is correctly set\"\"\"\n        var = TimeVariable('time', have_date=1)\n        self.assertTrue(var.have_date)\n        self.assertFalse(var.have_time)\n\n    def varcls_modified(self, name):\n        var = super().varcls_modified(name)\n        var.number_of_decimals = 5\n        var.have_date = 1\n        var.have_time = 1\n        return var\n\n\nPickleContinuousVariable = create_pickling_tests(\n    \"PickleContinuousVariable\",\n    (\"with_name\", lambda: ContinuousVariable(name=\"Feature 0\")),\n)\n\nPickleDiscreteVariable = create_pickling_tests(\n    \"PickleDiscreteVariable\",\n    (\"with_name\", lambda: DiscreteVariable(name=\"Feature 0\")),\n    (\"with_str_value\", lambda: DiscreteVariable(name=\"Feature 0\",\n                                                values=(\"F\", \"M\"))),\n    (\"ordered\", lambda: DiscreteVariable(name=\"Feature 0\",\n                                         values=(\"F\", \"M\"),\n                                         ordered=True)),\n)\n\n\nPickleStringVariable = create_pickling_tests(\n    \"PickleStringVariable\",\n    (\"with_name\", lambda: StringVariable(name=\"Feature 0\"))\n)\n\n\nclass VariableTestMakeProxy(unittest.TestCase):\n    def test_make_proxy_disc(self):\n        abc = DiscreteVariable(\"abc\", values=\"abc\", ordered=True)\n        abc1 = abc.make_proxy()\n        abc2 = abc1.make_proxy()\n        self.assertEqual(abc, abc1)\n        self.assertEqual(abc, abc2)\n        self.assertEqual(abc1, abc2)\n        self.assertEqual(hash(abc), hash(abc1))\n        self.assertEqual(hash(abc1), hash(abc2))\n\n        abcx = DiscreteVariable(\"abc\", values=\"abc\", ordered=True)\n        self.assertEqual(abc, abcx)\n        self.assertIsNot(abc, abcx)\n\n        abc1p = pickle.loads(pickle.dumps(abc1))\n        self.assertEqual(abc1p, abc)\n\n        abcp, abc1p, abc2p = pickle.loads(pickle.dumps((abc, abc1, abc2)))\n        self.assertEqual(abcp, abc1p)\n        self.assertEqual(abcp, abc2p)\n        self.assertEqual(abc1p, abc2p)\n\n    def test_make_proxy_cont(self):\n        abc = ContinuousVariable(\"abc\")\n        abc1 = abc.make_proxy()\n        abc2 = abc1.make_proxy()\n        self.assertEqual(abc, abc1)\n        self.assertEqual(abc, abc2)\n        self.assertEqual(abc1, abc2)\n        self.assertEqual(hash(abc), hash(abc1))\n        self.assertEqual(hash(abc1), hash(abc2))\n\n    def test_proxy_has_separate_attributes(self):\n        image = StringVariable(\"image\")\n        image1 = image.make_proxy()\n        image2 = image1.make_proxy()\n\n        image.attributes[\"origin\"] = \"a\"\n        image1.attributes[\"origin\"] = \"b\"\n        image2.attributes[\"origin\"] = \"c\"\n\n        self.assertEqual(image.attributes[\"origin\"], \"a\")\n        self.assertEqual(image1.attributes[\"origin\"], \"b\")\n        self.assertEqual(image2.attributes[\"origin\"], \"c\")\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\nrunning build_src\nbuild_src\nbuilding extension \"Orange.classification._simple_tree\" sources\nbuilding extension \"Orange.classification._tree_scorers\" sources\nbuilding extension \"Orange.data._valuecount\" sources\nbuilding extension \"Orange.data._contingency\" sources\nbuilding extension \"Orange.data._io\" sources\nbuilding extension \"Orange.data._variable\" sources\nbuilding extension \"Orange.distance._distance\" sources\nbuilding extension \"Orange.preprocess._discretize\" sources\nbuilding extension \"Orange.preprocess._relieff\" sources\nbuilding extension \"Orange.projection._som\" sources\nbuilding extension \"Orange.widgets.utils._grid_density\" sources\nbuild_src: building npy-pkg config files\ncustomize UnixCCompiler\nC compiler: cc -pthread -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -I/tools/deps/include -I/tools/deps/include/ncursesw -fPIC\n\ncreating /tmp/tmp7s8gipfn/tmp\ncreating /tmp/tmp7s8gipfn/tmp/tmp7s8gipfn\ncompile options: '-MMD -MF /tmp/tmp7s8gipfn/file.c.d -c'\ncc: /tmp/tmp7s8gipfn/file.c\ncustomize UnixCCompiler using build_ext\ncustomize UnixCCompiler\nC compiler: cc -pthread -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -I/tools/deps/include -I/tools/deps/include/ncursesw -fPIC\n\ncreating /tmp/tmpheu6coqt/tmp\ncreating /tmp/tmpheu6coqt/tmp/tmpheu6coqt\ncompile options: '-MMD -MF /tmp/tmpheu6coqt/file.c.d -c'\ncc: /tmp/tmpheu6coqt/file.c\ncustomize UnixCCompiler using build_ext\nbuilding 'Orange.classification._simple_tree' extension\ncompiling C sources\nC compiler: cc -pthread -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -I/tools/deps/include -I/tools/deps/include/ncursesw -fPIC\n\ncreating build/temp.linux-x86_64-3.7/Orange\ncreating build/temp.linux-x86_64-3.7/Orange/classification\ncompile options: '-I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_6061f2da1073d58ddc0fc946daba26030d9f0e2f/.venv/lib/python3.7/site-packages/numpy/core/include -I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_6061f2da1073d58ddc0fc946daba26030d9f0e2f/.venv/include -I/home/gcpuser/.local/share/uv/python/cpython-3.7.9-linux-x86_64-gnu/include/python3.7m -c'\ncc: Orange/classification/_simple_tree.c\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 Orange/classification/_simple_tree.cpython-37m-x86_64-linux-gnu.so\nbuilding 'Orange.classification._tree_scorers' extension\ncompiling C sources\nC compiler: cc -pthread -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -I/tools/deps/include -I/tools/deps/include/ncursesw -fPIC\n\ncompile options: '-I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_6061f2da1073d58ddc0fc946daba26030d9f0e2f/.venv/lib/python3.7/site-packages/numpy/core/include -I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_6061f2da1073d58ddc0fc946daba26030d9f0e2f/.venv/lib/python3.7/site-packages/numpy/core/include -I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_6061f2da1073d58ddc0fc946daba26030d9f0e2f/.venv/include -I/home/gcpuser/.local/share/uv/python/cpython-3.7.9-linux-x86_64-gnu/include/python3.7m -c'\ncc: Orange/classification/_tree_scorers.c\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 Orange/classification/_tree_scorers.cpython-37m-x86_64-linux-gnu.so\nbuilding 'Orange.data._valuecount' extension\ncompiling C sources\nC compiler: cc -pthread -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -I/tools/deps/include -I/tools/deps/include/ncursesw -fPIC\n\ncreating build/temp.linux-x86_64-3.7/Orange/data\ncompile options: '-I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_6061f2da1073d58ddc0fc946daba26030d9f0e2f/.venv/lib/python3.7/site-packages/numpy/core/include -I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_6061f2da1073d58ddc0fc946daba26030d9f0e2f/.venv/lib/python3.7/site-packages/numpy/core/include -I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_6061f2da1073d58ddc0fc946daba26030d9f0e2f/.venv/include -I/home/gcpuser/.local/share/uv/python/cpython-3.7.9-linux-x86_64-gnu/include/python3.7m -c'\ncc: Orange/data/_valuecount.c\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 Orange/data/_valuecount.cpython-37m-x86_64-linux-gnu.so\nbuilding 'Orange.data._contingency' extension\ncompiling C sources\nC compiler: cc -pthread -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -I/tools/deps/include -I/tools/deps/include/ncursesw -fPIC\n\ncompile options: '-I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_6061f2da1073d58ddc0fc946daba26030d9f0e2f/.venv/lib/python3.7/site-packages/numpy/core/include -I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_6061f2da1073d58ddc0fc946daba26030d9f0e2f/.venv/lib/python3.7/site-packages/numpy/core/include -I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_6061f2da1073d58ddc0fc946daba26030d9f0e2f/.venv/include -I/home/gcpuser/.local/share/uv/python/cpython-3.7.9-linux-x86_64-gnu/include/python3.7m -c'\ncc: Orange/data/_contingency.c\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 Orange/data/_contingency.cpython-37m-x86_64-linux-gnu.so\nbuilding 'Orange.data._io' extension\ncompiling C sources\nC compiler: cc -pthread -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -I/tools/deps/include -I/tools/deps/include/ncursesw -fPIC\n\ncompile options: '-I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_6061f2da1073d58ddc0fc946daba26030d9f0e2f/.venv/lib/python3.7/site-packages/numpy/core/include -I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_6061f2da1073d58ddc0fc946daba26030d9f0e2f/.venv/lib/python3.7/site-packages/numpy/core/include -I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_6061f2da1073d58ddc0fc946daba26030d9f0e2f/.venv/include -I/home/gcpuser/.local/share/uv/python/cpython-3.7.9-linux-x86_64-gnu/include/python3.7m -c'\ncc: Orange/data/_io.c\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 Orange/data/_io.cpython-37m-x86_64-linux-gnu.so\nbuilding 'Orange.data._variable' extension\ncompiling C sources\nC compiler: cc -pthread -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -I/tools/deps/include -I/tools/deps/include/ncursesw -fPIC\n\ncompile options: '-I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_6061f2da1073d58ddc0fc946daba26030d9f0e2f/.venv/lib/python3.7/site-packages/numpy/core/include -I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_6061f2da1073d58ddc0fc946daba26030d9f0e2f/.venv/lib/python3.7/site-packages/numpy/core/include -I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_6061f2da1073d58ddc0fc946daba26030d9f0e2f/.venv/include -I/home/gcpuser/.local/share/uv/python/cpython-3.7.9-linux-x86_64-gnu/include/python3.7m -c'\ncc: Orange/data/_variable.c\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 Orange/data/_variable.cpython-37m-x86_64-linux-gnu.so\nbuilding 'Orange.distance._distance' extension\ncompiling C sources\nC compiler: cc -pthread -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -I/tools/deps/include -I/tools/deps/include/ncursesw -fPIC\n\ncreating build/temp.linux-x86_64-3.7/Orange/distance\ncompile options: '-I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_6061f2da1073d58ddc0fc946daba26030d9f0e2f/.venv/lib/python3.7/site-packages/numpy/core/include -I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_6061f2da1073d58ddc0fc946daba26030d9f0e2f/.venv/lib/python3.7/site-packages/numpy/core/include -I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_6061f2da1073d58ddc0fc946daba26030d9f0e2f/.venv/include -I/home/gcpuser/.local/share/uv/python/cpython-3.7.9-linux-x86_64-gnu/include/python3.7m -c'\ncc: Orange/distance/_distance.c\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 Orange/distance/_distance.cpython-37m-x86_64-linux-gnu.so\nbuilding 'Orange.preprocess._discretize' extension\ncompiling C sources\nC compiler: cc -pthread -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -I/tools/deps/include -I/tools/deps/include/ncursesw -fPIC\n\ncreating build/temp.linux-x86_64-3.7/Orange/preprocess\ncompile options: '-I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_6061f2da1073d58ddc0fc946daba26030d9f0e2f/.venv/lib/python3.7/site-packages/numpy/core/include -I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_6061f2da1073d58ddc0fc946daba26030d9f0e2f/.venv/lib/python3.7/site-packages/numpy/core/include -I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_6061f2da1073d58ddc0fc946daba26030d9f0e2f/.venv/include -I/home/gcpuser/.local/share/uv/python/cpython-3.7.9-linux-x86_64-gnu/include/python3.7m -c'\ncc: Orange/preprocess/_discretize.c\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 Orange/preprocess/_discretize.cpython-37m-x86_64-linux-gnu.so\nbuilding 'Orange.preprocess._relieff' extension\ncompiling C++ sources\nC compiler: c++ -pthread -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -I/tools/deps/include -I/tools/deps/include/ncursesw -fPIC\n\ncompile options: '-I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_6061f2da1073d58ddc0fc946daba26030d9f0e2f/.venv/lib/python3.7/site-packages/numpy/core/include -I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_6061f2da1073d58ddc0fc946daba26030d9f0e2f/.venv/lib/python3.7/site-packages/numpy/core/include -I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_6061f2da1073d58ddc0fc946daba26030d9f0e2f/.venv/include -I/home/gcpuser/.local/share/uv/python/cpython-3.7.9-linux-x86_64-gnu/include/python3.7m -c'\nc++: Orange/preprocess/_relieff.cpp\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 Orange/preprocess/_relieff.cpython-37m-x86_64-linux-gnu.so\nbuilding 'Orange.projection._som' extension\ncompiling C sources\nC compiler: cc -pthread -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -I/tools/deps/include -I/tools/deps/include/ncursesw -fPIC\n\ncreating build/temp.linux-x86_64-3.7/Orange/projection\ncompile options: '-I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_6061f2da1073d58ddc0fc946daba26030d9f0e2f/.venv/lib/python3.7/site-packages/numpy/core/include -I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_6061f2da1073d58ddc0fc946daba26030d9f0e2f/.venv/lib/python3.7/site-packages/numpy/core/include -I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_6061f2da1073d58ddc0fc946daba26030d9f0e2f/.venv/include -I/home/gcpuser/.local/share/uv/python/cpython-3.7.9-linux-x86_64-gnu/include/python3.7m -c'\ncc: Orange/projection/_som.c\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 Orange/projection/_som.cpython-37m-x86_64-linux-gnu.so\nbuilding 'Orange.widgets.utils._grid_density' extension\ncompiling C++ sources\nC compiler: c++ -pthread -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -I/tools/deps/include -I/tools/deps/include/ncursesw -fPIC\n\ncreating build/temp.linux-x86_64-3.7/Orange/widgets\ncreating build/temp.linux-x86_64-3.7/Orange/widgets/utils\ncompile options: '-I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_6061f2da1073d58ddc0fc946daba26030d9f0e2f/.venv/lib/python3.7/site-packages/numpy/core/include -I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_6061f2da1073d58ddc0fc946daba26030d9f0e2f/.venv/include -I/home/gcpuser/.local/share/uv/python/cpython-3.7.9-linux-x86_64-gnu/include/python3.7m -c'\nc++: Orange/widgets/utils/_grid_density.cpp\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 Orange/widgets/utils/_grid_density.cpython-37m-x86_64-linux-gnu.so\nrunning develop\nrunning build_scripts\nrunning egg_info\nrunning build_src\nbuild_src\nbuilding extension \"Orange.classification._simple_tree\" sources\nbuilding extension \"Orange.classification._tree_scorers\" sources\nbuilding extension \"Orange.data._valuecount\" sources\nbuilding extension \"Orange.data._contingency\" sources\nbuilding extension \"Orange.data._io\" sources\nbuilding extension \"Orange.data._variable\" sources\nbuilding extension \"Orange.distance._distance\" sources\nbuilding extension \"Orange.preprocess._discretize\" sources\nbuilding extension \"Orange.preprocess._relieff\" sources\nbuilding extension \"Orange.projection._som\" sources\nbuilding extension \"Orange.widgets.utils._grid_density\" sources\nbuild_src: building npy-pkg config files\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'\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'\nadding license file 'LICENSE'\nwriting manifest file 'Orange3.egg-info/SOURCES.txt'\nrunning build_ext\ncustomize UnixCCompiler\nC compiler: cc -pthread -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -I/tools/deps/include -I/tools/deps/include/ncursesw -fPIC\n\ncreating /tmp/tmpevvjx6pq/tmp\ncreating /tmp/tmpevvjx6pq/tmp/tmpevvjx6pq\ncompile options: '-MMD -MF /tmp/tmpevvjx6pq/file.c.d -c'\ncc: /tmp/tmpevvjx6pq/file.c\ncustomize UnixCCompiler using build_ext\ncustomize UnixCCompiler\nC compiler: cc -pthread -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -I/tools/deps/include -I/tools/deps/include/ncursesw -fPIC\n\ncreating /tmp/tmpehf9mhct/tmp\ncreating /tmp/tmpehf9mhct/tmp/tmpehf9mhct\ncompile options: '-MMD -MF /tmp/tmpehf9mhct/file.c.d -c'\ncc: /tmp/tmpehf9mhct/file.c\ncustomize UnixCCompiler using build_ext\nCreating /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_6061f2da1073d58ddc0fc946daba26030d9f0e2f/.venv/lib/python3.7/site-packages/Orange3.egg-link (link to .)\nAdding Orange3 3.26.0.dev0+6061f2d to easy-install.pth file\nInstalling orange-canvas script to /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_6061f2da1073d58ddc0fc946daba26030d9f0e2f/.venv/bin\n\nInstalled /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_6061f2da1073d58ddc0fc946daba26030d9f0e2f\nProcessing dependencies for Orange3==3.26.0.dev0+6061f2d\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_6061f2da1073d58ddc0fc946daba26030d9f0e2f/.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_6061f2da1073d58ddc0fc946daba26030d9f0e2f/.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_6061f2da1073d58ddc0fc946daba26030d9f0e2f/.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_6061f2da1073d58ddc0fc946daba26030d9f0e2f/.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_6061f2da1073d58ddc0fc946daba26030d9f0e2f/.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_6061f2da1073d58ddc0fc946daba26030d9f0e2f/.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_6061f2da1073d58ddc0fc946daba26030d9f0e2f/.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_6061f2da1073d58ddc0fc946daba26030d9f0e2f/.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_6061f2da1073d58ddc0fc946daba26030d9f0e2f/.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_6061f2da1073d58ddc0fc946daba26030d9f0e2f/.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_6061f2da1073d58ddc0fc946daba26030d9f0e2f/.venv/bin\nInstalling pip3 script to /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_6061f2da1073d58ddc0fc946daba26030d9f0e2f/.venv/bin\nInstalling pip3.10 script to /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_6061f2da1073d58ddc0fc946daba26030d9f0e2f/.venv/bin\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_6061f2da1073d58ddc0fc946daba26030d9f0e2f/.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_6061f2da1073d58ddc0fc946daba26030d9f0e2f/.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_6061f2da1073d58ddc0fc946daba26030d9f0e2f/.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_6061f2da1073d58ddc0fc946daba26030d9f0e2f/.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_6061f2da1073d58ddc0fc946daba26030d9f0e2f/.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_6061f2da1073d58ddc0fc946daba26030d9f0e2f/.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_6061f2da1073d58ddc0fc946daba26030d9f0e2f/.venv/bin\nInstalling f2py3 script to /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_6061f2da1073d58ddc0fc946daba26030d9f0e2f/.venv/bin\nInstalling f2py3.7 script to /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_6061f2da1073d58ddc0fc946daba26030d9f0e2f/.venv/bin\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_6061f2da1073d58ddc0fc946daba26030d9f0e2f/.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_6061f2da1073d58ddc0fc946daba26030d9f0e2f/.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_6061f2da1073d58ddc0fc946daba26030d9f0e2f/.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_6061f2da1073d58ddc0fc946daba26030d9f0e2f/.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_6061f2da1073d58ddc0fc946daba26030d9f0e2f/.venv/bin\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_6061f2da1073d58ddc0fc946daba26030d9f0e2f/.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_6061f2da1073d58ddc0fc946daba26030d9f0e2f/.venv/lib/python3.7/site-packages\nSearching for httpx==0.24.1\nBest match: httpx 0.24.1\nAdding httpx 0.24.1 to easy-install.pth file\nInstalling httpx script to /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_6061f2da1073d58ddc0fc946daba26030d9f0e2f/.venv/bin\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_6061f2da1073d58ddc0fc946daba26030d9f0e2f/.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_6061f2da1073d58ddc0fc946daba26030d9f0e2f/.venv/bin\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_6061f2da1073d58ddc0fc946daba26030d9f0e2f/.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_6061f2da1073d58ddc0fc946daba26030d9f0e2f/.venv/bin\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_6061f2da1073d58ddc0fc946daba26030d9f0e2f/.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_6061f2da1073d58ddc0fc946daba26030d9f0e2f/.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_6061f2da1073d58ddc0fc946daba26030d9f0e2f/.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_6061f2da1073d58ddc0fc946daba26030d9f0e2f/.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_6061f2da1073d58ddc0fc946daba26030d9f0e2f/.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_6061f2da1073d58ddc0fc946daba26030d9f0e2f/.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_6061f2da1073d58ddc0fc946daba26030d9f0e2f/.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_6061f2da1073d58ddc0fc946daba26030d9f0e2f/.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_6061f2da1073d58ddc0fc946daba26030d9f0e2f/.venv/bin\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_6061f2da1073d58ddc0fc946daba26030d9f0e2f/.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_6061f2da1073d58ddc0fc946daba26030d9f0e2f/.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_6061f2da1073d58ddc0fc946daba26030d9f0e2f/.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_6061f2da1073d58ddc0fc946daba26030d9f0e2f/.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_6061f2da1073d58ddc0fc946daba26030d9f0e2f/.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_6061f2da1073d58ddc0fc946daba26030d9f0e2f/.venv/bin\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_6061f2da1073d58ddc0fc946daba26030d9f0e2f/.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_6061f2da1073d58ddc0fc946daba26030d9f0e2f/.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_6061f2da1073d58ddc0fc946daba26030d9f0e2f/.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_6061f2da1073d58ddc0fc946daba26030d9f0e2f/.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_6061f2da1073d58ddc0fc946daba26030d9f0e2f/.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_6061f2da1073d58ddc0fc946daba26030d9f0e2f/.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_6061f2da1073d58ddc0fc946daba26030d9f0e2f/.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_6061f2da1073d58ddc0fc946daba26030d9f0e2f/.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_6061f2da1073d58ddc0fc946daba26030d9f0e2f/.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_6061f2da1073d58ddc0fc946daba26030d9f0e2f/.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_6061f2da1073d58ddc0fc946daba26030d9f0e2f/.venv/bin\nInstalling pyftmerge script to /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_6061f2da1073d58ddc0fc946daba26030d9f0e2f/.venv/bin\nInstalling pyftsubset script to /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_6061f2da1073d58ddc0fc946daba26030d9f0e2f/.venv/bin\nInstalling ttx script to /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_6061f2da1073d58ddc0fc946daba26030d9f0e2f/.venv/bin\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_6061f2da1073d58ddc0fc946daba26030d9f0e2f/.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_6061f2da1073d58ddc0fc946daba26030d9f0e2f/.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_6061f2da1073d58ddc0fc946daba26030d9f0e2f/.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_6061f2da1073d58ddc0fc946daba26030d9f0e2f/.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_6061f2da1073d58ddc0fc946daba26030d9f0e2f/.venv/lib/python3.7/site-packages\nSearching for httpcore==0.17.3\nBest match: httpcore 0.17.3\nAdding httpcore 0.17.3 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_6061f2da1073d58ddc0fc946daba26030d9f0e2f/.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_6061f2da1073d58ddc0fc946daba26030d9f0e2f/.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_6061f2da1073d58ddc0fc946daba26030d9f0e2f/.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_6061f2da1073d58ddc0fc946daba26030d9f0e2f/.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_6061f2da1073d58ddc0fc946daba26030d9f0e2f/.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_6061f2da1073d58ddc0fc946daba26030d9f0e2f/.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_6061f2da1073d58ddc0fc946daba26030d9f0e2f/.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_6061f2da1073d58ddc0fc946daba26030d9f0e2f/.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_6061f2da1073d58ddc0fc946daba26030d9f0e2f/.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_6061f2da1073d58ddc0fc946daba26030d9f0e2f/.venv/lib/python3.7/site-packages\nSearching for h11==0.14.0\nBest match: h11 0.14.0\nAdding h11 0.14.0 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_6061f2da1073d58ddc0fc946daba26030d9f0e2f/.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_6061f2da1073d58ddc0fc946daba26030d9f0e2f/.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_6061f2da1073d58ddc0fc946daba26030d9f0e2f/.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_6061f2da1073d58ddc0fc946daba26030d9f0e2f/.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_6061f2da1073d58ddc0fc946daba26030d9f0e2f/.venv/lib/python3.7/site-packages\nFinished processing dependencies for Orange3==3.26.0.dev0+6061f2d\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 138ms\nPrepared 18 packages in 20ms\nInstalled 18 packages in 135ms\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 54 packages in 382ms\nInstalled 47 packages in 744ms\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.14.0\n + httpcore==0.17.3\n + httpx==0.24.1\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 + 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 34 packages in 118ms\nInstalled 13 packages in 110ms\n + anyqt==0.2.0\n + attrs==24.2.0\n + cattrs==23.1.2\n + commonmark==0.9.1\n + dictdiffer==0.9.0\n + docutils==0.20.1\n + orange-canvas-core==0.1.35\n + orange-widget-base==4.22.0\n + platformdirs==4.0.0\n + pyqtgraph==0.12.4\n + qasync==0.25.0\n + requests-cache==1.1.1\n + url-normalize==1.4.3\nResolved 2 packages in 4ms\nInstalled 2 packages in 10ms\n + psycopg2==2.9.9\n + pymssql==2.3.2\nAudited 1 package in 3ms\nAudited 2 packages in 2ms\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      |         ^~~~~~~~~~~~\nIn file included from /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_6061f2da1073d58ddc0fc946daba26030d9f0e2f/.venv/lib/python3.7/site-packages/numpy/core/include/numpy/ndarraytypes.h:1830,\n                 from /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_6061f2da1073d58ddc0fc946daba26030d9f0e2f/.venv/lib/python3.7/site-packages/numpy/core/include/numpy/ndarrayobject.h:12,\n                 from /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_6061f2da1073d58ddc0fc946daba26030d9f0e2f/.venv/lib/python3.7/site-packages/numpy/core/include/numpy/arrayobject.h:4,\n                 from Orange/classification/_tree_scorers.c:567:\n/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_6061f2da1073d58ddc0fc946daba26030d9f0e2f/.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:3115:27: warning: comparison of integer expressions of different signedness: ‘unsigned int’ and ‘int’ [-Wsign-compare]\n 3115 |   __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:4619:27: warning: comparison of integer expressions of different signedness: ‘unsigned int’ and ‘int’ [-Wsign-compare]\n 4619 |   __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:5396:43: warning: comparison of integer expressions of different signedness: ‘unsigned int’ and ‘int’ [-Wsign-compare]\n 5396 |           for (__pyx_t_22 = 0; __pyx_t_22 < __pyx_t_21; __pyx_t_22+=1) {\n      |                                           ^\nOrange/classification/_tree_scorers.c:5517:39: warning: comparison of integer expressions of different signedness: ‘unsigned int’ and ‘int’ [-Wsign-compare]\n 5517 |           __pyx_t_27 = ((__pyx_v_left >= __pyx_v_min_leaf) != 0);\n      |                                       ^~\nOrange/classification/_tree_scorers.c:5523:53: warning: comparison of integer expressions of different signedness: ‘unsigned int’ and ‘int’ [-Wsign-compare]\n 5523 |           __pyx_t_27 = (((__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:7051:41: warning: comparison of integer expressions of different signedness: ‘unsigned int’ and ‘int’ [-Wsign-compare]\n 7051 |         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:7741:41: warning: comparison of integer expressions of different signedness: ‘unsigned int’ and ‘int’ [-Wsign-compare]\n 7741 |         for (__pyx_t_11 = 0; __pyx_t_11 < __pyx_t_10; __pyx_t_11+=1) {\n      |                                         ^\nOrange/classification/_tree_scorers.c:7801:143: warning: comparison of integer expressions of different signedness: ‘__pyx_t_5numpy_int32_t’ {aka ‘int’} and ‘unsigned int’ [-Wsign-compare]\n 7801 |               __pyx_t_17 = (((*((__pyx_t_5numpy_int32_t *) ( /* dim=0 */ (__pyx_v_indices.data + __pyx_t_18 * __pyx_v_indices.strides[0]) ))) != __pyx_v_i) != 0);\n      |                                                                                                                                               ^~\nIn file included from /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_6061f2da1073d58ddc0fc946daba26030d9f0e2f/.venv/lib/python3.7/site-packages/numpy/core/include/numpy/ndarraytypes.h:1830,\n                 from /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_6061f2da1073d58ddc0fc946daba26030d9f0e2f/.venv/lib/python3.7/site-packages/numpy/core/include/numpy/ndarrayobject.h:12,\n                 from /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_6061f2da1073d58ddc0fc946daba26030d9f0e2f/.venv/lib/python3.7/site-packages/numpy/core/include/numpy/arrayobject.h:4,\n                 from Orange/data/_valuecount.c:567:\n/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_6061f2da1073d58ddc0fc946daba26030d9f0e2f/.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_6061f2da1073d58ddc0fc946daba26030d9f0e2f/.venv/lib/python3.7/site-packages/numpy/core/include/numpy/ndarraytypes.h:1830,\n                 from /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_6061f2da1073d58ddc0fc946daba26030d9f0e2f/.venv/lib/python3.7/site-packages/numpy/core/include/numpy/ndarrayobject.h:12,\n                 from /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_6061f2da1073d58ddc0fc946daba26030d9f0e2f/.venv/lib/python3.7/site-packages/numpy/core/include/numpy/arrayobject.h:4,\n                 from Orange/data/_contingency.c:598:\n/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_6061f2da1073d58ddc0fc946daba26030d9f0e2f/.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:3881:24: warning: ‘__pyx_v_decs’ may be used uninitialized in this function [-Wmaybe-uninitialized]\n 3881 |           __pyx_v_decs = (__pyx_v_decs / 10.0);\n      |           ~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~\nOrange/data/_io.c:4070:24: warning: ‘__pyx_v_value’ may be used uninitialized in this function [-Wmaybe-uninitialized]\n 4070 |           __pyx_t_10 = PyFloat_FromDouble(__pyx_v_value); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 221, __pyx_L5_error)\n      |                        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\nOrange/data/_io.c:480:40: warning: ‘__pyx_v_attr_index’ may be used uninitialized in this function [-Wmaybe-uninitialized]\n  480 |   #define PyInt_FromLong               PyLong_FromLong\n      |                                        ^~~~~~~~~~~~~~~\nOrange/data/_io.c:1301:7: note: ‘__pyx_v_attr_index’ was declared here\n 1301 |   int __pyx_v_attr_index;\n      |       ^~~~~~~~~~~~~~~~~~\nOrange/data/_io.c:2935:25: warning: ‘__pyx_v_atomp’ may be used uninitialized in this function [-Wmaybe-uninitialized]\n 2935 |           __pyx_v_atomp = (__pyx_v_atomp + 1);\n      |           ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~\nIn file included from /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_6061f2da1073d58ddc0fc946daba26030d9f0e2f/.venv/lib/python3.7/site-packages/numpy/core/include/numpy/ndarraytypes.h:1830,\n                 from /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_6061f2da1073d58ddc0fc946daba26030d9f0e2f/.venv/lib/python3.7/site-packages/numpy/core/include/numpy/ndarrayobject.h:12,\n                 from /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_6061f2da1073d58ddc0fc946daba26030d9f0e2f/.venv/lib/python3.7/site-packages/numpy/core/include/numpy/arrayobject.h:4,\n                 from Orange/distance/_distance.c:598:\n/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_6061f2da1073d58ddc0fc946daba26030d9f0e2f/.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_6061f2da1073d58ddc0fc946daba26030d9f0e2f/.venv/lib/python3.7/site-packages/numpy/core/include/numpy/ndarraytypes.h:1830,\n                 from /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_6061f2da1073d58ddc0fc946daba26030d9f0e2f/.venv/lib/python3.7/site-packages/numpy/core/include/numpy/ndarrayobject.h:12,\n                 from /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_6061f2da1073d58ddc0fc946daba26030d9f0e2f/.venv/lib/python3.7/site-packages/numpy/core/include/numpy/arrayobject.h:4,\n                 from Orange/preprocess/_discretize.c:567:\n/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_6061f2da1073d58ddc0fc946daba26030d9f0e2f/.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_6061f2da1073d58ddc0fc946daba26030d9f0e2f/.venv/lib/python3.7/site-packages/numpy/core/include/numpy/ndarraytypes.h:1830,\n                 from /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_6061f2da1073d58ddc0fc946daba26030d9f0e2f/.venv/lib/python3.7/site-packages/numpy/core/include/numpy/ndarrayobject.h:12,\n                 from /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_6061f2da1073d58ddc0fc946daba26030d9f0e2f/.venv/lib/python3.7/site-packages/numpy/core/include/numpy/arrayobject.h:4,\n                 from Orange/preprocess/_relieff.cpp:627:\n/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_6061f2da1073d58ddc0fc946daba26030d9f0e2f/.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_6061f2da1073d58ddc0fc946daba26030d9f0e2f/.venv/lib/python3.7/site-packages/numpy/core/include/numpy/ndarraytypes.h:1830,\n                 from /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_6061f2da1073d58ddc0fc946daba26030d9f0e2f/.venv/lib/python3.7/site-packages/numpy/core/include/numpy/ndarrayobject.h:12,\n                 from /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_6061f2da1073d58ddc0fc946daba26030d9f0e2f/.venv/lib/python3.7/site-packages/numpy/core/include/numpy/arrayobject.h:4,\n                 from Orange/projection/_som.c:598:\n/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_6061f2da1073d58ddc0fc946daba26030d9f0e2f/.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:3655:7: warning: ‘__pyx_v_win_y’ may be used uninitialized in this function [-Wmaybe-uninitialized]\n 3655 |   int __pyx_v_win_y;\n      |       ^~~~~~~~~~~~~\nOrange/projection/_som.c:3654:7: warning: ‘__pyx_v_win_x’ may be used uninitialized in this function [-Wmaybe-uninitialized]\n 3654 |   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:4547:223: warning: ‘__pyx_v_win_y’ may be used uninitialized in this function [-Wmaybe-uninitialized]\n 4547 |           *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_int16_t *, __pyx_pybuffernd_winners.rcbuffer->pybuffer.buf, __pyx_t_38, __pyx_pybuffernd_winners.diminfo[0].strides, __pyx_t_39, __pyx_pybuffernd_winners.diminfo[1].strides) = __pyx_v_win_y;\n      |           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~\nOrange/projection/_som.c:4114:7: note: ‘__pyx_v_win_y’ was declared here\n 4114 |   int __pyx_v_win_y;\n      |       ^~~~~~~~~~~~~\nOrange/projection/_som.c:4536:223: warning: ‘__pyx_v_win_x’ may be used uninitialized in this function [-Wmaybe-uninitialized]\n 4536 |           *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_int16_t *, __pyx_pybuffernd_winners.rcbuffer->pybuffer.buf, __pyx_t_36, __pyx_pybuffernd_winners.diminfo[0].strides, __pyx_t_37, __pyx_pybuffernd_winners.diminfo[1].strides) = __pyx_v_win_x;\n      |           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~\nOrange/projection/_som.c:4113:7: note: ‘__pyx_v_win_x’ was declared here\n 4113 |   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:4746:7: warning: ‘__pyx_v_win_y’ may be used uninitialized in this function [-Wmaybe-uninitialized]\n 4746 |   int __pyx_v_win_y;\n      |       ^~~~~~~~~~~~~\nOrange/projection/_som.c:4745:7: warning: ‘__pyx_v_win_x’ may be used uninitialized in this function [-Wmaybe-uninitialized]\n 4745 |   int __pyx_v_win_x;\n      |       ^~~~~~~~~~~~~\nOrange/projection/_som.c: In function ‘__pyx_pw_6Orange_10projection_4_som_3update’:\nOrange/projection/_som.c:3141:7: warning: ‘__pyx_v_win_y’ may be used uninitialized in this function [-Wmaybe-uninitialized]\n 3141 |   int __pyx_v_win_y;\n      |       ^~~~~~~~~~~~~\nOrange/projection/_som.c: In function ‘__pyx_pw_6Orange_10projection_4_som_1get_winners’:\nOrange/projection/_som.c:2964:223: warning: ‘__pyx_v_win_y’ may be used uninitialized in this function [-Wmaybe-uninitialized]\n 2964 |           *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_int16_t *, __pyx_pybuffernd_winners.rcbuffer->pybuffer.buf, __pyx_t_27, __pyx_pybuffernd_winners.diminfo[0].strides, __pyx_t_28, __pyx_pybuffernd_winners.diminfo[1].strides) = __pyx_v_win_y;\n      |           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~\nOrange/projection/_som.c:2665:7: note: ‘__pyx_v_win_y’ was declared here\n 2665 |   int __pyx_v_win_y;\n      |       ^~~~~~~~~~~~~\nOrange/projection/_som.c:2953:223: warning: ‘__pyx_v_win_x’ may be used uninitialized in this function [-Wmaybe-uninitialized]\n 2953 |           *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_int16_t *, __pyx_pybuffernd_winners.rcbuffer->pybuffer.buf, __pyx_t_25, __pyx_pybuffernd_winners.diminfo[0].strides, __pyx_t_26, __pyx_pybuffernd_winners.diminfo[1].strides) = __pyx_v_win_x;\n      |           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~\nOrange/projection/_som.c:2664:7: note: ‘__pyx_v_win_x’ was declared here\n 2664 |   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:5515:7: warning: ‘__pyx_v_win_y’ may be used uninitialized in this function [-Wmaybe-uninitialized]\n 5515 |   int __pyx_v_win_y;\n      |       ^~~~~~~~~~~~~\nOrange/projection/_som.c:5514:7: warning: ‘__pyx_v_win_x’ may be used uninitialized in this function [-Wmaybe-uninitialized]\n 5514 |   int __pyx_v_win_x;\n      |       ^~~~~~~~~~~~~\n/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_6061f2da1073d58ddc0fc946daba26030d9f0e2f/.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,\n/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_6061f2da1073d58ddc0fc946daba26030d9f0e2f/.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_6061f2da1073d58ddc0fc946daba26030d9f0e2f/.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,\n/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_6061f2da1073d58ddc0fc946daba26030d9f0e2f/.venv/lib/python3.7/site-packages/setuptools/command/egg_info.py:628: SetuptoolsDeprecationWarning: Custom 'build_py' does not implement 'get_data_files_without_manifest'.\nPlease extend command classes from setuptools instead of distutils.\n  SetuptoolsDeprecationWarning\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_6061f2da1073d58ddc0fc946daba26030d9f0e2f\nplugins: anyio-3.7.1\ncollected 62 items\n\nr2e_tests/test_1.py .................................................... [ 83%]\n..........                                                               [100%]\n\n==================================== PASSES ====================================\n=========================== short test summary info ============================\nPASSED r2e_tests/test_1.py::TestVariable::test_eq_with_compute_value\nPASSED r2e_tests/test_1.py::TestVariable::test_hash\nPASSED r2e_tests/test_1.py::TestVariable::test_hash_eq\nPASSED r2e_tests/test_1.py::TestVariable::test_name\nPASSED r2e_tests/test_1.py::TestVariable::test_properties\nPASSED r2e_tests/test_1.py::TestVariable::test_properties_as_predicates\nPASSED r2e_tests/test_1.py::TestVariable::test_repr_is_abstract\nPASSED r2e_tests/test_1.py::TestVariable::test_strange_eq\nPASSED r2e_tests/test_1.py::TestVariable::test_to_val\nPASSED r2e_tests/test_1.py::TestDiscreteVariable::test_copy_checks_len_values\nPASSED r2e_tests/test_1.py::TestDiscreteVariable::test_copy_copies_attributes\nPASSED r2e_tests/test_1.py::TestDiscreteVariable::test_dont_make_anonymous_variables\nPASSED r2e_tests/test_1.py::TestDiscreteVariable::test_dont_pickle_anonymous_variables\nPASSED r2e_tests/test_1.py::TestDiscreteVariable::test_make\nPASSED r2e_tests/test_1.py::TestDiscreteVariable::test_mapper_dense\nPASSED r2e_tests/test_1.py::TestDiscreteVariable::test_mapper_dim_check\nPASSED r2e_tests/test_1.py::TestDiscreteVariable::test_mapper_from_no_values\nPASSED r2e_tests/test_1.py::TestDiscreteVariable::test_mapper_inplace\nPASSED r2e_tests/test_1.py::TestDiscreteVariable::test_mapper_sparse\nPASSED r2e_tests/test_1.py::TestDiscreteVariable::test_no_duplicated_values\nPASSED r2e_tests/test_1.py::TestDiscreteVariable::test_no_nonstringvalues\nPASSED r2e_tests/test_1.py::TestDiscreteVariable::test_rename\nPASSED r2e_tests/test_1.py::TestDiscreteVariable::test_repr\nPASSED r2e_tests/test_1.py::TestDiscreteVariable::test_to_val\nPASSED r2e_tests/test_1.py::TestDiscreteVariable::test_tuple_list_warning\nPASSED r2e_tests/test_1.py::TestDiscreteVariable::test_unpickle\nPASSED r2e_tests/test_1.py::TestDiscreteVariable::test_val_from_str\nPASSED r2e_tests/test_1.py::TestDiscreteVariable::test_val_from_str_add\nPASSED r2e_tests/test_1.py::TestContinuousVariable::test_adjust_decimals\nPASSED r2e_tests/test_1.py::TestContinuousVariable::test_copy_copies_attributes\nPASSED r2e_tests/test_1.py::TestContinuousVariable::test_decimals\nPASSED r2e_tests/test_1.py::TestContinuousVariable::test_dont_make_anonymous_variables\nPASSED r2e_tests/test_1.py::TestContinuousVariable::test_dont_pickle_anonymous_variables\nPASSED r2e_tests/test_1.py::TestContinuousVariable::test_make\nPASSED r2e_tests/test_1.py::TestContinuousVariable::test_more_decimals\nPASSED r2e_tests/test_1.py::TestContinuousVariable::test_rename\nPASSED r2e_tests/test_1.py::TestStringVariable::test_copy_copies_attributes\nPASSED r2e_tests/test_1.py::TestStringVariable::test_dont_make_anonymous_variables\nPASSED r2e_tests/test_1.py::TestStringVariable::test_dont_pickle_anonymous_variables\nPASSED r2e_tests/test_1.py::TestStringVariable::test_rename\nPASSED r2e_tests/test_1.py::TestStringVariable::test_val\nPASSED r2e_tests/test_1.py::TestTimeVariable::test_copy_copies_attributes\nPASSED r2e_tests/test_1.py::TestTimeVariable::test_dont_make_anonymous_variables\nPASSED r2e_tests/test_1.py::TestTimeVariable::test_dont_pickle_anonymous_variables\nPASSED r2e_tests/test_1.py::TestTimeVariable::test_have_date\nPASSED r2e_tests/test_1.py::TestTimeVariable::test_have_date_have_time_in_construct\nPASSED r2e_tests/test_1.py::TestTimeVariable::test_no_date_no_time\nPASSED r2e_tests/test_1.py::TestTimeVariable::test_parse_invalid\nPASSED r2e_tests/test_1.py::TestTimeVariable::test_parse_repr\nPASSED r2e_tests/test_1.py::TestTimeVariable::test_parse_timestamp\nPASSED r2e_tests/test_1.py::TestTimeVariable::test_parse_utc\nPASSED r2e_tests/test_1.py::TestTimeVariable::test_readwrite_timevariable\nPASSED r2e_tests/test_1.py::TestTimeVariable::test_rename\nPASSED r2e_tests/test_1.py::TestTimeVariable::test_repr_value\nPASSED r2e_tests/test_1.py::PickleContinuousVariable::test_with_name\nPASSED r2e_tests/test_1.py::PickleDiscreteVariable::test_ordered\nPASSED r2e_tests/test_1.py::PickleDiscreteVariable::test_with_name\nPASSED r2e_tests/test_1.py::PickleDiscreteVariable::test_with_str_value\nPASSED r2e_tests/test_1.py::PickleStringVariable::test_with_name\nPASSED r2e_tests/test_1.py::VariableTestMakeProxy::test_make_proxy_cont\nPASSED r2e_tests/test_1.py::VariableTestMakeProxy::test_make_proxy_disc\nPASSED r2e_tests/test_1.py::VariableTestMakeProxy::test_proxy_has_separate_attributes\n============================== 62 passed in 2.05s ==============================\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_6061f2da1073d58ddc0fc946daba26030d9f0e2f\nplugins: anyio-3.7.1\ncollected 62 items\n\nr2e_tests/test_1.py ..F................................................. [ 83%]\n..........                                                               [100%]\n\n=================================== FAILURES ===================================\n__________________________ TestVariable.test_hash_eq ___________________________\n\nself = <r2e_tests.test_1.TestVariable testMethod=test_hash_eq>\n\n    def test_hash_eq(self):\n        a = ContinuousVariable(\"a\")\n        b1 = ContinuousVariable(\"b\", compute_value=Identity(a))\n        b2 = ContinuousVariable(\"b2\", compute_value=Identity(b1))\n        b3 = ContinuousVariable(\"b\")\n        self.assertEqual(a, b2)\n        self.assertEqual(b1, b2)\n        self.assertEqual(a, b1)\n        self.assertNotEqual(b1, b3)\n    \n>       self.assertEqual(hash(a), hash(b2))\nE       AssertionError: 2932374465468024490 != -8733545393274981979\n\nr2e_tests/test_1.py:226: AssertionError\n==================================== PASSES ====================================\n=========================== short test summary info ============================\nPASSED r2e_tests/test_1.py::TestVariable::test_eq_with_compute_value\nPASSED r2e_tests/test_1.py::TestVariable::test_hash\nPASSED r2e_tests/test_1.py::TestVariable::test_name\nPASSED r2e_tests/test_1.py::TestVariable::test_properties\nPASSED r2e_tests/test_1.py::TestVariable::test_properties_as_predicates\nPASSED r2e_tests/test_1.py::TestVariable::test_repr_is_abstract\nPASSED r2e_tests/test_1.py::TestVariable::test_strange_eq\nPASSED r2e_tests/test_1.py::TestVariable::test_to_val\nPASSED r2e_tests/test_1.py::TestDiscreteVariable::test_copy_checks_len_values\nPASSED r2e_tests/test_1.py::TestDiscreteVariable::test_copy_copies_attributes\nPASSED r2e_tests/test_1.py::TestDiscreteVariable::test_dont_make_anonymous_variables\nPASSED r2e_tests/test_1.py::TestDiscreteVariable::test_dont_pickle_anonymous_variables\nPASSED r2e_tests/test_1.py::TestDiscreteVariable::test_make\nPASSED r2e_tests/test_1.py::TestDiscreteVariable::test_mapper_dense\nPASSED r2e_tests/test_1.py::TestDiscreteVariable::test_mapper_dim_check\nPASSED r2e_tests/test_1.py::TestDiscreteVariable::test_mapper_from_no_values\nPASSED r2e_tests/test_1.py::TestDiscreteVariable::test_mapper_inplace\nPASSED r2e_tests/test_1.py::TestDiscreteVariable::test_mapper_sparse\nPASSED r2e_tests/test_1.py::TestDiscreteVariable::test_no_duplicated_values\nPASSED r2e_tests/test_1.py::TestDiscreteVariable::test_no_nonstringvalues\nPASSED r2e_tests/test_1.py::TestDiscreteVariable::test_rename\nPASSED r2e_tests/test_1.py::TestDiscreteVariable::test_repr\nPASSED r2e_tests/test_1.py::TestDiscreteVariable::test_to_val\nPASSED r2e_tests/test_1.py::TestDiscreteVariable::test_tuple_list_warning\nPASSED r2e_tests/test_1.py::TestDiscreteVariable::test_unpickle\nPASSED r2e_tests/test_1.py::TestDiscreteVariable::test_val_from_str\nPASSED r2e_tests/test_1.py::TestDiscreteVariable::test_val_from_str_add\nPASSED r2e_tests/test_1.py::TestContinuousVariable::test_adjust_decimals\nPASSED r2e_tests/test_1.py::TestContinuousVariable::test_copy_copies_attributes\nPASSED r2e_tests/test_1.py::TestContinuousVariable::test_decimals\nPASSED r2e_tests/test_1.py::TestContinuousVariable::test_dont_make_anonymous_variables\nPASSED r2e_tests/test_1.py::TestContinuousVariable::test_dont_pickle_anonymous_variables\nPASSED r2e_tests/test_1.py::TestContinuousVariable::test_make\nPASSED r2e_tests/test_1.py::TestContinuousVariable::test_more_decimals\nPASSED r2e_tests/test_1.py::TestContinuousVariable::test_rename\nPASSED r2e_tests/test_1.py::TestStringVariable::test_copy_copies_attributes\nPASSED r2e_tests/test_1.py::TestStringVariable::test_dont_make_anonymous_variables\nPASSED r2e_tests/test_1.py::TestStringVariable::test_dont_pickle_anonymous_variables\nPASSED r2e_tests/test_1.py::TestStringVariable::test_rename\nPASSED r2e_tests/test_1.py::TestStringVariable::test_val\nPASSED r2e_tests/test_1.py::TestTimeVariable::test_copy_copies_attributes\nPASSED r2e_tests/test_1.py::TestTimeVariable::test_dont_make_anonymous_variables\nPASSED r2e_tests/test_1.py::TestTimeVariable::test_dont_pickle_anonymous_variables\nPASSED r2e_tests/test_1.py::TestTimeVariable::test_have_date\nPASSED r2e_tests/test_1.py::TestTimeVariable::test_have_date_have_time_in_construct\nPASSED r2e_tests/test_1.py::TestTimeVariable::test_no_date_no_time\nPASSED r2e_tests/test_1.py::TestTimeVariable::test_parse_invalid\nPASSED r2e_tests/test_1.py::TestTimeVariable::test_parse_repr\nPASSED r2e_tests/test_1.py::TestTimeVariable::test_parse_timestamp\nPASSED r2e_tests/test_1.py::TestTimeVariable::test_parse_utc\nPASSED r2e_tests/test_1.py::TestTimeVariable::test_readwrite_timevariable\nPASSED r2e_tests/test_1.py::TestTimeVariable::test_rename\nPASSED r2e_tests/test_1.py::TestTimeVariable::test_repr_value\nPASSED r2e_tests/test_1.py::PickleContinuousVariable::test_with_name\nPASSED r2e_tests/test_1.py::PickleDiscreteVariable::test_ordered\nPASSED r2e_tests/test_1.py::PickleDiscreteVariable::test_with_name\nPASSED r2e_tests/test_1.py::PickleDiscreteVariable::test_with_str_value\nPASSED r2e_tests/test_1.py::PickleStringVariable::test_with_name\nPASSED r2e_tests/test_1.py::VariableTestMakeProxy::test_make_proxy_cont\nPASSED r2e_tests/test_1.py::VariableTestMakeProxy::test_make_proxy_disc\nPASSED r2e_tests/test_1.py::VariableTestMakeProxy::test_proxy_has_separate_attributes\nFAILED r2e_tests/test_1.py::TestVariable::test_hash_eq - AssertionError: 2932...\n========================= 1 failed, 61 passed in 1.92s =========================\n",
    "old_commit_res_stderr": ""
}
Orange/data/tests/test_variable.py Orange/data/variable.py
We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
[ISSUE]
**Title:** Equal Variables Produce Different Hashes, Causing Assertion Failure

**Description:**
When creating variables that are logically equal, their hash values differ unexpectedly, leading to assertion failures during tests.

**Example Buggy Code:**
```python
from Orange.data import ContinuousVariable
from Orange.preprocess.transformation import Identity

a = ContinuousVariable("a")
b1 = ContinuousVariable("b", compute_value=Identity(a))
b2 = ContinuousVariable("b2", compute_value=Identity(b1))
b3 = ContinuousVariable("b")

# Checking equality
print(a == b2)  # Expected: True
print(b1 == b2)  # Expected: True
print(a == b1)   # Expected: True
print(b1 == b3)  # Expected: False

# Checking hash values
print(hash(a) == hash(b2))  # Expected: True
print(hash(b1) == hash(b2))  # Expected: True
print(hash(a) == hash(b1))   # Expected: True
print(hash(b1) == hash(b3))  # Expected: False
```

**Expected Behavior:**
Variables that are equal (`a == b2`, `b1 == b2`, `a == b1`) should have identical hash values (`hash(a) == hash(b2)`, `hash(b1) == hash(b2)`, `hash(a) == hash(b1)`). Conversely, variables that are not equal (`b1 != b3`) should have different hash values (`hash(b1) != hash(b3)`).

**Actual Behavior:**
While the equality checks pass, the hash comparison `hash(a) == hash(b2)` fails, resulting in different hash values for equal variables. This discrepancy causes assertion failures in tests that rely on consistent hashing for equality.

[/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/variable.py
import re
import warnings
from collections import Iterable

from datetime import datetime, timedelta, timezone
from numbers import Number, Real, Integral
from math import isnan, floor
from pickle import PickleError

import numpy as np
import scipy.sparse as sp

from Orange.data import _variable
from Orange.util import Registry, Reprable, OrangeDeprecationWarning


__all__ = ["Unknown", "MISSING_VALUES", "make_variable", "is_discrete_values",
           "Value", "Variable", "ContinuousVariable", "DiscreteVariable",
           "StringVariable", "TimeVariable"]


# For storing unknowns
Unknown = ValueUnknown = float("nan")
# For checking for unknowns
MISSING_VALUES = {np.nan, "?", "nan", ".", "", "NA", "~", None}

DISCRETE_MAX_VALUES = 3  # == 2 + nan
MAX_NUM_OF_DECIMALS = 5
# the variable with more than 100 different values should not be StringVariable
DISCRETE_MAX_ALLOWED_VALUES = 100


def make_variable(cls, compute_value, *args):
    if compute_value is not None:
        return cls(*args, compute_value=compute_value)
    else:
        # For compatibility with old pickles
        return cls(*args)


def is_discrete_values(values):
    """
    Return set of uniques if `values` is an iterable of discrete values
    else False if non-discrete, or None if indeterminate.

    Note
    ----
    Assumes consistent type of items of `values`.
    """
    if len(values) == 0:
        return None
    # If the first few values are, or can be converted to, floats,
    # the type is numeric
    try:
        isinstance(next(iter(values)), Number) or \
        [float(v) for _, v in zip(range(min(3, len(values))), values)]
    except ValueError:
        is_numeric = False
        max_values = int(round(len(values)**.7))
    else:
        is_numeric = True
        max_values = DISCRETE_MAX_VALUES

    # If more than max values => not discrete
    unique = set()
    for i in values:
        unique.add(i)
        if (len(unique) > max_values or
                len(unique) > DISCRETE_MAX_ALLOWED_VALUES):
            return False

    # Strip NaN from unique
    unique = {i for i in unique
              if (not i in MISSING_VALUES and
                  not (isinstance(i, Number) and np.isnan(i)))}

    # All NaNs => indeterminate
    if not unique:
        return None

    # Strings with |values| < max_unique
    if not is_numeric:
        return unique

    # Handle numbers
    try:
        unique_float = set(map(float, unique))
    except ValueError:
        # Converting all the values to floats resulted in an error.
        # Since the values have enough unique values, they are probably
        # string values and discrete.
        return unique

    # If only values are {0, 1} or {1, 2} (or a subset of those sets) => discrete
    return (not (unique_float - {0, 1}) or
            not (unique_float - {1, 2})) and unique


class Value(float):
    """
    The class representing a value. The class is not used to store values but
    only to return them in contexts in which we want the value to be accompanied
    with the descriptor, for instance to print the symbolic value of discrete
    variables.

    The class is derived from `float`, with an additional attribute `variable`
    which holds the descriptor of type :obj:`Orange.data.Variable`. If the
    value continuous or discrete, it is stored as a float. Other types of
    values, like strings, are stored in the attribute `value`.

    The class overloads the methods for printing out the value:
    `variable.repr_val` and `variable.str_val` are used to get a suitable
    representation of the value.

    Equivalence operator is overloaded as follows:

    - unknown values are equal; if one value is unknown and the other is not,
      they are different;

    - if the value is compared with the string, the value is converted to a
      string using `variable.str_val` and the two strings are compared

    - if the value is stored in attribute `value`, it is compared with the
      given other value

    - otherwise, the inherited comparison operator for `float` is called.

    Finally, value defines a hash, so values can be put in sets and appear as
    keys in dictionaries.

    .. attribute:: variable (:obj:`Orange.data.Variable`)

        Descriptor; used for printing out and for comparing with strings

    .. attribute:: value

        Value; the value can be of arbitrary type and is used only for variables
        that are neither discrete nor continuous. If `value` is `None`, the
        derived `float` value is used.
    """
    __slots__ = "variable", "_value"

    def __new__(cls, variable, value=Unknown):
        """
        Construct a new instance of Value with the given descriptor and value.
        If the argument `value` can be converted to float, it is stored as
        `float` and the attribute `value` is set to `None`. Otherwise, the
        inherited float is set to `Unknown` and the value is held by the
        attribute `value`.

        :param variable: descriptor
        :type variable: Orange.data.Variable
        :param value: value
        """
        if variable.is_primitive():
            self = super().__new__(cls, value)
            self.variable = variable
            self._value = None
        else:
            isunknown = value == variable.Unknown
            self = super().__new__(
                cls, np.nan if isunknown else np.finfo(float).min)
            self.variable = variable
            self._value = value
        return self

    def __init__(self, _, __=Unknown):
        # __new__ does the job, pylint: disable=super-init-not-called
        pass

    def __repr__(self):
        return "Value('%s', %s)" % (self.variable.name,
                                    self.variable.repr_val(self))

    def __str__(self):
        return self.variable.str_val(self)

    def __eq__(self, other):
        if isinstance(self, Real) and isnan(self):
            if isinstance(other, Real):
                return isnan(other)
            else:
                return other in self.variable.unknown_str
        if isinstance(other, str):
            return self.variable.str_val(self) == other
        if isinstance(other, Value):
            return self.value == other.value
        return super().__eq__(other)

    def __ne__(self, other):
        return not self.__eq__(other)

    def __lt__(self, other):
        if self.variable.is_primitive():
            if isinstance(other, str):
                return super().__lt__(self.variable.to_val(other))
            else:
                return super().__lt__(other)
        else:
            if isinstance(other, str):
                return self.value < other
            else:
                return self.value < other.value

    def __le__(self, other):
        return self.__lt__(other) or self.__eq__(other)

    def __gt__(self, other):
        return not self.__le__(other)

    def __ge__(self, other):
        return not self.__lt__(other)

    def __contains__(self, other):
        if (self._value is not None
                and isinstance(self._value, str)
                and isinstance(other, str)):
            return other in self._value
        raise TypeError("invalid operation on Value()")

    def __hash__(self):
        if self.variable.is_discrete:
            # It is not possible to hash the id and the domain value to the
            # same number as required by __eq__.
            # hash(1)
            # == hash(Value(DiscreteVariable("var", ["red", "green", "blue"]), 1))
            # == hash("green")
            # User should hash directly ids or domain values instead.
            raise TypeError("unhashable type - cannot hash values of discrete variables!")
        if self._value is None:
            return super().__hash__()
        else:
            return hash(self._value)

    @property
    def value(self):
        if self.variable.is_discrete:
            return Unknown if isnan(self) else self.variable.values[int(self)]
        if self.variable.is_string:
            return self._value
        return float(self)

    def __getnewargs__(self):
        return self.variable, float(self)

    def __getstate__(self):
        return dict(value=getattr(self, '_value', None))

    def __setstate__(self, state):
        # defined in __new__, pylint: disable=attribute-defined-outside-init
        self._value = state.get('value', None)


class VariableMeta(Registry):
    pass


class _predicatedescriptor(property):
    """
    A property that behaves as a class method if accessed via a class
    >>> class A:
    ...     foo = False
    ...     @_predicatedescriptor
    ...     def is_foo(self):
    ...         return self.foo
    ...
    >>> a = A()
    >>> a.is_foo
    False
    >>> A.is_foo(a)
    False
    """
    def __get__(self, instance, objtype=None):
        if instance is None:
            return self.fget
        else:
            return super().__get__(instance, objtype)


class Variable(Reprable, metaclass=VariableMeta):
    """
    The base class for variable descriptors contains the variable's
    name and some basic properties.

    .. attribute:: name

        The name of the variable.

    .. attribute:: unknown_str

        A set of values that represent unknowns in conversion from textual
        formats. Default is `{"?", ".", "", "NA", "~", None}`.

    .. attribute:: compute_value

        A function for computing the variable's value when converting from
        another domain which does not contain this variable. The function will
        be called with a data set (`Orange.data.Table`) and has to return
        an array of computed values for all its instances. The base class
        defines a static method `compute_value`, which returns `Unknown`.
        Non-primitive variables must redefine it to return `None`.

    .. attribute:: sparse

        A flag about sparsity of the variable. When set, the variable suggests
        it should be stored in a sparse matrix.

    .. attribute:: source_variable

        An optional descriptor of the source variable - if any - from which
        this variable is derived and computed via :obj:`compute_value`.

    .. attribute:: attributes

        A dictionary with user-defined attributes of the variable
    """
    Unknown = ValueUnknown

    def __init__(self, name="", compute_value=None, *, sparse=False):
        """
        Construct a variable descriptor.
        """
        if not name:
            warnings.warn("Variable must have a name", OrangeDeprecationWarning,
                          stacklevel=3)
        self._name = name
        self._compute_value = compute_value
        self.unknown_str = MISSING_VALUES
        self.source_variable = None
        self.sparse = sparse
        self.attributes = {}

    @property
    def name(self):
        return self._name

    def make_proxy(self):
        """
        Copy the variable and set the master to `self.master` or to `self`.

        :return: copy of self
        :rtype: Variable
        """
        var = self.__class__(self.name)
        var.__dict__.update(self.__dict__)
        var.attributes = dict(self.attributes)
        return var

    def __eq__(self, other):
        # pylint: disable=protected-access,import-outside-toplevel

        def to_match(var):
            if var._compute_value is None:
                return var
            elif isinstance(var._compute_value, Identity):
                return var._compute_value.variable
            return None

        from Orange.preprocess.transformation import Identity
        return type(self) is type(other) and (
            self.name == other.name
            and self._compute_value == other._compute_value
            or
            (self.compute_value or other.compute_value)
            and to_match(self) == to_match(other) != None)

    def __hash__(self):
        # Two variables that are not equal can have the same hash.
        # This happens if one has compute_value == Identity and the other
        # doesn't have compute_value, or they have a different Identity.
        # Having the same hash while not being equal is of course allowed.
        # pylint: disable=import-outside-toplevel
        from Orange.preprocess.transformation import Identity
        compute_value = self._compute_value
        if isinstance(self._compute_value, Identity):
            compute_value = None
        return hash((self.name, type(self), compute_value))

    @classmethod
    def make(cls, name, *args, **kwargs):
        """
        Return an existing continuous variable with the given name, or
        construct and return a new one.
        """
        return cls(name, *args, **kwargs)

    @classmethod
    def _clear_cache(cls):
        warnings.warn(
            "_clear_cache is no longer needed and thus deprecated")

    @staticmethod
    def _clear_all_caches():
        warnings.warn(
            "_clear_all_caches is no longer needed and thus deprecated")

    @classmethod
    def is_primitive(cls, var=None):
        """
        `True` if the variable's values are stored as floats.
        Non-primitive variables can appear in the data only as meta attributes.
        """
        to_check = cls if var is None else type(var)
        return issubclass(to_check, (DiscreteVariable, ContinuousVariable))

    @_predicatedescriptor
    def is_discrete(self):
        return isinstance(self, DiscreteVariable)

    @_predicatedescriptor
    def is_continuous(self):
        return isinstance(self, ContinuousVariable)

    @_predicatedescriptor
    def is_string(self):
        return isinstance(self, StringVariable)

    @_predicatedescriptor
    def is_time(self):
        return isinstance(self, TimeVariable)

    @staticmethod
    def repr_val(val):
        """
        Return a textual representation of variable's value `val`. Argument
        `val` must be a float (for primitive variables) or an arbitrary
        Python object (for non-primitives).

        Derived classes must overload the function.
        """
        raise RuntimeError("variable descriptors must overload repr_val()")

    str_val = repr_val

    def to_val(self, s):
        """
        Convert the given argument to a value of the variable. The
        argument can be a string, a number or `None`. For primitive variables,
        the base class provides a method that returns
        :obj:`~Orange.data.Unknown` if `s` is found in
        :obj:`~Orange.data.Variable.unknown_str`, and raises an exception
        otherwise. For non-primitive variables it returns the argument itself.

        Derived classes of primitive variables must overload the function.

        :param s: value, represented as a number, string or `None`
        :type s: str, float or None
        :rtype: float or object
        """
        if not self.is_primitive():
            return s
        if s in self.unknown_str:
            return Unknown
        raise RuntimeError(
            "primitive variable descriptors must overload to_val()")

    def val_from_str_add(self, s):
        """
        Convert the given string to a value of the variable. The method
        is similar to :obj:`to_val` except that it only accepts strings and
        that it adds new values to the variable's domain where applicable.

        The base class method calls `to_val`.

        :param s: symbolic representation of the value
        :type s: str
        :rtype: float or object
        """
        return self.to_val(s)

    def __str__(self):
        return self.name

    @property
    def compute_value(self):
        return self._compute_value

    def __reduce__(self):
        if not self.name:
            raise PickleError("Variables without names cannot be pickled")

        # Use make to unpickle variables.
        return make_variable, (self.__class__, self._compute_value, self.name), self.__dict__

    _CopyComputeValue = object()

    def copy(self, compute_value=_CopyComputeValue, *, name=None, **kwargs):
        if compute_value is self._CopyComputeValue:
            compute_value = self.compute_value
        var = type(self)(name=name or self.name,
                         compute_value=compute_value,
                         sparse=self.sparse, **kwargs)
        var.attributes = dict(self.attributes)
        return var

    def renamed(self, new_name):
        # prevent cyclic import, pylint: disable=import-outside-toplevel
        from Orange.preprocess.transformation import Identity
        return self.copy(name=new_name, compute_value=Identity(variable=self))

del _predicatedescriptor


class ContinuousVariable(Variable):
    """
    Descriptor for continuous variables.

    .. attribute:: number_of_decimals

        The number of decimals when the value is printed out (default: 3).

    .. attribute:: adjust_decimals

        A flag regulating whether the `number_of_decimals` is being adjusted
        by :obj:`to_val`.

    The value of `number_of_decimals` is set to 3 and `adjust_decimals`
    is set to 2. When :obj:`val_from_str_add` is called for the first
    time with a string as an argument, `number_of_decimals` is set to the
    number of decimals in the string and `adjust_decimals` is set to 1.
    In the subsequent calls of `to_val`, the nubmer of decimals is
    increased if the string argument has a larger number of decimals.

    If the `number_of_decimals` is set manually, `adjust_decimals` is
    set to 0 to prevent changes by `to_val`.
    """

    TYPE_HEADERS = ('continuous', 'c', 'numeric', 'n')

    def __init__(self, name="", number_of_decimals=None, compute_value=None, *, sparse=False):
        """
        Construct a new continuous variable. The number of decimals is set to
        three, but adjusted at the first call of :obj:`to_val`.
        """
        super().__init__(name, compute_value, sparse=sparse)
        self._max_round_diff = 0
        self.number_of_decimals = number_of_decimals

    @property
    def number_of_decimals(self):
        return self._number_of_decimals

    @property
    def format_str(self):
        return self._format_str

    @format_str.setter
    def format_str(self, value):
        self._format_str = value

    # noinspection PyAttributeOutsideInit
    @number_of_decimals.setter
    def number_of_decimals(self, x):
        if x is None:
            self._number_of_decimals = 3
            self.adjust_decimals = 2
            self._format_str = "%g"
            return

        self._number_of_decimals = x
        self._max_round_diff = 10 ** (-x - 6)
        self.adjust_decimals = 0
        if self._number_of_decimals <= MAX_NUM_OF_DECIMALS:
            self._format_str = "%.{}f".format(self.number_of_decimals)
        else:
            self._format_str = "%g"

    def to_val(self, s):
        """
        Convert a value, given as an instance of an arbitrary type, to a float.
        """
        if s in self.unknown_str:
            return Unknown
        return float(s)

    def val_from_str_add(self, s):
        """
        Convert a value from a string and adjust the number of decimals if
        `adjust_decimals` is non-zero.
        """
        return _variable.val_from_str_add_cont(self, s)

    def repr_val(self, val):
        """
        Return the value as a string with the prescribed number of decimals.
        """
        if isnan(val):
            return "?"
        if self.format_str != "%g" \
                and abs(round(val, self._number_of_decimals) - val) \
                > self._max_round_diff:
            return f"{val:.{self._number_of_decimals + 2}f}"
        return self._format_str % val

    str_val = repr_val

    def copy(self, compute_value=Variable._CopyComputeValue,
             *, name=None, **kwargs):
        # pylint understand not that `var` is `DiscreteVariable`:
        # pylint: disable=protected-access
        number_of_decimals = kwargs.pop("number_of_decimals", None)
        var = super().copy(compute_value=compute_value, name=name, **kwargs)
        if number_of_decimals is not None:
            var.number_of_decimals = number_of_decimals
        else:
            var._number_of_decimals = self._number_of_decimals
            var._max_round_diff = self._max_round_diff
            var.adjust_decimals = self.adjust_decimals
            var.format_str = self._format_str
        return var


class TupleList(tuple):
    def __add__(self, other):
        if isinstance(other, list):
            warnings.warn(
                "DiscreteVariable.values is a tuple; "
                "support for adding a list will be dropped in Orange 3.27",
                DeprecationWarning)
            return list(self) + other
        return super().__add__(other)

    def copy(self):
        warnings.warn(
            "DiscreteVariable.values is a tuple;"
            "method copy will be dropped in Orange 3.27",
            DeprecationWarning)
        return list(self)


class DiscreteVariable(Variable):
    """
    Descriptor for symbolic, discrete variables. Values of discrete variables
    are stored as floats; the numbers corresponds to indices in the list of
    values.

    .. attribute:: values

        A list of variable's values.

    .. attribute:: ordered

        Some algorithms (and, in particular, visualizations) may
        sometime reorder the values of the variable, e.g. alphabetically.
        This flag hints that the given order of values is "natural"
        (e.g. "small", "middle", "large") and should not be changed.
    """

    TYPE_HEADERS = ('discrete', 'd', 'categorical')

    presorted_values = []

    def __init__(self, name="", values=(), ordered=False, compute_value=None,
                 *, sparse=False):
        """ Construct a discrete variable descriptor with the given values. """
        values = TupleList(values)  # some people (including me) pass a generator
        if not all(isinstance(value, str) for value in values):
            raise TypeError("values of DiscreteVariables must be strings")

        super().__init__(name, compute_value, sparse=sparse)
        self._values = values
        self._value_index = {value: i for i, value in enumerate(values)}
        self.ordered = ordered

    @property
    def values(self):
        return self._values

    def get_mapping_from(self, other):
        return np.array(
            [self._value_index.get(value, np.nan) for value in other.values],
            dtype=float)

    def get_mapper_from(self, other):
        mapping = self.get_mapping_from(other)
        if not mapping.size:
            # Nans in data are temporarily replaced with 0, mapped and changed
            # back to nans. This would fail is mapping[0] is out of range.
            mapping = np.array([np.nan])

        def mapper(value, col_idx=None):

            # In-place mapping
            if col_idx is not None:
                if sp.issparse(value) and mapping[0] != 0:
                    raise ValueError(
                        "In-place mapping of sparse matrices must map 0 to 0")

                # CSR requires mapping of non-contiguous area
                if sp.isspmatrix_csr(value):
                    col = value.indices == col_idx
                    nans = np.isnan(value.data) * col
                    value.data[nans] = 0
                    value.data[col] = mapping[value.data[col].astype(int)]
                    value.data[nans] = np.nan
                    return None

                # Dense and CSC map a contiguous area
                if isinstance(value, np.ndarray) and value.ndim == 2:
                    col = value[:, col_idx]
                elif sp.isspmatrix_csc(value):
                    col = value.data[value.indptr[col_idx]
                                     :value.indptr[col_idx + 1]]
                else:
                    raise ValueError(
                        "In-place column mapping requires a 2d array or"
                        "a csc or csr matrix.")

                nans = np.isnan(col)
                col[nans] = 0
                col[:] = mapping[col.astype(int)]
                col[nans] = np.nan
                return None

            # Mapping into a copy
            if isinstance(value, (int, float)):
                return value if np.isnan(value) else mapping[int(value)]
            if isinstance(value, str):
                return mapping[other.values.index(value)]
            if isinstance(value, np.ndarray):
                if not (value.ndim == 1
                        or value.ndim != 2 and min(value.shape) != 1):
                    raise ValueError(
                        f"Column mapping can't map {value.ndim}-d objects")

                if value.dtype == object:
                    value = value.astype(float)  # this happens with metas
                try:
                    nans = np.isnan(value)
                except TypeError:  # suppose it's already an integer type
                    return mapping[value]
                value = value.astype(int)
                value[nans] = 0
                value = mapping[value]
                value[nans] = np.nan
                return value
            if sp.issparse(value):
                if min(value.shape) != 1:
                    raise ValueError("Column mapping can't map "
                                     f"{value.ndim}-dimensional objects")
                if mapping[0] != 0 and not np.isnan(mapping[0]):
                    return mapper(np.array(value.todense()).flatten())
                value = value.copy()
                value.data = mapper(value.data)
                return value
            if isinstance(value, Iterable):
                return type(value)(val if np.isnan(val) else mapping[int(val)]
                                   for val in value)
            raise ValueError(
                f"invalid type for value(s): {type(value).__name__}")

        return mapper

    def to_val(self, s):
        """
        Convert the given argument to a value of the variable (`float`).
        If the argument is numeric, its value is returned without checking
        whether it is integer and within bounds. `Unknown` is returned if the
        argument is one of the representations for unknown values. Otherwise,
        the argument must be a string and the method returns its index in
        :obj:`values`.

        :param s: values, represented as a number, string or `None`
        :rtype: float
        """
        if s is None:
            return ValueUnknown

        if isinstance(s, Integral):
            return s
        if isinstance(s, Real):
            return s if isnan(s) else floor(s + 0.25)
        if s in self.unknown_str:
            return ValueUnknown
        if not isinstance(s, str):
            raise TypeError('Cannot convert {} to value of "{}"'.format(
                type(s).__name__, self.name))
        if s not in self._value_index:
            raise ValueError(f"Value {s} does not exist")
        return self._value_index[s]

    def add_value(self, s):
        """ Add a value `s` to the list of values.
        """
        if not isinstance(s, str):
            raise TypeError("values of DiscreteVariables must be strings")
        if s in self._value_index:
            return
        self._value_index[s] = len(self.values)
        self._values += (s, )

    def val_from_str_add(self, s):
        """
        Similar to :obj:`to_val`, except that it accepts only strings and that
        it adds the value to the list if it does not exist yet.

        :param s: symbolic representation of the value
        :type s: str
        :rtype: float
        """
        s = str(s) if s is not None else s
        if s in self.unknown_str:
            return ValueUnknown
        val = self._value_index.get(s)
        if val is None:
            self.add_value(s)
            val = len(self.values) - 1
        return val

    def repr_val(self, val):
        """
        Return a textual representation of the value (`self.values[int(val)]`)
        or "?" if the value is unknown.

        :param val: value
        :type val: float (should be whole number)
        :rtype: str
        """
        if isnan(val):
            return "?"
        return '{}'.format(self.values[int(val)])

    str_val = repr_val

    def __reduce__(self):
        if not self.name:
            raise PickleError("Variables without names cannot be pickled")
        __dict__ = dict(self.__dict__)
        __dict__.pop("_values")
        return make_variable, (self.__class__, self._compute_value, self.name,
                               self.values, self.ordered), \
            __dict__

    def copy(self, compute_value=Variable._CopyComputeValue,
             *, name=None, values=None, **_):
        # pylint: disable=arguments-differ
        if values is not None and len(values) != len(self.values):
            raise ValueError(
                "number of values must match the number of original values")
        return super().copy(compute_value=compute_value, name=name,
                            values=values or self.values, ordered=self.ordered)


class StringVariable(Variable):
    """
    Descriptor for string variables. String variables can only appear as
    meta attributes.
    """
    Unknown = ""
    TYPE_HEADERS = ('string', 's', 'text')

    def to_val(self, s):
        """
        Return the value as a string. If it is already a string, the same
        object is returned.
        """
        if s is None:
            return ""
        if isinstance(s, str):
            return s
        return str(s)

    val_from_str_add = to_val

    @staticmethod
    def str_val(val):
        """Return a string representation of the value."""
        if isinstance(val, str) and val == "":
            return "?"
        if isinstance(val, Value):
            if not val.value:
                return "?"
            val = val.value
        return str(val)

    def repr_val(self, val):
        """Return a string representation of the value."""
        return '"{}"'.format(self.str_val(val))


class TimeVariable(ContinuousVariable):
    """
    TimeVariable is a continuous variable with Unix epoch
    (1970-01-01 00:00:00+0000) as the origin (0.0). Later dates are positive
    real numbers (equivalent to Unix timestamp, with microseconds in the
    fraction part), and the dates before it map to the negative real numbers.

    Unfortunately due to limitation of Python datetime, only dates
    with year >= 1 (A.D.) are supported.

    If time is specified without a date, Unix epoch is assumed.

    If time is specified wihout an UTC offset, localtime is assumed.
    """
    _all_vars = {}
    TYPE_HEADERS = ('time', 't')
    UNIX_EPOCH = datetime(1970, 1, 1)
    _ISO_FORMATS = (
        # have_date, have_time, format_str
        # in order of decreased probability
        (1, 1, '%Y-%m-%d %H:%M:%S%z'),
        (1, 1, '%Y-%m-%d %H:%M:%S'),
        (1, 1, '%Y-%m-%d %H:%M'),
        (1, 1, '%Y-%m-%dT%H:%M:%S%z'),
        (1, 1, '%Y-%m-%dT%H:%M:%S'),

        (1, 0, '%Y-%m-%d'),

        (1, 1, '%Y-%m-%d %H:%M:%S.%f'),
        (1, 1, '%Y-%m-%dT%H:%M:%S.%f'),
        (1, 1, '%Y-%m-%d %H:%M:%S.%f%z'),
        (1, 1, '%Y-%m-%dT%H:%M:%S.%f%z'),

        (1, 1, '%Y%m%dT%H%M%S%z'),
        (1, 1, '%Y%m%d%H%M%S%z'),

        (0, 1, '%H:%M:%S.%f'),
        (0, 1, '%H:%M:%S'),
        (0, 1, '%H:%M'),

        # These parse as continuous features (plain numbers)
        (1, 1, '%Y%m%dT%H%M%S'),
        (1, 1, '%Y%m%d%H%M%S'),
        (1, 0, '%Y%m%d'),
        (1, 0, '%Y%j'),
        (1, 0, '%Y'),
        (0, 1, '%H%M%S.%f'),

        # BUG: In Python as in C, %j doesn't necessitate 0-padding,
        # so these two lines must be in this order
        (1, 0, '%Y-%m'),
        (1, 0, '%Y-%j'),
    )
    # Order in which `_ISO_FORMATS` are tried. Must never change order of
    # last 2 items. Only modified via assignment in `parse`.
    __ISO_FORMATS_PROBE_SEQ = list(range(len(_ISO_FORMATS)))
    # The regex that matches all above formats
    REGEX = (r'^('
             r'\d{1,4}-\d{2}-\d{2}([ T]\d{2}:\d{2}(:\d{2}(\.\d+)?([+-]\d{4})?)?)?|'
             r'\d{1,4}\d{2}\d{2}(T?\d{2}\d{2}\d{2}([+-]\d{4})?)?|'
             r'\d{2}:\d{2}(:\d{2}(\.\d+)?)?|'
             r'\d{2}\d{2}\d{2}\.\d+|'
             r'\d{1,4}(-?\d{2,3})?'
             r')$')

    class InvalidDateTimeFormatError(ValueError):
        def __init__(self, date_string):
            super().__init__(
                "Invalid datetime format '{}'. "
                "Only ISO 8601 supported.".format(date_string))

    _matches_iso_format = re.compile(REGEX).match

    # UTC offset and associated timezone. If parsed datetime values provide an
    # offset, it is used for display. If not all values have the same offset,
    # +0000 (=UTC) timezone is used and utc_offset is set to False.
    utc_offset = None
    timezone = timezone.utc

    def __init__(self, *args, have_date=0, have_time=0, **kwargs):
        super().__init__(*args, **kwargs)
        self.have_date = have_date
        self.have_time = have_time

    def copy(self, compute_value=Variable._CopyComputeValue, *, name=None, **_):
        return super().copy(compute_value=compute_value, name=name,
                            have_date=self.have_date, have_time=self.have_time)

    @staticmethod
    def _tzre_sub(s, _subtz=re.compile(r'([+-])(\d\d):(\d\d)$').sub):
        # Replace +ZZ:ZZ with ISO-compatible +ZZZZ, or strip +0000
        return s[:-6] if s.endswith(('+00:00', '-00:00')) else _subtz(r'\1\2\3', s)

    def repr_val(self, val):
        if isnan(val):
            return '?'
        if not self.have_date and not self.have_time:
            # The time is relative, unitless. The value is absolute.
            return str(val.value) if isinstance(val, Value) else str(val)

        # If you know how to simplify this, be my guest
        seconds = int(val)
        microseconds = int(round((val - seconds) * 1e6))
        if val < 0:
            if microseconds:
                seconds, microseconds = seconds - 1, int(1e6) + microseconds
            date = datetime.fromtimestamp(0, tz=self.timezone) + timedelta(seconds=seconds)
        else:
            date = datetime.fromtimestamp(seconds, tz=self.timezone)
        date = str(date.replace(microsecond=microseconds))

        if self.have_date and not self.have_time:
            date = date.split()[0]
        elif not self.have_date and self.have_time:
            date = date.split()[1]
        date = self._tzre_sub(date)
        return date

    str_val = repr_val

    def parse(self, datestr):
        """
        Return `datestr`, a datetime provided in one of ISO 8601 formats,
        parsed as a real number. Value 0 marks the Unix epoch, positive values
        are the dates after it, negative before.

        If date is unspecified, epoch date is assumed.

        If time is unspecified, 00:00:00.0 is assumed.

        If timezone is unspecified, local time is assumed.
        """
        if datestr in MISSING_VALUES:
            return Unknown
        datestr = datestr.strip().rstrip('Z')

        if not self._matches_iso_format(datestr):
            try:
                # If it is a number, assume it is a unix timestamp
                value = float(datestr)
                self.have_date = self.have_time = 1
                return value
            except ValueError:
                raise self.InvalidDateTimeFormatError(datestr)

        try_order = self.__ISO_FORMATS_PROBE_SEQ
        for i, (have_date, have_time, fmt) in enumerate(
                map(self._ISO_FORMATS.__getitem__, try_order)):
            try:
                dt = datetime.strptime(datestr, fmt)
            except ValueError:
                continue
            else:
                # Pop this most-recently-used format index to front,
                # excluding last 2
                if 0 < i < len(try_order) - 2:
                    try_order = try_order.copy()
                    try_order[i], try_order[0] = try_order[0], try_order[i]
                    TimeVariable.__ISO_FORMATS_PROBE_SEQ = try_order
                self.have_date |= have_date
                self.have_time |= have_time
                if not have_date:
                    dt = dt.replace(self.UNIX_EPOCH.year,
                                    self.UNIX_EPOCH.month,
                                    self.UNIX_EPOCH.day)
                break
        else:
            raise self.InvalidDateTimeFormatError(datestr)

        # Remember UTC offset. If not all parsed values share the same offset,
        # remember none of it.
        offset = dt.utcoffset()
        if self.utc_offset is not False:
            if offset and self.utc_offset is None:
                self.utc_offset = offset
                self.timezone = timezone(offset)
            elif self.utc_offset != offset:
                self.utc_offset = False
                self.timezone = timezone.utc

        # Convert time to UTC timezone. In dates without timezone,
        # localtime is assumed. See also:
        # https://docs.python.org/3.4/library/datetime.html#datetime.datetime.timestamp
        if dt.tzinfo:
            dt -= dt.utcoffset()
        dt = dt.replace(tzinfo=timezone.utc)

        # Unix epoch is the origin, older dates are negative
        try:
            return dt.timestamp()
        except OverflowError:
            return -(self.UNIX_EPOCH - dt).total_seconds()

    def parse_exact_iso(self, datestr):
        """
        This function is a meta function to `parse` function. It checks
        whether the date is of the iso format - it does not accept float-like
        date.
        """
        if not self._matches_iso_format(datestr):
            raise self.InvalidDateTimeFormatError(datestr)
        return self.parse(datestr)

    def to_val(self, s):
        """
        Convert a value, given as an instance of an arbitrary type, to a float.
        """
        if isinstance(s, str):
            return self.parse(s)
        else:
            return super().to_val(s)

```
--- 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:** Equal Variables Produce Different Hashes, Causing Assertion Failure

**Description:**
When creating variables that are logically equal, their hash values differ unexpectedly, leading to assertion failures during tests.

**Example Buggy Code:**
```python
from Orange.data import ContinuousVariable
from Orange.preprocess.transformation import Identity

a = ContinuousVariable("a")
b1 = ContinuousVariable("b", compute_value=Identity(a))
b2 = ContinuousVariable("b2", compute_value=Identity(b1))
b3 = ContinuousVariable("b")

# Checking equality
print(a == b2)  # Expected: True
print(b1 == b2)  # Expected: True
print(a == b1)   # Expected: True
print(b1 == b3)  # Expected: False

# Checking hash values
print(hash(a) == hash(b2))  # Expected: True
print(hash(b1) == hash(b2))  # Expected: True
print(hash(a) == hash(b1))   # Expected: True
print(hash(b1) == hash(b3))  # Expected: False
```

**Expected Behavior:**
Variables that are equal (`a == b2`, `b1 == b2`, `a == b1`) should have identical hash values (`hash(a) == hash(b2)`, `hash(b1) == hash(b2)`, `hash(a) == hash(b1)`). Conversely, variables that are not equal (`b1 != b3`) should have different hash values (`hash(b1) != hash(b3)`).

**Actual Behavior:**
While the equality checks pass, the hash comparison `hash(a) == hash(b2)` fails, resulting in different hash values for equal variables. This discrepancy causes assertion failures in tests that rely on consistent hashing for equality.

[/ISSUE]
{
    "TestVariable.test_eq_with_compute_value": "PASSED",
    "TestVariable.test_hash": "PASSED",
    "TestVariable.test_hash_eq": "PASSED",
    "TestVariable.test_name": "PASSED",
    "TestVariable.test_properties": "PASSED",
    "TestVariable.test_properties_as_predicates": "PASSED",
    "TestVariable.test_repr_is_abstract": "PASSED",
    "TestVariable.test_strange_eq": "PASSED",
    "TestVariable.test_to_val": "PASSED",
    "TestDiscreteVariable.test_copy_checks_len_values": "PASSED",
    "TestDiscreteVariable.test_copy_copies_attributes": "PASSED",
    "TestDiscreteVariable.test_dont_make_anonymous_variables": "PASSED",
    "TestDiscreteVariable.test_dont_pickle_anonymous_variables": "PASSED",
    "TestDiscreteVariable.test_make": "PASSED",
    "TestDiscreteVariable.test_mapper_dense": "PASSED",
    "TestDiscreteVariable.test_mapper_dim_check": "PASSED",
    "TestDiscreteVariable.test_mapper_from_no_values": "PASSED",
    "TestDiscreteVariable.test_mapper_inplace": "PASSED",
    "TestDiscreteVariable.test_mapper_sparse": "PASSED",
    "TestDiscreteVariable.test_no_duplicated_values": "PASSED",
    "TestDiscreteVariable.test_no_nonstringvalues": "PASSED",
    "TestDiscreteVariable.test_rename": "PASSED",
    "TestDiscreteVariable.test_repr": "PASSED",
    "TestDiscreteVariable.test_to_val": "PASSED",
    "TestDiscreteVariable.test_tuple_list_warning": "PASSED",
    "TestDiscreteVariable.test_unpickle": "PASSED",
    "TestDiscreteVariable.test_val_from_str": "PASSED",
    "TestDiscreteVariable.test_val_from_str_add": "PASSED",
    "TestContinuousVariable.test_adjust_decimals": "PASSED",
    "TestContinuousVariable.test_copy_copies_attributes": "PASSED",
    "TestContinuousVariable.test_decimals": "PASSED",
    "TestContinuousVariable.test_dont_make_anonymous_variables": "PASSED",
    "TestContinuousVariable.test_dont_pickle_anonymous_variables": "PASSED",
    "TestContinuousVariable.test_make": "PASSED",
    "TestContinuousVariable.test_more_decimals": "PASSED",
    "TestContinuousVariable.test_rename": "PASSED",
    "TestStringVariable.test_copy_copies_attributes": "PASSED",
    "TestStringVariable.test_dont_make_anonymous_variables": "PASSED",
    "TestStringVariable.test_dont_pickle_anonymous_variables": "PASSED",
    "TestStringVariable.test_rename": "PASSED",
    "TestStringVariable.test_val": "PASSED",
    "TestTimeVariable.test_copy_copies_attributes": "PASSED",
    "TestTimeVariable.test_dont_make_anonymous_variables": "PASSED",
    "TestTimeVariable.test_dont_pickle_anonymous_variables": "PASSED",
    "TestTimeVariable.test_have_date": "PASSED",
    "TestTimeVariable.test_have_date_have_time_in_construct": "PASSED",
    "TestTimeVariable.test_no_date_no_time": "PASSED",
    "TestTimeVariable.test_parse_invalid": "PASSED",
    "TestTimeVariable.test_parse_repr": "PASSED",
    "TestTimeVariable.test_parse_timestamp": "PASSED",
    "TestTimeVariable.test_parse_utc": "PASSED",
    "TestTimeVariable.test_readwrite_timevariable": "PASSED",
    "TestTimeVariable.test_rename": "PASSED",
    "TestTimeVariable.test_repr_value": "PASSED",
    "PickleContinuousVariable.test_with_name": "PASSED",
    "PickleDiscreteVariable.test_ordered": "PASSED",
    "PickleDiscreteVariable.test_with_name": "PASSED",
    "PickleDiscreteVariable.test_with_str_value": "PASSED",
    "PickleStringVariable.test_with_name": "PASSED",
    "VariableTestMakeProxy.test_make_proxy_cont": "PASSED",
    "VariableTestMakeProxy.test_make_proxy_disc": "PASSED",
    "VariableTestMakeProxy.test_proxy_has_separate_attributes": "PASSED"
}
diff --git a/Orange/data/variable.py b/Orange/data/variable.py
index 9c2d90977..c5ac2cecb 100644
--- a/Orange/data/variable.py
+++ b/Orange/data/variable.py
@@ -347,34 +347,26 @@ class Variable(Reprable, metaclass=VariableMeta):
         return var
 
     def __eq__(self, other):
-        # pylint: disable=protected-access,import-outside-toplevel
-
-        def to_match(var):
-            if var._compute_value is None:
-                return var
-            elif isinstance(var._compute_value, Identity):
-                return var._compute_value.variable
-            return None
+        if type(self) is not type(other):
+            return False
 
-        from Orange.preprocess.transformation import Identity
-        return type(self) is type(other) and (
-            self.name == other.name
-            and self._compute_value == other._compute_value
-            or
-            (self.compute_value or other.compute_value)
-            and to_match(self) == to_match(other) != None)
+        var1 = self._get_identical_source(self)
+        var2 = self._get_identical_source(other)
+        # pylint: disable=protected-access
+        return var1.name == var2.name \
+               and var1._compute_value == var2._compute_value
 
     def __hash__(self):
-        # Two variables that are not equal can have the same hash.
-        # This happens if one has compute_value == Identity and the other
-        # doesn't have compute_value, or they have a different Identity.
-        # Having the same hash while not being equal is of course allowed.
-        # pylint: disable=import-outside-toplevel
+        var = self._get_identical_source(self)
+        return hash((var.name, type(self), var._compute_value))
+
+    @staticmethod
+    def _get_identical_source(var):
+        # pylint: disable=protected-access,import-outside-toplevel
         from Orange.preprocess.transformation import Identity
-        compute_value = self._compute_value
-        if isinstance(self._compute_value, Identity):
-            compute_value = None
-        return hash((self.name, type(self), compute_value))
+        while isinstance(var._compute_value, Identity):
+            var = var._compute_value.variable
+        return var
 
     @classmethod
     def make(cls, name, *args, **kwargs):
 

{"Orange/data/variable.py": "import re\nimport warnings\nfrom collections import Iterable\n\nfrom datetime import datetime, timedelta, timezone\nfrom numbers import Number, Real, Integral\nfrom math import isnan, floor\nfrom pickle import PickleError\n\nimport numpy as np\nimport scipy.sparse as sp\n\nfrom Orange.data import _variable\nfrom Orange.util import Registry, Reprable, OrangeDeprecationWarning\n\n\n__all__ = [\"Unknown\", \"MISSING_VALUES\", \"make_variable\", \"is_discrete_values\",\n           \"Value\", \"Variable\", \"ContinuousVariable\", \"DiscreteVariable\",\n           \"StringVariable\", \"TimeVariable\"]\n\n\n# For storing unknowns\nUnknown = ValueUnknown = float(\"nan\")\n# For checking for unknowns\nMISSING_VALUES = {np.nan, \"?\", \"nan\", \".\", \"\", \"NA\", \"~\", None}\n\nDISCRETE_MAX_VALUES = 3  # == 2 + nan\nMAX_NUM_OF_DECIMALS = 5\n# the variable with more than 100 different values should not be StringVariable\nDISCRETE_MAX_ALLOWED_VALUES = 100\n\n\ndef make_variable(cls, compute_value, *args):\n    if compute_value is not None:\n        return cls(*args, compute_value=compute_value)\n    else:\n        # For compatibility with old pickles\n        return cls(*args)\n\n\ndef is_discrete_values(values):\n    \"\"\"\n    Return set of uniques if `values` is an iterable of discrete values\n    else False if non-discrete, or None if indeterminate.\n\n    Note\n    ----\n    Assumes consistent type of items of `values`.\n    \"\"\"\n    if len(values) == 0:\n        return None\n    # If the first few values are, or can be converted to, floats,\n    # the type is numeric\n    try:\n        isinstance(next(iter(values)), Number) or \\\n        [float(v) for _, v in zip(range(min(3, len(values))), values)]\n    except ValueError:\n        is_numeric = False\n        max_values = int(round(len(values)**.7))\n    else:\n        is_numeric = True\n        max_values = DISCRETE_MAX_VALUES\n\n    # If more than max values => not discrete\n    unique = set()\n    for i in values:\n        unique.add(i)\n        if (len(unique) > max_values or\n                len(unique) > DISCRETE_MAX_ALLOWED_VALUES):\n            return False\n\n    # Strip NaN from unique\n    unique = {i for i in unique\n              if (not i in MISSING_VALUES and\n                  not (isinstance(i, Number) and np.isnan(i)))}\n\n    # All NaNs => indeterminate\n    if not unique:\n        return None\n\n    # Strings with |values| < max_unique\n    if not is_numeric:\n        return unique\n\n    # Handle numbers\n    try:\n        unique_float = set(map(float, unique))\n    except ValueError:\n        # Converting all the values to floats resulted in an error.\n        # Since the values have enough unique values, they are probably\n        # string values and discrete.\n        return unique\n\n    # If only values are {0, 1} or {1, 2} (or a subset of those sets) => discrete\n    return (not (unique_float - {0, 1}) or\n            not (unique_float - {1, 2})) and unique\n\n\nclass Value(float):\n    \"\"\"\n    The class representing a value. The class is not used to store values but\n    only to return them in contexts in which we want the value to be accompanied\n    with the descriptor, for instance to print the symbolic value of discrete\n    variables.\n\n    The class is derived from `float`, with an additional attribute `variable`\n    which holds the descriptor of type :obj:`Orange.data.Variable`. If the\n    value continuous or discrete, it is stored as a float. Other types of\n    values, like strings, are stored in the attribute `value`.\n\n    The class overloads the methods for printing out the value:\n    `variable.repr_val` and `variable.str_val` are used to get a suitable\n    representation of the value.\n\n    Equivalence operator is overloaded as follows:\n\n    - unknown values are equal; if one value is unknown and the other is not,\n      they are different;\n\n    - if the value is compared with the string, the value is converted to a\n      string using `variable.str_val` and the two strings are compared\n\n    - if the value is stored in attribute `value`, it is compared with the\n      given other value\n\n    - otherwise, the inherited comparison operator for `float` is called.\n\n    Finally, value defines a hash, so values can be put in sets and appear as\n    keys in dictionaries.\n\n    .. attribute:: variable (:obj:`Orange.data.Variable`)\n\n        Descriptor; used for printing out and for comparing with strings\n\n    .. attribute:: value\n\n        Value; the value can be of arbitrary type and is used only for variables\n        that are neither discrete nor continuous. If `value` is `None`, the\n        derived `float` value is used.\n    \"\"\"\n    __slots__ = \"variable\", \"_value\"\n\n    def __new__(cls, variable, value=Unknown):\n        \"\"\"\n        Construct a new instance of Value with the given descriptor and value.\n        If the argument `value` can be converted to float, it is stored as\n        `float` and the attribute `value` is set to `None`. Otherwise, the\n        inherited float is set to `Unknown` and the value is held by the\n        attribute `value`.\n\n        :param variable: descriptor\n        :type variable: Orange.data.Variable\n        :param value: value\n        \"\"\"\n        if variable.is_primitive():\n            self = super().__new__(cls, value)\n            self.variable = variable\n            self._value = None\n        else:\n            isunknown = value == variable.Unknown\n            self = super().__new__(\n                cls, np.nan if isunknown else np.finfo(float).min)\n            self.variable = variable\n            self._value = value\n        return self\n\n    def __init__(self, _, __=Unknown):\n        # __new__ does the job, pylint: disable=super-init-not-called\n        pass\n\n    def __repr__(self):\n        return \"Value('%s', %s)\" % (self.variable.name,\n                                    self.variable.repr_val(self))\n\n    def __str__(self):\n        return self.variable.str_val(self)\n\n    def __eq__(self, other):\n        if isinstance(self, Real) and isnan(self):\n            if isinstance(other, Real):\n                return isnan(other)\n            else:\n                return other in self.variable.unknown_str\n        if isinstance(other, str):\n            return self.variable.str_val(self) == other\n        if isinstance(other, Value):\n            return self.value == other.value\n        return super().__eq__(other)\n\n    def __ne__(self, other):\n        return not self.__eq__(other)\n\n    def __lt__(self, other):\n        if self.variable.is_primitive():\n            if isinstance(other, str):\n                return super().__lt__(self.variable.to_val(other))\n            else:\n                return super().__lt__(other)\n        else:\n            if isinstance(other, str):\n                return self.value < other\n            else:\n                return self.value < other.value\n\n    def __le__(self, other):\n        return self.__lt__(other) or self.__eq__(other)\n\n    def __gt__(self, other):\n        return not self.__le__(other)\n\n    def __ge__(self, other):\n        return not self.__lt__(other)\n\n    def __contains__(self, other):\n        if (self._value is not None\n                and isinstance(self._value, str)\n                and isinstance(other, str)):\n            return other in self._value\n        raise TypeError(\"invalid operation on Value()\")\n\n    def __hash__(self):\n        if self.variable.is_discrete:\n            # It is not possible to hash the id and the domain value to the\n            # same number as required by __eq__.\n            # hash(1)\n            # == hash(Value(DiscreteVariable(\"var\", [\"red\", \"green\", \"blue\"]), 1))\n            # == hash(\"green\")\n            # User should hash directly ids or domain values instead.\n            raise TypeError(\"unhashable type - cannot hash values of discrete variables!\")\n        if self._value is None:\n            return super().__hash__()\n        else:\n            return hash(self._value)\n\n    @property\n    def value(self):\n        if self.variable.is_discrete:\n            return Unknown if isnan(self) else self.variable.values[int(self)]\n        if self.variable.is_string:\n            return self._value\n        return float(self)\n\n    def __getnewargs__(self):\n        return self.variable, float(self)\n\n    def __getstate__(self):\n        return dict(value=getattr(self, '_value', None))\n\n    def __setstate__(self, state):\n        # defined in __new__, pylint: disable=attribute-defined-outside-init\n        self._value = state.get('value', None)\n\n\nclass VariableMeta(Registry):\n    pass\n\n\nclass _predicatedescriptor(property):\n    \"\"\"\n    A property that behaves as a class method if accessed via a class\n    >>> class A:\n    ...     foo = False\n    ...     @_predicatedescriptor\n    ...     def is_foo(self):\n    ...         return self.foo\n    ...\n    >>> a = A()\n    >>> a.is_foo\n    False\n    >>> A.is_foo(a)\n    False\n    \"\"\"\n    def __get__(self, instance, objtype=None):\n        if instance is None:\n            return self.fget\n        else:\n            return super().__get__(instance, objtype)\n\n\nclass Variable(Reprable, metaclass=VariableMeta):\n    \"\"\"\n    The base class for variable descriptors contains the variable's\n    name and some basic properties.\n\n    .. attribute:: name\n\n        The name of the variable.\n\n    .. attribute:: unknown_str\n\n        A set of values that represent unknowns in conversion from textual\n        formats. Default is `{\"?\", \".\", \"\", \"NA\", \"~\", None}`.\n\n    .. attribute:: compute_value\n\n        A function for computing the variable's value when converting from\n        another domain which does not contain this variable. The function will\n        be called with a data set (`Orange.data.Table`) and has to return\n        an array of computed values for all its instances. The base class\n        defines a static method `compute_value`, which returns `Unknown`.\n        Non-primitive variables must redefine it to return `None`.\n\n    .. attribute:: sparse\n\n        A flag about sparsity of the variable. When set, the variable suggests\n        it should be stored in a sparse matrix.\n\n    .. attribute:: source_variable\n\n        An optional descriptor of the source variable - if any - from which\n        this variable is derived and computed via :obj:`compute_value`.\n\n    .. attribute:: attributes\n\n        A dictionary with user-defined attributes of the variable\n    \"\"\"\n    Unknown = ValueUnknown\n\n    def __init__(self, name=\"\", compute_value=None, *, sparse=False):\n        \"\"\"\n        Construct a variable descriptor.\n        \"\"\"\n        if not name:\n            warnings.warn(\"Variable must have a name\", OrangeDeprecationWarning,\n                          stacklevel=3)\n        self._name = name\n        self._compute_value = compute_value\n        self.unknown_str = MISSING_VALUES\n        self.source_variable = None\n        self.sparse = sparse\n        self.attributes = {}\n\n    @property\n    def name(self):\n        return self._name\n\n    def make_proxy(self):\n        \"\"\"\n        Copy the variable and set the master to `self.master` or to `self`.\n\n        :return: copy of self\n        :rtype: Variable\n        \"\"\"\n        var = self.__class__(self.name)\n        var.__dict__.update(self.__dict__)\n        var.attributes = dict(self.attributes)\n        return var\n\n    def __eq__(self, other):\n        # pylint: disable=protected-access,import-outside-toplevel\n\n        def to_match(var):\n            if var._compute_value is None:\n                return var\n            elif isinstance(var._compute_value, Identity):\n                return var._compute_value.variable\n            return None\n\n        from Orange.preprocess.transformation import Identity\n        return type(self) is type(other) and (\n            self.name == other.name\n            and self._compute_value == other._compute_value\n            or\n            (self.compute_value or other.compute_value)\n            and to_match(self) == to_match(other) != None)\n\n    def __hash__(self):\n        # Two variables that are not equal can have the same hash.\n        # This happens if one has compute_value == Identity and the other\n        # doesn't have compute_value, or they have a different Identity.\n        # Having the same hash while not being equal is of course allowed.\n        # pylint: disable=import-outside-toplevel\n        from Orange.preprocess.transformation import Identity\n        compute_value = self._compute_value\n        if isinstance(self._compute_value, Identity):\n            compute_value = None\n        return hash((self.name, type(self), compute_value))\n\n    @classmethod\n    def make(cls, name, *args, **kwargs):\n        \"\"\"\n        Return an existing continuous variable with the given name, or\n        construct and return a new one.\n        \"\"\"\n        return cls(name, *args, **kwargs)\n\n    @classmethod\n    def _clear_cache(cls):\n        warnings.warn(\n            \"_clear_cache is no longer needed and thus deprecated\")\n\n    @staticmethod\n    def _clear_all_caches():\n        warnings.warn(\n            \"_clear_all_caches is no longer needed and thus deprecated\")\n\n    @classmethod\n    def is_primitive(cls, var=None):\n        \"\"\"\n        `True` if the variable's values are stored as floats.\n        Non-primitive variables can appear in the data only as meta attributes.\n        \"\"\"\n        to_check = cls if var is None else type(var)\n        return issubclass(to_check, (DiscreteVariable, ContinuousVariable))\n\n    @_predicatedescriptor\n    def is_discrete(self):\n        return isinstance(self, DiscreteVariable)\n\n    @_predicatedescriptor\n    def is_continuous(self):\n        return isinstance(self, ContinuousVariable)\n\n    @_predicatedescriptor\n    def is_string(self):\n        return isinstance(self, StringVariable)\n\n    @_predicatedescriptor\n    def is_time(self):\n        return isinstance(self, TimeVariable)\n\n    @staticmethod\n    def repr_val(val):\n        \"\"\"\n        Return a textual representation of variable's value `val`. Argument\n        `val` must be a float (for primitive variables) or an arbitrary\n        Python object (for non-primitives).\n\n        Derived classes must overload the function.\n        \"\"\"\n        raise RuntimeError(\"variable descriptors must overload repr_val()\")\n\n    str_val = repr_val\n\n    def to_val(self, s):\n        \"\"\"\n        Convert the given argument to a value of the variable. The\n        argument can be a string, a number or `None`. For primitive variables,\n        the base class provides a method that returns\n        :obj:`~Orange.data.Unknown` if `s` is found in\n        :obj:`~Orange.data.Variable.unknown_str`, and raises an exception\n        otherwise. For non-primitive variables it returns the argument itself.\n\n        Derived classes of primitive variables must overload the function.\n\n        :param s: value, represented as a number, string or `None`\n        :type s: str, float or None\n        :rtype: float or object\n        \"\"\"\n        if not self.is_primitive():\n            return s\n        if s in self.unknown_str:\n            return Unknown\n        raise RuntimeError(\n            \"primitive variable descriptors must overload to_val()\")\n\n    def val_from_str_add(self, s):\n        \"\"\"\n        Convert the given string to a value of the variable. The method\n        is similar to :obj:`to_val` except that it only accepts strings and\n        that it adds new values to the variable's domain where applicable.\n\n        The base class method calls `to_val`.\n\n        :param s: symbolic representation of the value\n        :type s: str\n        :rtype: float or object\n        \"\"\"\n        return self.to_val(s)\n\n    def __str__(self):\n        return self.name\n\n    @property\n    def compute_value(self):\n        return self._compute_value\n\n    def __reduce__(self):\n        if not self.name:\n            raise PickleError(\"Variables without names cannot be pickled\")\n\n        # Use make to unpickle variables.\n        return make_variable, (self.__class__, self._compute_value, self.name), self.__dict__\n\n    _CopyComputeValue = object()\n\n    def copy(self, compute_value=_CopyComputeValue, *, name=None, **kwargs):\n        if compute_value is self._CopyComputeValue:\n            compute_value = self.compute_value\n        var = type(self)(name=name or self.name,\n                         compute_value=compute_value,\n                         sparse=self.sparse, **kwargs)\n        var.attributes = dict(self.attributes)\n        return var\n\n    def renamed(self, new_name):\n        # prevent cyclic import, pylint: disable=import-outside-toplevel\n        from Orange.preprocess.transformation import Identity\n        return self.copy(name=new_name, compute_value=Identity(variable=self))\n\ndel _predicatedescriptor\n\n\nclass ContinuousVariable(Variable):\n    \"\"\"\n    Descriptor for continuous variables.\n\n    .. attribute:: number_of_decimals\n\n        The number of decimals when the value is printed out (default: 3).\n\n    .. attribute:: adjust_decimals\n\n        A flag regulating whether the `number_of_decimals` is being adjusted\n        by :obj:`to_val`.\n\n    The value of `number_of_decimals` is set to 3 and `adjust_decimals`\n    is set to 2. When :obj:`val_from_str_add` is called for the first\n    time with a string as an argument, `number_of_decimals` is set to the\n    number of decimals in the string and `adjust_decimals` is set to 1.\n    In the subsequent calls of `to_val`, the nubmer of decimals is\n    increased if the string argument has a larger number of decimals.\n\n    If the `number_of_decimals` is set manually, `adjust_decimals` is\n    set to 0 to prevent changes by `to_val`.\n    \"\"\"\n\n    TYPE_HEADERS = ('continuous', 'c', 'numeric', 'n')\n\n    def __init__(self, name=\"\", number_of_decimals=None, compute_value=None, *, sparse=False):\n        \"\"\"\n        Construct a new continuous variable. The number of decimals is set to\n        three, but adjusted at the first call of :obj:`to_val`.\n        \"\"\"\n        super().__init__(name, compute_value, sparse=sparse)\n        self._max_round_diff = 0\n        self.number_of_decimals = number_of_decimals\n\n    @property\n    def number_of_decimals(self):\n        return self._number_of_decimals\n\n    @property\n    def format_str(self):\n        return self._format_str\n\n    @format_str.setter\n    def format_str(self, value):\n        self._format_str = value\n\n    # noinspection PyAttributeOutsideInit\n    @number_of_decimals.setter\n    def number_of_decimals(self, x):\n        if x is None:\n            self._number_of_decimals = 3\n            self.adjust_decimals = 2\n            self._format_str = \"%g\"\n            return\n\n        self._number_of_decimals = x\n        self._max_round_diff = 10 ** (-x - 6)\n        self.adjust_decimals = 0\n        if self._number_of_decimals <= MAX_NUM_OF_DECIMALS:\n            self._format_str = \"%.{}f\".format(self.number_of_decimals)\n        else:\n            self._format_str = \"%g\"\n\n    def to_val(self, s):\n        \"\"\"\n        Convert a value, given as an instance of an arbitrary type, to a float.\n        \"\"\"\n        if s in self.unknown_str:\n            return Unknown\n        return float(s)\n\n    def val_from_str_add(self, s):\n        \"\"\"\n        Convert a value from a string and adjust the number of decimals if\n        `adjust_decimals` is non-zero.\n        \"\"\"\n        return _variable.val_from_str_add_cont(self, s)\n\n    def repr_val(self, val):\n        \"\"\"\n        Return the value as a string with the prescribed number of decimals.\n        \"\"\"\n        if isnan(val):\n            return \"?\"\n        if self.format_str != \"%g\" \\\n                and abs(round(val, self._number_of_decimals) - val) \\\n                > self._max_round_diff:\n            return f\"{val:.{self._number_of_decimals + 2}f}\"\n        return self._format_str % val\n\n    str_val = repr_val\n\n    def copy(self, compute_value=Variable._CopyComputeValue,\n             *, name=None, **kwargs):\n        # pylint understand not that `var` is `DiscreteVariable`:\n        # pylint: disable=protected-access\n        number_of_decimals = kwargs.pop(\"number_of_decimals\", None)\n        var = super().copy(compute_value=compute_value, name=name, **kwargs)\n        if number_of_decimals is not None:\n            var.number_of_decimals = number_of_decimals\n        else:\n            var._number_of_decimals = self._number_of_decimals\n            var._max_round_diff = self._max_round_diff\n            var.adjust_decimals = self.adjust_decimals\n            var.format_str = self._format_str\n        return var\n\n\nclass TupleList(tuple):\n    def __add__(self, other):\n        if isinstance(other, list):\n            warnings.warn(\n                \"DiscreteVariable.values is a tuple; \"\n                \"support for adding a list will be dropped in Orange 3.27\",\n                DeprecationWarning)\n            return list(self) + other\n        return super().__add__(other)\n\n    def copy(self):\n        warnings.warn(\n            \"DiscreteVariable.values is a tuple;\"\n            \"method copy will be dropped in Orange 3.27\",\n            DeprecationWarning)\n        return list(self)\n\n\nclass DiscreteVariable(Variable):\n    \"\"\"\n    Descriptor for symbolic, discrete variables. Values of discrete variables\n    are stored as floats; the numbers corresponds to indices in the list of\n    values.\n\n    .. attribute:: values\n\n        A list of variable's values.\n\n    .. attribute:: ordered\n\n        Some algorithms (and, in particular, visualizations) may\n        sometime reorder the values of the variable, e.g. alphabetically.\n        This flag hints that the given order of values is \"natural\"\n        (e.g. \"small\", \"middle\", \"large\") and should not be changed.\n    \"\"\"\n\n    TYPE_HEADERS = ('discrete', 'd', 'categorical')\n\n    presorted_values = []\n\n    def __init__(self, name=\"\", values=(), ordered=False, compute_value=None,\n                 *, sparse=False):\n        \"\"\" Construct a discrete variable descriptor with the given values. \"\"\"\n        values = TupleList(values)  # some people (including me) pass a generator\n        if not all(isinstance(value, str) for value in values):\n            raise TypeError(\"values of DiscreteVariables must be strings\")\n\n        super().__init__(name, compute_value, sparse=sparse)\n        self._values = values\n        self._value_index = {value: i for i, value in enumerate(values)}\n        self.ordered = ordered\n\n    @property\n    def values(self):\n        return self._values\n\n    def get_mapping_from(self, other):\n        return np.array(\n            [self._value_index.get(value, np.nan) for value in other.values],\n            dtype=float)\n\n    def get_mapper_from(self, other):\n        mapping = self.get_mapping_from(other)\n        if not mapping.size:\n            # Nans in data are temporarily replaced with 0, mapped and changed\n            # back to nans. This would fail is mapping[0] is out of range.\n            mapping = np.array([np.nan])\n\n        def mapper(value, col_idx=None):\n\n            # In-place mapping\n            if col_idx is not None:\n                if sp.issparse(value) and mapping[0] != 0:\n                    raise ValueError(\n                        \"In-place mapping of sparse matrices must map 0 to 0\")\n\n                # CSR requires mapping of non-contiguous area\n                if sp.isspmatrix_csr(value):\n                    col = value.indices == col_idx\n                    nans = np.isnan(value.data) * col\n                    value.data[nans] = 0\n                    value.data[col] = mapping[value.data[col].astype(int)]\n                    value.data[nans] = np.nan\n                    return None\n\n                # Dense and CSC map a contiguous area\n                if isinstance(value, np.ndarray) and value.ndim == 2:\n                    col = value[:, col_idx]\n                elif sp.isspmatrix_csc(value):\n                    col = value.data[value.indptr[col_idx]\n                                     :value.indptr[col_idx + 1]]\n                else:\n                    raise ValueError(\n                        \"In-place column mapping requires a 2d array or\"\n                        \"a csc or csr matrix.\")\n\n                nans = np.isnan(col)\n                col[nans] = 0\n                col[:] = mapping[col.astype(int)]\n                col[nans] = np.nan\n                return None\n\n            # Mapping into a copy\n            if isinstance(value, (int, float)):\n                return value if np.isnan(value) else mapping[int(value)]\n            if isinstance(value, str):\n                return mapping[other.values.index(value)]\n            if isinstance(value, np.ndarray):\n                if not (value.ndim == 1\n                        or value.ndim != 2 and min(value.shape) != 1):\n                    raise ValueError(\n                        f\"Column mapping can't map {value.ndim}-d objects\")\n\n                if value.dtype == object:\n                    value = value.astype(float)  # this happens with metas\n                try:\n                    nans = np.isnan(value)\n                except TypeError:  # suppose it's already an integer type\n                    return mapping[value]\n                value = value.astype(int)\n                value[nans] = 0\n                value = mapping[value]\n                value[nans] = np.nan\n                return value\n            if sp.issparse(value):\n                if min(value.shape) != 1:\n                    raise ValueError(\"Column mapping can't map \"\n                                     f\"{value.ndim}-dimensional objects\")\n                if mapping[0] != 0 and not np.isnan(mapping[0]):\n                    return mapper(np.array(value.todense()).flatten())\n                value = value.copy()\n                value.data = mapper(value.data)\n                return value\n            if isinstance(value, Iterable):\n                return type(value)(val if np.isnan(val) else mapping[int(val)]\n                                   for val in value)\n            raise ValueError(\n                f\"invalid type for value(s): {type(value).__name__}\")\n\n        return mapper\n\n    def to_val(self, s):\n        \"\"\"\n        Convert the given argument to a value of the variable (`float`).\n        If the argument is numeric, its value is returned without checking\n        whether it is integer and within bounds. `Unknown` is returned if the\n        argument is one of the representations for unknown values. Otherwise,\n        the argument must be a string and the method returns its index in\n        :obj:`values`.\n\n        :param s: values, represented as a number, string or `None`\n        :rtype: float\n        \"\"\"\n        if s is None:\n            return ValueUnknown\n\n        if isinstance(s, Integral):\n            return s\n        if isinstance(s, Real):\n            return s if isnan(s) else floor(s + 0.25)\n        if s in self.unknown_str:\n            return ValueUnknown\n        if not isinstance(s, str):\n            raise TypeError('Cannot convert {} to value of \"{}\"'.format(\n                type(s).__name__, self.name))\n        if s not in self._value_index:\n            raise ValueError(f\"Value {s} does not exist\")\n        return self._value_index[s]\n\n    def add_value(self, s):\n        \"\"\" Add a value `s` to the list of values.\n        \"\"\"\n        if not isinstance(s, str):\n            raise TypeError(\"values of DiscreteVariables must be strings\")\n        if s in self._value_index:\n            return\n        self._value_index[s] = len(self.values)\n        self._values += (s, )\n\n    def val_from_str_add(self, s):\n        \"\"\"\n        Similar to :obj:`to_val`, except that it accepts only strings and that\n        it adds the value to the list if it does not exist yet.\n\n        :param s: symbolic representation of the value\n        :type s: str\n        :rtype: float\n        \"\"\"\n        s = str(s) if s is not None else s\n        if s in self.unknown_str:\n            return ValueUnknown\n        val = self._value_index.get(s)\n        if val is None:\n            self.add_value(s)\n            val = len(self.values) - 1\n        return val\n\n    def repr_val(self, val):\n        \"\"\"\n        Return a textual representation of the value (`self.values[int(val)]`)\n        or \"?\" if the value is unknown.\n\n        :param val: value\n        :type val: float (should be whole number)\n        :rtype: str\n        \"\"\"\n        if isnan(val):\n            return \"?\"\n        return '{}'.format(self.values[int(val)])\n\n    str_val = repr_val\n\n    def __reduce__(self):\n        if not self.name:\n            raise PickleError(\"Variables without names cannot be pickled\")\n        __dict__ = dict(self.__dict__)\n        __dict__.pop(\"_values\")\n        return make_variable, (self.__class__, self._compute_value, self.name,\n                               self.values, self.ordered), \\\n            __dict__\n\n    def copy(self, compute_value=Variable._CopyComputeValue,\n             *, name=None, values=None, **_):\n        # pylint: disable=arguments-differ\n        if values is not None and len(values) != len(self.values):\n            raise ValueError(\n                \"number of values must match the number of original values\")\n        return super().copy(compute_value=compute_value, name=name,\n                            values=values or self.values, ordered=self.ordered)\n\n\nclass StringVariable(Variable):\n    \"\"\"\n    Descriptor for string variables. String variables can only appear as\n    meta attributes.\n    \"\"\"\n    Unknown = \"\"\n    TYPE_HEADERS = ('string', 's', 'text')\n\n    def to_val(self, s):\n        \"\"\"\n        Return the value as a string. If it is already a string, the same\n        object is returned.\n        \"\"\"\n        if s is None:\n            return \"\"\n        if isinstance(s, str):\n            return s\n        return str(s)\n\n    val_from_str_add = to_val\n\n    @staticmethod\n    def str_val(val):\n        \"\"\"Return a string representation of the value.\"\"\"\n        if isinstance(val, str) and val == \"\":\n            return \"?\"\n        if isinstance(val, Value):\n            if not val.value:\n                return \"?\"\n            val = val.value\n        return str(val)\n\n    def repr_val(self, val):\n        \"\"\"Return a string representation of the value.\"\"\"\n        return '\"{}\"'.format(self.str_val(val))\n\n\nclass TimeVariable(ContinuousVariable):\n    \"\"\"\n    TimeVariable is a continuous variable with Unix epoch\n    (1970-01-01 00:00:00+0000) as the origin (0.0). Later dates are positive\n    real numbers (equivalent to Unix timestamp, with microseconds in the\n    fraction part), and the dates before it map to the negative real numbers.\n\n    Unfortunately due to limitation of Python datetime, only dates\n    with year >= 1 (A.D.) are supported.\n\n    If time is specified without a date, Unix epoch is assumed.\n\n    If time is specified wihout an UTC offset, localtime is assumed.\n    \"\"\"\n    _all_vars = {}\n    TYPE_HEADERS = ('time', 't')\n    UNIX_EPOCH = datetime(1970, 1, 1)\n    _ISO_FORMATS = (\n        # have_date, have_time, format_str\n        # in order of decreased probability\n        (1, 1, '%Y-%m-%d %H:%M:%S%z'),\n        (1, 1, '%Y-%m-%d %H:%M:%S'),\n        (1, 1, '%Y-%m-%d %H:%M'),\n        (1, 1, '%Y-%m-%dT%H:%M:%S%z'),\n        (1, 1, '%Y-%m-%dT%H:%M:%S'),\n\n        (1, 0, '%Y-%m-%d'),\n\n        (1, 1, '%Y-%m-%d %H:%M:%S.%f'),\n        (1, 1, '%Y-%m-%dT%H:%M:%S.%f'),\n        (1, 1, '%Y-%m-%d %H:%M:%S.%f%z'),\n        (1, 1, '%Y-%m-%dT%H:%M:%S.%f%z'),\n\n        (1, 1, '%Y%m%dT%H%M%S%z'),\n        (1, 1, '%Y%m%d%H%M%S%z'),\n\n        (0, 1, '%H:%M:%S.%f'),\n        (0, 1, '%H:%M:%S'),\n        (0, 1, '%H:%M'),\n\n        # These parse as continuous features (plain numbers)\n        (1, 1, '%Y%m%dT%H%M%S'),\n        (1, 1, '%Y%m%d%H%M%S'),\n        (1, 0, '%Y%m%d'),\n        (1, 0, '%Y%j'),\n        (1, 0, '%Y'),\n        (0, 1, '%H%M%S.%f'),\n\n        # BUG: In Python as in C, %j doesn't necessitate 0-padding,\n        # so these two lines must be in this order\n        (1, 0, '%Y-%m'),\n        (1, 0, '%Y-%j'),\n    )\n    # Order in which `_ISO_FORMATS` are tried. Must never change order of\n    # last 2 items. Only modified via assignment in `parse`.\n    __ISO_FORMATS_PROBE_SEQ = list(range(len(_ISO_FORMATS)))\n    # The regex that matches all above formats\n    REGEX = (r'^('\n             r'\\d{1,4}-\\d{2}-\\d{2}([ T]\\d{2}:\\d{2}(:\\d{2}(\\.\\d+)?([+-]\\d{4})?)?)?|'\n             r'\\d{1,4}\\d{2}\\d{2}(T?\\d{2}\\d{2}\\d{2}([+-]\\d{4})?)?|'\n             r'\\d{2}:\\d{2}(:\\d{2}(\\.\\d+)?)?|'\n             r'\\d{2}\\d{2}\\d{2}\\.\\d+|'\n             r'\\d{1,4}(-?\\d{2,3})?'\n             r')$')\n\n    class InvalidDateTimeFormatError(ValueError):\n        def __init__(self, date_string):\n            super().__init__(\n                \"Invalid datetime format '{}'. \"\n                \"Only ISO 8601 supported.\".format(date_string))\n\n    _matches_iso_format = re.compile(REGEX).match\n\n    # UTC offset and associated timezone. If parsed datetime values provide an\n    # offset, it is used for display. If not all values have the same offset,\n    # +0000 (=UTC) timezone is used and utc_offset is set to False.\n    utc_offset = None\n    timezone = timezone.utc\n\n    def __init__(self, *args, have_date=0, have_time=0, **kwargs):\n        super().__init__(*args, **kwargs)\n        self.have_date = have_date\n        self.have_time = have_time\n\n    def copy(self, compute_value=Variable._CopyComputeValue, *, name=None, **_):\n        return super().copy(compute_value=compute_value, name=name,\n                            have_date=self.have_date, have_time=self.have_time)\n\n    @staticmethod\n    def _tzre_sub(s, _subtz=re.compile(r'([+-])(\\d\\d):(\\d\\d)$').sub):\n        # Replace +ZZ:ZZ with ISO-compatible +ZZZZ, or strip +0000\n        return s[:-6] if s.endswith(('+00:00', '-00:00')) else _subtz(r'\\1\\2\\3', s)\n\n    def repr_val(self, val):\n        if isnan(val):\n            return '?'\n        if not self.have_date and not self.have_time:\n            # The time is relative, unitless. The value is absolute.\n            return str(val.value) if isinstance(val, Value) else str(val)\n\n        # If you know how to simplify this, be my guest\n        seconds = int(val)\n        microseconds = int(round((val - seconds) * 1e6))\n        if val < 0:\n            if microseconds:\n                seconds, microseconds = seconds - 1, int(1e6) + microseconds\n            date = datetime.fromtimestamp(0, tz=self.timezone) + timedelta(seconds=seconds)\n        else:\n            date = datetime.fromtimestamp(seconds, tz=self.timezone)\n        date = str(date.replace(microsecond=microseconds))\n\n        if self.have_date and not self.have_time:\n            date = date.split()[0]\n        elif not self.have_date and self.have_time:\n            date = date.split()[1]\n        date = self._tzre_sub(date)\n        return date\n\n    str_val = repr_val\n\n    def parse(self, datestr):\n        \"\"\"\n        Return `datestr`, a datetime provided in one of ISO 8601 formats,\n        parsed as a real number. Value 0 marks the Unix epoch, positive values\n        are the dates after it, negative before.\n\n        If date is unspecified, epoch date is assumed.\n\n        If time is unspecified, 00:00:00.0 is assumed.\n\n        If timezone is unspecified, local time is assumed.\n        \"\"\"\n        if datestr in MISSING_VALUES:\n            return Unknown\n        datestr = datestr.strip().rstrip('Z')\n\n        if not self._matches_iso_format(datestr):\n            try:\n                # If it is a number, assume it is a unix timestamp\n                value = float(datestr)\n                self.have_date = self.have_time = 1\n                return value\n            except ValueError:\n                raise self.InvalidDateTimeFormatError(datestr)\n\n        try_order = self.__ISO_FORMATS_PROBE_SEQ\n        for i, (have_date, have_time, fmt) in enumerate(\n                map(self._ISO_FORMATS.__getitem__, try_order)):\n            try:\n                dt = datetime.strptime(datestr, fmt)\n            except ValueError:\n                continue\n            else:\n                # Pop this most-recently-used format index to front,\n                # excluding last 2\n                if 0 < i < len(try_order) - 2:\n                    try_order = try_order.copy()\n                    try_order[i], try_order[0] = try_order[0], try_order[i]\n                    TimeVariable.__ISO_FORMATS_PROBE_SEQ = try_order\n                self.have_date |= have_date\n                self.have_time |= have_time\n                if not have_date:\n                    dt = dt.replace(self.UNIX_EPOCH.year,\n                                    self.UNIX_EPOCH.month,\n                                    self.UNIX_EPOCH.day)\n                break\n        else:\n            raise self.InvalidDateTimeFormatError(datestr)\n\n        # Remember UTC offset. If not all parsed values share the same offset,\n        # remember none of it.\n        offset = dt.utcoffset()\n        if self.utc_offset is not False:\n            if offset and self.utc_offset is None:\n                self.utc_offset = offset\n                self.timezone = timezone(offset)\n            elif self.utc_offset != offset:\n                self.utc_offset = False\n                self.timezone = timezone.utc\n\n        # Convert time to UTC timezone. In dates without timezone,\n        # localtime is assumed. See also:\n        # https://docs.python.org/3.4/library/datetime.html#datetime.datetime.timestamp\n        if dt.tzinfo:\n            dt -= dt.utcoffset()\n        dt = dt.replace(tzinfo=timezone.utc)\n\n        # Unix epoch is the origin, older dates are negative\n        try:\n            return dt.timestamp()\n        except OverflowError:\n            return -(self.UNIX_EPOCH - dt).total_seconds()\n\n    def parse_exact_iso(self, datestr):\n        \"\"\"\n        This function is a meta function to `parse` function. It checks\n        whether the date is of the iso format - it does not accept float-like\n        date.\n        \"\"\"\n        if not self._matches_iso_format(datestr):\n            raise self.InvalidDateTimeFormatError(datestr)\n        return self.parse(datestr)\n\n    def to_val(self, s):\n        \"\"\"\n        Convert a value, given as an instance of an arbitrary type, to a float.\n        \"\"\"\n        if isinstance(s, str):\n            return self.parse(s)\n        else:\n            return super().to_val(s)\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:** Equal Variables Produce Different Hashes, Causing Assertion Failure

**Description:**
When creating variables that are logically equal, their hash values differ unexpectedly, leading to assertion failures during tests.

**Example Buggy Code:**
```python
from Orange.data import ContinuousVariable
from Orange.preprocess.transformation import Identity

a = ContinuousVariable("a")
b1 = ContinuousVariable("b", compute_value=Identity(a))
b2 = ContinuousVariable("b2", compute_value=Identity(b1))
b3 = ContinuousVariable("b")

# Checking equality
print(a == b2)  # Expected: True
print(b1 == b2)  # Expected: True
print(a == b1)   # Expected: True
print(b1 == b3)  # Expected: False

# Checking hash values
print(hash(a) == hash(b2))  # Expected: True
print(hash(b1) == hash(b2))  # Expected: True
print(hash(a) == hash(b1))   # Expected: True
print(hash(b1) == hash(b3))  # Expected: False
```

**Expected Behavior:**
Variables that are equal (`a == b2`, `b1 == b2`, `a == b1`) should have identical hash values (`hash(a) == hash(b2)`, `hash(b1) == hash(b2)`, `hash(a) == hash(b1)`). Conversely, variables that are not equal (`b1 != b3`) should have different hash values (`hash(b1) != hash(b3)`).

**Actual Behavior:**
While the equality checks pass, the hash comparison `hash(a) == hash(b2)` fails, resulting in different hash values for equal variables. This discrepancy causes assertion failures in tests that rely on consistent hashing for equality.

[/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/variable.py
import re
import warnings
from collections import Iterable

from datetime import datetime, timedelta, timezone
from numbers import Number, Real, Integral
from math import isnan, floor
from pickle import PickleError

import numpy as np
import scipy.sparse as sp

from Orange.data import _variable
from Orange.util import Registry, Reprable, OrangeDeprecationWarning


__all__ = ["Unknown", "MISSING_VALUES", "make_variable", "is_discrete_values",
           "Value", "Variable", "ContinuousVariable", "DiscreteVariable",
           "StringVariable", "TimeVariable"]


# For storing unknowns
Unknown = ValueUnknown = float("nan")
# For checking for unknowns
MISSING_VALUES = {np.nan, "?", "nan", ".", "", "NA", "~", None}

DISCRETE_MAX_VALUES = 3  # == 2 + nan
MAX_NUM_OF_DECIMALS = 5
# the variable with more than 100 different values should not be StringVariable
DISCRETE_MAX_ALLOWED_VALUES = 100


def make_variable(cls, compute_value, *args):
    if compute_value is not None:
        return cls(*args, compute_value=compute_value)
    else:
        # For compatibility with old pickles
        return cls(*args)


def is_discrete_values(values):
    """
    Return set of uniques if `values` is an iterable of discrete values
    else False if non-discrete, or None if indeterminate.

    Note
    ----
    Assumes consistent type of items of `values`.
    """
    if len(values) == 0:
        return None
    # If the first few values are, or can be converted to, floats,
    # the type is numeric
    try:
        isinstance(next(iter(values)), Number) or \
        [float(v) for _, v in zip(range(min(3, len(values))), values)]
    except ValueError:
        is_numeric = False
        max_values = int(round(len(values)**.7))
    else:
        is_numeric = True
        max_values = DISCRETE_MAX_VALUES

    # If more than max values => not discrete
    unique = set()
    for i in values:
        unique.add(i)
        if (len(unique) > max_values or
                len(unique) > DISCRETE_MAX_ALLOWED_VALUES):
            return False

    # Strip NaN from unique
    unique = {i for i in unique
              if (not i in MISSING_VALUES and
                  not (isinstance(i, Number) and np.isnan(i)))}

    # All NaNs => indeterminate
    if not unique:
        return None

    # Strings with |values| < max_unique
    if not is_numeric:
        return unique

    # Handle numbers
    try:
        unique_float = set(map(float, unique))
    except ValueError:
        # Converting all the values to floats resulted in an error.
        # Since the values have enough unique values, they are probably
        # string values and discrete.
        return unique

    # If only values are {0, 1} or {1, 2} (or a subset of those sets) => discrete
    return (not (unique_float - {0, 1}) or
            not (unique_float - {1, 2})) and unique


class Value(float):
    """
    The class representing a value. The class is not used to store values but
    only to return them in contexts in which we want the value to be accompanied
    with the descriptor, for instance to print the symbolic value of discrete
    variables.

    The class is derived from `float`, with an additional attribute `variable`
    which holds the descriptor of type :obj:`Orange.data.Variable`. If the
    value continuous or discrete, it is stored as a float. Other types of
    values, like strings, are stored in the attribute `value`.

    The class overloads the methods for printing out the value:
    `variable.repr_val` and `variable.str_val` are used to get a suitable
    representation of the value.

    Equivalence operator is overloaded as follows:

    - unknown values are equal; if one value is unknown and the other is not,
      they are different;

    - if the value is compared with the string, the value is converted to a
      string using `variable.str_val` and the two strings are compared

    - if the value is stored in attribute `value`, it is compared with the
      given other value

    - otherwise, the inherited comparison operator for `float` is called.

    Finally, value defines a hash, so values can be put in sets and appear as
    keys in dictionaries.

    .. attribute:: variable (:obj:`Orange.data.Variable`)

        Descriptor; used for printing out and for comparing with strings

    .. attribute:: value

        Value; the value can be of arbitrary type and is used only for variables
        that are neither discrete nor continuous. If `value` is `None`, the
        derived `float` value is used.
    """
    __slots__ = "variable", "_value"

    def __new__(cls, variable, value=Unknown):
        """
        Construct a new instance of Value with the given descriptor and value.
        If the argument `value` can be converted to float, it is stored as
        `float` and the attribute `value` is set to `None`. Otherwise, the
        inherited float is set to `Unknown` and the value is held by the
        attribute `value`.

        :param variable: descriptor
        :type variable: Orange.data.Variable
        :param value: value
        """
        if variable.is_primitive():
            self = super().__new__(cls, value)
            self.variable = variable
            self._value = None
        else:
            isunknown = value == variable.Unknown
            self = super().__new__(
                cls, np.nan if isunknown else np.finfo(float).min)
            self.variable = variable
            self._value = value
        return self

    def __init__(self, _, __=Unknown):
        # __new__ does the job, pylint: disable=super-init-not-called
        pass

    def __repr__(self):
        return "Value('%s', %s)" % (self.variable.name,
                                    self.variable.repr_val(self))

    def __str__(self):
        return self.variable.str_val(self)

    def __eq__(self, other):
        if isinstance(self, Real) and isnan(self):
            if isinstance(other, Real):
                return isnan(other)
            else:
                return other in self.variable.unknown_str
        if isinstance(other, str):
            return self.variable.str_val(self) == other
        if isinstance(other, Value):
            return self.value == other.value
        return super().__eq__(other)

    def __ne__(self, other):
        return not self.__eq__(other)

    def __lt__(self, other):
        if self.variable.is_primitive():
            if isinstance(other, str):
                return super().__lt__(self.variable.to_val(other))
            else:
                return super().__lt__(other)
        else:
            if isinstance(other, str):
                return self.value < other
            else:
                return self.value < other.value

    def __le__(self, other):
        return self.__lt__(other) or self.__eq__(other)

    def __gt__(self, other):
        return not self.__le__(other)

    def __ge__(self, other):
        return not self.__lt__(other)

    def __contains__(self, other):
        if (self._value is not None
                and isinstance(self._value, str)
                and isinstance(other, str)):
            return other in self._value
        raise TypeError("invalid operation on Value()")

    def __hash__(self):
        if self.variable.is_discrete:
            # It is not possible to hash the id and the domain value to the
            # same number as required by __eq__.
            # hash(1)
            # == hash(Value(DiscreteVariable("var", ["red", "green", "blue"]), 1))
            # == hash("green")
            # User should hash directly ids or domain values instead.
            raise TypeError("unhashable type - cannot hash values of discrete variables!")
        if self._value is None:
            return super().__hash__()
        else:
            return hash(self._value)

    @property
    def value(self):
        if self.variable.is_discrete:
            return Unknown if isnan(self) else self.variable.values[int(self)]
        if self.variable.is_string:
            return self._value
        return float(self)

    def __getnewargs__(self):
        return self.variable, float(self)

    def __getstate__(self):
        return dict(value=getattr(self, '_value', None))

    def __setstate__(self, state):
        # defined in __new__, pylint: disable=attribute-defined-outside-init
        self._value = state.get('value', None)


class VariableMeta(Registry):
    pass


class _predicatedescriptor(property):
    """
    A property that behaves as a class method if accessed via a class
    >>> class A:
    ...     foo = False
    ...     @_predicatedescriptor
    ...     def is_foo(self):
    ...         return self.foo
    ...
    >>> a = A()
    >>> a.is_foo
    False
    >>> A.is_foo(a)
    False
    """
    def __get__(self, instance, objtype=None):
        if instance is None:
            return self.fget
        else:
            return super().__get__(instance, objtype)


class Variable(Reprable, metaclass=VariableMeta):
    """
    The base class for variable descriptors contains the variable's
    name and some basic properties.

    .. attribute:: name

        The name of the variable.

    .. attribute:: unknown_str

        A set of values that represent unknowns in conversion from textual
        formats. Default is `{"?", ".", "", "NA", "~", None}`.

    .. attribute:: compute_value

        A function for computing the variable's value when converting from
        another domain which does not contain this variable. The function will
        be called with a data set (`Orange.data.Table`) and has to return
        an array of computed values for all its instances. The base class
        defines a static method `compute_value`, which returns `Unknown`.
        Non-primitive variables must redefine it to return `None`.

    .. attribute:: sparse

        A flag about sparsity of the variable. When set, the variable suggests
        it should be stored in a sparse matrix.

    .. attribute:: source_variable

        An optional descriptor of the source variable - if any - from which
        this variable is derived and computed via :obj:`compute_value`.

    .. attribute:: attributes

        A dictionary with user-defined attributes of the variable
    """
    Unknown = ValueUnknown

    def __init__(self, name="", compute_value=None, *, sparse=False):
        """
        Construct a variable descriptor.
        """
        if not name:
            warnings.warn("Variable must have a name", OrangeDeprecationWarning,
                          stacklevel=3)
        self._name = name
        self._compute_value = compute_value
        self.unknown_str = MISSING_VALUES
        self.source_variable = None
        self.sparse = sparse
        self.attributes = {}

    @property
    def name(self):
        return self._name

    def make_proxy(self):
        """
        Copy the variable and set the master to `self.master` or to `self`.

        :return: copy of self
        :rtype: Variable
        """
        var = self.__class__(self.name)
        var.__dict__.update(self.__dict__)
        var.attributes = dict(self.attributes)
        return var

    def __eq__(self, other):
        # pylint: disable=protected-access,import-outside-toplevel

        def to_match(var):
            if var._compute_value is None:
                return var
            elif isinstance(var._compute_value, Identity):
                return var._compute_value.variable
            return None

        from Orange.preprocess.transformation import Identity
        return type(self) is type(other) and (
            self.name == other.name
            and self._compute_value == other._compute_value
            or
            (self.compute_value or other.compute_value)
            and to_match(self) == to_match(other) != None)

    def __hash__(self):
        # Two variables that are not equal can have the same hash.
        # This happens if one has compute_value == Identity and the other
        # doesn't have compute_value, or they have a different Identity.
        # Having the same hash while not being equal is of course allowed.
        # pylint: disable=import-outside-toplevel
        from Orange.preprocess.transformation import Identity
        compute_value = self._compute_value
        if isinstance(self._compute_value, Identity):
            compute_value = None
        return hash((self.name, type(self), compute_value))

    @classmethod
    def make(cls, name, *args, **kwargs):
        """
        Return an existing continuous variable with the given name, or
        construct and return a new one.
        """
        return cls(name, *args, **kwargs)

    @classmethod
    def _clear_cache(cls):
        warnings.warn(
            "_clear_cache is no longer needed and thus deprecated")

    @staticmethod
    def _clear_all_caches():
        warnings.warn(
            "_clear_all_caches is no longer needed and thus deprecated")

    @classmethod
    def is_primitive(cls, var=None):
        """
        `True` if the variable's values are stored as floats.
        Non-primitive variables can appear in the data only as meta attributes.
        """
        to_check = cls if var is None else type(var)
        return issubclass(to_check, (DiscreteVariable, ContinuousVariable))

    @_predicatedescriptor
    def is_discrete(self):
        return isinstance(self, DiscreteVariable)

    @_predicatedescriptor
    def is_continuous(self):
        return isinstance(self, ContinuousVariable)

    @_predicatedescriptor
    def is_string(self):
        return isinstance(self, StringVariable)

    @_predicatedescriptor
    def is_time(self):
        return isinstance(self, TimeVariable)

    @staticmethod
    def repr_val(val):
        """
        Return a textual representation of variable's value `val`. Argument
        `val` must be a float (for primitive variables) or an arbitrary
        Python object (for non-primitives).

        Derived classes must overload the function.
        """
        raise RuntimeError("variable descriptors must overload repr_val()")

    str_val = repr_val

    def to_val(self, s):
        """
        Convert the given argument to a value of the variable. The
        argument can be a string, a number or `None`. For primitive variables,
        the base class provides a method that returns
        :obj:`~Orange.data.Unknown` if `s` is found in
        :obj:`~Orange.data.Variable.unknown_str`, and raises an exception
        otherwise. For non-primitive variables it returns the argument itself.

        Derived classes of primitive variables must overload the function.

        :param s: value, represented as a number, string or `None`
        :type s: str, float or None
        :rtype: float or object
        """
        if not self.is_primitive():
            return s
        if s in self.unknown_str:
            return Unknown
        raise RuntimeError(
            "primitive variable descriptors must overload to_val()")

    def val_from_str_add(self, s):
        """
        Convert the given string to a value of the variable. The method
        is similar to :obj:`to_val` except that it only accepts strings and
        that it adds new values to the variable's domain where applicable.

        The base class method calls `to_val`.

        :param s: symbolic representation of the value
        :type s: str
        :rtype: float or object
        """
        return self.to_val(s)

    def __str__(self):
        return self.name

    @property
    def compute_value(self):
        return self._compute_value

    def __reduce__(self):
        if not self.name:
            raise PickleError("Variables without names cannot be pickled")

        # Use make to unpickle variables.
        return make_variable, (self.__class__, self._compute_value, self.name), self.__dict__

    _CopyComputeValue = object()

    def copy(self, compute_value=_CopyComputeValue, *, name=None, **kwargs):
        if compute_value is self._CopyComputeValue:
            compute_value = self.compute_value
        var = type(self)(name=name or self.name,
                         compute_value=compute_value,
                         sparse=self.sparse, **kwargs)
        var.attributes = dict(self.attributes)
        return var

    def renamed(self, new_name):
        # prevent cyclic import, pylint: disable=import-outside-toplevel
        from Orange.preprocess.transformation import Identity
        return self.copy(name=new_name, compute_value=Identity(variable=self))

del _predicatedescriptor


class ContinuousVariable(Variable):
    """
    Descriptor for continuous variables.

    .. attribute:: number_of_decimals

        The number of decimals when the value is printed out (default: 3).

    .. attribute:: adjust_decimals

        A flag regulating whether the `number_of_decimals` is being adjusted
        by :obj:`to_val`.

    The value of `number_of_decimals` is set to 3 and `adjust_decimals`
    is set to 2. When :obj:`val_from_str_add` is called for the first
    time with a string as an argument, `number_of_decimals` is set to the
    number of decimals in the string and `adjust_decimals` is set to 1.
    In the subsequent calls of `to_val`, the nubmer of decimals is
    increased if the string argument has a larger number of decimals.

    If the `number_of_decimals` is set manually, `adjust_decimals` is
    set to 0 to prevent changes by `to_val`.
    """

    TYPE_HEADERS = ('continuous', 'c', 'numeric', 'n')

    def __init__(self, name="", number_of_decimals=None, compute_value=None, *, sparse=False):
        """
        Construct a new continuous variable. The number of decimals is set to
        three, but adjusted at the first call of :obj:`to_val`.
        """
        super().__init__(name, compute_value, sparse=sparse)
        self._max_round_diff = 0
        self.number_of_decimals = number_of_decimals

    @property
    def number_of_decimals(self):
        return self._number_of_decimals

    @property
    def format_str(self):
        return self._format_str

    @format_str.setter
    def format_str(self, value):
        self._format_str = value

    # noinspection PyAttributeOutsideInit
    @number_of_decimals.setter
    def number_of_decimals(self, x):
        if x is None:
            self._number_of_decimals = 3
            self.adjust_decimals = 2
            self._format_str = "%g"
            return

        self._number_of_decimals = x
        self._max_round_diff = 10 ** (-x - 6)
        self.adjust_decimals = 0
        if self._number_of_decimals <= MAX_NUM_OF_DECIMALS:
            self._format_str = "%.{}f".format(self.number_of_decimals)
        else:
            self._format_str = "%g"

    def to_val(self, s):
        """
        Convert a value, given as an instance of an arbitrary type, to a float.
        """
        if s in self.unknown_str:
            return Unknown
        return float(s)

    def val_from_str_add(self, s):
        """
        Convert a value from a string and adjust the number of decimals if
        `adjust_decimals` is non-zero.
        """
        return _variable.val_from_str_add_cont(self, s)

    def repr_val(self, val):
        """
        Return the value as a string with the prescribed number of decimals.
        """
        if isnan(val):
            return "?"
        if self.format_str != "%g" \
                and abs(round(val, self._number_of_decimals) - val) \
                > self._max_round_diff:
            return f"{val:.{self._number_of_decimals + 2}f}"
        return self._format_str % val

    str_val = repr_val

    def copy(self, compute_value=Variable._CopyComputeValue,
             *, name=None, **kwargs):
        # pylint understand not that `var` is `DiscreteVariable`:
        # pylint: disable=protected-access
        number_of_decimals = kwargs.pop("number_of_decimals", None)
        var = super().copy(compute_value=compute_value, name=name, **kwargs)
        if number_of_decimals is not None:
            var.number_of_decimals = number_of_decimals
        else:
            var._number_of_decimals = self._number_of_decimals
            var._max_round_diff = self._max_round_diff
            var.adjust_decimals = self.adjust_decimals
            var.format_str = self._format_str
        return var


class TupleList(tuple):
    def __add__(self, other):
        if isinstance(other, list):
            warnings.warn(
                "DiscreteVariable.values is a tuple; "
                "support for adding a list will be dropped in Orange 3.27",
                DeprecationWarning)
            return list(self) + other
        return super().__add__(other)

    def copy(self):
        warnings.warn(
            "DiscreteVariable.values is a tuple;"
            "method copy will be dropped in Orange 3.27",
            DeprecationWarning)
        return list(self)


class DiscreteVariable(Variable):
    """
    Descriptor for symbolic, discrete variables. Values of discrete variables
    are stored as floats; the numbers corresponds to indices in the list of
    values.

    .. attribute:: values

        A list of variable's values.

    .. attribute:: ordered

        Some algorithms (and, in particular, visualizations) may
        sometime reorder the values of the variable, e.g. alphabetically.
        This flag hints that the given order of values is "natural"
        (e.g. "small", "middle", "large") and should not be changed.
    """

    TYPE_HEADERS = ('discrete', 'd', 'categorical')

    presorted_values = []

    def __init__(self, name="", values=(), ordered=False, compute_value=None,
                 *, sparse=False):
        """ Construct a discrete variable descriptor with the given values. """
        values = TupleList(values)  # some people (including me) pass a generator
        if not all(isinstance(value, str) for value in values):
            raise TypeError("values of DiscreteVariables must be strings")

        super().__init__(name, compute_value, sparse=sparse)
        self._values = values
        self._value_index = {value: i for i, value in enumerate(values)}
        self.ordered = ordered

    @property
    def values(self):
        return self._values

    def get_mapping_from(self, other):
        return np.array(
            [self._value_index.get(value, np.nan) for value in other.values],
            dtype=float)

    def get_mapper_from(self, other):
        mapping = self.get_mapping_from(other)
        if not mapping.size:
            # Nans in data are temporarily replaced with 0, mapped and changed
            # back to nans. This would fail is mapping[0] is out of range.
            mapping = np.array([np.nan])

        def mapper(value, col_idx=None):

            # In-place mapping
            if col_idx is not None:
                if sp.issparse(value) and mapping[0] != 0:
                    raise ValueError(
                        "In-place mapping of sparse matrices must map 0 to 0")

                # CSR requires mapping of non-contiguous area
                if sp.isspmatrix_csr(value):
                    col = value.indices == col_idx
                    nans = np.isnan(value.data) * col
                    value.data[nans] = 0
                    value.data[col] = mapping[value.data[col].astype(int)]
                    value.data[nans] = np.nan
                    return None

                # Dense and CSC map a contiguous area
                if isinstance(value, np.ndarray) and value.ndim == 2:
                    col = value[:, col_idx]
                elif sp.isspmatrix_csc(value):
                    col = value.data[value.indptr[col_idx]
                                     :value.indptr[col_idx + 1]]
                else:
                    raise ValueError(
                        "In-place column mapping requires a 2d array or"
                        "a csc or csr matrix.")

                nans = np.isnan(col)
                col[nans] = 0
                col[:] = mapping[col.astype(int)]
                col[nans] = np.nan
                return None

            # Mapping into a copy
            if isinstance(value, (int, float)):
                return value if np.isnan(value) else mapping[int(value)]
            if isinstance(value, str):
                return mapping[other.values.index(value)]
            if isinstance(value, np.ndarray):
                if not (value.ndim == 1
                        or value.ndim != 2 and min(value.shape) != 1):
                    raise ValueError(
                        f"Column mapping can't map {value.ndim}-d objects")

                if value.dtype == object:
                    value = value.astype(float)  # this happens with metas
                try:
                    nans = np.isnan(value)
                except TypeError:  # suppose it's already an integer type
                    return mapping[value]
                value = value.astype(int)
                value[nans] = 0
                value = mapping[value]
                value[nans] = np.nan
                return value
            if sp.issparse(value):
                if min(value.shape) != 1:
                    raise ValueError("Column mapping can't map "
                                     f"{value.ndim}-dimensional objects")
                if mapping[0] != 0 and not np.isnan(mapping[0]):
                    return mapper(np.array(value.todense()).flatten())
                value = value.copy()
                value.data = mapper(value.data)
                return value
            if isinstance(value, Iterable):
                return type(value)(val if np.isnan(val) else mapping[int(val)]
                                   for val in value)
            raise ValueError(
                f"invalid type for value(s): {type(value).__name__}")

        return mapper

    def to_val(self, s):
        """
        Convert the given argument to a value of the variable (`float`).
        If the argument is numeric, its value is returned without checking
        whether it is integer and within bounds. `Unknown` is returned if the
        argument is one of the representations for unknown values. Otherwise,
        the argument must be a string and the method returns its index in
        :obj:`values`.

        :param s: values, represented as a number, string or `None`
        :rtype: float
        """
        if s is None:
            return ValueUnknown

        if isinstance(s, Integral):
            return s
        if isinstance(s, Real):
            return s if isnan(s) else floor(s + 0.25)
        if s in self.unknown_str:
            return ValueUnknown
        if not isinstance(s, str):
            raise TypeError('Cannot convert {} to value of "{}"'.format(
                type(s).__name__, self.name))
        if s not in self._value_index:
            raise ValueError(f"Value {s} does not exist")
        return self._value_index[s]

    def add_value(self, s):
        """ Add a value `s` to the list of values.
        """
        if not isinstance(s, str):
            raise TypeError("values of DiscreteVariables must be strings")
        if s in self._value_index:
            return
        self._value_index[s] = len(self.values)
        self._values += (s, )

    def val_from_str_add(self, s):
        """
        Similar to :obj:`to_val`, except that it accepts only strings and that
        it adds the value to the list if it does not exist yet.

        :param s: symbolic representation of the value
        :type s: str
        :rtype: float
        """
        s = str(s) if s is not None else s
        if s in self.unknown_str:
            return ValueUnknown
        val = self._value_index.get(s)
        if val is None:
            self.add_value(s)
            val = len(self.values) - 1
        return val

    def repr_val(self, val):
        """
        Return a textual representation of the value (`self.values[int(val)]`)
        or "?" if the value is unknown.

        :param val: value
        :type val: float (should be whole number)
        :rtype: str
        """
        if isnan(val):
            return "?"
        return '{}'.format(self.values[int(val)])

    str_val = repr_val

    def __reduce__(self):
        if not self.name:
            raise PickleError("Variables without names cannot be pickled")
        __dict__ = dict(self.__dict__)
        __dict__.pop("_values")
        return make_variable, (self.__class__, self._compute_value, self.name,
                               self.values, self.ordered), \
            __dict__

    def copy(self, compute_value=Variable._CopyComputeValue,
             *, name=None, values=None, **_):
        # pylint: disable=arguments-differ
        if values is not None and len(values) != len(self.values):
            raise ValueError(
                "number of values must match the number of original values")
        return super().copy(compute_value=compute_value, name=name,
                            values=values or self.values, ordered=self.ordered)


class StringVariable(Variable):
    """
    Descriptor for string variables. String variables can only appear as
    meta attributes.
    """
    Unknown = ""
    TYPE_HEADERS = ('string', 's', 'text')

    def to_val(self, s):
        """
        Return the value as a string. If it is already a string, the same
        object is returned.
        """
        if s is None:
            return ""
        if isinstance(s, str):
            return s
        return str(s)

    val_from_str_add = to_val

    @staticmethod
    def str_val(val):
        """Return a string representation of the value."""
        if isinstance(val, str) and val == "":
            return "?"
        if isinstance(val, Value):
            if not val.value:
                return "?"
            val = val.value
        return str(val)

    def repr_val(self, val):
        """Return a string representation of the value."""
        return '"{}"'.format(self.str_val(val))


class TimeVariable(ContinuousVariable):
    """
    TimeVariable is a continuous variable with Unix epoch
    (1970-01-01 00:00:00+0000) as the origin (0.0). Later dates are positive
    real numbers (equivalent to Unix timestamp, with microseconds in the
    fraction part), and the dates before it map to the negative real numbers.

    Unfortunately due to limitation of Python datetime, only dates
    with year >= 1 (A.D.) are supported.

    If time is specified without a date, Unix epoch is assumed.

    If time is specified wihout an UTC offset, localtime is assumed.
    """
    _all_vars = {}
    TYPE_HEADERS = ('time', 't')
    UNIX_EPOCH = datetime(1970, 1, 1)
    _ISO_FORMATS = (
        # have_date, have_time, format_str
        # in order of decreased probability
        (1, 1, '%Y-%m-%d %H:%M:%S%z'),
        (1, 1, '%Y-%m-%d %H:%M:%S'),
        (1, 1, '%Y-%m-%d %H:%M'),
        (1, 1, '%Y-%m-%dT%H:%M:%S%z'),
        (1, 1, '%Y-%m-%dT%H:%M:%S'),

        (1, 0, '%Y-%m-%d'),

        (1, 1, '%Y-%m-%d %H:%M:%S.%f'),
        (1, 1, '%Y-%m-%dT%H:%M:%S.%f'),
        (1, 1, '%Y-%m-%d %H:%M:%S.%f%z'),
        (1, 1, '%Y-%m-%dT%H:%M:%S.%f%z'),

        (1, 1, '%Y%m%dT%H%M%S%z'),
        (1, 1, '%Y%m%d%H%M%S%z'),

        (0, 1, '%H:%M:%S.%f'),
        (0, 1, '%H:%M:%S'),
        (0, 1, '%H:%M'),

        # These parse as continuous features (plain numbers)
        (1, 1, '%Y%m%dT%H%M%S'),
        (1, 1, '%Y%m%d%H%M%S'),
        (1, 0, '%Y%m%d'),
        (1, 0, '%Y%j'),
        (1, 0, '%Y'),
        (0, 1, '%H%M%S.%f'),

        # BUG: In Python as in C, %j doesn't necessitate 0-padding,
        # so these two lines must be in this order
        (1, 0, '%Y-%m'),
        (1, 0, '%Y-%j'),
    )
    # Order in which `_ISO_FORMATS` are tried. Must never change order of
    # last 2 items. Only modified via assignment in `parse`.
    __ISO_FORMATS_PROBE_SEQ = list(range(len(_ISO_FORMATS)))
    # The regex that matches all above formats
    REGEX = (r'^('
             r'\d{1,4}-\d{2}-\d{2}([ T]\d{2}:\d{2}(:\d{2}(\.\d+)?([+-]\d{4})?)?)?|'
             r'\d{1,4}\d{2}\d{2}(T?\d{2}\d{2}\d{2}([+-]\d{4})?)?|'
             r'\d{2}:\d{2}(:\d{2}(\.\d+)?)?|'
             r'\d{2}\d{2}\d{2}\.\d+|'
             r'\d{1,4}(-?\d{2,3})?'
             r')$')

    class InvalidDateTimeFormatError(ValueError):
        def __init__(self, date_string):
            super().__init__(
                "Invalid datetime format '{}'. "
                "Only ISO 8601 supported.".format(date_string))

    _matches_iso_format = re.compile(REGEX).match

    # UTC offset and associated timezone. If parsed datetime values provide an
    # offset, it is used for display. If not all values have the same offset,
    # +0000 (=UTC) timezone is used and utc_offset is set to False.
    utc_offset = None
    timezone = timezone.utc

    def __init__(self, *args, have_date=0, have_time=0, **kwargs):
        super().__init__(*args, **kwargs)
        self.have_date = have_date
        self.have_time = have_time

    def copy(self, compute_value=Variable._CopyComputeValue, *, name=None, **_):
        return super().copy(compute_value=compute_value, name=name,
                            have_date=self.have_date, have_time=self.have_time)

    @staticmethod
    def _tzre_sub(s, _subtz=re.compile(r'([+-])(\d\d):(\d\d)$').sub):
        # Replace +ZZ:ZZ with ISO-compatible +ZZZZ, or strip +0000
        return s[:-6] if s.endswith(('+00:00', '-00:00')) else _subtz(r'\1\2\3', s)

    def repr_val(self, val):
        if isnan(val):
            return '?'
        if not self.have_date and not self.have_time:
            # The time is relative, unitless. The value is absolute.
            return str(val.value) if isinstance(val, Value) else str(val)

        # If you know how to simplify this, be my guest
        seconds = int(val)
        microseconds = int(round((val - seconds) * 1e6))
        if val < 0:
            if microseconds:
                seconds, microseconds = seconds - 1, int(1e6) + microseconds
            date = datetime.fromtimestamp(0, tz=self.timezone) + timedelta(seconds=seconds)
        else:
            date = datetime.fromtimestamp(seconds, tz=self.timezone)
        date = str(date.replace(microsecond=microseconds))

        if self.have_date and not self.have_time:
            date = date.split()[0]
        elif not self.have_date and self.have_time:
            date = date.split()[1]
        date = self._tzre_sub(date)
        return date

    str_val = repr_val

    def parse(self, datestr):
        """
        Return `datestr`, a datetime provided in one of ISO 8601 formats,
        parsed as a real number. Value 0 marks the Unix epoch, positive values
        are the dates after it, negative before.

        If date is unspecified, epoch date is assumed.

        If time is unspecified, 00:00:00.0 is assumed.

        If timezone is unspecified, local time is assumed.
        """
        if datestr in MISSING_VALUES:
            return Unknown
        datestr = datestr.strip().rstrip('Z')

        if not self._matches_iso_format(datestr):
            try:
                # If it is a number, assume it is a unix timestamp
                value = float(datestr)
                self.have_date = self.have_time = 1
                return value
            except ValueError:
                raise self.InvalidDateTimeFormatError(datestr)

        try_order = self.__ISO_FORMATS_PROBE_SEQ
        for i, (have_date, have_time, fmt) in enumerate(
                map(self._ISO_FORMATS.__getitem__, try_order)):
            try:
                dt = datetime.strptime(datestr, fmt)
            except ValueError:
                continue
            else:
                # Pop this most-recently-used format index to front,
                # excluding last 2
                if 0 < i < len(try_order) - 2:
                    try_order = try_order.copy()
                    try_order[i], try_order[0] = try_order[0], try_order[i]
                    TimeVariable.__ISO_FORMATS_PROBE_SEQ = try_order
                self.have_date |= have_date
                self.have_time |= have_time
                if not have_date:
                    dt = dt.replace(self.UNIX_EPOCH.year,
                                    self.UNIX_EPOCH.month,
                                    self.UNIX_EPOCH.day)
                break
        else:
            raise self.InvalidDateTimeFormatError(datestr)

        # Remember UTC offset. If not all parsed values share the same offset,
        # remember none of it.
        offset = dt.utcoffset()
        if self.utc_offset is not False:
            if offset and self.utc_offset is None:
                self.utc_offset = offset
                self.timezone = timezone(offset)
            elif self.utc_offset != offset:
                self.utc_offset = False
                self.timezone = timezone.utc

        # Convert time to UTC timezone. In dates without timezone,
        # localtime is assumed. See also:
        # https://docs.python.org/3.4/library/datetime.html#datetime.datetime.timestamp
        if dt.tzinfo:
            dt -= dt.utcoffset()
        dt = dt.replace(tzinfo=timezone.utc)

        # Unix epoch is the origin, older dates are negative
        try:
            return dt.timestamp()
        except OverflowError:
            return -(self.UNIX_EPOCH - dt).total_seconds()

    def parse_exact_iso(self, datestr):
        """
        This function is a meta function to `parse` function. It checks
        whether the date is of the iso format - it does not accept float-like
        date.
        """
        if not self._matches_iso_format(datestr):
            raise self.InvalidDateTimeFormatError(datestr)
        return self.parse(datestr)

    def to_val(self, s):
        """
        Convert a value, given as an instance of an arbitrary type, to a float.
        """
        if isinstance(s, str):
            return self.parse(s)
        else:
            return super().to_val(s)

```
--- 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