{
    "file_diffs": [
        {
            "old_file_content": "from ..data.variable import *\nfrom ..data import Domain\nfrom scipy import sparse\nimport numpy as np\nimport bottleneck as bn\n\nimport re\n\nclass FileReader:\n    def prescan_file(self, f, delim, nvars, disc_cols, cont_cols):\n        values = [set() for _ in range(nvars)]\n        decimals = [-1]*nvars\n        for lne in f:\n            lne = lne.split(delim)\n            for vs, col in zip(values, disc_cols):\n                vs[col].add(lne[col])\n            for col in cont_cols:\n                val = lne[col]\n                if not col in Variable.DefaultUnknownStr and \".\" in val:\n                    decs = len(val) - val.find(\".\") - 1\n                    if decs > decimals[col]:\n                        decimals[col] = decs\n        return values, decimals\n\n\nclass TabDelimReader:\n    def read_header(self, filename):\n        f = open(filename)\n        names = f.readline().strip(\"\\n\\r\").split(\"\\t\")\n        types = f.readline().strip(\"\\n\\r\").split(\"\\t\")\n        flags = f.readline().strip(\"\\n\\r\").split(\"\\t\")\n        self.n_columns = len(names)\n        if len(types) != self.n_columns:\n            raise ValueError(\"File contains %i variable names and %i types\" %\n                             (len(names), len(types)))\n        if len(flags) > self.n_columns:\n            raise ValueError(\"There are more flags than variables\")\n        else:\n            flags += [\"\"] * self.n_columns\n\n        attributes = []\n        class_vars = []\n        metas = []\n\n        self.attribute_columns = []\n        self.classvar_columns = []\n        self.meta_columns = []\n        self.weight_column = -1\n        self.basket_column = -1\n\n        for col, (name, tpe, flag) in enumerate(zip(names, types, flags)):\n            tpe = tpe.strip()\n            flag = flag.split()\n            if \"i\" in flag or \"ignore\" in flag:\n                continue\n            if \"b\" in flag or \"basket\" in flag:\n                self.basket_column = col\n                continue\n            is_class = \"class\" in flag\n            is_meta = \"m\" in flag or \"meta\" in flag or \\\n                      \"s\" in tpe or \"string\" in tpe\n            is_weight = \"w\" in tpe or \"weight\" in tpe or \\\n                        \"w\" in flag or \"weight\" in flag\n\n            if is_weight:\n                if is_class:\n                    raise ValueError(\"Variable {} (column {}) is marked as \"\n                                     \"class and weight\".format(name, col))\n                self.weight_column = col\n                continue\n\n            if tpe in [\"c\", \"continuous\"]:\n                var = ContinuousVariable.make(name)\n            elif tpe in [\"w\", \"weight\"]:\n                var = None\n            elif tpe in [\"d\", \"discrete\"]:\n                var = DiscreteVariable.make(name)\n            elif tpe in [\"s\", \"string\"]:\n                var = StringVariable.make(name)\n            else:\n                var = DiscreteVariable.make(name, values=tpe.split())\n            var.fix_order = isinstance(var, DiscreteVariable) and not var.values\n\n            if is_class:\n                if is_meta:\n                    raise ValueError(\"Variable {} (column {}) is marked as \"\n                                     \"class and meta attribute\".format(name, col))\n                class_vars.append(var)\n                self.classvar_columns.append((col, var.val_from_str_add))\n            elif is_meta:\n                metas.append(var)\n                self.meta_columns.append((col, var.val_from_str_add))\n            else:\n                attributes.append(var)\n                self.attribute_columns.append((col, var.val_from_str_add))\n\n        domain = Domain(attributes, class_vars, metas)\n        return domain\n\n\n    def count_lines(self, filename):\n        i = -3\n        for _ in open(filename):\n            i += 1\n        return i\n\n\n    def read_data(self, filename, table):\n        _X, _Y = table._X, table._Y\n        _W = table._W if table._W.shape[-1] else None\n        f = open(filename)\n        f.readline(); f.readline(); f.readline()\n        padding = [\"\"] * self.n_columns\n        if self.basket_column >= 0:\n            table._Xsparse = _Xsparse = sparse.lil_matrix(len(_X), 100) # TODO how many columns?!\n        table._metas = _metas = \\\n            np.empty((len(_X), len(self.meta_columns)), dtype=object)\n        line_count = 0\n        _Xr = None # To be able to delete it below even when there are no attributes\n        for lne in f:\n            values = lne.strip().split()\n            if not values:\n                continue\n            if len(values) > self.n_columns:\n                raise ValueError(\"Too many columns in line {}\", 4+line_count)\n            elif len(values) < self.n_columns:\n                values += padding\n            if self.attribute_columns:\n                _Xr = _X[line_count]\n                for i, (col, reader) in enumerate(self.attribute_columns):\n                    _Xr[i] = reader(values[col])\n            for i, (col, reader) in enumerate(self.classvar_columns):\n                _Y[line_count, i] = reader(values[col])\n            if _W is not None:\n                _W[line_count] = float(values[self.weight_column])\n            for i, (col, reader) in enumerate(self.meta_columns):\n                _metas[line_count, i] = reader(values[col])\n            line_count += 1\n        if line_count != len(_X):\n            del _Xr, _X, _Y, _W, _metas\n            table._X.resize(line_count, len(table.domain.attributes))\n            table._Y.resize(line_count, len(table.domain.class_vars))\n            if table._W.ndim == 1:\n                table._W.resize(line_count)\n            else:\n                table._W.resize((line_count, 0))\n            table._metas.resize((line_count, len(self.meta_columns)))\n        table.n_rows = line_count\n\n\n    def reorder_values_array(self, arr, variables):\n        for col, var in enumerate(variables):\n            if var.fix_order and len(var.values) < 1000:\n                new_order = var.order_values(var.values)\n                if new_order == var.values:\n                    continue\n                arr[:, col] += 1000\n                for i, val in enumerate(var.values):\n                    bn.replace(arr[:,col], 1000+i, new_order.index(val))\n                var.values = new_order\n            delattr(var, \"fix_order\")\n\n\n    def reorder_values(self, table):\n        self.reorder_values_array(table._X, table.domain.attributes)\n        self.reorder_values_array(table._Y, table.domain.class_vars)\n\n    def read_file(self, filename):\n        from ..data import Table\n        domain = self.read_header(filename)\n        nExamples = self.count_lines(filename)\n        table = Table.new_from_domain(domain, nExamples, self.weight_column >= 0)\n        self.read_data(filename, table)\n        self.reorder_values(table)\n        return table\n\n\nclass BasketReader():\n    re_name = re.compile(\"([^,=\\\\n]+)(=((\\d+\\.?)|(\\d*\\.\\d+)))?\")\n    def prescan_file(self, filename):\n        \"\"\"Return a list of attributes that appear in the file\"\"\"\n        names = set()\n        n_elements = 0\n        n_rows = 0\n        for line in open(filename):\n            items = set(mo.group(1).strip() for mo in self.re_name.finditer(line))\n            names.update(items)\n            n_elements += len(items)\n            n_rows += 1\n        return names, n_elements, n_rows\n\n    def construct_domain(self, names):\n        attributes = [ContinuousVariable.make(name) for name in sorted(names)]\n        return Domain(attributes)\n\n    def read_file(self, filename):\n        names, n_elements, n_rows = self.prescan_file(filename)\n        domain = self.construct_domain(names)\n        data = np.ones(n_elements)\n        indices = np.empty(n_elements, dtype=int)\n        indptr = np.empty(n_rows+1, dtype=int)\n        indptr[0] = curptr = 0\n        for row, line in enumerate(open(filename)):\n            items = {mo.group(1).strip(): float(mo.group(3) or 1)\n                     for mo in self.re_name.finditer(line)}\n            nextptr = curptr + len(items)\n            data[curptr:nextptr] = list(items.values())\n            indices[curptr:nextptr] = [domain.index(name) for name in items]\n            indptr[row+1] = nextptr\n            curptr = nextptr\n        X = sparse.csr_matrix((data, indices, indptr), (n_rows, len(domain.variables)))\n        from ..data import Table\n        return Table.new_from_numpy(domain, X)\n\n",
            "new_file_content": "from ..data.variable import *\nfrom ..data import Domain\nfrom scipy import sparse\nimport numpy as np\nimport bottleneck as bn\n\nimport re\n\nclass FileReader:\n    def prescan_file(self, f, delim, nvars, disc_cols, cont_cols):\n        values = [set() for _ in range(nvars)]\n        decimals = [-1]*nvars\n        for lne in f:\n            lne = lne.split(delim)\n            for vs, col in zip(values, disc_cols):\n                vs[col].add(lne[col])\n            for col in cont_cols:\n                val = lne[col]\n                if not col in Variable.DefaultUnknownStr and \".\" in val:\n                    decs = len(val) - val.find(\".\") - 1\n                    if decs > decimals[col]:\n                        decimals[col] = decs\n        return values, decimals\n\n\nclass TabDelimReader:\n    def read_header(self, filename):\n        f = open(filename)\n        names = f.readline().strip(\"\\n\\r\").split(\"\\t\")\n        types = f.readline().strip(\"\\n\\r\").split(\"\\t\")\n        flags = f.readline().strip(\"\\n\\r\").split(\"\\t\")\n        self.n_columns = len(names)\n        if len(types) != self.n_columns:\n            raise ValueError(\"File contains %i variable names and %i types\" %\n                             (len(names), len(types)))\n        if len(flags) > self.n_columns:\n            raise ValueError(\"There are more flags than variables\")\n        else:\n            flags += [\"\"] * self.n_columns\n\n        attributes = []\n        class_vars = []\n        metas = []\n\n        self.attribute_columns = []\n        self.classvar_columns = []\n        self.meta_columns = []\n        self.weight_column = -1\n        self.basket_column = -1\n\n        for col, (name, tpe, flag) in enumerate(zip(names, types, flags)):\n            tpe = tpe.strip()\n            flag = flag.split()\n            if \"i\" in flag or \"ignore\" in flag:\n                continue\n            if \"b\" in flag or \"basket\" in flag:\n                self.basket_column = col\n                continue\n            is_class = \"class\" in flag\n            is_meta = \"m\" in flag or \"meta\" in flag or \\\n                      \"s\" in tpe or \"string\" in tpe\n            is_weight = \"w\" in tpe or \"weight\" in tpe or \\\n                        \"w\" in flag or \"weight\" in flag\n\n            if is_weight:\n                if is_class:\n                    raise ValueError(\"Variable {} (column {}) is marked as \"\n                                     \"class and weight\".format(name, col))\n                self.weight_column = col\n                continue\n\n            if tpe in [\"c\", \"continuous\"]:\n                var = ContinuousVariable.make(name)\n            elif tpe in [\"w\", \"weight\"]:\n                var = None\n            elif tpe in [\"d\", \"discrete\"]:\n                var = DiscreteVariable.make(name)\n            elif tpe in [\"s\", \"string\"]:\n                var = StringVariable.make(name)\n            else:\n                var = DiscreteVariable.make(name, values=tpe.split())\n            var.fix_order = isinstance(var, DiscreteVariable) and not var.values\n\n            if is_class:\n                if is_meta:\n                    raise ValueError(\"Variable {} (column {}) is marked as \"\n                                     \"class and meta attribute\".format(name, col))\n                class_vars.append(var)\n                self.classvar_columns.append((col, var.val_from_str_add))\n            elif is_meta:\n                metas.append(var)\n                self.meta_columns.append((col, var.val_from_str_add))\n            else:\n                attributes.append(var)\n                self.attribute_columns.append((col, var.val_from_str_add))\n\n        domain = Domain(attributes, class_vars, metas)\n        return domain\n\n\n    def count_lines(self, filename):\n        i = -3\n        for _ in open(filename):\n            i += 1\n        return i\n\n\n    def read_data(self, filename, table):\n        _X, _Y = table._X, table._Y\n        _W = table._W if table._W.shape[-1] else None\n        f = open(filename)\n        f.readline(); f.readline(); f.readline()\n        padding = [\"\"] * self.n_columns\n        if self.basket_column >= 0:\n            table._Xsparse = _Xsparse = sparse.lil_matrix(len(_X), 100) # TODO how many columns?!\n        table._metas = _metas = \\\n            np.empty((len(_X), len(self.meta_columns)), dtype=object)\n        line_count = 0\n        _Xr = None # To be able to delete it below even when there are no attributes\n        for lne in f:\n            values = lne.strip().split()\n            if not values:\n                continue\n            if len(values) > self.n_columns:\n                raise ValueError(\"Too many columns in line {}\", 4+line_count)\n            elif len(values) < self.n_columns:\n                values += padding\n            if self.attribute_columns:\n                _Xr = _X[line_count]\n                for i, (col, reader) in enumerate(self.attribute_columns):\n                    _Xr[i] = reader(values[col])\n            for i, (col, reader) in enumerate(self.classvar_columns):\n                _Y[line_count, i] = reader(values[col])\n            if _W is not None:\n                _W[line_count] = float(values[self.weight_column])\n            for i, (col, reader) in enumerate(self.meta_columns):\n                _metas[line_count, i] = reader(values[col])\n            line_count += 1\n        if line_count != len(_X):\n            del _Xr, _X, _Y, _W, _metas\n            table._X.resize(line_count, len(table.domain.attributes))\n            table._Y.resize(line_count, len(table.domain.class_vars))\n            if table._W.ndim == 1:\n                table._W.resize(line_count)\n            else:\n                table._W.resize((line_count, 0))\n            table._metas.resize((line_count, len(self.meta_columns)))\n        table.n_rows = line_count\n\n\n    def reorder_values_array(self, arr, variables):\n        for col, var in enumerate(variables):\n            if var.fix_order and len(var.values) < 1000:\n                new_order = var.order_values(var.values)\n                if new_order == var.values:\n                    continue\n                arr[:, col] += 1000\n                for i, val in enumerate(var.values):\n                    bn.replace(arr[:,col], 1000+i, new_order.index(val))\n                var.values = new_order\n            delattr(var, \"fix_order\")\n\n\n    def reorder_values(self, table):\n        self.reorder_values_array(table._X, table.domain.attributes)\n        self.reorder_values_array(table._Y, table.domain.class_vars)\n\n    def read_file(self, filename):\n        from ..data import Table\n        domain = self.read_header(filename)\n        nExamples = self.count_lines(filename)\n        table = Table.new_from_domain(domain, nExamples, self.weight_column >= 0)\n        self.read_data(filename, table)\n        self.reorder_values(table)\n        return table\n\n\nclass BasketReader():\n    re_name = re.compile(\"([^,=\\\\n]+)(=((\\d+\\.?)|(\\d*\\.\\d+)))?\")\n    def prescan_file(self, file):\n        \"\"\"Return a list of attributes that appear in the file\"\"\"\n        names = set()\n        n_elements = 0\n        n_rows = 0\n        for line in file:\n            items = set(mo.group(1).strip() for mo in self.re_name.finditer(line))\n            names.update(items)\n            n_elements += len(items)\n            n_rows += 1\n        return names, n_elements, n_rows\n\n    def construct_domain(self, names):\n        attributes = [ContinuousVariable.make(name) for name in sorted(names)]\n        return Domain(attributes)\n\n    def read_file(self, filename):\n        with open(filename) as file:\n            return self._read_file(file)\n\n    def _read_file(self, file):\n        names, n_elements, n_rows = self.prescan_file(file)\n        domain = self.construct_domain(names)\n        data = np.ones(n_elements)\n        indices = np.empty(n_elements, dtype=int)\n        indptr = np.empty(n_rows+1, dtype=int)\n        indptr[0] = curptr = 0\n\n        file.seek(0)\n        for row, line in enumerate(file):\n            items = {mo.group(1).strip(): float(mo.group(3) or 1)\n                     for mo in self.re_name.finditer(line)}\n            nextptr = curptr + len(items)\n            data[curptr:nextptr] = list(items.values())\n            indices[curptr:nextptr] = [domain.index(name) for name in items]\n            indptr[row+1] = nextptr\n            curptr = nextptr\n        X = sparse.csr_matrix((data, indices, indptr), (n_rows, len(domain.variables)))\n        from ..data import Table\n        return Table.new_from_numpy(domain, X)\n\n",
            "header": {
                "file": {
                    "path": "Orange/data/io.py"
                },
                "misc_line": null
            },
            "index_line": {
                "old_commit_hash": "64ad52e23",
                "new_commit_hash": "855df8c04",
                "mode": "100644"
            },
            "is_binary_file": false,
            "binary_line": null,
            "minus_file": {
                "path": "a/Orange/data/io.py"
            },
            "plus_file": {
                "path": "b/Orange/data/io.py"
            },
            "hunks": [
                {
                    "descriptor": {
                        "old_range": {
                            "start": 177,
                            "length": 12
                        },
                        "new_range": {
                            "start": 177,
                            "length": 12
                        },
                        "section": "class TabDelimReader:"
                    },
                    "line_group": {
                        "all_lines": [
                            {
                                "content": "",
                                "type": "context"
                            },
                            {
                                "content": "class BasketReader():",
                                "type": "context"
                            },
                            {
                                "content": "    re_name = re.compile(\"([^,=\\\\n]+)(=((\\d+\\.?)|(\\d*\\.\\d+)))?\")",
                                "type": "context"
                            },
                            {
                                "content": "    def prescan_file(self, filename):",
                                "type": "deleted"
                            },
                            {
                                "content": "    def prescan_file(self, file):",
                                "type": "added"
                            },
                            {
                                "content": "        \"\"\"Return a list of attributes that appear in the file\"\"\"",
                                "type": "context"
                            },
                            {
                                "content": "        names = set()",
                                "type": "context"
                            },
                            {
                                "content": "        n_elements = 0",
                                "type": "context"
                            },
                            {
                                "content": "        n_rows = 0",
                                "type": "context"
                            },
                            {
                                "content": "        for line in open(filename):",
                                "type": "deleted"
                            },
                            {
                                "content": "        for line in file:",
                                "type": "added"
                            },
                            {
                                "content": "            items = set(mo.group(1).strip() for mo in self.re_name.finditer(line))",
                                "type": "context"
                            },
                            {
                                "content": "            names.update(items)",
                                "type": "context"
                            },
                            {
                                "content": "            n_elements += len(items)",
                                "type": "context"
                            }
                        ]
                    },
                    "modified_entities": [
                        {
                            "file_name": "Orange/data/io.py",
                            "type": "class",
                            "name": "BasketReader",
                            "content": "class BasketReader():\n    re_name = re.compile(\"([^,=\\\\n]+)(=((\\d+\\.?)|(\\d*\\.\\d+)))?\")\n    def prescan_file(self, filename):\n        \"\"\"Return a list of attributes that appear in the file\"\"\"\n        names = set()\n        n_elements = 0\n        n_rows = 0\n        for line in open(filename):\n            items = set(mo.group(1).strip() for mo in self.re_name.finditer(line))\n            names.update(items)\n            n_elements += len(items)\n            n_rows += 1\n        return names, n_elements, n_rows\n\n    def construct_domain(self, names):\n        attributes = [ContinuousVariable.make(name) for name in sorted(names)]\n        return Domain(attributes)\n\n    def read_file(self, filename):\n        names, n_elements, n_rows = self.prescan_file(filename)\n        domain = self.construct_domain(names)\n        data = np.ones(n_elements)\n        indices = np.empty(n_elements, dtype=int)\n        indptr = np.empty(n_rows+1, dtype=int)\n        indptr[0] = curptr = 0\n        for row, line in enumerate(open(filename)):\n            items = {mo.group(1).strip(): float(mo.group(3) or 1)\n                     for mo in self.re_name.finditer(line)}\n            nextptr = curptr + len(items)\n            data[curptr:nextptr] = list(items.values())\n            indices[curptr:nextptr] = [domain.index(name) for name in items]\n            indptr[row+1] = nextptr\n            curptr = nextptr\n        X = sparse.csr_matrix((data, indices, indptr), (n_rows, len(domain.variables)))\n        from ..data import Table\n        return Table.new_from_numpy(domain, X)",
                            "ast_type_str": "ClassDef",
                            "start_lineno": 178,
                            "end_lineno": 213,
                            "parent": null
                        },
                        {
                            "file_name": "Orange/data/io.py",
                            "type": "method",
                            "name": "BasketReader.prescan_file",
                            "content": "class BasketReader():\n    re_name = re.compile(\"([^,=\\\\n]+)(=((\\d+\\.?)|(\\d*\\.\\d+)))?\")\n    def prescan_file(self, filename):\n        \"\"\"Return a list of attributes that appear in the file\"\"\"\n        names = set()\n        n_elements = 0\n        n_rows = 0\n        for line in open(filename):\n            items = set(mo.group(1).strip() for mo in self.re_name.finditer(line))\n            names.update(items)\n            n_elements += len(items)\n            n_rows += 1\n        return names, n_elements, n_rows\n\n    def construct_domain(self, names):\n        attributes = [ContinuousVariable.make(name) for name in sorted(names)]\n        return Domain(attributes)\n\n    def read_file(self, filename):\n        names, n_elements, n_rows = self.prescan_file(filename)\n        domain = self.construct_domain(names)\n        data = np.ones(n_elements)\n        indices = np.empty(n_elements, dtype=int)\n        indptr = np.empty(n_rows+1, dtype=int)\n        indptr[0] = curptr = 0\n        for row, line in enumerate(open(filename)):\n            items = {mo.group(1).strip(): float(mo.group(3) or 1)\n                     for mo in self.re_name.finditer(line)}\n            nextptr = curptr + len(items)\n            data[curptr:nextptr] = list(items.values())\n            indices[curptr:nextptr] = [domain.index(name) for name in items]\n            indptr[row+1] = nextptr\n            curptr = nextptr\n        X = sparse.csr_matrix((data, indices, indptr), (n_rows, len(domain.variables)))\n        from ..data import Table\n        return Table.new_from_numpy(domain, X)",
                            "ast_type_str": "ClassDef",
                            "start_lineno": 180,
                            "end_lineno": 190,
                            "parent": {
                                "file_name": "Orange/data/io.py",
                                "type": "class",
                                "name": "BasketReader",
                                "content": "class BasketReader():\n    re_name = re.compile(\"([^,=\\\\n]+)(=((\\d+\\.?)|(\\d*\\.\\d+)))?\")\n    def prescan_file(self, filename):\n        \"\"\"Return a list of attributes that appear in the file\"\"\"\n        names = set()\n        n_elements = 0\n        n_rows = 0\n        for line in open(filename):\n            items = set(mo.group(1).strip() for mo in self.re_name.finditer(line))\n            names.update(items)\n            n_elements += len(items)\n            n_rows += 1\n        return names, n_elements, n_rows\n\n    def construct_domain(self, names):\n        attributes = [ContinuousVariable.make(name) for name in sorted(names)]\n        return Domain(attributes)\n\n    def read_file(self, filename):\n        names, n_elements, n_rows = self.prescan_file(filename)\n        domain = self.construct_domain(names)\n        data = np.ones(n_elements)\n        indices = np.empty(n_elements, dtype=int)\n        indptr = np.empty(n_rows+1, dtype=int)\n        indptr[0] = curptr = 0\n        for row, line in enumerate(open(filename)):\n            items = {mo.group(1).strip(): float(mo.group(3) or 1)\n                     for mo in self.re_name.finditer(line)}\n            nextptr = curptr + len(items)\n            data[curptr:nextptr] = list(items.values())\n            indices[curptr:nextptr] = [domain.index(name) for name in items]\n            indptr[row+1] = nextptr\n            curptr = nextptr\n        X = sparse.csr_matrix((data, indices, indptr), (n_rows, len(domain.variables)))\n        from ..data import Table\n        return Table.new_from_numpy(domain, X)",
                                "ast_type_str": "ClassDef",
                                "start_lineno": 178,
                                "end_lineno": 213,
                                "parent": null
                            }
                        }
                    ],
                    "added_entities": [],
                    "deleted_entities": []
                },
                {
                    "descriptor": {
                        "old_range": {
                            "start": 194,
                            "length": 13
                        },
                        "new_range": {
                            "start": 194,
                            "length": 19
                        },
                        "section": "class BasketReader():"
                    },
                    "line_group": {
                        "all_lines": [
                            {
                                "content": "        return Domain(attributes)",
                                "type": "context"
                            },
                            {
                                "content": "",
                                "type": "context"
                            },
                            {
                                "content": "    def read_file(self, filename):",
                                "type": "context"
                            },
                            {
                                "content": "        names, n_elements, n_rows = self.prescan_file(filename)",
                                "type": "deleted"
                            },
                            {
                                "content": "        with open(filename) as file:",
                                "type": "added"
                            },
                            {
                                "content": "            return self._read_file(file)",
                                "type": "added"
                            },
                            {
                                "content": "",
                                "type": "added"
                            },
                            {
                                "content": "    def _read_file(self, file):",
                                "type": "added"
                            },
                            {
                                "content": "        names, n_elements, n_rows = self.prescan_file(file)",
                                "type": "added"
                            },
                            {
                                "content": "        domain = self.construct_domain(names)",
                                "type": "context"
                            },
                            {
                                "content": "        data = np.ones(n_elements)",
                                "type": "context"
                            },
                            {
                                "content": "        indices = np.empty(n_elements, dtype=int)",
                                "type": "context"
                            },
                            {
                                "content": "        indptr = np.empty(n_rows+1, dtype=int)",
                                "type": "context"
                            },
                            {
                                "content": "        indptr[0] = curptr = 0",
                                "type": "context"
                            },
                            {
                                "content": "        for row, line in enumerate(open(filename)):",
                                "type": "deleted"
                            },
                            {
                                "content": "",
                                "type": "added"
                            },
                            {
                                "content": "        file.seek(0)",
                                "type": "added"
                            },
                            {
                                "content": "        for row, line in enumerate(file):",
                                "type": "added"
                            },
                            {
                                "content": "            items = {mo.group(1).strip(): float(mo.group(3) or 1)",
                                "type": "context"
                            },
                            {
                                "content": "                     for mo in self.re_name.finditer(line)}",
                                "type": "context"
                            },
                            {
                                "content": "            nextptr = curptr + len(items)",
                                "type": "context"
                            }
                        ]
                    },
                    "modified_entities": [
                        {
                            "file_name": "Orange/data/io.py",
                            "type": "class",
                            "name": "BasketReader",
                            "content": "class BasketReader():\n    re_name = re.compile(\"([^,=\\\\n]+)(=((\\d+\\.?)|(\\d*\\.\\d+)))?\")\n    def prescan_file(self, filename):\n        \"\"\"Return a list of attributes that appear in the file\"\"\"\n        names = set()\n        n_elements = 0\n        n_rows = 0\n        for line in open(filename):\n            items = set(mo.group(1).strip() for mo in self.re_name.finditer(line))\n            names.update(items)\n            n_elements += len(items)\n            n_rows += 1\n        return names, n_elements, n_rows\n\n    def construct_domain(self, names):\n        attributes = [ContinuousVariable.make(name) for name in sorted(names)]\n        return Domain(attributes)\n\n    def read_file(self, filename):\n        names, n_elements, n_rows = self.prescan_file(filename)\n        domain = self.construct_domain(names)\n        data = np.ones(n_elements)\n        indices = np.empty(n_elements, dtype=int)\n        indptr = np.empty(n_rows+1, dtype=int)\n        indptr[0] = curptr = 0\n        for row, line in enumerate(open(filename)):\n            items = {mo.group(1).strip(): float(mo.group(3) or 1)\n                     for mo in self.re_name.finditer(line)}\n            nextptr = curptr + len(items)\n            data[curptr:nextptr] = list(items.values())\n            indices[curptr:nextptr] = [domain.index(name) for name in items]\n            indptr[row+1] = nextptr\n            curptr = nextptr\n        X = sparse.csr_matrix((data, indices, indptr), (n_rows, len(domain.variables)))\n        from ..data import Table\n        return Table.new_from_numpy(domain, X)",
                            "ast_type_str": "ClassDef",
                            "start_lineno": 178,
                            "end_lineno": 213,
                            "parent": null
                        },
                        {
                            "file_name": "Orange/data/io.py",
                            "type": "method",
                            "name": "BasketReader.read_file",
                            "content": "class BasketReader():\n    re_name = re.compile(\"([^,=\\\\n]+)(=((\\d+\\.?)|(\\d*\\.\\d+)))?\")\n    def prescan_file(self, filename):\n        \"\"\"Return a list of attributes that appear in the file\"\"\"\n        names = set()\n        n_elements = 0\n        n_rows = 0\n        for line in open(filename):\n            items = set(mo.group(1).strip() for mo in self.re_name.finditer(line))\n            names.update(items)\n            n_elements += len(items)\n            n_rows += 1\n        return names, n_elements, n_rows\n\n    def construct_domain(self, names):\n        attributes = [ContinuousVariable.make(name) for name in sorted(names)]\n        return Domain(attributes)\n\n    def read_file(self, filename):\n        names, n_elements, n_rows = self.prescan_file(filename)\n        domain = self.construct_domain(names)\n        data = np.ones(n_elements)\n        indices = np.empty(n_elements, dtype=int)\n        indptr = np.empty(n_rows+1, dtype=int)\n        indptr[0] = curptr = 0\n        for row, line in enumerate(open(filename)):\n            items = {mo.group(1).strip(): float(mo.group(3) or 1)\n                     for mo in self.re_name.finditer(line)}\n            nextptr = curptr + len(items)\n            data[curptr:nextptr] = list(items.values())\n            indices[curptr:nextptr] = [domain.index(name) for name in items]\n            indptr[row+1] = nextptr\n            curptr = nextptr\n        X = sparse.csr_matrix((data, indices, indptr), (n_rows, len(domain.variables)))\n        from ..data import Table\n        return Table.new_from_numpy(domain, X)",
                            "ast_type_str": "ClassDef",
                            "start_lineno": 196,
                            "end_lineno": 213,
                            "parent": {
                                "file_name": "Orange/data/io.py",
                                "type": "class",
                                "name": "BasketReader",
                                "content": "class BasketReader():\n    re_name = re.compile(\"([^,=\\\\n]+)(=((\\d+\\.?)|(\\d*\\.\\d+)))?\")\n    def prescan_file(self, filename):\n        \"\"\"Return a list of attributes that appear in the file\"\"\"\n        names = set()\n        n_elements = 0\n        n_rows = 0\n        for line in open(filename):\n            items = set(mo.group(1).strip() for mo in self.re_name.finditer(line))\n            names.update(items)\n            n_elements += len(items)\n            n_rows += 1\n        return names, n_elements, n_rows\n\n    def construct_domain(self, names):\n        attributes = [ContinuousVariable.make(name) for name in sorted(names)]\n        return Domain(attributes)\n\n    def read_file(self, filename):\n        names, n_elements, n_rows = self.prescan_file(filename)\n        domain = self.construct_domain(names)\n        data = np.ones(n_elements)\n        indices = np.empty(n_elements, dtype=int)\n        indptr = np.empty(n_rows+1, dtype=int)\n        indptr[0] = curptr = 0\n        for row, line in enumerate(open(filename)):\n            items = {mo.group(1).strip(): float(mo.group(3) or 1)\n                     for mo in self.re_name.finditer(line)}\n            nextptr = curptr + len(items)\n            data[curptr:nextptr] = list(items.values())\n            indices[curptr:nextptr] = [domain.index(name) for name in items]\n            indptr[row+1] = nextptr\n            curptr = nextptr\n        X = sparse.csr_matrix((data, indices, indptr), (n_rows, len(domain.variables)))\n        from ..data import Table\n        return Table.new_from_numpy(domain, X)",
                                "ast_type_str": "ClassDef",
                                "start_lineno": 178,
                                "end_lineno": 213,
                                "parent": null
                            }
                        }
                    ],
                    "added_entities": [
                        {
                            "file_name": "Orange/data/io.py",
                            "type": "method",
                            "name": "BasketReader._read_file",
                            "content": "class BasketReader():\n    re_name = re.compile(\"([^,=\\\\n]+)(=((\\d+\\.?)|(\\d*\\.\\d+)))?\")\n    def prescan_file(self, file):\n        \"\"\"Return a list of attributes that appear in the file\"\"\"\n        names = set()\n        n_elements = 0\n        n_rows = 0\n        for line in file:\n            items = set(mo.group(1).strip() for mo in self.re_name.finditer(line))\n            names.update(items)\n            n_elements += len(items)\n            n_rows += 1\n        return names, n_elements, n_rows\n\n    def construct_domain(self, names):\n        attributes = [ContinuousVariable.make(name) for name in sorted(names)]\n        return Domain(attributes)\n\n    def read_file(self, filename):\n        with open(filename) as file:\n            return self._read_file(file)\n\n    def _read_file(self, file):\n        names, n_elements, n_rows = self.prescan_file(file)\n        domain = self.construct_domain(names)\n        data = np.ones(n_elements)\n        indices = np.empty(n_elements, dtype=int)\n        indptr = np.empty(n_rows+1, dtype=int)\n        indptr[0] = curptr = 0\n\n        file.seek(0)\n        for row, line in enumerate(file):\n            items = {mo.group(1).strip(): float(mo.group(3) or 1)\n                     for mo in self.re_name.finditer(line)}\n            nextptr = curptr + len(items)\n            data[curptr:nextptr] = list(items.values())\n            indices[curptr:nextptr] = [domain.index(name) for name in items]\n            indptr[row+1] = nextptr\n            curptr = nextptr\n        X = sparse.csr_matrix((data, indices, indptr), (n_rows, len(domain.variables)))\n        from ..data import Table\n        return Table.new_from_numpy(domain, X)",
                            "ast_type_str": "ClassDef",
                            "start_lineno": 200,
                            "end_lineno": 219,
                            "parent": {
                                "file_name": "Orange/data/io.py",
                                "type": "class",
                                "name": "BasketReader",
                                "content": "class BasketReader():\n    re_name = re.compile(\"([^,=\\\\n]+)(=((\\d+\\.?)|(\\d*\\.\\d+)))?\")\n    def prescan_file(self, file):\n        \"\"\"Return a list of attributes that appear in the file\"\"\"\n        names = set()\n        n_elements = 0\n        n_rows = 0\n        for line in file:\n            items = set(mo.group(1).strip() for mo in self.re_name.finditer(line))\n            names.update(items)\n            n_elements += len(items)\n            n_rows += 1\n        return names, n_elements, n_rows\n\n    def construct_domain(self, names):\n        attributes = [ContinuousVariable.make(name) for name in sorted(names)]\n        return Domain(attributes)\n\n    def read_file(self, filename):\n        with open(filename) as file:\n            return self._read_file(file)\n\n    def _read_file(self, file):\n        names, n_elements, n_rows = self.prescan_file(file)\n        domain = self.construct_domain(names)\n        data = np.ones(n_elements)\n        indices = np.empty(n_elements, dtype=int)\n        indptr = np.empty(n_rows+1, dtype=int)\n        indptr[0] = curptr = 0\n\n        file.seek(0)\n        for row, line in enumerate(file):\n            items = {mo.group(1).strip(): float(mo.group(3) or 1)\n                     for mo in self.re_name.finditer(line)}\n            nextptr = curptr + len(items)\n            data[curptr:nextptr] = list(items.values())\n            indices[curptr:nextptr] = [domain.index(name) for name in items]\n            indptr[row+1] = nextptr\n            curptr = nextptr\n        X = sparse.csr_matrix((data, indices, indptr), (n_rows, len(domain.variables)))\n        from ..data import Table\n        return Table.new_from_numpy(domain, X)",
                                "ast_type_str": "ClassDef",
                                "start_lineno": 178,
                                "end_lineno": 219,
                                "parent": null
                            }
                        }
                    ],
                    "deleted_entities": []
                }
            ]
        },
        {
            "old_file_content": "",
            "new_file_content": "import io\nimport unittest\n\nimport numpy as np\n\nfrom Orange.data.io import BasketReader\n\nclass TestBasketReader(unittest.TestCase):\n    def test_read_variable_is_value_syntax(self):\n        file = io.StringIO(\"\"\"a=1,b=2,c=3\"\"\")\n        table = BasketReader()._read_file(file)\n\n        self.assertEqual(len(table.domain.variables), 3)\n        self.assertEqual([\"a\", \"b\", \"c\"], list(map(lambda x:x.name, table.domain.variables)))\n        np.testing.assert_almost_equal(table.X.todense(), np.array([[1,2,3]]))\n\n    def test_read_variable_only_syntax(self):\n        file = io.StringIO(\"\"\"a,b,c,d,e\"\"\")\n        table = BasketReader()._read_file(file)\n        self.assertEqual(len(table.domain.variables), 5)\n        np.testing.assert_almost_equal(table.X.todense(), np.array([[1,1,1,1,1]]))\n\n    def test_handles_spaces_between_variables(self):\n        file = io.StringIO(\"\"\"a=1, b=2, c=3\"\"\")\n        table = BasketReader()._read_file(file)\n\n        self.assertEqual(len(table.domain.variables), 3)\n        np.testing.assert_almost_equal(table.X.todense(), np.array([[1,2,3]]))\n\n    def test_handles_duplicate_variables(self):\n        file = io.StringIO(\"\"\"a=1, b=2, a=3\"\"\")\n        table = BasketReader()._read_file(file)\n\n        self.assertEqual(len(table.domain.variables), 2)\n        np.testing.assert_almost_equal(table.X.todense(), np.array([[3,2]]))\n\n    def test_variables_can_be_listed_in_any_order(self):\n        file = io.StringIO(\"\"\"a=1, b=2\\na=1, b=4\"\"\")\n        table = BasketReader()._read_file(file)\n\n        self.assertEqual(len(table.domain.variables), 2)\n        np.testing.assert_almost_equal(table.X.todense(), np.array([[1,2], [1,4]]))\n\n    def test_variables_can_be_listed_in_any_order(self):\n        file = io.StringIO(\"\"\"a=1, b=2\\na=1, b=4\"\"\")\n        table = BasketReader()._read_file(file)\n\n        self.assertEqual(len(table.domain.variables), 2)\n        np.testing.assert_almost_equal(table.X.todense(), np.array([[1,2], [1,4]]))\n\n    def test_variables_can_be_listed_in_any_order(self):\n        file = io.StringIO(\"\"\"a,b\\nc,b,a\"\"\")\n        table = BasketReader()._read_file(file)\n\n        self.assertEqual(len(table.domain.variables), 3)\n        np.testing.assert_almost_equal(table.X.todense(), np.array([[1,1,0], [1,1,1]]))\n\n    def test_handles_unicode(self):\n        file = io.StringIO(\"\"\"č,š,ž\"\"\")\n        table = BasketReader()._read_file(file)\n\n        self.assertEqual(len(table.domain.variables), 3)\n        np.testing.assert_almost_equal(table.X.todense(), np.array([[1,1,1]]))",
            "header": {
                "file": {
                    "path": "Orange/tests/test_basket_reader.py"
                },
                "misc_line": "new file mode 100644"
            },
            "index_line": {
                "old_commit_hash": "000000000",
                "new_commit_hash": "1db81bd85",
                "mode": ""
            },
            "is_binary_file": false,
            "binary_line": null,
            "minus_file": {
                "path": "/dev/null"
            },
            "plus_file": {
                "path": "b/Orange/tests/test_basket_reader.py"
            },
            "hunks": [
                {
                    "descriptor": {
                        "old_range": {
                            "start": 0,
                            "length": 0
                        },
                        "new_range": {
                            "start": 1,
                            "length": 63
                        },
                        "section": ""
                    },
                    "line_group": {
                        "all_lines": [
                            {
                                "content": "import io",
                                "type": "added"
                            },
                            {
                                "content": "import unittest",
                                "type": "added"
                            },
                            {
                                "content": "",
                                "type": "added"
                            },
                            {
                                "content": "import numpy as np",
                                "type": "added"
                            },
                            {
                                "content": "",
                                "type": "added"
                            },
                            {
                                "content": "from Orange.data.io import BasketReader",
                                "type": "added"
                            },
                            {
                                "content": "",
                                "type": "added"
                            },
                            {
                                "content": "class TestBasketReader(unittest.TestCase):",
                                "type": "added"
                            },
                            {
                                "content": "    def test_read_variable_is_value_syntax(self):",
                                "type": "added"
                            },
                            {
                                "content": "        file = io.StringIO(\"\"\"a=1,b=2,c=3\"\"\")",
                                "type": "added"
                            },
                            {
                                "content": "        table = BasketReader()._read_file(file)",
                                "type": "added"
                            },
                            {
                                "content": "",
                                "type": "added"
                            },
                            {
                                "content": "        self.assertEqual(len(table.domain.variables), 3)",
                                "type": "added"
                            },
                            {
                                "content": "        self.assertEqual([\"a\", \"b\", \"c\"], list(map(lambda x:x.name, table.domain.variables)))",
                                "type": "added"
                            },
                            {
                                "content": "        np.testing.assert_almost_equal(table.X.todense(), np.array([[1,2,3]]))",
                                "type": "added"
                            },
                            {
                                "content": "",
                                "type": "added"
                            },
                            {
                                "content": "    def test_read_variable_only_syntax(self):",
                                "type": "added"
                            },
                            {
                                "content": "        file = io.StringIO(\"\"\"a,b,c,d,e\"\"\")",
                                "type": "added"
                            },
                            {
                                "content": "        table = BasketReader()._read_file(file)",
                                "type": "added"
                            },
                            {
                                "content": "        self.assertEqual(len(table.domain.variables), 5)",
                                "type": "added"
                            },
                            {
                                "content": "        np.testing.assert_almost_equal(table.X.todense(), np.array([[1,1,1,1,1]]))",
                                "type": "added"
                            },
                            {
                                "content": "",
                                "type": "added"
                            },
                            {
                                "content": "    def test_handles_spaces_between_variables(self):",
                                "type": "added"
                            },
                            {
                                "content": "        file = io.StringIO(\"\"\"a=1, b=2, c=3\"\"\")",
                                "type": "added"
                            },
                            {
                                "content": "        table = BasketReader()._read_file(file)",
                                "type": "added"
                            },
                            {
                                "content": "",
                                "type": "added"
                            },
                            {
                                "content": "        self.assertEqual(len(table.domain.variables), 3)",
                                "type": "added"
                            },
                            {
                                "content": "        np.testing.assert_almost_equal(table.X.todense(), np.array([[1,2,3]]))",
                                "type": "added"
                            },
                            {
                                "content": "",
                                "type": "added"
                            },
                            {
                                "content": "    def test_handles_duplicate_variables(self):",
                                "type": "added"
                            },
                            {
                                "content": "        file = io.StringIO(\"\"\"a=1, b=2, a=3\"\"\")",
                                "type": "added"
                            },
                            {
                                "content": "        table = BasketReader()._read_file(file)",
                                "type": "added"
                            },
                            {
                                "content": "",
                                "type": "added"
                            },
                            {
                                "content": "        self.assertEqual(len(table.domain.variables), 2)",
                                "type": "added"
                            },
                            {
                                "content": "        np.testing.assert_almost_equal(table.X.todense(), np.array([[3,2]]))",
                                "type": "added"
                            },
                            {
                                "content": "",
                                "type": "added"
                            },
                            {
                                "content": "    def test_variables_can_be_listed_in_any_order(self):",
                                "type": "added"
                            },
                            {
                                "content": "        file = io.StringIO(\"\"\"a=1, b=2\\na=1, b=4\"\"\")",
                                "type": "added"
                            },
                            {
                                "content": "        table = BasketReader()._read_file(file)",
                                "type": "added"
                            },
                            {
                                "content": "",
                                "type": "added"
                            },
                            {
                                "content": "        self.assertEqual(len(table.domain.variables), 2)",
                                "type": "added"
                            },
                            {
                                "content": "        np.testing.assert_almost_equal(table.X.todense(), np.array([[1,2], [1,4]]))",
                                "type": "added"
                            },
                            {
                                "content": "",
                                "type": "added"
                            },
                            {
                                "content": "    def test_variables_can_be_listed_in_any_order(self):",
                                "type": "added"
                            },
                            {
                                "content": "        file = io.StringIO(\"\"\"a=1, b=2\\na=1, b=4\"\"\")",
                                "type": "added"
                            },
                            {
                                "content": "        table = BasketReader()._read_file(file)",
                                "type": "added"
                            },
                            {
                                "content": "",
                                "type": "added"
                            },
                            {
                                "content": "        self.assertEqual(len(table.domain.variables), 2)",
                                "type": "added"
                            },
                            {
                                "content": "        np.testing.assert_almost_equal(table.X.todense(), np.array([[1,2], [1,4]]))",
                                "type": "added"
                            },
                            {
                                "content": "",
                                "type": "added"
                            },
                            {
                                "content": "    def test_variables_can_be_listed_in_any_order(self):",
                                "type": "added"
                            },
                            {
                                "content": "        file = io.StringIO(\"\"\"a,b\\nc,b,a\"\"\")",
                                "type": "added"
                            },
                            {
                                "content": "        table = BasketReader()._read_file(file)",
                                "type": "added"
                            },
                            {
                                "content": "",
                                "type": "added"
                            },
                            {
                                "content": "        self.assertEqual(len(table.domain.variables), 3)",
                                "type": "added"
                            },
                            {
                                "content": "        np.testing.assert_almost_equal(table.X.todense(), np.array([[1,1,0], [1,1,1]]))",
                                "type": "added"
                            },
                            {
                                "content": "",
                                "type": "added"
                            },
                            {
                                "content": "    def test_handles_unicode(self):",
                                "type": "added"
                            },
                            {
                                "content": "        file = io.StringIO(\"\"\"č,š,ž\"\"\")",
                                "type": "added"
                            },
                            {
                                "content": "        table = BasketReader()._read_file(file)",
                                "type": "added"
                            },
                            {
                                "content": "",
                                "type": "added"
                            },
                            {
                                "content": "        self.assertEqual(len(table.domain.variables), 3)",
                                "type": "added"
                            },
                            {
                                "content": "        np.testing.assert_almost_equal(table.X.todense(), np.array([[1,1,1]]))",
                                "type": "added"
                            },
                            {
                                "content": "No newline at end of file",
                                "type": "note"
                            },
                            {
                                "content": "",
                                "type": "context"
                            }
                        ]
                    },
                    "modified_entities": [],
                    "added_entities": [
                        {
                            "file_name": "Orange/tests/test_basket_reader.py",
                            "type": "import",
                            "name": "unittest",
                            "content": "import unittest",
                            "ast_type_str": "Import",
                            "start_lineno": 2,
                            "end_lineno": 2,
                            "parent": null
                        },
                        {
                            "file_name": "Orange/tests/test_basket_reader.py",
                            "type": "method",
                            "name": "TestBasketReader.test_handles_duplicate_variables",
                            "content": "class TestBasketReader(unittest.TestCase):\n    def test_read_variable_is_value_syntax(self):\n        file = io.StringIO(\"\"\"a=1,b=2,c=3\"\"\")\n        table = BasketReader()._read_file(file)\n\n        self.assertEqual(len(table.domain.variables), 3)\n        self.assertEqual([\"a\", \"b\", \"c\"], list(map(lambda x:x.name, table.domain.variables)))\n        np.testing.assert_almost_equal(table.X.todense(), np.array([[1,2,3]]))\n\n    def test_read_variable_only_syntax(self):\n        file = io.StringIO(\"\"\"a,b,c,d,e\"\"\")\n        table = BasketReader()._read_file(file)\n        self.assertEqual(len(table.domain.variables), 5)\n        np.testing.assert_almost_equal(table.X.todense(), np.array([[1,1,1,1,1]]))\n\n    def test_handles_spaces_between_variables(self):\n        file = io.StringIO(\"\"\"a=1, b=2, c=3\"\"\")\n        table = BasketReader()._read_file(file)\n\n        self.assertEqual(len(table.domain.variables), 3)\n        np.testing.assert_almost_equal(table.X.todense(), np.array([[1,2,3]]))\n\n    def test_handles_duplicate_variables(self):\n        file = io.StringIO(\"\"\"a=1, b=2, a=3\"\"\")\n        table = BasketReader()._read_file(file)\n\n        self.assertEqual(len(table.domain.variables), 2)\n        np.testing.assert_almost_equal(table.X.todense(), np.array([[3,2]]))\n\n    def test_variables_can_be_listed_in_any_order(self):\n        file = io.StringIO(\"\"\"a=1, b=2\\na=1, b=4\"\"\")\n        table = BasketReader()._read_file(file)\n\n        self.assertEqual(len(table.domain.variables), 2)\n        np.testing.assert_almost_equal(table.X.todense(), np.array([[1,2], [1,4]]))\n\n    def test_variables_can_be_listed_in_any_order(self):\n        file = io.StringIO(\"\"\"a=1, b=2\\na=1, b=4\"\"\")\n        table = BasketReader()._read_file(file)\n\n        self.assertEqual(len(table.domain.variables), 2)\n        np.testing.assert_almost_equal(table.X.todense(), np.array([[1,2], [1,4]]))\n\n    def test_variables_can_be_listed_in_any_order(self):\n        file = io.StringIO(\"\"\"a,b\\nc,b,a\"\"\")\n        table = BasketReader()._read_file(file)\n\n        self.assertEqual(len(table.domain.variables), 3)\n        np.testing.assert_almost_equal(table.X.todense(), np.array([[1,1,0], [1,1,1]]))\n\n    def test_handles_unicode(self):\n        file = io.StringIO(\"\"\"č,š,ž\"\"\")\n        table = BasketReader()._read_file(file)\n\n        self.assertEqual(len(table.domain.variables), 3)\n        np.testing.assert_almost_equal(table.X.todense(), np.array([[1,1,1]]))",
                            "ast_type_str": "ClassDef",
                            "start_lineno": 30,
                            "end_lineno": 35,
                            "parent": {
                                "file_name": "Orange/tests/test_basket_reader.py",
                                "type": "class",
                                "name": "TestBasketReader",
                                "content": "class TestBasketReader(unittest.TestCase):\n    def test_read_variable_is_value_syntax(self):\n        file = io.StringIO(\"\"\"a=1,b=2,c=3\"\"\")\n        table = BasketReader()._read_file(file)\n\n        self.assertEqual(len(table.domain.variables), 3)\n        self.assertEqual([\"a\", \"b\", \"c\"], list(map(lambda x:x.name, table.domain.variables)))\n        np.testing.assert_almost_equal(table.X.todense(), np.array([[1,2,3]]))\n\n    def test_read_variable_only_syntax(self):\n        file = io.StringIO(\"\"\"a,b,c,d,e\"\"\")\n        table = BasketReader()._read_file(file)\n        self.assertEqual(len(table.domain.variables), 5)\n        np.testing.assert_almost_equal(table.X.todense(), np.array([[1,1,1,1,1]]))\n\n    def test_handles_spaces_between_variables(self):\n        file = io.StringIO(\"\"\"a=1, b=2, c=3\"\"\")\n        table = BasketReader()._read_file(file)\n\n        self.assertEqual(len(table.domain.variables), 3)\n        np.testing.assert_almost_equal(table.X.todense(), np.array([[1,2,3]]))\n\n    def test_handles_duplicate_variables(self):\n        file = io.StringIO(\"\"\"a=1, b=2, a=3\"\"\")\n        table = BasketReader()._read_file(file)\n\n        self.assertEqual(len(table.domain.variables), 2)\n        np.testing.assert_almost_equal(table.X.todense(), np.array([[3,2]]))\n\n    def test_variables_can_be_listed_in_any_order(self):\n        file = io.StringIO(\"\"\"a=1, b=2\\na=1, b=4\"\"\")\n        table = BasketReader()._read_file(file)\n\n        self.assertEqual(len(table.domain.variables), 2)\n        np.testing.assert_almost_equal(table.X.todense(), np.array([[1,2], [1,4]]))\n\n    def test_variables_can_be_listed_in_any_order(self):\n        file = io.StringIO(\"\"\"a=1, b=2\\na=1, b=4\"\"\")\n        table = BasketReader()._read_file(file)\n\n        self.assertEqual(len(table.domain.variables), 2)\n        np.testing.assert_almost_equal(table.X.todense(), np.array([[1,2], [1,4]]))\n\n    def test_variables_can_be_listed_in_any_order(self):\n        file = io.StringIO(\"\"\"a,b\\nc,b,a\"\"\")\n        table = BasketReader()._read_file(file)\n\n        self.assertEqual(len(table.domain.variables), 3)\n        np.testing.assert_almost_equal(table.X.todense(), np.array([[1,1,0], [1,1,1]]))\n\n    def test_handles_unicode(self):\n        file = io.StringIO(\"\"\"č,š,ž\"\"\")\n        table = BasketReader()._read_file(file)\n\n        self.assertEqual(len(table.domain.variables), 3)\n        np.testing.assert_almost_equal(table.X.todense(), np.array([[1,1,1]]))",
                                "ast_type_str": "ClassDef",
                                "start_lineno": 8,
                                "end_lineno": 63,
                                "parent": null
                            }
                        },
                        {
                            "file_name": "Orange/tests/test_basket_reader.py",
                            "type": "class",
                            "name": "TestBasketReader",
                            "content": "class TestBasketReader(unittest.TestCase):\n    def test_read_variable_is_value_syntax(self):\n        file = io.StringIO(\"\"\"a=1,b=2,c=3\"\"\")\n        table = BasketReader()._read_file(file)\n\n        self.assertEqual(len(table.domain.variables), 3)\n        self.assertEqual([\"a\", \"b\", \"c\"], list(map(lambda x:x.name, table.domain.variables)))\n        np.testing.assert_almost_equal(table.X.todense(), np.array([[1,2,3]]))\n\n    def test_read_variable_only_syntax(self):\n        file = io.StringIO(\"\"\"a,b,c,d,e\"\"\")\n        table = BasketReader()._read_file(file)\n        self.assertEqual(len(table.domain.variables), 5)\n        np.testing.assert_almost_equal(table.X.todense(), np.array([[1,1,1,1,1]]))\n\n    def test_handles_spaces_between_variables(self):\n        file = io.StringIO(\"\"\"a=1, b=2, c=3\"\"\")\n        table = BasketReader()._read_file(file)\n\n        self.assertEqual(len(table.domain.variables), 3)\n        np.testing.assert_almost_equal(table.X.todense(), np.array([[1,2,3]]))\n\n    def test_handles_duplicate_variables(self):\n        file = io.StringIO(\"\"\"a=1, b=2, a=3\"\"\")\n        table = BasketReader()._read_file(file)\n\n        self.assertEqual(len(table.domain.variables), 2)\n        np.testing.assert_almost_equal(table.X.todense(), np.array([[3,2]]))\n\n    def test_variables_can_be_listed_in_any_order(self):\n        file = io.StringIO(\"\"\"a=1, b=2\\na=1, b=4\"\"\")\n        table = BasketReader()._read_file(file)\n\n        self.assertEqual(len(table.domain.variables), 2)\n        np.testing.assert_almost_equal(table.X.todense(), np.array([[1,2], [1,4]]))\n\n    def test_variables_can_be_listed_in_any_order(self):\n        file = io.StringIO(\"\"\"a=1, b=2\\na=1, b=4\"\"\")\n        table = BasketReader()._read_file(file)\n\n        self.assertEqual(len(table.domain.variables), 2)\n        np.testing.assert_almost_equal(table.X.todense(), np.array([[1,2], [1,4]]))\n\n    def test_variables_can_be_listed_in_any_order(self):\n        file = io.StringIO(\"\"\"a,b\\nc,b,a\"\"\")\n        table = BasketReader()._read_file(file)\n\n        self.assertEqual(len(table.domain.variables), 3)\n        np.testing.assert_almost_equal(table.X.todense(), np.array([[1,1,0], [1,1,1]]))\n\n    def test_handles_unicode(self):\n        file = io.StringIO(\"\"\"č,š,ž\"\"\")\n        table = BasketReader()._read_file(file)\n\n        self.assertEqual(len(table.domain.variables), 3)\n        np.testing.assert_almost_equal(table.X.todense(), np.array([[1,1,1]]))",
                            "ast_type_str": "ClassDef",
                            "start_lineno": 8,
                            "end_lineno": 63,
                            "parent": null
                        },
                        {
                            "file_name": "Orange/tests/test_basket_reader.py",
                            "type": "method",
                            "name": "TestBasketReader.test_handles_unicode",
                            "content": "class TestBasketReader(unittest.TestCase):\n    def test_read_variable_is_value_syntax(self):\n        file = io.StringIO(\"\"\"a=1,b=2,c=3\"\"\")\n        table = BasketReader()._read_file(file)\n\n        self.assertEqual(len(table.domain.variables), 3)\n        self.assertEqual([\"a\", \"b\", \"c\"], list(map(lambda x:x.name, table.domain.variables)))\n        np.testing.assert_almost_equal(table.X.todense(), np.array([[1,2,3]]))\n\n    def test_read_variable_only_syntax(self):\n        file = io.StringIO(\"\"\"a,b,c,d,e\"\"\")\n        table = BasketReader()._read_file(file)\n        self.assertEqual(len(table.domain.variables), 5)\n        np.testing.assert_almost_equal(table.X.todense(), np.array([[1,1,1,1,1]]))\n\n    def test_handles_spaces_between_variables(self):\n        file = io.StringIO(\"\"\"a=1, b=2, c=3\"\"\")\n        table = BasketReader()._read_file(file)\n\n        self.assertEqual(len(table.domain.variables), 3)\n        np.testing.assert_almost_equal(table.X.todense(), np.array([[1,2,3]]))\n\n    def test_handles_duplicate_variables(self):\n        file = io.StringIO(\"\"\"a=1, b=2, a=3\"\"\")\n        table = BasketReader()._read_file(file)\n\n        self.assertEqual(len(table.domain.variables), 2)\n        np.testing.assert_almost_equal(table.X.todense(), np.array([[3,2]]))\n\n    def test_variables_can_be_listed_in_any_order(self):\n        file = io.StringIO(\"\"\"a=1, b=2\\na=1, b=4\"\"\")\n        table = BasketReader()._read_file(file)\n\n        self.assertEqual(len(table.domain.variables), 2)\n        np.testing.assert_almost_equal(table.X.todense(), np.array([[1,2], [1,4]]))\n\n    def test_variables_can_be_listed_in_any_order(self):\n        file = io.StringIO(\"\"\"a=1, b=2\\na=1, b=4\"\"\")\n        table = BasketReader()._read_file(file)\n\n        self.assertEqual(len(table.domain.variables), 2)\n        np.testing.assert_almost_equal(table.X.todense(), np.array([[1,2], [1,4]]))\n\n    def test_variables_can_be_listed_in_any_order(self):\n        file = io.StringIO(\"\"\"a,b\\nc,b,a\"\"\")\n        table = BasketReader()._read_file(file)\n\n        self.assertEqual(len(table.domain.variables), 3)\n        np.testing.assert_almost_equal(table.X.todense(), np.array([[1,1,0], [1,1,1]]))\n\n    def test_handles_unicode(self):\n        file = io.StringIO(\"\"\"č,š,ž\"\"\")\n        table = BasketReader()._read_file(file)\n\n        self.assertEqual(len(table.domain.variables), 3)\n        np.testing.assert_almost_equal(table.X.todense(), np.array([[1,1,1]]))",
                            "ast_type_str": "ClassDef",
                            "start_lineno": 58,
                            "end_lineno": 63,
                            "parent": {
                                "file_name": "Orange/tests/test_basket_reader.py",
                                "type": "class",
                                "name": "TestBasketReader",
                                "content": "class TestBasketReader(unittest.TestCase):\n    def test_read_variable_is_value_syntax(self):\n        file = io.StringIO(\"\"\"a=1,b=2,c=3\"\"\")\n        table = BasketReader()._read_file(file)\n\n        self.assertEqual(len(table.domain.variables), 3)\n        self.assertEqual([\"a\", \"b\", \"c\"], list(map(lambda x:x.name, table.domain.variables)))\n        np.testing.assert_almost_equal(table.X.todense(), np.array([[1,2,3]]))\n\n    def test_read_variable_only_syntax(self):\n        file = io.StringIO(\"\"\"a,b,c,d,e\"\"\")\n        table = BasketReader()._read_file(file)\n        self.assertEqual(len(table.domain.variables), 5)\n        np.testing.assert_almost_equal(table.X.todense(), np.array([[1,1,1,1,1]]))\n\n    def test_handles_spaces_between_variables(self):\n        file = io.StringIO(\"\"\"a=1, b=2, c=3\"\"\")\n        table = BasketReader()._read_file(file)\n\n        self.assertEqual(len(table.domain.variables), 3)\n        np.testing.assert_almost_equal(table.X.todense(), np.array([[1,2,3]]))\n\n    def test_handles_duplicate_variables(self):\n        file = io.StringIO(\"\"\"a=1, b=2, a=3\"\"\")\n        table = BasketReader()._read_file(file)\n\n        self.assertEqual(len(table.domain.variables), 2)\n        np.testing.assert_almost_equal(table.X.todense(), np.array([[3,2]]))\n\n    def test_variables_can_be_listed_in_any_order(self):\n        file = io.StringIO(\"\"\"a=1, b=2\\na=1, b=4\"\"\")\n        table = BasketReader()._read_file(file)\n\n        self.assertEqual(len(table.domain.variables), 2)\n        np.testing.assert_almost_equal(table.X.todense(), np.array([[1,2], [1,4]]))\n\n    def test_variables_can_be_listed_in_any_order(self):\n        file = io.StringIO(\"\"\"a=1, b=2\\na=1, b=4\"\"\")\n        table = BasketReader()._read_file(file)\n\n        self.assertEqual(len(table.domain.variables), 2)\n        np.testing.assert_almost_equal(table.X.todense(), np.array([[1,2], [1,4]]))\n\n    def test_variables_can_be_listed_in_any_order(self):\n        file = io.StringIO(\"\"\"a,b\\nc,b,a\"\"\")\n        table = BasketReader()._read_file(file)\n\n        self.assertEqual(len(table.domain.variables), 3)\n        np.testing.assert_almost_equal(table.X.todense(), np.array([[1,1,0], [1,1,1]]))\n\n    def test_handles_unicode(self):\n        file = io.StringIO(\"\"\"č,š,ž\"\"\")\n        table = BasketReader()._read_file(file)\n\n        self.assertEqual(len(table.domain.variables), 3)\n        np.testing.assert_almost_equal(table.X.todense(), np.array([[1,1,1]]))",
                                "ast_type_str": "ClassDef",
                                "start_lineno": 8,
                                "end_lineno": 63,
                                "parent": null
                            }
                        },
                        {
                            "file_name": "Orange/tests/test_basket_reader.py",
                            "type": "method",
                            "name": "TestBasketReader.test_handles_spaces_between_variables",
                            "content": "class TestBasketReader(unittest.TestCase):\n    def test_read_variable_is_value_syntax(self):\n        file = io.StringIO(\"\"\"a=1,b=2,c=3\"\"\")\n        table = BasketReader()._read_file(file)\n\n        self.assertEqual(len(table.domain.variables), 3)\n        self.assertEqual([\"a\", \"b\", \"c\"], list(map(lambda x:x.name, table.domain.variables)))\n        np.testing.assert_almost_equal(table.X.todense(), np.array([[1,2,3]]))\n\n    def test_read_variable_only_syntax(self):\n        file = io.StringIO(\"\"\"a,b,c,d,e\"\"\")\n        table = BasketReader()._read_file(file)\n        self.assertEqual(len(table.domain.variables), 5)\n        np.testing.assert_almost_equal(table.X.todense(), np.array([[1,1,1,1,1]]))\n\n    def test_handles_spaces_between_variables(self):\n        file = io.StringIO(\"\"\"a=1, b=2, c=3\"\"\")\n        table = BasketReader()._read_file(file)\n\n        self.assertEqual(len(table.domain.variables), 3)\n        np.testing.assert_almost_equal(table.X.todense(), np.array([[1,2,3]]))\n\n    def test_handles_duplicate_variables(self):\n        file = io.StringIO(\"\"\"a=1, b=2, a=3\"\"\")\n        table = BasketReader()._read_file(file)\n\n        self.assertEqual(len(table.domain.variables), 2)\n        np.testing.assert_almost_equal(table.X.todense(), np.array([[3,2]]))\n\n    def test_variables_can_be_listed_in_any_order(self):\n        file = io.StringIO(\"\"\"a=1, b=2\\na=1, b=4\"\"\")\n        table = BasketReader()._read_file(file)\n\n        self.assertEqual(len(table.domain.variables), 2)\n        np.testing.assert_almost_equal(table.X.todense(), np.array([[1,2], [1,4]]))\n\n    def test_variables_can_be_listed_in_any_order(self):\n        file = io.StringIO(\"\"\"a=1, b=2\\na=1, b=4\"\"\")\n        table = BasketReader()._read_file(file)\n\n        self.assertEqual(len(table.domain.variables), 2)\n        np.testing.assert_almost_equal(table.X.todense(), np.array([[1,2], [1,4]]))\n\n    def test_variables_can_be_listed_in_any_order(self):\n        file = io.StringIO(\"\"\"a,b\\nc,b,a\"\"\")\n        table = BasketReader()._read_file(file)\n\n        self.assertEqual(len(table.domain.variables), 3)\n        np.testing.assert_almost_equal(table.X.todense(), np.array([[1,1,0], [1,1,1]]))\n\n    def test_handles_unicode(self):\n        file = io.StringIO(\"\"\"č,š,ž\"\"\")\n        table = BasketReader()._read_file(file)\n\n        self.assertEqual(len(table.domain.variables), 3)\n        np.testing.assert_almost_equal(table.X.todense(), np.array([[1,1,1]]))",
                            "ast_type_str": "ClassDef",
                            "start_lineno": 23,
                            "end_lineno": 28,
                            "parent": {
                                "file_name": "Orange/tests/test_basket_reader.py",
                                "type": "class",
                                "name": "TestBasketReader",
                                "content": "class TestBasketReader(unittest.TestCase):\n    def test_read_variable_is_value_syntax(self):\n        file = io.StringIO(\"\"\"a=1,b=2,c=3\"\"\")\n        table = BasketReader()._read_file(file)\n\n        self.assertEqual(len(table.domain.variables), 3)\n        self.assertEqual([\"a\", \"b\", \"c\"], list(map(lambda x:x.name, table.domain.variables)))\n        np.testing.assert_almost_equal(table.X.todense(), np.array([[1,2,3]]))\n\n    def test_read_variable_only_syntax(self):\n        file = io.StringIO(\"\"\"a,b,c,d,e\"\"\")\n        table = BasketReader()._read_file(file)\n        self.assertEqual(len(table.domain.variables), 5)\n        np.testing.assert_almost_equal(table.X.todense(), np.array([[1,1,1,1,1]]))\n\n    def test_handles_spaces_between_variables(self):\n        file = io.StringIO(\"\"\"a=1, b=2, c=3\"\"\")\n        table = BasketReader()._read_file(file)\n\n        self.assertEqual(len(table.domain.variables), 3)\n        np.testing.assert_almost_equal(table.X.todense(), np.array([[1,2,3]]))\n\n    def test_handles_duplicate_variables(self):\n        file = io.StringIO(\"\"\"a=1, b=2, a=3\"\"\")\n        table = BasketReader()._read_file(file)\n\n        self.assertEqual(len(table.domain.variables), 2)\n        np.testing.assert_almost_equal(table.X.todense(), np.array([[3,2]]))\n\n    def test_variables_can_be_listed_in_any_order(self):\n        file = io.StringIO(\"\"\"a=1, b=2\\na=1, b=4\"\"\")\n        table = BasketReader()._read_file(file)\n\n        self.assertEqual(len(table.domain.variables), 2)\n        np.testing.assert_almost_equal(table.X.todense(), np.array([[1,2], [1,4]]))\n\n    def test_variables_can_be_listed_in_any_order(self):\n        file = io.StringIO(\"\"\"a=1, b=2\\na=1, b=4\"\"\")\n        table = BasketReader()._read_file(file)\n\n        self.assertEqual(len(table.domain.variables), 2)\n        np.testing.assert_almost_equal(table.X.todense(), np.array([[1,2], [1,4]]))\n\n    def test_variables_can_be_listed_in_any_order(self):\n        file = io.StringIO(\"\"\"a,b\\nc,b,a\"\"\")\n        table = BasketReader()._read_file(file)\n\n        self.assertEqual(len(table.domain.variables), 3)\n        np.testing.assert_almost_equal(table.X.todense(), np.array([[1,1,0], [1,1,1]]))\n\n    def test_handles_unicode(self):\n        file = io.StringIO(\"\"\"č,š,ž\"\"\")\n        table = BasketReader()._read_file(file)\n\n        self.assertEqual(len(table.domain.variables), 3)\n        np.testing.assert_almost_equal(table.X.todense(), np.array([[1,1,1]]))",
                                "ast_type_str": "ClassDef",
                                "start_lineno": 8,
                                "end_lineno": 63,
                                "parent": null
                            }
                        },
                        {
                            "file_name": "Orange/tests/test_basket_reader.py",
                            "type": "import",
                            "name": "io",
                            "content": "import io",
                            "ast_type_str": "Import",
                            "start_lineno": 1,
                            "end_lineno": 1,
                            "parent": null
                        },
                        {
                            "file_name": "Orange/tests/test_basket_reader.py",
                            "type": "method",
                            "name": "TestBasketReader.test_variables_can_be_listed_in_any_order",
                            "content": "class TestBasketReader(unittest.TestCase):\n    def test_read_variable_is_value_syntax(self):\n        file = io.StringIO(\"\"\"a=1,b=2,c=3\"\"\")\n        table = BasketReader()._read_file(file)\n\n        self.assertEqual(len(table.domain.variables), 3)\n        self.assertEqual([\"a\", \"b\", \"c\"], list(map(lambda x:x.name, table.domain.variables)))\n        np.testing.assert_almost_equal(table.X.todense(), np.array([[1,2,3]]))\n\n    def test_read_variable_only_syntax(self):\n        file = io.StringIO(\"\"\"a,b,c,d,e\"\"\")\n        table = BasketReader()._read_file(file)\n        self.assertEqual(len(table.domain.variables), 5)\n        np.testing.assert_almost_equal(table.X.todense(), np.array([[1,1,1,1,1]]))\n\n    def test_handles_spaces_between_variables(self):\n        file = io.StringIO(\"\"\"a=1, b=2, c=3\"\"\")\n        table = BasketReader()._read_file(file)\n\n        self.assertEqual(len(table.domain.variables), 3)\n        np.testing.assert_almost_equal(table.X.todense(), np.array([[1,2,3]]))\n\n    def test_handles_duplicate_variables(self):\n        file = io.StringIO(\"\"\"a=1, b=2, a=3\"\"\")\n        table = BasketReader()._read_file(file)\n\n        self.assertEqual(len(table.domain.variables), 2)\n        np.testing.assert_almost_equal(table.X.todense(), np.array([[3,2]]))\n\n    def test_variables_can_be_listed_in_any_order(self):\n        file = io.StringIO(\"\"\"a=1, b=2\\na=1, b=4\"\"\")\n        table = BasketReader()._read_file(file)\n\n        self.assertEqual(len(table.domain.variables), 2)\n        np.testing.assert_almost_equal(table.X.todense(), np.array([[1,2], [1,4]]))\n\n    def test_variables_can_be_listed_in_any_order(self):\n        file = io.StringIO(\"\"\"a=1, b=2\\na=1, b=4\"\"\")\n        table = BasketReader()._read_file(file)\n\n        self.assertEqual(len(table.domain.variables), 2)\n        np.testing.assert_almost_equal(table.X.todense(), np.array([[1,2], [1,4]]))\n\n    def test_variables_can_be_listed_in_any_order(self):\n        file = io.StringIO(\"\"\"a,b\\nc,b,a\"\"\")\n        table = BasketReader()._read_file(file)\n\n        self.assertEqual(len(table.domain.variables), 3)\n        np.testing.assert_almost_equal(table.X.todense(), np.array([[1,1,0], [1,1,1]]))\n\n    def test_handles_unicode(self):\n        file = io.StringIO(\"\"\"č,š,ž\"\"\")\n        table = BasketReader()._read_file(file)\n\n        self.assertEqual(len(table.domain.variables), 3)\n        np.testing.assert_almost_equal(table.X.todense(), np.array([[1,1,1]]))",
                            "ast_type_str": "ClassDef",
                            "start_lineno": 37,
                            "end_lineno": 42,
                            "parent": {
                                "file_name": "Orange/tests/test_basket_reader.py",
                                "type": "class",
                                "name": "TestBasketReader",
                                "content": "class TestBasketReader(unittest.TestCase):\n    def test_read_variable_is_value_syntax(self):\n        file = io.StringIO(\"\"\"a=1,b=2,c=3\"\"\")\n        table = BasketReader()._read_file(file)\n\n        self.assertEqual(len(table.domain.variables), 3)\n        self.assertEqual([\"a\", \"b\", \"c\"], list(map(lambda x:x.name, table.domain.variables)))\n        np.testing.assert_almost_equal(table.X.todense(), np.array([[1,2,3]]))\n\n    def test_read_variable_only_syntax(self):\n        file = io.StringIO(\"\"\"a,b,c,d,e\"\"\")\n        table = BasketReader()._read_file(file)\n        self.assertEqual(len(table.domain.variables), 5)\n        np.testing.assert_almost_equal(table.X.todense(), np.array([[1,1,1,1,1]]))\n\n    def test_handles_spaces_between_variables(self):\n        file = io.StringIO(\"\"\"a=1, b=2, c=3\"\"\")\n        table = BasketReader()._read_file(file)\n\n        self.assertEqual(len(table.domain.variables), 3)\n        np.testing.assert_almost_equal(table.X.todense(), np.array([[1,2,3]]))\n\n    def test_handles_duplicate_variables(self):\n        file = io.StringIO(\"\"\"a=1, b=2, a=3\"\"\")\n        table = BasketReader()._read_file(file)\n\n        self.assertEqual(len(table.domain.variables), 2)\n        np.testing.assert_almost_equal(table.X.todense(), np.array([[3,2]]))\n\n    def test_variables_can_be_listed_in_any_order(self):\n        file = io.StringIO(\"\"\"a=1, b=2\\na=1, b=4\"\"\")\n        table = BasketReader()._read_file(file)\n\n        self.assertEqual(len(table.domain.variables), 2)\n        np.testing.assert_almost_equal(table.X.todense(), np.array([[1,2], [1,4]]))\n\n    def test_variables_can_be_listed_in_any_order(self):\n        file = io.StringIO(\"\"\"a=1, b=2\\na=1, b=4\"\"\")\n        table = BasketReader()._read_file(file)\n\n        self.assertEqual(len(table.domain.variables), 2)\n        np.testing.assert_almost_equal(table.X.todense(), np.array([[1,2], [1,4]]))\n\n    def test_variables_can_be_listed_in_any_order(self):\n        file = io.StringIO(\"\"\"a,b\\nc,b,a\"\"\")\n        table = BasketReader()._read_file(file)\n\n        self.assertEqual(len(table.domain.variables), 3)\n        np.testing.assert_almost_equal(table.X.todense(), np.array([[1,1,0], [1,1,1]]))\n\n    def test_handles_unicode(self):\n        file = io.StringIO(\"\"\"č,š,ž\"\"\")\n        table = BasketReader()._read_file(file)\n\n        self.assertEqual(len(table.domain.variables), 3)\n        np.testing.assert_almost_equal(table.X.todense(), np.array([[1,1,1]]))",
                                "ast_type_str": "ClassDef",
                                "start_lineno": 8,
                                "end_lineno": 63,
                                "parent": null
                            }
                        },
                        {
                            "file_name": "Orange/tests/test_basket_reader.py",
                            "type": "import",
                            "name": "numpy",
                            "content": "import numpy as np",
                            "ast_type_str": "Import",
                            "start_lineno": 4,
                            "end_lineno": 4,
                            "parent": null
                        },
                        {
                            "file_name": "Orange/tests/test_basket_reader.py",
                            "type": "statement",
                            "name": "",
                            "content": "from Orange.data.io import BasketReader",
                            "ast_type_str": "ImportFrom",
                            "start_lineno": 6,
                            "end_lineno": 6,
                            "parent": null
                        },
                        {
                            "file_name": "Orange/tests/test_basket_reader.py",
                            "type": "method",
                            "name": "TestBasketReader.test_read_variable_is_value_syntax",
                            "content": "class TestBasketReader(unittest.TestCase):\n    def test_read_variable_is_value_syntax(self):\n        file = io.StringIO(\"\"\"a=1,b=2,c=3\"\"\")\n        table = BasketReader()._read_file(file)\n\n        self.assertEqual(len(table.domain.variables), 3)\n        self.assertEqual([\"a\", \"b\", \"c\"], list(map(lambda x:x.name, table.domain.variables)))\n        np.testing.assert_almost_equal(table.X.todense(), np.array([[1,2,3]]))\n\n    def test_read_variable_only_syntax(self):\n        file = io.StringIO(\"\"\"a,b,c,d,e\"\"\")\n        table = BasketReader()._read_file(file)\n        self.assertEqual(len(table.domain.variables), 5)\n        np.testing.assert_almost_equal(table.X.todense(), np.array([[1,1,1,1,1]]))\n\n    def test_handles_spaces_between_variables(self):\n        file = io.StringIO(\"\"\"a=1, b=2, c=3\"\"\")\n        table = BasketReader()._read_file(file)\n\n        self.assertEqual(len(table.domain.variables), 3)\n        np.testing.assert_almost_equal(table.X.todense(), np.array([[1,2,3]]))\n\n    def test_handles_duplicate_variables(self):\n        file = io.StringIO(\"\"\"a=1, b=2, a=3\"\"\")\n        table = BasketReader()._read_file(file)\n\n        self.assertEqual(len(table.domain.variables), 2)\n        np.testing.assert_almost_equal(table.X.todense(), np.array([[3,2]]))\n\n    def test_variables_can_be_listed_in_any_order(self):\n        file = io.StringIO(\"\"\"a=1, b=2\\na=1, b=4\"\"\")\n        table = BasketReader()._read_file(file)\n\n        self.assertEqual(len(table.domain.variables), 2)\n        np.testing.assert_almost_equal(table.X.todense(), np.array([[1,2], [1,4]]))\n\n    def test_variables_can_be_listed_in_any_order(self):\n        file = io.StringIO(\"\"\"a=1, b=2\\na=1, b=4\"\"\")\n        table = BasketReader()._read_file(file)\n\n        self.assertEqual(len(table.domain.variables), 2)\n        np.testing.assert_almost_equal(table.X.todense(), np.array([[1,2], [1,4]]))\n\n    def test_variables_can_be_listed_in_any_order(self):\n        file = io.StringIO(\"\"\"a,b\\nc,b,a\"\"\")\n        table = BasketReader()._read_file(file)\n\n        self.assertEqual(len(table.domain.variables), 3)\n        np.testing.assert_almost_equal(table.X.todense(), np.array([[1,1,0], [1,1,1]]))\n\n    def test_handles_unicode(self):\n        file = io.StringIO(\"\"\"č,š,ž\"\"\")\n        table = BasketReader()._read_file(file)\n\n        self.assertEqual(len(table.domain.variables), 3)\n        np.testing.assert_almost_equal(table.X.todense(), np.array([[1,1,1]]))",
                            "ast_type_str": "ClassDef",
                            "start_lineno": 9,
                            "end_lineno": 15,
                            "parent": {
                                "file_name": "Orange/tests/test_basket_reader.py",
                                "type": "class",
                                "name": "TestBasketReader",
                                "content": "class TestBasketReader(unittest.TestCase):\n    def test_read_variable_is_value_syntax(self):\n        file = io.StringIO(\"\"\"a=1,b=2,c=3\"\"\")\n        table = BasketReader()._read_file(file)\n\n        self.assertEqual(len(table.domain.variables), 3)\n        self.assertEqual([\"a\", \"b\", \"c\"], list(map(lambda x:x.name, table.domain.variables)))\n        np.testing.assert_almost_equal(table.X.todense(), np.array([[1,2,3]]))\n\n    def test_read_variable_only_syntax(self):\n        file = io.StringIO(\"\"\"a,b,c,d,e\"\"\")\n        table = BasketReader()._read_file(file)\n        self.assertEqual(len(table.domain.variables), 5)\n        np.testing.assert_almost_equal(table.X.todense(), np.array([[1,1,1,1,1]]))\n\n    def test_handles_spaces_between_variables(self):\n        file = io.StringIO(\"\"\"a=1, b=2, c=3\"\"\")\n        table = BasketReader()._read_file(file)\n\n        self.assertEqual(len(table.domain.variables), 3)\n        np.testing.assert_almost_equal(table.X.todense(), np.array([[1,2,3]]))\n\n    def test_handles_duplicate_variables(self):\n        file = io.StringIO(\"\"\"a=1, b=2, a=3\"\"\")\n        table = BasketReader()._read_file(file)\n\n        self.assertEqual(len(table.domain.variables), 2)\n        np.testing.assert_almost_equal(table.X.todense(), np.array([[3,2]]))\n\n    def test_variables_can_be_listed_in_any_order(self):\n        file = io.StringIO(\"\"\"a=1, b=2\\na=1, b=4\"\"\")\n        table = BasketReader()._read_file(file)\n\n        self.assertEqual(len(table.domain.variables), 2)\n        np.testing.assert_almost_equal(table.X.todense(), np.array([[1,2], [1,4]]))\n\n    def test_variables_can_be_listed_in_any_order(self):\n        file = io.StringIO(\"\"\"a=1, b=2\\na=1, b=4\"\"\")\n        table = BasketReader()._read_file(file)\n\n        self.assertEqual(len(table.domain.variables), 2)\n        np.testing.assert_almost_equal(table.X.todense(), np.array([[1,2], [1,4]]))\n\n    def test_variables_can_be_listed_in_any_order(self):\n        file = io.StringIO(\"\"\"a,b\\nc,b,a\"\"\")\n        table = BasketReader()._read_file(file)\n\n        self.assertEqual(len(table.domain.variables), 3)\n        np.testing.assert_almost_equal(table.X.todense(), np.array([[1,1,0], [1,1,1]]))\n\n    def test_handles_unicode(self):\n        file = io.StringIO(\"\"\"č,š,ž\"\"\")\n        table = BasketReader()._read_file(file)\n\n        self.assertEqual(len(table.domain.variables), 3)\n        np.testing.assert_almost_equal(table.X.todense(), np.array([[1,1,1]]))",
                                "ast_type_str": "ClassDef",
                                "start_lineno": 8,
                                "end_lineno": 63,
                                "parent": null
                            }
                        },
                        {
                            "file_name": "Orange/tests/test_basket_reader.py",
                            "type": "method",
                            "name": "TestBasketReader.test_read_variable_only_syntax",
                            "content": "class TestBasketReader(unittest.TestCase):\n    def test_read_variable_is_value_syntax(self):\n        file = io.StringIO(\"\"\"a=1,b=2,c=3\"\"\")\n        table = BasketReader()._read_file(file)\n\n        self.assertEqual(len(table.domain.variables), 3)\n        self.assertEqual([\"a\", \"b\", \"c\"], list(map(lambda x:x.name, table.domain.variables)))\n        np.testing.assert_almost_equal(table.X.todense(), np.array([[1,2,3]]))\n\n    def test_read_variable_only_syntax(self):\n        file = io.StringIO(\"\"\"a,b,c,d,e\"\"\")\n        table = BasketReader()._read_file(file)\n        self.assertEqual(len(table.domain.variables), 5)\n        np.testing.assert_almost_equal(table.X.todense(), np.array([[1,1,1,1,1]]))\n\n    def test_handles_spaces_between_variables(self):\n        file = io.StringIO(\"\"\"a=1, b=2, c=3\"\"\")\n        table = BasketReader()._read_file(file)\n\n        self.assertEqual(len(table.domain.variables), 3)\n        np.testing.assert_almost_equal(table.X.todense(), np.array([[1,2,3]]))\n\n    def test_handles_duplicate_variables(self):\n        file = io.StringIO(\"\"\"a=1, b=2, a=3\"\"\")\n        table = BasketReader()._read_file(file)\n\n        self.assertEqual(len(table.domain.variables), 2)\n        np.testing.assert_almost_equal(table.X.todense(), np.array([[3,2]]))\n\n    def test_variables_can_be_listed_in_any_order(self):\n        file = io.StringIO(\"\"\"a=1, b=2\\na=1, b=4\"\"\")\n        table = BasketReader()._read_file(file)\n\n        self.assertEqual(len(table.domain.variables), 2)\n        np.testing.assert_almost_equal(table.X.todense(), np.array([[1,2], [1,4]]))\n\n    def test_variables_can_be_listed_in_any_order(self):\n        file = io.StringIO(\"\"\"a=1, b=2\\na=1, b=4\"\"\")\n        table = BasketReader()._read_file(file)\n\n        self.assertEqual(len(table.domain.variables), 2)\n        np.testing.assert_almost_equal(table.X.todense(), np.array([[1,2], [1,4]]))\n\n    def test_variables_can_be_listed_in_any_order(self):\n        file = io.StringIO(\"\"\"a,b\\nc,b,a\"\"\")\n        table = BasketReader()._read_file(file)\n\n        self.assertEqual(len(table.domain.variables), 3)\n        np.testing.assert_almost_equal(table.X.todense(), np.array([[1,1,0], [1,1,1]]))\n\n    def test_handles_unicode(self):\n        file = io.StringIO(\"\"\"č,š,ž\"\"\")\n        table = BasketReader()._read_file(file)\n\n        self.assertEqual(len(table.domain.variables), 3)\n        np.testing.assert_almost_equal(table.X.todense(), np.array([[1,1,1]]))",
                            "ast_type_str": "ClassDef",
                            "start_lineno": 17,
                            "end_lineno": 21,
                            "parent": {
                                "file_name": "Orange/tests/test_basket_reader.py",
                                "type": "class",
                                "name": "TestBasketReader",
                                "content": "class TestBasketReader(unittest.TestCase):\n    def test_read_variable_is_value_syntax(self):\n        file = io.StringIO(\"\"\"a=1,b=2,c=3\"\"\")\n        table = BasketReader()._read_file(file)\n\n        self.assertEqual(len(table.domain.variables), 3)\n        self.assertEqual([\"a\", \"b\", \"c\"], list(map(lambda x:x.name, table.domain.variables)))\n        np.testing.assert_almost_equal(table.X.todense(), np.array([[1,2,3]]))\n\n    def test_read_variable_only_syntax(self):\n        file = io.StringIO(\"\"\"a,b,c,d,e\"\"\")\n        table = BasketReader()._read_file(file)\n        self.assertEqual(len(table.domain.variables), 5)\n        np.testing.assert_almost_equal(table.X.todense(), np.array([[1,1,1,1,1]]))\n\n    def test_handles_spaces_between_variables(self):\n        file = io.StringIO(\"\"\"a=1, b=2, c=3\"\"\")\n        table = BasketReader()._read_file(file)\n\n        self.assertEqual(len(table.domain.variables), 3)\n        np.testing.assert_almost_equal(table.X.todense(), np.array([[1,2,3]]))\n\n    def test_handles_duplicate_variables(self):\n        file = io.StringIO(\"\"\"a=1, b=2, a=3\"\"\")\n        table = BasketReader()._read_file(file)\n\n        self.assertEqual(len(table.domain.variables), 2)\n        np.testing.assert_almost_equal(table.X.todense(), np.array([[3,2]]))\n\n    def test_variables_can_be_listed_in_any_order(self):\n        file = io.StringIO(\"\"\"a=1, b=2\\na=1, b=4\"\"\")\n        table = BasketReader()._read_file(file)\n\n        self.assertEqual(len(table.domain.variables), 2)\n        np.testing.assert_almost_equal(table.X.todense(), np.array([[1,2], [1,4]]))\n\n    def test_variables_can_be_listed_in_any_order(self):\n        file = io.StringIO(\"\"\"a=1, b=2\\na=1, b=4\"\"\")\n        table = BasketReader()._read_file(file)\n\n        self.assertEqual(len(table.domain.variables), 2)\n        np.testing.assert_almost_equal(table.X.todense(), np.array([[1,2], [1,4]]))\n\n    def test_variables_can_be_listed_in_any_order(self):\n        file = io.StringIO(\"\"\"a,b\\nc,b,a\"\"\")\n        table = BasketReader()._read_file(file)\n\n        self.assertEqual(len(table.domain.variables), 3)\n        np.testing.assert_almost_equal(table.X.todense(), np.array([[1,1,0], [1,1,1]]))\n\n    def test_handles_unicode(self):\n        file = io.StringIO(\"\"\"č,š,ž\"\"\")\n        table = BasketReader()._read_file(file)\n\n        self.assertEqual(len(table.domain.variables), 3)\n        np.testing.assert_almost_equal(table.X.todense(), np.array([[1,1,1]]))",
                                "ast_type_str": "ClassDef",
                                "start_lineno": 8,
                                "end_lineno": 63,
                                "parent": null
                            }
                        }
                    ],
                    "deleted_entities": []
                }
            ]
        }
    ],
    "old_commit_hash": "a8d53f3c625bd2b6698ddd210a2ef790825d993a^",
    "new_commit_hash": "a8d53f3c625bd2b6698ddd210a2ef790825d993a",
    "commit_message": "Added some basic tests for BasketReader.",
    "commit_date": "2012-11-13T18:14:34+01:00",
    "metadata": {}
}
{
    "repo_name": "orange3",
    "new_commit_hash": "a8d53f3c625bd2b6698ddd210a2ef790825d993a",
    "test_file_codes": [
        "import io\nimport unittest\n\nimport numpy as np\n\nfrom Orange.data.io import BasketReader\n\nclass TestBasketReader(unittest.TestCase):\n    def test_read_variable_is_value_syntax(self):\n        file = io.StringIO(\"\"\"a=1,b=2,c=3\"\"\")\n        table = BasketReader()._read_file(file)\n\n        self.assertEqual(len(table.domain.variables), 3)\n        self.assertEqual([\"a\", \"b\", \"c\"], list(map(lambda x:x.name, table.domain.variables)))\n        np.testing.assert_almost_equal(table.X.todense(), np.array([[1,2,3]]))\n\n    def test_read_variable_only_syntax(self):\n        file = io.StringIO(\"\"\"a,b,c,d,e\"\"\")\n        table = BasketReader()._read_file(file)\n        self.assertEqual(len(table.domain.variables), 5)\n        np.testing.assert_almost_equal(table.X.todense(), np.array([[1,1,1,1,1]]))\n\n    def test_handles_spaces_between_variables(self):\n        file = io.StringIO(\"\"\"a=1, b=2, c=3\"\"\")\n        table = BasketReader()._read_file(file)\n\n        self.assertEqual(len(table.domain.variables), 3)\n        np.testing.assert_almost_equal(table.X.todense(), np.array([[1,2,3]]))\n\n    def test_handles_duplicate_variables(self):\n        file = io.StringIO(\"\"\"a=1, b=2, a=3\"\"\")\n        table = BasketReader()._read_file(file)\n\n        self.assertEqual(len(table.domain.variables), 2)\n        np.testing.assert_almost_equal(table.X.todense(), np.array([[3,2]]))\n\n    def test_variables_can_be_listed_in_any_order(self):\n        file = io.StringIO(\"\"\"a=1, b=2\\na=1, b=4\"\"\")\n        table = BasketReader()._read_file(file)\n\n        self.assertEqual(len(table.domain.variables), 2)\n        np.testing.assert_almost_equal(table.X.todense(), np.array([[1,2], [1,4]]))\n\n    def test_variables_can_be_listed_in_any_order(self):\n        file = io.StringIO(\"\"\"a=1, b=2\\na=1, b=4\"\"\")\n        table = BasketReader()._read_file(file)\n\n        self.assertEqual(len(table.domain.variables), 2)\n        np.testing.assert_almost_equal(table.X.todense(), np.array([[1,2], [1,4]]))\n\n    def test_variables_can_be_listed_in_any_order(self):\n        file = io.StringIO(\"\"\"a,b\\nc,b,a\"\"\")\n        table = BasketReader()._read_file(file)\n\n        self.assertEqual(len(table.domain.variables), 3)\n        np.testing.assert_almost_equal(table.X.todense(), np.array([[1,1,0], [1,1,1]]))\n\n    def test_handles_unicode(self):\n        file = io.StringIO(\"\"\"č,š,ž\"\"\")\n        table = BasketReader()._read_file(file)\n\n        self.assertEqual(len(table.domain.variables), 3)\n        np.testing.assert_almost_equal(table.X.todense(), np.array([[1,1,1]]))"
    ],
    "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 develop\nrunning egg_info\ncreating Orange.egg-info\nwriting Orange.egg-info/PKG-INFO\nwriting dependency_links to Orange.egg-info/dependency_links.txt\nwriting requirements to Orange.egg-info/requires.txt\nwriting top-level names to Orange.egg-info/top_level.txt\nwriting manifest file 'Orange.egg-info/SOURCES.txt'\nreading manifest file 'Orange.egg-info/SOURCES.txt'\nadding license file 'LICENSES'\nadding license file 'COPYING'\nwriting manifest file 'Orange.egg-info/SOURCES.txt'\nrunning build_ext\nCreating /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a8d53f3c625bd2b6698ddd210a2ef790825d993a/.venv/lib/python3.7/site-packages/Orange.egg-link (link to .)\nAdding Orange 3.0 to easy-install.pth file\n\nInstalled /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a8d53f3c625bd2b6698ddd210a2ef790825d993a\nProcessing dependencies for Orange==3.0\nSearching for bottleneck\nReading https://pypi.org/simple/bottleneck/\nDownloading https://files.pythonhosted.org/packages/2e/61/9fb34409d58f04e1929da41666a055c36f9495903ff669b80c893bdee65f/bottleneck-1.4.2.tar.gz#sha256=fa8e8e1799dea5483ce6669462660f9d9a95649f6f98a80d315b84ec89f449f4\nBest match: bottleneck 1.4.2\nProcessing bottleneck-1.4.2.tar.gz\nWriting /tmp/easy_install-qiovd1va/bottleneck-1.4.2/setup.cfg\nRunning bottleneck-1.4.2/setup.py -q bdist_egg --dist-dir /tmp/easy_install-qiovd1va/bottleneck-1.4.2/egg-dist-tmp-11z9_zfs\nUPDATING build/lib.linux-x86_64-3.7/bottleneck/_version.py\nset build/lib.linux-x86_64-3.7/bottleneck/_version.py to '1.4.2'\ncreating /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a8d53f3c625bd2b6698ddd210a2ef790825d993a/.venv/lib/python3.7/site-packages/Bottleneck-1.4.2-py3.7-linux-x86_64.egg\nExtracting Bottleneck-1.4.2-py3.7-linux-x86_64.egg to /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a8d53f3c625bd2b6698ddd210a2ef790825d993a/.venv/lib/python3.7/site-packages\nAdding Bottleneck 1.4.2 to easy-install.pth file\n\nInstalled /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a8d53f3c625bd2b6698ddd210a2ef790825d993a/.venv/lib/python3.7/site-packages/Bottleneck-1.4.2-py3.7-linux-x86_64.egg\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_a8d53f3c625bd2b6698ddd210a2ef790825d993a/.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_a8d53f3c625bd2b6698ddd210a2ef790825d993a/.venv/bin\nInstalling f2py3 script to /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a8d53f3c625bd2b6698ddd210a2ef790825d993a/.venv/bin\nInstalling f2py3.7 script to /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a8d53f3c625bd2b6698ddd210a2ef790825d993a/.venv/bin\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a8d53f3c625bd2b6698ddd210a2ef790825d993a/.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_a8d53f3c625bd2b6698ddd210a2ef790825d993a/.venv/lib/python3.7/site-packages\nFinished processing dependencies for Orange==3.0\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 124ms\nPrepared 18 packages in 2ms\nInstalled 18 packages in 115ms\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\nerror: File not found: `requirements-core.txt`\nerror: File not found: `requirements-gui.txt`\nerror: File not found: `requirements-sql.txt`\nResolved 5 packages in 23ms\nInstalled 4 packages in 700ms\n + joblib==1.3.2\n + scikit-learn==1.0.2\n + scipy==1.7.3\n + threadpoolctl==3.1.0\nsetup.py:3: DeprecationWarning: the imp module is deprecated in favour of importlib; see the module's documentation for alternative uses\n  import  imp, os, subprocess\nWarning: 'keywords' should be a list, got type 'tuple'\nWarning: 'classifiers' should be a list, got type 'tuple'\nsetup.py:3: DeprecationWarning: the imp module is deprecated in favour of importlib; see the module's documentation for alternative uses\n  import  imp, os, subprocess\nWarning: 'keywords' should be a list, got type 'tuple'\nWarning: 'classifiers' should be a list, got type 'tuple'\n/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a8d53f3c625bd2b6698ddd210a2ef790825d993a/.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_a8d53f3c625bd2b6698ddd210a2ef790825d993a/.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_a8d53f3c625bd2b6698ddd210a2ef790825d993a/.venv/lib/python3.7/site-packages/pkg_resources/__init__.py:119: PkgResourcesDeprecationWarning:  is an invalid version and will not be supported in a future release\n  PkgResourcesDeprecationWarning,\n/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a8d53f3c625bd2b6698ddd210a2ef790825d993a/.venv/lib/python3.7/site-packages/pkg_resources/__init__.py:119: PkgResourcesDeprecationWarning: 0.4.0-32bitOS is an invalid version and will not be supported in a future release\n  PkgResourcesDeprecationWarning,\n/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a8d53f3c625bd2b6698ddd210a2ef790825d993a/.venv/lib/python3.7/site-packages/pkg_resources/__init__.py:119: PkgResourcesDeprecationWarning: 0.4.0-64bitOS is an invalid version and will not be supported in a future release\n  PkgResourcesDeprecationWarning,\n/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a8d53f3c625bd2b6698ddd210a2ef790825d993a/.venv/lib/python3.7/site-packages/pkg_resources/__init__.py:119: PkgResourcesDeprecationWarning: 0.4.1-32bitOS is an invalid version and will not be supported in a future release\n  PkgResourcesDeprecationWarning,\n/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a8d53f3c625bd2b6698ddd210a2ef790825d993a/.venv/lib/python3.7/site-packages/pkg_resources/__init__.py:119: PkgResourcesDeprecationWarning: 0.4.1-64bitOS is an invalid version and will not be supported in a future release\n  PkgResourcesDeprecationWarning,\n/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a8d53f3c625bd2b6698ddd210a2ef790825d993a/.venv/lib/python3.7/site-packages/pkg_resources/__init__.py:119: PkgResourcesDeprecationWarning: 0.4.2-32bitOS is an invalid version and will not be supported in a future release\n  PkgResourcesDeprecationWarning,\n/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a8d53f3c625bd2b6698ddd210a2ef790825d993a/.venv/lib/python3.7/site-packages/pkg_resources/__init__.py:119: PkgResourcesDeprecationWarning: 0.4.2-64bitOS is an invalid version and will not be supported in a future release\n  PkgResourcesDeprecationWarning,\n/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a8d53f3c625bd2b6698ddd210a2ef790825d993a/.venv/lib/python3.7/site-packages/pkg_resources/__init__.py:119: PkgResourcesDeprecationWarning: 0.4.3-32bitOS is an invalid version and will not be supported in a future release\n  PkgResourcesDeprecationWarning,\n/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a8d53f3c625bd2b6698ddd210a2ef790825d993a/.venv/lib/python3.7/site-packages/pkg_resources/__init__.py:119: PkgResourcesDeprecationWarning: 0.4.3-64bitOS is an invalid version and will not be supported in a future release\n  PkgResourcesDeprecationWarning,\nwarning: no files found matching 'tox.ini'\nwarning: no previously-included files found matching 'bottleneck/src/reduce.c'\nwarning: no previously-included files found matching 'bottleneck/src/move.c'\nwarning: no previously-included files found matching 'bottleneck/src/nonreduce.c'\nwarning: no previously-included files found matching 'bottleneck/src/nonreduce_axis.c'\nwarning: no previously-included files found matching 'bottleneck/src/bn_config.h'\nwarning: no previously-included files matching '*' found under directory 'doc/build'\nwarning: no previously-included files matching '__pycache__' found anywhere in distribution\nwarning: no previously-included files matching '*.pyc' found anywhere in distribution\nwarning: no previously-included files matching '*~' found anywhere in distribution\n/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a8d53f3c625bd2b6698ddd210a2ef790825d993a/.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",
    "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_a8d53f3c625bd2b6698ddd210a2ef790825d993a\ncollected 6 items\n\nr2e_tests/test_1.py ......                                               [100%]\n\n==================================== PASSES ====================================\n=========================== short test summary info ============================\nPASSED r2e_tests/test_1.py::TestBasketReader::test_handles_duplicate_variables\nPASSED r2e_tests/test_1.py::TestBasketReader::test_handles_spaces_between_variables\nPASSED r2e_tests/test_1.py::TestBasketReader::test_handles_unicode\nPASSED r2e_tests/test_1.py::TestBasketReader::test_read_variable_is_value_syntax\nPASSED r2e_tests/test_1.py::TestBasketReader::test_read_variable_only_syntax\nPASSED r2e_tests/test_1.py::TestBasketReader::test_variables_can_be_listed_in_any_order\n============================== 6 passed in 0.39s ===============================\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_a8d53f3c625bd2b6698ddd210a2ef790825d993a\ncollected 6 items\n\nr2e_tests/test_1.py FFFFFF                                               [100%]\n\n=================================== FAILURES ===================================\n______________ TestBasketReader.test_handles_duplicate_variables _______________\n\nself = <r2e_tests.test_1.TestBasketReader testMethod=test_handles_duplicate_variables>\n\n    def test_handles_duplicate_variables(self):\n        file = io.StringIO(\"\"\"a=1, b=2, a=3\"\"\")\n>       table = BasketReader()._read_file(file)\nE       AttributeError: 'BasketReader' object has no attribute '_read_file'\n\nr2e_tests/test_1.py:32: AttributeError\n____________ TestBasketReader.test_handles_spaces_between_variables ____________\n\nself = <r2e_tests.test_1.TestBasketReader testMethod=test_handles_spaces_between_variables>\n\n    def test_handles_spaces_between_variables(self):\n        file = io.StringIO(\"\"\"a=1, b=2, c=3\"\"\")\n>       table = BasketReader()._read_file(file)\nE       AttributeError: 'BasketReader' object has no attribute '_read_file'\n\nr2e_tests/test_1.py:25: AttributeError\n____________________ TestBasketReader.test_handles_unicode _____________________\n\nself = <r2e_tests.test_1.TestBasketReader testMethod=test_handles_unicode>\n\n    def test_handles_unicode(self):\n        file = io.StringIO(\"\"\"č,š,ž\"\"\")\n>       table = BasketReader()._read_file(file)\nE       AttributeError: 'BasketReader' object has no attribute '_read_file'\n\nr2e_tests/test_1.py:60: AttributeError\n_____________ TestBasketReader.test_read_variable_is_value_syntax ______________\n\nself = <r2e_tests.test_1.TestBasketReader testMethod=test_read_variable_is_value_syntax>\n\n    def test_read_variable_is_value_syntax(self):\n        file = io.StringIO(\"\"\"a=1,b=2,c=3\"\"\")\n>       table = BasketReader()._read_file(file)\nE       AttributeError: 'BasketReader' object has no attribute '_read_file'\n\nr2e_tests/test_1.py:11: AttributeError\n_______________ TestBasketReader.test_read_variable_only_syntax ________________\n\nself = <r2e_tests.test_1.TestBasketReader testMethod=test_read_variable_only_syntax>\n\n    def test_read_variable_only_syntax(self):\n        file = io.StringIO(\"\"\"a,b,c,d,e\"\"\")\n>       table = BasketReader()._read_file(file)\nE       AttributeError: 'BasketReader' object has no attribute '_read_file'\n\nr2e_tests/test_1.py:19: AttributeError\n__________ TestBasketReader.test_variables_can_be_listed_in_any_order __________\n\nself = <r2e_tests.test_1.TestBasketReader testMethod=test_variables_can_be_listed_in_any_order>\n\n    def test_variables_can_be_listed_in_any_order(self):\n        file = io.StringIO(\"\"\"a,b\\nc,b,a\"\"\")\n>       table = BasketReader()._read_file(file)\nE       AttributeError: 'BasketReader' object has no attribute '_read_file'\n\nr2e_tests/test_1.py:53: AttributeError\n=========================== short test summary info ============================\nFAILED r2e_tests/test_1.py::TestBasketReader::test_handles_duplicate_variables\nFAILED r2e_tests/test_1.py::TestBasketReader::test_handles_spaces_between_variables\nFAILED r2e_tests/test_1.py::TestBasketReader::test_handles_unicode - Attribut...\nFAILED r2e_tests/test_1.py::TestBasketReader::test_read_variable_is_value_syntax\nFAILED r2e_tests/test_1.py::TestBasketReader::test_read_variable_only_syntax\nFAILED r2e_tests/test_1.py::TestBasketReader::test_variables_can_be_listed_in_any_order\n============================== 6 failed in 0.54s ===============================\n",
    "old_commit_res_stderr": ""
}
Orange/data/io.py Orange/tests/test_basket_reader.py
We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
[ISSUE]
**Title:** `BasketReader` Missing `_read_file` Method Causes AttributeError

**Description:**
When using the `BasketReader` class to process files, calling the `_read_file` method results in an `AttributeError` because the method is not defined within the class.

**Example Code:**
```python
import io
from Orange.data.io import BasketReader

file = io.StringIO("a=1,b=2,c=3")
table = BasketReader()._read_file(file)
```

**Expected Behavior:**
The `BasketReader` class should have a `_read_file` method that processes the provided file object and returns a data structure representing the parsed data without any errors.

**Actual Behavior:**
Executing the above code raises the following error:
```
AttributeError: 'BasketReader' object has no attribute '_read_file'
```

This prevents successful reading and processing of basket data using the `BasketReader`.
[/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/io.py
from ..data.variable import *
from ..data import Domain
from scipy import sparse
import numpy as np
import bottleneck as bn

import re

class FileReader:
    def prescan_file(self, f, delim, nvars, disc_cols, cont_cols):
        values = [set() for _ in range(nvars)]
        decimals = [-1]*nvars
        for lne in f:
            lne = lne.split(delim)
            for vs, col in zip(values, disc_cols):
                vs[col].add(lne[col])
            for col in cont_cols:
                val = lne[col]
                if not col in Variable.DefaultUnknownStr and "." in val:
                    decs = len(val) - val.find(".") - 1
                    if decs > decimals[col]:
                        decimals[col] = decs
        return values, decimals


class TabDelimReader:
    def read_header(self, filename):
        f = open(filename)
        names = f.readline().strip("\n\r").split("\t")
        types = f.readline().strip("\n\r").split("\t")
        flags = f.readline().strip("\n\r").split("\t")
        self.n_columns = len(names)
        if len(types) != self.n_columns:
            raise ValueError("File contains %i variable names and %i types" %
                             (len(names), len(types)))
        if len(flags) > self.n_columns:
            raise ValueError("There are more flags than variables")
        else:
            flags += [""] * self.n_columns

        attributes = []
        class_vars = []
        metas = []

        self.attribute_columns = []
        self.classvar_columns = []
        self.meta_columns = []
        self.weight_column = -1
        self.basket_column = -1

        for col, (name, tpe, flag) in enumerate(zip(names, types, flags)):
            tpe = tpe.strip()
            flag = flag.split()
            if "i" in flag or "ignore" in flag:
                continue
            if "b" in flag or "basket" in flag:
                self.basket_column = col
                continue
            is_class = "class" in flag
            is_meta = "m" in flag or "meta" in flag or \
                      "s" in tpe or "string" in tpe
            is_weight = "w" in tpe or "weight" in tpe or \
                        "w" in flag or "weight" in flag

            if is_weight:
                if is_class:
                    raise ValueError("Variable {} (column {}) is marked as "
                                     "class and weight".format(name, col))
                self.weight_column = col
                continue

            if tpe in ["c", "continuous"]:
                var = ContinuousVariable.make(name)
            elif tpe in ["w", "weight"]:
                var = None
            elif tpe in ["d", "discrete"]:
                var = DiscreteVariable.make(name)
            elif tpe in ["s", "string"]:
                var = StringVariable.make(name)
            else:
                var = DiscreteVariable.make(name, values=tpe.split())
            var.fix_order = isinstance(var, DiscreteVariable) and not var.values

            if is_class:
                if is_meta:
                    raise ValueError("Variable {} (column {}) is marked as "
                                     "class and meta attribute".format(name, col))
                class_vars.append(var)
                self.classvar_columns.append((col, var.val_from_str_add))
            elif is_meta:
                metas.append(var)
                self.meta_columns.append((col, var.val_from_str_add))
            else:
                attributes.append(var)
                self.attribute_columns.append((col, var.val_from_str_add))

        domain = Domain(attributes, class_vars, metas)
        return domain


    def count_lines(self, filename):
        i = -3
        for _ in open(filename):
            i += 1
        return i


    def read_data(self, filename, table):
        _X, _Y = table._X, table._Y
        _W = table._W if table._W.shape[-1] else None
        f = open(filename)
        f.readline(); f.readline(); f.readline()
        padding = [""] * self.n_columns
        if self.basket_column >= 0:
            table._Xsparse = _Xsparse = sparse.lil_matrix(len(_X), 100) # TODO how many columns?!
        table._metas = _metas = \
            np.empty((len(_X), len(self.meta_columns)), dtype=object)
        line_count = 0
        _Xr = None # To be able to delete it below even when there are no attributes
        for lne in f:
            values = lne.strip().split()
            if not values:
                continue
            if len(values) > self.n_columns:
                raise ValueError("Too many columns in line {}", 4+line_count)
            elif len(values) < self.n_columns:
                values += padding
            if self.attribute_columns:
                _Xr = _X[line_count]
                for i, (col, reader) in enumerate(self.attribute_columns):
                    _Xr[i] = reader(values[col])
            for i, (col, reader) in enumerate(self.classvar_columns):
                _Y[line_count, i] = reader(values[col])
            if _W is not None:
                _W[line_count] = float(values[self.weight_column])
            for i, (col, reader) in enumerate(self.meta_columns):
                _metas[line_count, i] = reader(values[col])
            line_count += 1
        if line_count != len(_X):
            del _Xr, _X, _Y, _W, _metas
            table._X.resize(line_count, len(table.domain.attributes))
            table._Y.resize(line_count, len(table.domain.class_vars))
            if table._W.ndim == 1:
                table._W.resize(line_count)
            else:
                table._W.resize((line_count, 0))
            table._metas.resize((line_count, len(self.meta_columns)))
        table.n_rows = line_count


    def reorder_values_array(self, arr, variables):
        for col, var in enumerate(variables):
            if var.fix_order and len(var.values) < 1000:
                new_order = var.order_values(var.values)
                if new_order == var.values:
                    continue
                arr[:, col] += 1000
                for i, val in enumerate(var.values):
                    bn.replace(arr[:,col], 1000+i, new_order.index(val))
                var.values = new_order
            delattr(var, "fix_order")


    def reorder_values(self, table):
        self.reorder_values_array(table._X, table.domain.attributes)
        self.reorder_values_array(table._Y, table.domain.class_vars)

    def read_file(self, filename):
        from ..data import Table
        domain = self.read_header(filename)
        nExamples = self.count_lines(filename)
        table = Table.new_from_domain(domain, nExamples, self.weight_column >= 0)
        self.read_data(filename, table)
        self.reorder_values(table)
        return table


class BasketReader():
    re_name = re.compile("([^,=\\n]+)(=((\d+\.?)|(\d*\.\d+)))?")
    def prescan_file(self, filename):
        """Return a list of attributes that appear in the file"""
        names = set()
        n_elements = 0
        n_rows = 0
        for line in open(filename):
            items = set(mo.group(1).strip() for mo in self.re_name.finditer(line))
            names.update(items)
            n_elements += len(items)
            n_rows += 1
        return names, n_elements, n_rows

    def construct_domain(self, names):
        attributes = [ContinuousVariable.make(name) for name in sorted(names)]
        return Domain(attributes)

    def read_file(self, filename):
        names, n_elements, n_rows = self.prescan_file(filename)
        domain = self.construct_domain(names)
        data = np.ones(n_elements)
        indices = np.empty(n_elements, dtype=int)
        indptr = np.empty(n_rows+1, dtype=int)
        indptr[0] = curptr = 0
        for row, line in enumerate(open(filename)):
            items = {mo.group(1).strip(): float(mo.group(3) or 1)
                     for mo in self.re_name.finditer(line)}
            nextptr = curptr + len(items)
            data[curptr:nextptr] = list(items.values())
            indices[curptr:nextptr] = [domain.index(name) for name in items]
            indptr[row+1] = nextptr
            curptr = nextptr
        X = sparse.csr_matrix((data, indices, indptr), (n_rows, len(domain.variables)))
        from ..data import Table
        return Table.new_from_numpy(domain, X)


```
--- 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:** `BasketReader` Missing `_read_file` Method Causes AttributeError

**Description:**
When using the `BasketReader` class to process files, calling the `_read_file` method results in an `AttributeError` because the method is not defined within the class.

**Example Code:**
```python
import io
from Orange.data.io import BasketReader

file = io.StringIO("a=1,b=2,c=3")
table = BasketReader()._read_file(file)
```

**Expected Behavior:**
The `BasketReader` class should have a `_read_file` method that processes the provided file object and returns a data structure representing the parsed data without any errors.

**Actual Behavior:**
Executing the above code raises the following error:
```
AttributeError: 'BasketReader' object has no attribute '_read_file'
```

This prevents successful reading and processing of basket data using the `BasketReader`.
[/ISSUE]
{
    "TestBasketReader.test_handles_duplicate_variables": "PASSED",
    "TestBasketReader.test_handles_spaces_between_variables": "PASSED",
    "TestBasketReader.test_handles_unicode": "PASSED",
    "TestBasketReader.test_read_variable_is_value_syntax": "PASSED",
    "TestBasketReader.test_read_variable_only_syntax": "PASSED",
    "TestBasketReader.test_variables_can_be_listed_in_any_order": "PASSED"
}
diff --git a/Orange/data/io.py b/Orange/data/io.py
index 64ad52e23..855df8c04 100644
--- a/Orange/data/io.py
+++ b/Orange/data/io.py
@@ -177,12 +177,12 @@ class TabDelimReader:
 
 class BasketReader():
     re_name = re.compile("([^,=\\n]+)(=((\d+\.?)|(\d*\.\d+)))?")
-    def prescan_file(self, filename):
+    def prescan_file(self, file):
         """Return a list of attributes that appear in the file"""
         names = set()
         n_elements = 0
         n_rows = 0
-        for line in open(filename):
+        for line in file:
             items = set(mo.group(1).strip() for mo in self.re_name.finditer(line))
             names.update(items)
             n_elements += len(items)
@@ -194,13 +194,19 @@ class BasketReader():
         return Domain(attributes)
 
     def read_file(self, filename):
-        names, n_elements, n_rows = self.prescan_file(filename)
+        with open(filename) as file:
+            return self._read_file(file)
+
+    def _read_file(self, file):
+        names, n_elements, n_rows = self.prescan_file(file)
         domain = self.construct_domain(names)
         data = np.ones(n_elements)
         indices = np.empty(n_elements, dtype=int)
         indptr = np.empty(n_rows+1, dtype=int)
         indptr[0] = curptr = 0
-        for row, line in enumerate(open(filename)):
+
+        file.seek(0)
+        for row, line in enumerate(file):
             items = {mo.group(1).strip(): float(mo.group(3) or 1)
                      for mo in self.re_name.finditer(line)}
             nextptr = curptr + len(items)

{"Orange/data/io.py": "from ..data.variable import *\nfrom ..data import Domain\nfrom scipy import sparse\nimport numpy as np\nimport bottleneck as bn\n\nimport re\n\nclass FileReader:\n    def prescan_file(self, f, delim, nvars, disc_cols, cont_cols):\n        values = [set() for _ in range(nvars)]\n        decimals = [-1]*nvars\n        for lne in f:\n            lne = lne.split(delim)\n            for vs, col in zip(values, disc_cols):\n                vs[col].add(lne[col])\n            for col in cont_cols:\n                val = lne[col]\n                if not col in Variable.DefaultUnknownStr and \".\" in val:\n                    decs = len(val) - val.find(\".\") - 1\n                    if decs > decimals[col]:\n                        decimals[col] = decs\n        return values, decimals\n\n\nclass TabDelimReader:\n    def read_header(self, filename):\n        f = open(filename)\n        names = f.readline().strip(\"\\n\\r\").split(\"\\t\")\n        types = f.readline().strip(\"\\n\\r\").split(\"\\t\")\n        flags = f.readline().strip(\"\\n\\r\").split(\"\\t\")\n        self.n_columns = len(names)\n        if len(types) != self.n_columns:\n            raise ValueError(\"File contains %i variable names and %i types\" %\n                             (len(names), len(types)))\n        if len(flags) > self.n_columns:\n            raise ValueError(\"There are more flags than variables\")\n        else:\n            flags += [\"\"] * self.n_columns\n\n        attributes = []\n        class_vars = []\n        metas = []\n\n        self.attribute_columns = []\n        self.classvar_columns = []\n        self.meta_columns = []\n        self.weight_column = -1\n        self.basket_column = -1\n\n        for col, (name, tpe, flag) in enumerate(zip(names, types, flags)):\n            tpe = tpe.strip()\n            flag = flag.split()\n            if \"i\" in flag or \"ignore\" in flag:\n                continue\n            if \"b\" in flag or \"basket\" in flag:\n                self.basket_column = col\n                continue\n            is_class = \"class\" in flag\n            is_meta = \"m\" in flag or \"meta\" in flag or \\\n                      \"s\" in tpe or \"string\" in tpe\n            is_weight = \"w\" in tpe or \"weight\" in tpe or \\\n                        \"w\" in flag or \"weight\" in flag\n\n            if is_weight:\n                if is_class:\n                    raise ValueError(\"Variable {} (column {}) is marked as \"\n                                     \"class and weight\".format(name, col))\n                self.weight_column = col\n                continue\n\n            if tpe in [\"c\", \"continuous\"]:\n                var = ContinuousVariable.make(name)\n            elif tpe in [\"w\", \"weight\"]:\n                var = None\n            elif tpe in [\"d\", \"discrete\"]:\n                var = DiscreteVariable.make(name)\n            elif tpe in [\"s\", \"string\"]:\n                var = StringVariable.make(name)\n            else:\n                var = DiscreteVariable.make(name, values=tpe.split())\n            var.fix_order = isinstance(var, DiscreteVariable) and not var.values\n\n            if is_class:\n                if is_meta:\n                    raise ValueError(\"Variable {} (column {}) is marked as \"\n                                     \"class and meta attribute\".format(name, col))\n                class_vars.append(var)\n                self.classvar_columns.append((col, var.val_from_str_add))\n            elif is_meta:\n                metas.append(var)\n                self.meta_columns.append((col, var.val_from_str_add))\n            else:\n                attributes.append(var)\n                self.attribute_columns.append((col, var.val_from_str_add))\n\n        domain = Domain(attributes, class_vars, metas)\n        return domain\n\n\n    def count_lines(self, filename):\n        i = -3\n        for _ in open(filename):\n            i += 1\n        return i\n\n\n    def read_data(self, filename, table):\n        _X, _Y = table._X, table._Y\n        _W = table._W if table._W.shape[-1] else None\n        f = open(filename)\n        f.readline(); f.readline(); f.readline()\n        padding = [\"\"] * self.n_columns\n        if self.basket_column >= 0:\n            table._Xsparse = _Xsparse = sparse.lil_matrix(len(_X), 100) # TODO how many columns?!\n        table._metas = _metas = \\\n            np.empty((len(_X), len(self.meta_columns)), dtype=object)\n        line_count = 0\n        _Xr = None # To be able to delete it below even when there are no attributes\n        for lne in f:\n            values = lne.strip().split()\n            if not values:\n                continue\n            if len(values) > self.n_columns:\n                raise ValueError(\"Too many columns in line {}\", 4+line_count)\n            elif len(values) < self.n_columns:\n                values += padding\n            if self.attribute_columns:\n                _Xr = _X[line_count]\n                for i, (col, reader) in enumerate(self.attribute_columns):\n                    _Xr[i] = reader(values[col])\n            for i, (col, reader) in enumerate(self.classvar_columns):\n                _Y[line_count, i] = reader(values[col])\n            if _W is not None:\n                _W[line_count] = float(values[self.weight_column])\n            for i, (col, reader) in enumerate(self.meta_columns):\n                _metas[line_count, i] = reader(values[col])\n            line_count += 1\n        if line_count != len(_X):\n            del _Xr, _X, _Y, _W, _metas\n            table._X.resize(line_count, len(table.domain.attributes))\n            table._Y.resize(line_count, len(table.domain.class_vars))\n            if table._W.ndim == 1:\n                table._W.resize(line_count)\n            else:\n                table._W.resize((line_count, 0))\n            table._metas.resize((line_count, len(self.meta_columns)))\n        table.n_rows = line_count\n\n\n    def reorder_values_array(self, arr, variables):\n        for col, var in enumerate(variables):\n            if var.fix_order and len(var.values) < 1000:\n                new_order = var.order_values(var.values)\n                if new_order == var.values:\n                    continue\n                arr[:, col] += 1000\n                for i, val in enumerate(var.values):\n                    bn.replace(arr[:,col], 1000+i, new_order.index(val))\n                var.values = new_order\n            delattr(var, \"fix_order\")\n\n\n    def reorder_values(self, table):\n        self.reorder_values_array(table._X, table.domain.attributes)\n        self.reorder_values_array(table._Y, table.domain.class_vars)\n\n    def read_file(self, filename):\n        from ..data import Table\n        domain = self.read_header(filename)\n        nExamples = self.count_lines(filename)\n        table = Table.new_from_domain(domain, nExamples, self.weight_column >= 0)\n        self.read_data(filename, table)\n        self.reorder_values(table)\n        return table\n\n\nclass BasketReader():\n    re_name = re.compile(\"([^,=\\\\n]+)(=((\\d+\\.?)|(\\d*\\.\\d+)))?\")\n    def prescan_file(self, filename):\n        \"\"\"Return a list of attributes that appear in the file\"\"\"\n        names = set()\n        n_elements = 0\n        n_rows = 0\n        for line in open(filename):\n            items = set(mo.group(1).strip() for mo in self.re_name.finditer(line))\n            names.update(items)\n            n_elements += len(items)\n            n_rows += 1\n        return names, n_elements, n_rows\n\n    def construct_domain(self, names):\n        attributes = [ContinuousVariable.make(name) for name in sorted(names)]\n        return Domain(attributes)\n\n    def read_file(self, filename):\n        names, n_elements, n_rows = self.prescan_file(filename)\n        domain = self.construct_domain(names)\n        data = np.ones(n_elements)\n        indices = np.empty(n_elements, dtype=int)\n        indptr = np.empty(n_rows+1, dtype=int)\n        indptr[0] = curptr = 0\n        for row, line in enumerate(open(filename)):\n            items = {mo.group(1).strip(): float(mo.group(3) or 1)\n                     for mo in self.re_name.finditer(line)}\n            nextptr = curptr + len(items)\n            data[curptr:nextptr] = list(items.values())\n            indices[curptr:nextptr] = [domain.index(name) for name in items]\n            indptr[row+1] = nextptr\n            curptr = nextptr\n        X = sparse.csr_matrix((data, indices, indptr), (n_rows, len(domain.variables)))\n        from ..data import Table\n        return Table.new_from_numpy(domain, X)\n\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:** `BasketReader` Missing `_read_file` Method Causes AttributeError

**Description:**
When using the `BasketReader` class to process files, calling the `_read_file` method results in an `AttributeError` because the method is not defined within the class.

**Example Code:**
```python
import io
from Orange.data.io import BasketReader

file = io.StringIO("a=1,b=2,c=3")
table = BasketReader()._read_file(file)
```

**Expected Behavior:**
The `BasketReader` class should have a `_read_file` method that processes the provided file object and returns a data structure representing the parsed data without any errors.

**Actual Behavior:**
Executing the above code raises the following error:
```
AttributeError: 'BasketReader' object has no attribute '_read_file'
```

This prevents successful reading and processing of basket data using the `BasketReader`.
[/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/io.py
from ..data.variable import *
from ..data import Domain
from scipy import sparse
import numpy as np
import bottleneck as bn

import re

class FileReader:
    def prescan_file(self, f, delim, nvars, disc_cols, cont_cols):
        values = [set() for _ in range(nvars)]
        decimals = [-1]*nvars
        for lne in f:
            lne = lne.split(delim)
            for vs, col in zip(values, disc_cols):
                vs[col].add(lne[col])
            for col in cont_cols:
                val = lne[col]
                if not col in Variable.DefaultUnknownStr and "." in val:
                    decs = len(val) - val.find(".") - 1
                    if decs > decimals[col]:
                        decimals[col] = decs
        return values, decimals


class TabDelimReader:
    def read_header(self, filename):
        f = open(filename)
        names = f.readline().strip("\n\r").split("\t")
        types = f.readline().strip("\n\r").split("\t")
        flags = f.readline().strip("\n\r").split("\t")
        self.n_columns = len(names)
        if len(types) != self.n_columns:
            raise ValueError("File contains %i variable names and %i types" %
                             (len(names), len(types)))
        if len(flags) > self.n_columns:
            raise ValueError("There are more flags than variables")
        else:
            flags += [""] * self.n_columns

        attributes = []
        class_vars = []
        metas = []

        self.attribute_columns = []
        self.classvar_columns = []
        self.meta_columns = []
        self.weight_column = -1
        self.basket_column = -1

        for col, (name, tpe, flag) in enumerate(zip(names, types, flags)):
            tpe = tpe.strip()
            flag = flag.split()
            if "i" in flag or "ignore" in flag:
                continue
            if "b" in flag or "basket" in flag:
                self.basket_column = col
                continue
            is_class = "class" in flag
            is_meta = "m" in flag or "meta" in flag or \
                      "s" in tpe or "string" in tpe
            is_weight = "w" in tpe or "weight" in tpe or \
                        "w" in flag or "weight" in flag

            if is_weight:
                if is_class:
                    raise ValueError("Variable {} (column {}) is marked as "
                                     "class and weight".format(name, col))
                self.weight_column = col
                continue

            if tpe in ["c", "continuous"]:
                var = ContinuousVariable.make(name)
            elif tpe in ["w", "weight"]:
                var = None
            elif tpe in ["d", "discrete"]:
                var = DiscreteVariable.make(name)
            elif tpe in ["s", "string"]:
                var = StringVariable.make(name)
            else:
                var = DiscreteVariable.make(name, values=tpe.split())
            var.fix_order = isinstance(var, DiscreteVariable) and not var.values

            if is_class:
                if is_meta:
                    raise ValueError("Variable {} (column {}) is marked as "
                                     "class and meta attribute".format(name, col))
                class_vars.append(var)
                self.classvar_columns.append((col, var.val_from_str_add))
            elif is_meta:
                metas.append(var)
                self.meta_columns.append((col, var.val_from_str_add))
            else:
                attributes.append(var)
                self.attribute_columns.append((col, var.val_from_str_add))

        domain = Domain(attributes, class_vars, metas)
        return domain


    def count_lines(self, filename):
        i = -3
        for _ in open(filename):
            i += 1
        return i


    def read_data(self, filename, table):
        _X, _Y = table._X, table._Y
        _W = table._W if table._W.shape[-1] else None
        f = open(filename)
        f.readline(); f.readline(); f.readline()
        padding = [""] * self.n_columns
        if self.basket_column >= 0:
            table._Xsparse = _Xsparse = sparse.lil_matrix(len(_X), 100) # TODO how many columns?!
        table._metas = _metas = \
            np.empty((len(_X), len(self.meta_columns)), dtype=object)
        line_count = 0
        _Xr = None # To be able to delete it below even when there are no attributes
        for lne in f:
            values = lne.strip().split()
            if not values:
                continue
            if len(values) > self.n_columns:
                raise ValueError("Too many columns in line {}", 4+line_count)
            elif len(values) < self.n_columns:
                values += padding
            if self.attribute_columns:
                _Xr = _X[line_count]
                for i, (col, reader) in enumerate(self.attribute_columns):
                    _Xr[i] = reader(values[col])
            for i, (col, reader) in enumerate(self.classvar_columns):
                _Y[line_count, i] = reader(values[col])
            if _W is not None:
                _W[line_count] = float(values[self.weight_column])
            for i, (col, reader) in enumerate(self.meta_columns):
                _metas[line_count, i] = reader(values[col])
            line_count += 1
        if line_count != len(_X):
            del _Xr, _X, _Y, _W, _metas
            table._X.resize(line_count, len(table.domain.attributes))
            table._Y.resize(line_count, len(table.domain.class_vars))
            if table._W.ndim == 1:
                table._W.resize(line_count)
            else:
                table._W.resize((line_count, 0))
            table._metas.resize((line_count, len(self.meta_columns)))
        table.n_rows = line_count


    def reorder_values_array(self, arr, variables):
        for col, var in enumerate(variables):
            if var.fix_order and len(var.values) < 1000:
                new_order = var.order_values(var.values)
                if new_order == var.values:
                    continue
                arr[:, col] += 1000
                for i, val in enumerate(var.values):
                    bn.replace(arr[:,col], 1000+i, new_order.index(val))
                var.values = new_order
            delattr(var, "fix_order")


    def reorder_values(self, table):
        self.reorder_values_array(table._X, table.domain.attributes)
        self.reorder_values_array(table._Y, table.domain.class_vars)

    def read_file(self, filename):
        from ..data import Table
        domain = self.read_header(filename)
        nExamples = self.count_lines(filename)
        table = Table.new_from_domain(domain, nExamples, self.weight_column >= 0)
        self.read_data(filename, table)
        self.reorder_values(table)
        return table


class BasketReader():
    re_name = re.compile("([^,=\\n]+)(=((\d+\.?)|(\d*\.\d+)))?")
    def prescan_file(self, filename):
        """Return a list of attributes that appear in the file"""
        names = set()
        n_elements = 0
        n_rows = 0
        for line in open(filename):
            items = set(mo.group(1).strip() for mo in self.re_name.finditer(line))
            names.update(items)
            n_elements += len(items)
            n_rows += 1
        return names, n_elements, n_rows

    def construct_domain(self, names):
        attributes = [ContinuousVariable.make(name) for name in sorted(names)]
        return Domain(attributes)

    def read_file(self, filename):
        names, n_elements, n_rows = self.prescan_file(filename)
        domain = self.construct_domain(names)
        data = np.ones(n_elements)
        indices = np.empty(n_elements, dtype=int)
        indptr = np.empty(n_rows+1, dtype=int)
        indptr[0] = curptr = 0
        for row, line in enumerate(open(filename)):
            items = {mo.group(1).strip(): float(mo.group(3) or 1)
                     for mo in self.re_name.finditer(line)}
            nextptr = curptr + len(items)
            data[curptr:nextptr] = list(items.values())
            indices[curptr:nextptr] = [domain.index(name) for name in items]
            indptr[row+1] = nextptr
            curptr = nextptr
        X = sparse.csr_matrix((data, indices, indptr), (n_rows, len(domain.variables)))
        from ..data import Table
        return Table.new_from_numpy(domain, X)


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