{
    "file_diffs": [
        {
            "old_file_content": "#\n# The Python Imaging Library.\n# $Id$\n#\n# SGI image file handling\n#\n# See \"The SGI Image File Format (Draft version 0.97)\", Paul Haeberli.\n# <ftp://ftp.sgi.com/graphics/SGIIMAGESPEC>\n#\n# History:\n# 1995-09-10 fl   Created\n#\n# Copyright (c) 2008 by Karsten Hiddemann.\n# Copyright (c) 1997 by Secret Labs AB.\n# Copyright (c) 1995 by Fredrik Lundh.\n#\n# See the README file for information on usage and redistribution.\n#\n\n\n__version__ = \"0.2\"\n\n\nfrom PIL import Image, ImageFile, _binary\n\ni8 = _binary.i8\ni16 = _binary.i16be\ni32 = _binary.i32be\n\n\ndef _accept(prefix):\n    return i16(prefix) == 474\n\n\n##\n# Image plugin for SGI images.\n\nclass SgiImageFile(ImageFile.ImageFile):\n\n    format = \"SGI\"\n    format_description = \"SGI Image File Format\"\n\n    def _open(self):\n\n        # HEAD\n        s = self.fp.read(512)\n        if i16(s) != 474:\n            raise SyntaxError(\"not an SGI image file\")\n\n        # relevant header entries\n        compression = i8(s[2])\n\n        # bytes, dimension, zsize\n        layout = i8(s[3]), i16(s[4:]), i16(s[10:])\n\n        # determine mode from bytes/zsize\n        if layout == (1, 2, 1) or layout == (1, 1, 1):\n            self.mode = \"L\"\n        elif layout == (1, 3, 3):\n            self.mode = \"RGB\"\n        elif layout == (1, 3, 4):\n            self.mode = \"RGBA\"\n        else:\n            raise SyntaxError(\"unsupported SGI image mode\")\n\n        # size\n        self.size = i16(s[6:]), i16(s[8:])\n\n        # decoder info\n        if compression == 0:\n            offset = 512\n            pagesize = self.size[0]*self.size[1]*layout[0]\n            self.tile = []\n            for layer in self.mode:\n                self.tile.append(\n                    (\"raw\", (0, 0)+self.size, offset, (layer, 0, -1)))\n                offset = offset + pagesize\n        elif compression == 1:\n            self.tile = [\n                (\"sgi_rle\", (0, 0)+self.size, 512, (self.mode, 0, -1))]\n\n#\n# registry\n\nImage.register_open(\"SGI\", SgiImageFile, _accept)\n\nImage.register_extension(\"SGI\", \".bw\")\nImage.register_extension(\"SGI\", \".rgb\")\nImage.register_extension(\"SGI\", \".rgba\")\n\nImage.register_extension(\"SGI\", \".sgi\")\n",
            "new_file_content": "#\n# The Python Imaging Library.\n# $Id$\n#\n# SGI image file handling\n#\n# See \"The SGI Image File Format (Draft version 0.97)\", Paul Haeberli.\n# <ftp://ftp.sgi.com/graphics/SGIIMAGESPEC>\n#\n# History:\n# 1995-09-10 fl   Created\n#\n# Copyright (c) 2008 by Karsten Hiddemann.\n# Copyright (c) 1997 by Secret Labs AB.\n# Copyright (c) 1995 by Fredrik Lundh.\n#\n# See the README file for information on usage and redistribution.\n#\n\n\n__version__ = \"0.2\"\n\n\nfrom PIL import Image, ImageFile, _binary\n\ni8 = _binary.i8\ni16 = _binary.i16be\ni32 = _binary.i32be\n\n\ndef _accept(prefix):\n    return i16(prefix) == 474\n\n\n##\n# Image plugin for SGI images.\n\nclass SgiImageFile(ImageFile.ImageFile):\n\n    format = \"SGI\"\n    format_description = \"SGI Image File Format\"\n\n    def _open(self):\n\n        # HEAD\n        s = self.fp.read(512)\n        if i16(s) != 474:\n            raise ValueError(\"Not an SGI image file\")\n\n        # relevant header entries\n        compression = i8(s[2])\n\n        # bytes, dimension, zsize\n        layout = i8(s[3]), i16(s[4:]), i16(s[10:])\n\n        # determine mode from bytes/zsize\n        if layout == (1, 2, 1) or layout == (1, 1, 1):\n            self.mode = \"L\"\n        elif layout == (1, 3, 3):\n            self.mode = \"RGB\"\n        elif layout == (1, 3, 4):\n            self.mode = \"RGBA\"\n        else:\n            raise ValueError(\"Unsupported SGI image mode\")\n\n        # size\n        self.size = i16(s[6:]), i16(s[8:])\n\n        # decoder info\n        if compression == 0:\n            offset = 512\n            pagesize = self.size[0]*self.size[1]*layout[0]\n            self.tile = []\n            for layer in self.mode:\n                self.tile.append(\n                    (\"raw\", (0, 0)+self.size, offset, (layer, 0, -1)))\n                offset = offset + pagesize\n        elif compression == 1:\n            raise ValueError(\"SGI RLE encoding not supported\")\n\n#\n# registry\n\nImage.register_open(\"SGI\", SgiImageFile, _accept)\n\nImage.register_extension(\"SGI\", \".bw\")\nImage.register_extension(\"SGI\", \".rgb\")\nImage.register_extension(\"SGI\", \".rgba\")\nImage.register_extension(\"SGI\", \".sgi\")\n\n# End of file\n",
            "header": {
                "file": {
                    "path": "PIL/SgiImagePlugin.py"
                },
                "misc_line": null
            },
            "index_line": {
                "old_commit_hash": "bf3c18a43",
                "new_commit_hash": "2b8fcd8e4",
                "mode": "100644"
            },
            "is_binary_file": false,
            "binary_line": null,
            "minus_file": {
                "path": "a/PIL/SgiImagePlugin.py"
            },
            "plus_file": {
                "path": "b/PIL/SgiImagePlugin.py"
            },
            "hunks": [
                {
                    "descriptor": {
                        "old_range": {
                            "start": 45,
                            "length": 7
                        },
                        "new_range": {
                            "start": 45,
                            "length": 7
                        },
                        "section": "class SgiImageFile(ImageFile.ImageFile):"
                    },
                    "line_group": {
                        "all_lines": [
                            {
                                "content": "        # HEAD",
                                "type": "context"
                            },
                            {
                                "content": "        s = self.fp.read(512)",
                                "type": "context"
                            },
                            {
                                "content": "        if i16(s) != 474:",
                                "type": "context"
                            },
                            {
                                "content": "            raise SyntaxError(\"not an SGI image file\")",
                                "type": "deleted"
                            },
                            {
                                "content": "            raise ValueError(\"Not an SGI image file\")",
                                "type": "added"
                            },
                            {
                                "content": "",
                                "type": "context"
                            },
                            {
                                "content": "        # relevant header entries",
                                "type": "context"
                            },
                            {
                                "content": "        compression = i8(s[2])",
                                "type": "context"
                            }
                        ]
                    },
                    "modified_entities": [
                        {
                            "file_name": "PIL/SgiImagePlugin.py",
                            "type": "class",
                            "name": "SgiImageFile",
                            "content": "class SgiImageFile(ImageFile.ImageFile):\n\n    format = \"SGI\"\n    format_description = \"SGI Image File Format\"\n\n    def _open(self):\n\n        # HEAD\n        s = self.fp.read(512)\n        if i16(s) != 474:\n            raise SyntaxError(\"not an SGI image file\")\n\n        # relevant header entries\n        compression = i8(s[2])\n\n        # bytes, dimension, zsize\n        layout = i8(s[3]), i16(s[4:]), i16(s[10:])\n\n        # determine mode from bytes/zsize\n        if layout == (1, 2, 1) or layout == (1, 1, 1):\n            self.mode = \"L\"\n        elif layout == (1, 3, 3):\n            self.mode = \"RGB\"\n        elif layout == (1, 3, 4):\n            self.mode = \"RGBA\"\n        else:\n            raise SyntaxError(\"unsupported SGI image mode\")\n\n        # size\n        self.size = i16(s[6:]), i16(s[8:])\n\n        # decoder info\n        if compression == 0:\n            offset = 512\n            pagesize = self.size[0]*self.size[1]*layout[0]\n            self.tile = []\n            for layer in self.mode:\n                self.tile.append(\n                    (\"raw\", (0, 0)+self.size, offset, (layer, 0, -1)))\n                offset = offset + pagesize\n        elif compression == 1:\n            self.tile = [\n                (\"sgi_rle\", (0, 0)+self.size, 512, (self.mode, 0, -1))]",
                            "ast_type_str": "ClassDef",
                            "start_lineno": 38,
                            "end_lineno": 80,
                            "parent": null
                        },
                        {
                            "file_name": "PIL/SgiImagePlugin.py",
                            "type": "method",
                            "name": "SgiImageFile._open",
                            "content": "class SgiImageFile(ImageFile.ImageFile):\n\n    format = \"SGI\"\n    format_description = \"SGI Image File Format\"\n\n    def _open(self):\n\n        # HEAD\n        s = self.fp.read(512)\n        if i16(s) != 474:\n            raise SyntaxError(\"not an SGI image file\")\n\n        # relevant header entries\n        compression = i8(s[2])\n\n        # bytes, dimension, zsize\n        layout = i8(s[3]), i16(s[4:]), i16(s[10:])\n\n        # determine mode from bytes/zsize\n        if layout == (1, 2, 1) or layout == (1, 1, 1):\n            self.mode = \"L\"\n        elif layout == (1, 3, 3):\n            self.mode = \"RGB\"\n        elif layout == (1, 3, 4):\n            self.mode = \"RGBA\"\n        else:\n            raise SyntaxError(\"unsupported SGI image mode\")\n\n        # size\n        self.size = i16(s[6:]), i16(s[8:])\n\n        # decoder info\n        if compression == 0:\n            offset = 512\n            pagesize = self.size[0]*self.size[1]*layout[0]\n            self.tile = []\n            for layer in self.mode:\n                self.tile.append(\n                    (\"raw\", (0, 0)+self.size, offset, (layer, 0, -1)))\n                offset = offset + pagesize\n        elif compression == 1:\n            self.tile = [\n                (\"sgi_rle\", (0, 0)+self.size, 512, (self.mode, 0, -1))]",
                            "ast_type_str": "ClassDef",
                            "start_lineno": 43,
                            "end_lineno": 80,
                            "parent": {
                                "file_name": "PIL/SgiImagePlugin.py",
                                "type": "class",
                                "name": "SgiImageFile",
                                "content": "class SgiImageFile(ImageFile.ImageFile):\n\n    format = \"SGI\"\n    format_description = \"SGI Image File Format\"\n\n    def _open(self):\n\n        # HEAD\n        s = self.fp.read(512)\n        if i16(s) != 474:\n            raise SyntaxError(\"not an SGI image file\")\n\n        # relevant header entries\n        compression = i8(s[2])\n\n        # bytes, dimension, zsize\n        layout = i8(s[3]), i16(s[4:]), i16(s[10:])\n\n        # determine mode from bytes/zsize\n        if layout == (1, 2, 1) or layout == (1, 1, 1):\n            self.mode = \"L\"\n        elif layout == (1, 3, 3):\n            self.mode = \"RGB\"\n        elif layout == (1, 3, 4):\n            self.mode = \"RGBA\"\n        else:\n            raise SyntaxError(\"unsupported SGI image mode\")\n\n        # size\n        self.size = i16(s[6:]), i16(s[8:])\n\n        # decoder info\n        if compression == 0:\n            offset = 512\n            pagesize = self.size[0]*self.size[1]*layout[0]\n            self.tile = []\n            for layer in self.mode:\n                self.tile.append(\n                    (\"raw\", (0, 0)+self.size, offset, (layer, 0, -1)))\n                offset = offset + pagesize\n        elif compression == 1:\n            self.tile = [\n                (\"sgi_rle\", (0, 0)+self.size, 512, (self.mode, 0, -1))]",
                                "ast_type_str": "ClassDef",
                                "start_lineno": 38,
                                "end_lineno": 80,
                                "parent": null
                            }
                        }
                    ],
                    "added_entities": [],
                    "deleted_entities": []
                },
                {
                    "descriptor": {
                        "old_range": {
                            "start": 61,
                            "length": 7
                        },
                        "new_range": {
                            "start": 61,
                            "length": 7
                        },
                        "section": "class SgiImageFile(ImageFile.ImageFile):"
                    },
                    "line_group": {
                        "all_lines": [
                            {
                                "content": "        elif layout == (1, 3, 4):",
                                "type": "context"
                            },
                            {
                                "content": "            self.mode = \"RGBA\"",
                                "type": "context"
                            },
                            {
                                "content": "        else:",
                                "type": "context"
                            },
                            {
                                "content": "            raise SyntaxError(\"unsupported SGI image mode\")",
                                "type": "deleted"
                            },
                            {
                                "content": "            raise ValueError(\"Unsupported SGI image mode\")",
                                "type": "added"
                            },
                            {
                                "content": "",
                                "type": "context"
                            },
                            {
                                "content": "        # size",
                                "type": "context"
                            },
                            {
                                "content": "        self.size = i16(s[6:]), i16(s[8:])",
                                "type": "context"
                            }
                        ]
                    },
                    "modified_entities": [
                        {
                            "file_name": "PIL/SgiImagePlugin.py",
                            "type": "class",
                            "name": "SgiImageFile",
                            "content": "class SgiImageFile(ImageFile.ImageFile):\n\n    format = \"SGI\"\n    format_description = \"SGI Image File Format\"\n\n    def _open(self):\n\n        # HEAD\n        s = self.fp.read(512)\n        if i16(s) != 474:\n            raise SyntaxError(\"not an SGI image file\")\n\n        # relevant header entries\n        compression = i8(s[2])\n\n        # bytes, dimension, zsize\n        layout = i8(s[3]), i16(s[4:]), i16(s[10:])\n\n        # determine mode from bytes/zsize\n        if layout == (1, 2, 1) or layout == (1, 1, 1):\n            self.mode = \"L\"\n        elif layout == (1, 3, 3):\n            self.mode = \"RGB\"\n        elif layout == (1, 3, 4):\n            self.mode = \"RGBA\"\n        else:\n            raise SyntaxError(\"unsupported SGI image mode\")\n\n        # size\n        self.size = i16(s[6:]), i16(s[8:])\n\n        # decoder info\n        if compression == 0:\n            offset = 512\n            pagesize = self.size[0]*self.size[1]*layout[0]\n            self.tile = []\n            for layer in self.mode:\n                self.tile.append(\n                    (\"raw\", (0, 0)+self.size, offset, (layer, 0, -1)))\n                offset = offset + pagesize\n        elif compression == 1:\n            self.tile = [\n                (\"sgi_rle\", (0, 0)+self.size, 512, (self.mode, 0, -1))]",
                            "ast_type_str": "ClassDef",
                            "start_lineno": 38,
                            "end_lineno": 80,
                            "parent": null
                        },
                        {
                            "file_name": "PIL/SgiImagePlugin.py",
                            "type": "method",
                            "name": "SgiImageFile._open",
                            "content": "class SgiImageFile(ImageFile.ImageFile):\n\n    format = \"SGI\"\n    format_description = \"SGI Image File Format\"\n\n    def _open(self):\n\n        # HEAD\n        s = self.fp.read(512)\n        if i16(s) != 474:\n            raise SyntaxError(\"not an SGI image file\")\n\n        # relevant header entries\n        compression = i8(s[2])\n\n        # bytes, dimension, zsize\n        layout = i8(s[3]), i16(s[4:]), i16(s[10:])\n\n        # determine mode from bytes/zsize\n        if layout == (1, 2, 1) or layout == (1, 1, 1):\n            self.mode = \"L\"\n        elif layout == (1, 3, 3):\n            self.mode = \"RGB\"\n        elif layout == (1, 3, 4):\n            self.mode = \"RGBA\"\n        else:\n            raise SyntaxError(\"unsupported SGI image mode\")\n\n        # size\n        self.size = i16(s[6:]), i16(s[8:])\n\n        # decoder info\n        if compression == 0:\n            offset = 512\n            pagesize = self.size[0]*self.size[1]*layout[0]\n            self.tile = []\n            for layer in self.mode:\n                self.tile.append(\n                    (\"raw\", (0, 0)+self.size, offset, (layer, 0, -1)))\n                offset = offset + pagesize\n        elif compression == 1:\n            self.tile = [\n                (\"sgi_rle\", (0, 0)+self.size, 512, (self.mode, 0, -1))]",
                            "ast_type_str": "ClassDef",
                            "start_lineno": 43,
                            "end_lineno": 80,
                            "parent": {
                                "file_name": "PIL/SgiImagePlugin.py",
                                "type": "class",
                                "name": "SgiImageFile",
                                "content": "class SgiImageFile(ImageFile.ImageFile):\n\n    format = \"SGI\"\n    format_description = \"SGI Image File Format\"\n\n    def _open(self):\n\n        # HEAD\n        s = self.fp.read(512)\n        if i16(s) != 474:\n            raise SyntaxError(\"not an SGI image file\")\n\n        # relevant header entries\n        compression = i8(s[2])\n\n        # bytes, dimension, zsize\n        layout = i8(s[3]), i16(s[4:]), i16(s[10:])\n\n        # determine mode from bytes/zsize\n        if layout == (1, 2, 1) or layout == (1, 1, 1):\n            self.mode = \"L\"\n        elif layout == (1, 3, 3):\n            self.mode = \"RGB\"\n        elif layout == (1, 3, 4):\n            self.mode = \"RGBA\"\n        else:\n            raise SyntaxError(\"unsupported SGI image mode\")\n\n        # size\n        self.size = i16(s[6:]), i16(s[8:])\n\n        # decoder info\n        if compression == 0:\n            offset = 512\n            pagesize = self.size[0]*self.size[1]*layout[0]\n            self.tile = []\n            for layer in self.mode:\n                self.tile.append(\n                    (\"raw\", (0, 0)+self.size, offset, (layer, 0, -1)))\n                offset = offset + pagesize\n        elif compression == 1:\n            self.tile = [\n                (\"sgi_rle\", (0, 0)+self.size, 512, (self.mode, 0, -1))]",
                                "ast_type_str": "ClassDef",
                                "start_lineno": 38,
                                "end_lineno": 80,
                                "parent": null
                            }
                        }
                    ],
                    "added_entities": [],
                    "deleted_entities": []
                },
                {
                    "descriptor": {
                        "old_range": {
                            "start": 76,
                            "length": 8
                        },
                        "new_range": {
                            "start": 76,
                            "length": 7
                        },
                        "section": "class SgiImageFile(ImageFile.ImageFile):"
                    },
                    "line_group": {
                        "all_lines": [
                            {
                                "content": "                    (\"raw\", (0, 0)+self.size, offset, (layer, 0, -1)))",
                                "type": "context"
                            },
                            {
                                "content": "                offset = offset + pagesize",
                                "type": "context"
                            },
                            {
                                "content": "        elif compression == 1:",
                                "type": "context"
                            },
                            {
                                "content": "            self.tile = [",
                                "type": "deleted"
                            },
                            {
                                "content": "                (\"sgi_rle\", (0, 0)+self.size, 512, (self.mode, 0, -1))]",
                                "type": "deleted"
                            },
                            {
                                "content": "            raise ValueError(\"SGI RLE encoding not supported\")",
                                "type": "added"
                            },
                            {
                                "content": "",
                                "type": "context"
                            },
                            {
                                "content": "#",
                                "type": "context"
                            },
                            {
                                "content": "# registry",
                                "type": "context"
                            }
                        ]
                    },
                    "modified_entities": [
                        {
                            "file_name": "PIL/SgiImagePlugin.py",
                            "type": "class",
                            "name": "SgiImageFile",
                            "content": "class SgiImageFile(ImageFile.ImageFile):\n\n    format = \"SGI\"\n    format_description = \"SGI Image File Format\"\n\n    def _open(self):\n\n        # HEAD\n        s = self.fp.read(512)\n        if i16(s) != 474:\n            raise SyntaxError(\"not an SGI image file\")\n\n        # relevant header entries\n        compression = i8(s[2])\n\n        # bytes, dimension, zsize\n        layout = i8(s[3]), i16(s[4:]), i16(s[10:])\n\n        # determine mode from bytes/zsize\n        if layout == (1, 2, 1) or layout == (1, 1, 1):\n            self.mode = \"L\"\n        elif layout == (1, 3, 3):\n            self.mode = \"RGB\"\n        elif layout == (1, 3, 4):\n            self.mode = \"RGBA\"\n        else:\n            raise SyntaxError(\"unsupported SGI image mode\")\n\n        # size\n        self.size = i16(s[6:]), i16(s[8:])\n\n        # decoder info\n        if compression == 0:\n            offset = 512\n            pagesize = self.size[0]*self.size[1]*layout[0]\n            self.tile = []\n            for layer in self.mode:\n                self.tile.append(\n                    (\"raw\", (0, 0)+self.size, offset, (layer, 0, -1)))\n                offset = offset + pagesize\n        elif compression == 1:\n            self.tile = [\n                (\"sgi_rle\", (0, 0)+self.size, 512, (self.mode, 0, -1))]",
                            "ast_type_str": "ClassDef",
                            "start_lineno": 38,
                            "end_lineno": 80,
                            "parent": null
                        },
                        {
                            "file_name": "PIL/SgiImagePlugin.py",
                            "type": "method",
                            "name": "SgiImageFile._open",
                            "content": "class SgiImageFile(ImageFile.ImageFile):\n\n    format = \"SGI\"\n    format_description = \"SGI Image File Format\"\n\n    def _open(self):\n\n        # HEAD\n        s = self.fp.read(512)\n        if i16(s) != 474:\n            raise SyntaxError(\"not an SGI image file\")\n\n        # relevant header entries\n        compression = i8(s[2])\n\n        # bytes, dimension, zsize\n        layout = i8(s[3]), i16(s[4:]), i16(s[10:])\n\n        # determine mode from bytes/zsize\n        if layout == (1, 2, 1) or layout == (1, 1, 1):\n            self.mode = \"L\"\n        elif layout == (1, 3, 3):\n            self.mode = \"RGB\"\n        elif layout == (1, 3, 4):\n            self.mode = \"RGBA\"\n        else:\n            raise SyntaxError(\"unsupported SGI image mode\")\n\n        # size\n        self.size = i16(s[6:]), i16(s[8:])\n\n        # decoder info\n        if compression == 0:\n            offset = 512\n            pagesize = self.size[0]*self.size[1]*layout[0]\n            self.tile = []\n            for layer in self.mode:\n                self.tile.append(\n                    (\"raw\", (0, 0)+self.size, offset, (layer, 0, -1)))\n                offset = offset + pagesize\n        elif compression == 1:\n            self.tile = [\n                (\"sgi_rle\", (0, 0)+self.size, 512, (self.mode, 0, -1))]",
                            "ast_type_str": "ClassDef",
                            "start_lineno": 43,
                            "end_lineno": 80,
                            "parent": {
                                "file_name": "PIL/SgiImagePlugin.py",
                                "type": "class",
                                "name": "SgiImageFile",
                                "content": "class SgiImageFile(ImageFile.ImageFile):\n\n    format = \"SGI\"\n    format_description = \"SGI Image File Format\"\n\n    def _open(self):\n\n        # HEAD\n        s = self.fp.read(512)\n        if i16(s) != 474:\n            raise SyntaxError(\"not an SGI image file\")\n\n        # relevant header entries\n        compression = i8(s[2])\n\n        # bytes, dimension, zsize\n        layout = i8(s[3]), i16(s[4:]), i16(s[10:])\n\n        # determine mode from bytes/zsize\n        if layout == (1, 2, 1) or layout == (1, 1, 1):\n            self.mode = \"L\"\n        elif layout == (1, 3, 3):\n            self.mode = \"RGB\"\n        elif layout == (1, 3, 4):\n            self.mode = \"RGBA\"\n        else:\n            raise SyntaxError(\"unsupported SGI image mode\")\n\n        # size\n        self.size = i16(s[6:]), i16(s[8:])\n\n        # decoder info\n        if compression == 0:\n            offset = 512\n            pagesize = self.size[0]*self.size[1]*layout[0]\n            self.tile = []\n            for layer in self.mode:\n                self.tile.append(\n                    (\"raw\", (0, 0)+self.size, offset, (layer, 0, -1)))\n                offset = offset + pagesize\n        elif compression == 1:\n            self.tile = [\n                (\"sgi_rle\", (0, 0)+self.size, 512, (self.mode, 0, -1))]",
                                "ast_type_str": "ClassDef",
                                "start_lineno": 38,
                                "end_lineno": 80,
                                "parent": null
                            }
                        }
                    ],
                    "added_entities": [],
                    "deleted_entities": []
                },
                {
                    "descriptor": {
                        "old_range": {
                            "start": 87,
                            "length": 5
                        },
                        "new_range": {
                            "start": 86,
                            "length": 6
                        },
                        "section": "Image.register_open(\"SGI\", SgiImageFile, _accept)"
                    },
                    "line_group": {
                        "all_lines": [
                            {
                                "content": "Image.register_extension(\"SGI\", \".bw\")",
                                "type": "context"
                            },
                            {
                                "content": "Image.register_extension(\"SGI\", \".rgb\")",
                                "type": "context"
                            },
                            {
                                "content": "Image.register_extension(\"SGI\", \".rgba\")",
                                "type": "context"
                            },
                            {
                                "content": "",
                                "type": "deleted"
                            },
                            {
                                "content": "Image.register_extension(\"SGI\", \".sgi\")",
                                "type": "context"
                            },
                            {
                                "content": "",
                                "type": "added"
                            },
                            {
                                "content": "# End of file",
                                "type": "added"
                            }
                        ]
                    },
                    "modified_entities": [],
                    "added_entities": [],
                    "deleted_entities": []
                }
            ]
        },
        {
            "old_file_content": "from helper import unittest, PillowTestCase\n\nfrom PIL import Image\n\n\nclass TestFileSgi(PillowTestCase):\n\n    def sanity(self, filename, expected_mode, expected_size=(128, 128)):\n        # Act\n        im = Image.open(filename)\n\n        # Assert\n        self.assertEqual(im.mode, expected_mode)\n        self.assertEqual(im.size, expected_size)\n\n    def test_rgb(self):\n        # Arrange\n        # Created with ImageMagick then renamed:\n        # convert lena.ppm lena.sgi\n        test_file = \"Tests/images/lena.rgb\"\n        expected_mode = \"RGB\"\n\n        # Act / Assert\n        self.sanity(test_file, expected_mode)\n\n    def test_l(self):\n        # Arrange\n        # Created with ImageMagick then renamed:\n        # convert lena.ppm -monochrome lena.sgi\n        test_file = \"Tests/images/lena.bw\"\n        expected_mode = \"L\"\n\n        # Act / Assert\n        self.sanity(test_file, expected_mode)\n\n    def test_rgba(self):\n        # Arrange\n        # Created with ImageMagick:\n        # convert transparent.png transparent.sgi\n        test_file = \"Tests/images/transparent.sgi\"\n        expected_mode = \"RGBA\"\n        expected_size = (200, 150)\n\n        # Act / Assert\n        self.sanity(test_file, expected_mode, expected_size)\n\n\nif __name__ == '__main__':\n    unittest.main()\n\n# End of file\n",
            "new_file_content": "from helper import unittest, PillowTestCase\n\nfrom PIL import Image\n\n\nclass TestFileSgi(PillowTestCase):\n\n    def test_rgb(self):\n        # Arrange\n        # Created with ImageMagick then renamed:\n        # convert lena.ppm lena.sgi\n        test_file = \"Tests/images/lena.rgb\"\n\n        # Act / Assert\n        self.assertRaises(ValueError, lambda: Image.open(test_file))\n\n    def test_l(self):\n        # Arrange\n        # Created with ImageMagick then renamed:\n        # convert lena.ppm -monochrome lena.sgi\n        test_file = \"Tests/images/lena.bw\"\n\n        # Act / Assert\n        self.assertRaises(ValueError, lambda: Image.open(test_file))\n\n    def test_rgba(self):\n        # Arrange\n        # Created with ImageMagick:\n        # convert transparent.png transparent.sgi\n        test_file = \"Tests/images/transparent.sgi\"\n\n        # Act / Assert\n        self.assertRaises(ValueError, lambda: Image.open(test_file))\n\n\nif __name__ == '__main__':\n    unittest.main()\n\n# End of file\n",
            "header": {
                "file": {
                    "path": "Tests/test_file_sgi.py"
                },
                "misc_line": null
            },
            "index_line": {
                "old_commit_hash": "e94f0d989",
                "new_commit_hash": "84b184b63",
                "mode": "100644"
            },
            "is_binary_file": false,
            "binary_line": null,
            "minus_file": {
                "path": "a/Tests/test_file_sgi.py"
            },
            "plus_file": {
                "path": "b/Tests/test_file_sgi.py"
            },
            "hunks": [
                {
                    "descriptor": {
                        "old_range": {
                            "start": 5,
                            "length": 44
                        },
                        "new_range": {
                            "start": 5,
                            "length": 32
                        },
                        "section": "from PIL import Image"
                    },
                    "line_group": {
                        "all_lines": [
                            {
                                "content": "",
                                "type": "context"
                            },
                            {
                                "content": "class TestFileSgi(PillowTestCase):",
                                "type": "context"
                            },
                            {
                                "content": "",
                                "type": "context"
                            },
                            {
                                "content": "    def sanity(self, filename, expected_mode, expected_size=(128, 128)):",
                                "type": "deleted"
                            },
                            {
                                "content": "        # Act",
                                "type": "deleted"
                            },
                            {
                                "content": "        im = Image.open(filename)",
                                "type": "deleted"
                            },
                            {
                                "content": "",
                                "type": "deleted"
                            },
                            {
                                "content": "        # Assert",
                                "type": "deleted"
                            },
                            {
                                "content": "        self.assertEqual(im.mode, expected_mode)",
                                "type": "deleted"
                            },
                            {
                                "content": "        self.assertEqual(im.size, expected_size)",
                                "type": "deleted"
                            },
                            {
                                "content": "",
                                "type": "deleted"
                            },
                            {
                                "content": "    def test_rgb(self):",
                                "type": "context"
                            },
                            {
                                "content": "        # Arrange",
                                "type": "context"
                            },
                            {
                                "content": "        # Created with ImageMagick then renamed:",
                                "type": "context"
                            },
                            {
                                "content": "        # convert lena.ppm lena.sgi",
                                "type": "context"
                            },
                            {
                                "content": "        test_file = \"Tests/images/lena.rgb\"",
                                "type": "context"
                            },
                            {
                                "content": "        expected_mode = \"RGB\"",
                                "type": "deleted"
                            },
                            {
                                "content": "",
                                "type": "context"
                            },
                            {
                                "content": "        # Act / Assert",
                                "type": "context"
                            },
                            {
                                "content": "        self.sanity(test_file, expected_mode)",
                                "type": "deleted"
                            },
                            {
                                "content": "        self.assertRaises(ValueError, lambda: Image.open(test_file))",
                                "type": "added"
                            },
                            {
                                "content": "",
                                "type": "context"
                            },
                            {
                                "content": "    def test_l(self):",
                                "type": "context"
                            },
                            {
                                "content": "        # Arrange",
                                "type": "context"
                            },
                            {
                                "content": "        # Created with ImageMagick then renamed:",
                                "type": "context"
                            },
                            {
                                "content": "        # convert lena.ppm -monochrome lena.sgi",
                                "type": "context"
                            },
                            {
                                "content": "        test_file = \"Tests/images/lena.bw\"",
                                "type": "context"
                            },
                            {
                                "content": "        expected_mode = \"L\"",
                                "type": "deleted"
                            },
                            {
                                "content": "",
                                "type": "context"
                            },
                            {
                                "content": "        # Act / Assert",
                                "type": "context"
                            },
                            {
                                "content": "        self.sanity(test_file, expected_mode)",
                                "type": "deleted"
                            },
                            {
                                "content": "        self.assertRaises(ValueError, lambda: Image.open(test_file))",
                                "type": "added"
                            },
                            {
                                "content": "",
                                "type": "context"
                            },
                            {
                                "content": "    def test_rgba(self):",
                                "type": "context"
                            },
                            {
                                "content": "        # Arrange",
                                "type": "context"
                            },
                            {
                                "content": "        # Created with ImageMagick:",
                                "type": "context"
                            },
                            {
                                "content": "        # convert transparent.png transparent.sgi",
                                "type": "context"
                            },
                            {
                                "content": "        test_file = \"Tests/images/transparent.sgi\"",
                                "type": "context"
                            },
                            {
                                "content": "        expected_mode = \"RGBA\"",
                                "type": "deleted"
                            },
                            {
                                "content": "        expected_size = (200, 150)",
                                "type": "deleted"
                            },
                            {
                                "content": "",
                                "type": "context"
                            },
                            {
                                "content": "        # Act / Assert",
                                "type": "context"
                            },
                            {
                                "content": "        self.sanity(test_file, expected_mode, expected_size)",
                                "type": "deleted"
                            },
                            {
                                "content": "        self.assertRaises(ValueError, lambda: Image.open(test_file))",
                                "type": "added"
                            },
                            {
                                "content": "",
                                "type": "context"
                            },
                            {
                                "content": "",
                                "type": "context"
                            },
                            {
                                "content": "if __name__ == '__main__':",
                                "type": "context"
                            },
                            {
                                "content": "",
                                "type": "context"
                            }
                        ]
                    },
                    "modified_entities": [
                        {
                            "file_name": "Tests/test_file_sgi.py",
                            "type": "method",
                            "name": "TestFileSgi.test_rgba",
                            "content": "class TestFileSgi(PillowTestCase):\n\n    def sanity(self, filename, expected_mode, expected_size=(128, 128)):\n        # Act\n        im = Image.open(filename)\n\n        # Assert\n        self.assertEqual(im.mode, expected_mode)\n        self.assertEqual(im.size, expected_size)\n\n    def test_rgb(self):\n        # Arrange\n        # Created with ImageMagick then renamed:\n        # convert lena.ppm lena.sgi\n        test_file = \"Tests/images/lena.rgb\"\n        expected_mode = \"RGB\"\n\n        # Act / Assert\n        self.sanity(test_file, expected_mode)\n\n    def test_l(self):\n        # Arrange\n        # Created with ImageMagick then renamed:\n        # convert lena.ppm -monochrome lena.sgi\n        test_file = \"Tests/images/lena.bw\"\n        expected_mode = \"L\"\n\n        # Act / Assert\n        self.sanity(test_file, expected_mode)\n\n    def test_rgba(self):\n        # Arrange\n        # Created with ImageMagick:\n        # convert transparent.png transparent.sgi\n        test_file = \"Tests/images/transparent.sgi\"\n        expected_mode = \"RGBA\"\n        expected_size = (200, 150)\n\n        # Act / Assert\n        self.sanity(test_file, expected_mode, expected_size)",
                            "ast_type_str": "ClassDef",
                            "start_lineno": 36,
                            "end_lineno": 45,
                            "parent": {
                                "file_name": "Tests/test_file_sgi.py",
                                "type": "class",
                                "name": "TestFileSgi",
                                "content": "class TestFileSgi(PillowTestCase):\n\n    def sanity(self, filename, expected_mode, expected_size=(128, 128)):\n        # Act\n        im = Image.open(filename)\n\n        # Assert\n        self.assertEqual(im.mode, expected_mode)\n        self.assertEqual(im.size, expected_size)\n\n    def test_rgb(self):\n        # Arrange\n        # Created with ImageMagick then renamed:\n        # convert lena.ppm lena.sgi\n        test_file = \"Tests/images/lena.rgb\"\n        expected_mode = \"RGB\"\n\n        # Act / Assert\n        self.sanity(test_file, expected_mode)\n\n    def test_l(self):\n        # Arrange\n        # Created with ImageMagick then renamed:\n        # convert lena.ppm -monochrome lena.sgi\n        test_file = \"Tests/images/lena.bw\"\n        expected_mode = \"L\"\n\n        # Act / Assert\n        self.sanity(test_file, expected_mode)\n\n    def test_rgba(self):\n        # Arrange\n        # Created with ImageMagick:\n        # convert transparent.png transparent.sgi\n        test_file = \"Tests/images/transparent.sgi\"\n        expected_mode = \"RGBA\"\n        expected_size = (200, 150)\n\n        # Act / Assert\n        self.sanity(test_file, expected_mode, expected_size)",
                                "ast_type_str": "ClassDef",
                                "start_lineno": 6,
                                "end_lineno": 45,
                                "parent": null
                            }
                        },
                        {
                            "file_name": "Tests/test_file_sgi.py",
                            "type": "method",
                            "name": "TestFileSgi.test_l",
                            "content": "class TestFileSgi(PillowTestCase):\n\n    def sanity(self, filename, expected_mode, expected_size=(128, 128)):\n        # Act\n        im = Image.open(filename)\n\n        # Assert\n        self.assertEqual(im.mode, expected_mode)\n        self.assertEqual(im.size, expected_size)\n\n    def test_rgb(self):\n        # Arrange\n        # Created with ImageMagick then renamed:\n        # convert lena.ppm lena.sgi\n        test_file = \"Tests/images/lena.rgb\"\n        expected_mode = \"RGB\"\n\n        # Act / Assert\n        self.sanity(test_file, expected_mode)\n\n    def test_l(self):\n        # Arrange\n        # Created with ImageMagick then renamed:\n        # convert lena.ppm -monochrome lena.sgi\n        test_file = \"Tests/images/lena.bw\"\n        expected_mode = \"L\"\n\n        # Act / Assert\n        self.sanity(test_file, expected_mode)\n\n    def test_rgba(self):\n        # Arrange\n        # Created with ImageMagick:\n        # convert transparent.png transparent.sgi\n        test_file = \"Tests/images/transparent.sgi\"\n        expected_mode = \"RGBA\"\n        expected_size = (200, 150)\n\n        # Act / Assert\n        self.sanity(test_file, expected_mode, expected_size)",
                            "ast_type_str": "ClassDef",
                            "start_lineno": 26,
                            "end_lineno": 34,
                            "parent": {
                                "file_name": "Tests/test_file_sgi.py",
                                "type": "class",
                                "name": "TestFileSgi",
                                "content": "class TestFileSgi(PillowTestCase):\n\n    def sanity(self, filename, expected_mode, expected_size=(128, 128)):\n        # Act\n        im = Image.open(filename)\n\n        # Assert\n        self.assertEqual(im.mode, expected_mode)\n        self.assertEqual(im.size, expected_size)\n\n    def test_rgb(self):\n        # Arrange\n        # Created with ImageMagick then renamed:\n        # convert lena.ppm lena.sgi\n        test_file = \"Tests/images/lena.rgb\"\n        expected_mode = \"RGB\"\n\n        # Act / Assert\n        self.sanity(test_file, expected_mode)\n\n    def test_l(self):\n        # Arrange\n        # Created with ImageMagick then renamed:\n        # convert lena.ppm -monochrome lena.sgi\n        test_file = \"Tests/images/lena.bw\"\n        expected_mode = \"L\"\n\n        # Act / Assert\n        self.sanity(test_file, expected_mode)\n\n    def test_rgba(self):\n        # Arrange\n        # Created with ImageMagick:\n        # convert transparent.png transparent.sgi\n        test_file = \"Tests/images/transparent.sgi\"\n        expected_mode = \"RGBA\"\n        expected_size = (200, 150)\n\n        # Act / Assert\n        self.sanity(test_file, expected_mode, expected_size)",
                                "ast_type_str": "ClassDef",
                                "start_lineno": 6,
                                "end_lineno": 45,
                                "parent": null
                            }
                        },
                        {
                            "file_name": "Tests/test_file_sgi.py",
                            "type": "method",
                            "name": "TestFileSgi.test_rgb",
                            "content": "class TestFileSgi(PillowTestCase):\n\n    def sanity(self, filename, expected_mode, expected_size=(128, 128)):\n        # Act\n        im = Image.open(filename)\n\n        # Assert\n        self.assertEqual(im.mode, expected_mode)\n        self.assertEqual(im.size, expected_size)\n\n    def test_rgb(self):\n        # Arrange\n        # Created with ImageMagick then renamed:\n        # convert lena.ppm lena.sgi\n        test_file = \"Tests/images/lena.rgb\"\n        expected_mode = \"RGB\"\n\n        # Act / Assert\n        self.sanity(test_file, expected_mode)\n\n    def test_l(self):\n        # Arrange\n        # Created with ImageMagick then renamed:\n        # convert lena.ppm -monochrome lena.sgi\n        test_file = \"Tests/images/lena.bw\"\n        expected_mode = \"L\"\n\n        # Act / Assert\n        self.sanity(test_file, expected_mode)\n\n    def test_rgba(self):\n        # Arrange\n        # Created with ImageMagick:\n        # convert transparent.png transparent.sgi\n        test_file = \"Tests/images/transparent.sgi\"\n        expected_mode = \"RGBA\"\n        expected_size = (200, 150)\n\n        # Act / Assert\n        self.sanity(test_file, expected_mode, expected_size)",
                            "ast_type_str": "ClassDef",
                            "start_lineno": 16,
                            "end_lineno": 24,
                            "parent": {
                                "file_name": "Tests/test_file_sgi.py",
                                "type": "class",
                                "name": "TestFileSgi",
                                "content": "class TestFileSgi(PillowTestCase):\n\n    def sanity(self, filename, expected_mode, expected_size=(128, 128)):\n        # Act\n        im = Image.open(filename)\n\n        # Assert\n        self.assertEqual(im.mode, expected_mode)\n        self.assertEqual(im.size, expected_size)\n\n    def test_rgb(self):\n        # Arrange\n        # Created with ImageMagick then renamed:\n        # convert lena.ppm lena.sgi\n        test_file = \"Tests/images/lena.rgb\"\n        expected_mode = \"RGB\"\n\n        # Act / Assert\n        self.sanity(test_file, expected_mode)\n\n    def test_l(self):\n        # Arrange\n        # Created with ImageMagick then renamed:\n        # convert lena.ppm -monochrome lena.sgi\n        test_file = \"Tests/images/lena.bw\"\n        expected_mode = \"L\"\n\n        # Act / Assert\n        self.sanity(test_file, expected_mode)\n\n    def test_rgba(self):\n        # Arrange\n        # Created with ImageMagick:\n        # convert transparent.png transparent.sgi\n        test_file = \"Tests/images/transparent.sgi\"\n        expected_mode = \"RGBA\"\n        expected_size = (200, 150)\n\n        # Act / Assert\n        self.sanity(test_file, expected_mode, expected_size)",
                                "ast_type_str": "ClassDef",
                                "start_lineno": 6,
                                "end_lineno": 45,
                                "parent": null
                            }
                        },
                        {
                            "file_name": "Tests/test_file_sgi.py",
                            "type": "class",
                            "name": "TestFileSgi",
                            "content": "class TestFileSgi(PillowTestCase):\n\n    def sanity(self, filename, expected_mode, expected_size=(128, 128)):\n        # Act\n        im = Image.open(filename)\n\n        # Assert\n        self.assertEqual(im.mode, expected_mode)\n        self.assertEqual(im.size, expected_size)\n\n    def test_rgb(self):\n        # Arrange\n        # Created with ImageMagick then renamed:\n        # convert lena.ppm lena.sgi\n        test_file = \"Tests/images/lena.rgb\"\n        expected_mode = \"RGB\"\n\n        # Act / Assert\n        self.sanity(test_file, expected_mode)\n\n    def test_l(self):\n        # Arrange\n        # Created with ImageMagick then renamed:\n        # convert lena.ppm -monochrome lena.sgi\n        test_file = \"Tests/images/lena.bw\"\n        expected_mode = \"L\"\n\n        # Act / Assert\n        self.sanity(test_file, expected_mode)\n\n    def test_rgba(self):\n        # Arrange\n        # Created with ImageMagick:\n        # convert transparent.png transparent.sgi\n        test_file = \"Tests/images/transparent.sgi\"\n        expected_mode = \"RGBA\"\n        expected_size = (200, 150)\n\n        # Act / Assert\n        self.sanity(test_file, expected_mode, expected_size)",
                            "ast_type_str": "ClassDef",
                            "start_lineno": 6,
                            "end_lineno": 45,
                            "parent": null
                        }
                    ],
                    "added_entities": [],
                    "deleted_entities": [
                        {
                            "file_name": "Tests/test_file_sgi.py",
                            "type": "method",
                            "name": "TestFileSgi.sanity",
                            "content": "class TestFileSgi(PillowTestCase):\n\n    def sanity(self, filename, expected_mode, expected_size=(128, 128)):\n        # Act\n        im = Image.open(filename)\n\n        # Assert\n        self.assertEqual(im.mode, expected_mode)\n        self.assertEqual(im.size, expected_size)\n\n    def test_rgb(self):\n        # Arrange\n        # Created with ImageMagick then renamed:\n        # convert lena.ppm lena.sgi\n        test_file = \"Tests/images/lena.rgb\"\n        expected_mode = \"RGB\"\n\n        # Act / Assert\n        self.sanity(test_file, expected_mode)\n\n    def test_l(self):\n        # Arrange\n        # Created with ImageMagick then renamed:\n        # convert lena.ppm -monochrome lena.sgi\n        test_file = \"Tests/images/lena.bw\"\n        expected_mode = \"L\"\n\n        # Act / Assert\n        self.sanity(test_file, expected_mode)\n\n    def test_rgba(self):\n        # Arrange\n        # Created with ImageMagick:\n        # convert transparent.png transparent.sgi\n        test_file = \"Tests/images/transparent.sgi\"\n        expected_mode = \"RGBA\"\n        expected_size = (200, 150)\n\n        # Act / Assert\n        self.sanity(test_file, expected_mode, expected_size)",
                            "ast_type_str": "ClassDef",
                            "start_lineno": 8,
                            "end_lineno": 14,
                            "parent": {
                                "file_name": "Tests/test_file_sgi.py",
                                "type": "class",
                                "name": "TestFileSgi",
                                "content": "class TestFileSgi(PillowTestCase):\n\n    def sanity(self, filename, expected_mode, expected_size=(128, 128)):\n        # Act\n        im = Image.open(filename)\n\n        # Assert\n        self.assertEqual(im.mode, expected_mode)\n        self.assertEqual(im.size, expected_size)\n\n    def test_rgb(self):\n        # Arrange\n        # Created with ImageMagick then renamed:\n        # convert lena.ppm lena.sgi\n        test_file = \"Tests/images/lena.rgb\"\n        expected_mode = \"RGB\"\n\n        # Act / Assert\n        self.sanity(test_file, expected_mode)\n\n    def test_l(self):\n        # Arrange\n        # Created with ImageMagick then renamed:\n        # convert lena.ppm -monochrome lena.sgi\n        test_file = \"Tests/images/lena.bw\"\n        expected_mode = \"L\"\n\n        # Act / Assert\n        self.sanity(test_file, expected_mode)\n\n    def test_rgba(self):\n        # Arrange\n        # Created with ImageMagick:\n        # convert transparent.png transparent.sgi\n        test_file = \"Tests/images/transparent.sgi\"\n        expected_mode = \"RGBA\"\n        expected_size = (200, 150)\n\n        # Act / Assert\n        self.sanity(test_file, expected_mode, expected_size)",
                                "ast_type_str": "ClassDef",
                                "start_lineno": 6,
                                "end_lineno": 45,
                                "parent": null
                            }
                        }
                    ]
                }
            ]
        }
    ],
    "old_commit_hash": "fef3ceb2c02ef241a508ee020fe2617e10e33e42^",
    "new_commit_hash": "fef3ceb2c02ef241a508ee020fe2617e10e33e42",
    "commit_message": "If we can't read a file due to unsupported compression, raise an error",
    "commit_date": "2014-07-20T01:50:05+03:00",
    "metadata": {}
}
{
    "repo_name": "pillow",
    "new_commit_hash": "fef3ceb2c02ef241a508ee020fe2617e10e33e42",
    "test_file_codes": [
        "from helper import unittest, PillowTestCase\n\nfrom PIL import Image\n\n\nclass TestFileSgi(PillowTestCase):\n\n    def test_rgb(self):\n        # Arrange\n        # Created with ImageMagick then renamed:\n        # convert lena.ppm lena.sgi\n        test_file = \"Tests/images/lena.rgb\"\n\n        # Act / Assert\n        self.assertRaises(ValueError, lambda: Image.open(test_file))\n\n    def test_l(self):\n        # Arrange\n        # Created with ImageMagick then renamed:\n        # convert lena.ppm -monochrome lena.sgi\n        test_file = \"Tests/images/lena.bw\"\n\n        # Act / Assert\n        self.assertRaises(ValueError, lambda: Image.open(test_file))\n\n    def test_rgba(self):\n        # Arrange\n        # Created with ImageMagick:\n        # convert transparent.png transparent.sgi\n        test_file = \"Tests/images/transparent.sgi\"\n\n        # Act / Assert\n        self.assertRaises(ValueError, lambda: Image.open(test_file))\n\n\nif __name__ == '__main__':\n    unittest.main()\n\n# End of file\n",
        "#!/usr/bin/env python\nimport unittest\nimport sys\nimport time\nimport traceback\nimport platform\nimport os\n\n\nclass PytestLikeResult(unittest.TestResult):\n    def __init__(self, *args, **kwargs):\n        super().__init__(*args, **kwargs)\n        self.start_time = None\n        # Store (test, outcome, info) for each test:\n        #   outcome ∈ { \"passed\", \"failed\", \"error\", \"skipped\" }\n        #   info can hold the exception or skip reason, etc.\n        self.results = []\n\n    def startTestRun(self):\n        \"\"\"Called once before all tests.\"\"\"\n        self.start_time = time.time()\n        # Print a header similar to pytest\n        print(\"=\" * 29 + \" test session starts \" + \"=\" * 29)\n        # You can customize the platform/versions/paths as you like:\n        print(\n            f\"platform {platform.system().lower()} -- Python {platform.python_version()}\"\n        )\n        print(f\"rootdir: {os.path.abspath(os.curdir)}\")\n\n    def stopTestRun(self):\n        \"\"\"Called once after all tests are done.\"\"\"\n        elapsed = time.time() - self.start_time\n        print()  # blank line after final dot\n\n        # Summarize\n        ntests = len(self.results)\n        print(f\"collected {ntests} items\")\n\n        # Show details of failures/errors\n        failures = [r for r in self.results if r[1] == \"failed\"]\n        errors = [r for r in self.results if r[1] == \"error\"]\n\n        if failures:\n            print(\"\\n\" + \"=\" * 35 + \" FAILURES \" + \"=\" * 35)\n            for test, outcome, err_info in failures:\n                test = test.split(\"::\")\n                if len(test) == 3:\n                    test = f\"{test[1]}.{test[2]}\"\n                else:\n                    test = f\"{test[1]}\"\n                print(f\"__________ {test} __________\")\n                self._print_traceback(err_info)\n        if errors:\n            print(\"\\n\" + \"=\" * 35 + \" ERRORS \" + \"=\" * 37)\n            for test, outcome, err_info in errors:\n                test = test.split(\"::\")\n                if len(test) == 3:\n                    test = f\"{test[1]}.{test[2]}\"\n                else:\n                    test = f\"{test[1]}\"\n                print(f\"__________ {test} __________\")\n                self._print_traceback(err_info)\n\n        # Optional short summary lines for passes/fails/skips\n        print(\"\\n==================== short test summary info ====================\")\n        for test, outcome, info in self.results:\n            if outcome in (\"passed\", \"failed\", \"error\", \"skipped\"):\n                print(f\"{outcome.upper()} {test}\")\n\n        # Final one-line summary: “1 failed, 1 errors, 10 passed in 2.04s”\n        passed_count = sum(1 for r in self.results if r[1] == \"passed\")\n        failed_count = len(failures)\n        error_count = len(errors)\n        skipped_count = sum(1 for r in self.results if r[1] == \"skipped\")\n\n        summary_bits = []\n        if failed_count:\n            summary_bits.append(f\"{failed_count} failed\")\n        if error_count:\n            summary_bits.append(f\"{error_count} error{'s' if error_count != 1 else ''}\")\n        if passed_count:\n            summary_bits.append(f\"{passed_count} passed\")\n        if skipped_count:\n            summary_bits.append(f\"{skipped_count} skipped\")\n\n        summary_str = \", \".join(summary_bits) if summary_bits else \"no tests run\"\n        print(\n            f\"=================== {summary_str} in {elapsed:.2f}s ===================\"\n        )\n\n    def startTest(self, test):\n        \"\"\"Called right before each test method.\"\"\"\n        super().startTest(test)\n        # Print a dot or some indicator\n        print(\".\", end=\"\", flush=True)\n\n    def addSuccess(self, test):\n        super().addSuccess(test)\n        self.results.append((self._test_id(test), \"passed\", None))\n\n    def addFailure(self, test, err):\n        super().addFailure(test, err)\n        self.results.append((self._test_id(test), \"failed\", err))\n\n    def addError(self, test, err):\n        super().addError(test, err)\n        self.results.append((self._test_id(test), \"error\", err))\n\n    def addSkip(self, test, reason):\n        super().addSkip(test, reason)\n        self.results.append((self._test_id(test), \"skipped\", reason))\n\n    def _print_traceback(self, err_info):\n        \"\"\"Helper to print the traceback like pytest does.\"\"\"\n        if isinstance(err_info, tuple) and len(err_info) == 3:\n            exc_type, exc_value, tb = err_info\n            traceback.print_exception(exc_type, exc_value, tb, file=sys.stdout)\n        else:\n            print(str(err_info))\n\n    def _test_id(self, test):\n        try:\n            return f\"{test.__class__.__module__}::{test.__class__.__name__}::{test._testMethodName}\"\n        except AttributeError:\n            # Fallback for _ErrorHolder objects\n            return f\"{test.__class__.__module__}::{test.__class__.__name__}\"\n\n\nclass PytestLikeRunner(unittest.TextTestRunner):\n    \"\"\"A custom TextTestRunner that uses the PytestLikeResult.\"\"\"\n\n    resultclass = PytestLikeResult\n\n    def run(self, test):\n        result = self._makeResult()\n        # Overriding run to ensure we call startTestRun/stopTestRun\n        result.startTestRun()\n        test(result)\n        result.stopTestRun()\n        return result\n\n\ndef main():\n    loader = unittest.TestLoader()\n    suite = loader.discover(\"r2e_tests\")  # discover tests in r2e_tests/\n    runner = PytestLikeRunner(verbosity=0)\n    result = runner.run(suite)\n    # Exit with code 0 if all tests passed/skipped, 1 if there were fails/errors\n    sys.exit(not result.wasSuccessful())\n\n\nif __name__ == \"__main__\":\n    main()\n"
    ],
    "test_file_names": [
        "test_1.py",
        "unittest_custom_runner.py"
    ],
    "setup_res_code": 0,
    "setup_res_stdout": "Starting Pillow installation attempts...\nVerifying Pillow installation...\n✅ Pillow installation successful!\nSuccessfully installed Pillow\n",
    "setup_res_stderr": "Using CPython 3.9.21\nCreating virtual environment at: .venv\nActivate with: source .venv/bin/activate\nResolved 12 packages in 23ms\nInstalled 12 packages in 154ms\n + coverage==7.6.10\n + exceptiongroup==1.2.2\n + iniconfig==2.0.0\n + packaging==24.2\n + pluggy==1.5.0\n + pyqt5==5.15.11\n + pyqt5-qt5==5.15.16\n + pyqt5-sip==12.16.1\n + pytest==8.3.4\n + pytest-cov==6.0.0\n + setuptools==75.8.0\n + tomli==2.2.1\nResolved 1 package in 953ms\nPrepared 1 package in 12.46s\nInstalled 1 package in 2ms\n + pillow==2.5.0 (from file:///home/gcpuser/buckets/local_repoeval_bucket/repos/pillow_fef3ceb2c02ef241a508ee020fe2617e10e33e42)\n",
    "new_commit_res_code": 0,
    "new_commit_res_stdout": "============================= test session starts =============================\nplatform linux -- Python 3.9.21\nrootdir: /home/gcpuser/buckets/local_repoeval_bucket/repos/pillow_fef3ceb2c02ef241a508ee020fe2617e10e33e42\n...\ncollected 3 items\n\n==================== short test summary info ====================\nPASSED test_1::TestFileSgi::test_l\nPASSED test_1::TestFileSgi::test_rgb\nPASSED test_1::TestFileSgi::test_rgba\n=================== 3 passed in 0.13s ===================\n",
    "new_commit_res_stderr": "",
    "old_commit_res_code": 1,
    "old_commit_res_stdout": "============================= test session starts =============================\nplatform linux -- Python 3.9.21\nrootdir: /home/gcpuser/buckets/local_repoeval_bucket/repos/pillow_fef3ceb2c02ef241a508ee020fe2617e10e33e42\n...\ncollected 3 items\n\n=================================== FAILURES ===================================\n__________ TestFileSgi.test_l __________\nTraceback (most recent call last):\n  File \"/home/gcpuser/.local/share/uv/python/cpython-3.9.21-linux-x86_64-gnu/lib/python3.9/unittest/case.py\", line 59, in testPartExecutor\n    yield\n  File \"/home/gcpuser/.local/share/uv/python/cpython-3.9.21-linux-x86_64-gnu/lib/python3.9/unittest/case.py\", line 592, in run\n    self._callTestMethod(testMethod)\n  File \"/home/gcpuser/.local/share/uv/python/cpython-3.9.21-linux-x86_64-gnu/lib/python3.9/unittest/case.py\", line 550, in _callTestMethod\n    method()\n  File \"/home/gcpuser/buckets/local_repoeval_bucket/repos/pillow_fef3ceb2c02ef241a508ee020fe2617e10e33e42/r2e_tests/test_1.py\", line 24, in test_l\n    self.assertRaises(ValueError, lambda: Image.open(test_file))\nAssertionError: ValueError not raised by <lambda>\n__________ TestFileSgi.test_rgb __________\nTraceback (most recent call last):\n  File \"/home/gcpuser/.local/share/uv/python/cpython-3.9.21-linux-x86_64-gnu/lib/python3.9/unittest/case.py\", line 59, in testPartExecutor\n    yield\n  File \"/home/gcpuser/.local/share/uv/python/cpython-3.9.21-linux-x86_64-gnu/lib/python3.9/unittest/case.py\", line 592, in run\n    self._callTestMethod(testMethod)\n  File \"/home/gcpuser/.local/share/uv/python/cpython-3.9.21-linux-x86_64-gnu/lib/python3.9/unittest/case.py\", line 550, in _callTestMethod\n    method()\n  File \"/home/gcpuser/buckets/local_repoeval_bucket/repos/pillow_fef3ceb2c02ef241a508ee020fe2617e10e33e42/r2e_tests/test_1.py\", line 15, in test_rgb\n    self.assertRaises(ValueError, lambda: Image.open(test_file))\nAssertionError: ValueError not raised by <lambda>\n__________ TestFileSgi.test_rgba __________\nTraceback (most recent call last):\n  File \"/home/gcpuser/.local/share/uv/python/cpython-3.9.21-linux-x86_64-gnu/lib/python3.9/unittest/case.py\", line 59, in testPartExecutor\n    yield\n  File \"/home/gcpuser/.local/share/uv/python/cpython-3.9.21-linux-x86_64-gnu/lib/python3.9/unittest/case.py\", line 592, in run\n    self._callTestMethod(testMethod)\n  File \"/home/gcpuser/.local/share/uv/python/cpython-3.9.21-linux-x86_64-gnu/lib/python3.9/unittest/case.py\", line 550, in _callTestMethod\n    method()\n  File \"/home/gcpuser/buckets/local_repoeval_bucket/repos/pillow_fef3ceb2c02ef241a508ee020fe2617e10e33e42/r2e_tests/test_1.py\", line 33, in test_rgba\n    self.assertRaises(ValueError, lambda: Image.open(test_file))\nAssertionError: ValueError not raised by <lambda>\n\n==================== short test summary info ====================\nFAILED test_1::TestFileSgi::test_l\nFAILED test_1::TestFileSgi::test_rgb\nFAILED test_1::TestFileSgi::test_rgba\n=================== 3 failed in 0.03s ===================\n",
    "old_commit_res_stderr": ""
}
PIL/SgiImagePlugin.py Tests/test_file_sgi.py
We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
[ISSUE]
**Title:** SGIImagePlugin Fails to Raise Error for Unsupported Compression

**Description:**
When attempting to open SGI image files that use unsupported compression or have unsupported image modes, the `PIL.SgiImagePlugin` does not raise an appropriate error. This results in the image failing to load correctly without providing a clear indication of the issue, making it difficult to debug and handle such cases programmatically.

**Example:**
```python
from PIL import Image

# Attempting to open an SGI image with unsupported compression
Image.open('path/to/unsupported_compression_image.sgi')
```

**Expected Behavior:**
A `ValueError` should be raised with a message indicating that the SGI image file is not supported or that the compression method is unsupported.

**Actual Behavior:**
No error is raised, causing the image loading process to fail silently or behave unpredictably without a clear error message.

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

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

--- BEGIN FILE ---
```
### PIL/SgiImagePlugin.py
#
# The Python Imaging Library.
# $Id$
#
# SGI image file handling
#
# See "The SGI Image File Format (Draft version 0.97)", Paul Haeberli.
# <ftp://ftp.sgi.com/graphics/SGIIMAGESPEC>
#
# History:
# 1995-09-10 fl   Created
#
# Copyright (c) 2008 by Karsten Hiddemann.
# Copyright (c) 1997 by Secret Labs AB.
# Copyright (c) 1995 by Fredrik Lundh.
#
# See the README file for information on usage and redistribution.
#


__version__ = "0.2"


from PIL import Image, ImageFile, _binary

i8 = _binary.i8
i16 = _binary.i16be
i32 = _binary.i32be


def _accept(prefix):
    return i16(prefix) == 474


##
# Image plugin for SGI images.

class SgiImageFile(ImageFile.ImageFile):

    format = "SGI"
    format_description = "SGI Image File Format"

    def _open(self):

        # HEAD
        s = self.fp.read(512)
        if i16(s) != 474:
            raise SyntaxError("not an SGI image file")

        # relevant header entries
        compression = i8(s[2])

        # bytes, dimension, zsize
        layout = i8(s[3]), i16(s[4:]), i16(s[10:])

        # determine mode from bytes/zsize
        if layout == (1, 2, 1) or layout == (1, 1, 1):
            self.mode = "L"
        elif layout == (1, 3, 3):
            self.mode = "RGB"
        elif layout == (1, 3, 4):
            self.mode = "RGBA"
        else:
            raise SyntaxError("unsupported SGI image mode")

        # size
        self.size = i16(s[6:]), i16(s[8:])

        # decoder info
        if compression == 0:
            offset = 512
            pagesize = self.size[0]*self.size[1]*layout[0]
            self.tile = []
            for layer in self.mode:
                self.tile.append(
                    ("raw", (0, 0)+self.size, offset, (layer, 0, -1)))
                offset = offset + pagesize
        elif compression == 1:
            self.tile = [
                ("sgi_rle", (0, 0)+self.size, 512, (self.mode, 0, -1))]

#
# registry

Image.register_open("SGI", SgiImageFile, _accept)

Image.register_extension("SGI", ".bw")
Image.register_extension("SGI", ".rgb")
Image.register_extension("SGI", ".rgba")

Image.register_extension("SGI", ".sgi")

```
--- 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:** SGIImagePlugin Fails to Raise Error for Unsupported Compression

**Description:**
When attempting to open SGI image files that use unsupported compression or have unsupported image modes, the `PIL.SgiImagePlugin` does not raise an appropriate error. This results in the image failing to load correctly without providing a clear indication of the issue, making it difficult to debug and handle such cases programmatically.

**Example:**
```python
from PIL import Image

# Attempting to open an SGI image with unsupported compression
Image.open('path/to/unsupported_compression_image.sgi')
```

**Expected Behavior:**
A `ValueError` should be raised with a message indicating that the SGI image file is not supported or that the compression method is unsupported.

**Actual Behavior:**
No error is raised, causing the image loading process to fail silently or behave unpredictably without a clear error message.

[/ISSUE]
{
    "TestFileSgi.test_l": "PASSED",
    "TestFileSgi.test_rgb": "PASSED",
    "TestFileSgi.test_rgba": "PASSED"
}
diff --git a/PIL/SgiImagePlugin.py b/PIL/SgiImagePlugin.py
index bf3c18a43..2b8fcd8e4 100644
--- a/PIL/SgiImagePlugin.py
+++ b/PIL/SgiImagePlugin.py
@@ -45,7 +45,7 @@ class SgiImageFile(ImageFile.ImageFile):
         # HEAD
         s = self.fp.read(512)
         if i16(s) != 474:
-            raise SyntaxError("not an SGI image file")
+            raise ValueError("Not an SGI image file")
 
         # relevant header entries
         compression = i8(s[2])
@@ -61,7 +61,7 @@ class SgiImageFile(ImageFile.ImageFile):
         elif layout == (1, 3, 4):
             self.mode = "RGBA"
         else:
-            raise SyntaxError("unsupported SGI image mode")
+            raise ValueError("Unsupported SGI image mode")
 
         # size
         self.size = i16(s[6:]), i16(s[8:])
@@ -76,8 +76,7 @@ class SgiImageFile(ImageFile.ImageFile):
                     ("raw", (0, 0)+self.size, offset, (layer, 0, -1)))
                 offset = offset + pagesize
         elif compression == 1:
-            self.tile = [
-                ("sgi_rle", (0, 0)+self.size, 512, (self.mode, 0, -1))]
+            raise ValueError("SGI RLE encoding not supported")
 
 #
 # registry
@@ -87,5 +86,6 @@ Image.register_open("SGI", SgiImageFile, _accept)
 Image.register_extension("SGI", ".bw")
 Image.register_extension("SGI", ".rgb")
 Image.register_extension("SGI", ".rgba")
-
 Image.register_extension("SGI", ".sgi")
+
+# End of file

{"PIL/SgiImagePlugin.py": "#\n# The Python Imaging Library.\n# $Id$\n#\n# SGI image file handling\n#\n# See \"The SGI Image File Format (Draft version 0.97)\", Paul Haeberli.\n# <ftp://ftp.sgi.com/graphics/SGIIMAGESPEC>\n#\n# History:\n# 1995-09-10 fl   Created\n#\n# Copyright (c) 2008 by Karsten Hiddemann.\n# Copyright (c) 1997 by Secret Labs AB.\n# Copyright (c) 1995 by Fredrik Lundh.\n#\n# See the README file for information on usage and redistribution.\n#\n\n\n__version__ = \"0.2\"\n\n\nfrom PIL import Image, ImageFile, _binary\n\ni8 = _binary.i8\ni16 = _binary.i16be\ni32 = _binary.i32be\n\n\ndef _accept(prefix):\n    return i16(prefix) == 474\n\n\n##\n# Image plugin for SGI images.\n\nclass SgiImageFile(ImageFile.ImageFile):\n\n    format = \"SGI\"\n    format_description = \"SGI Image File Format\"\n\n    def _open(self):\n\n        # HEAD\n        s = self.fp.read(512)\n        if i16(s) != 474:\n            raise SyntaxError(\"not an SGI image file\")\n\n        # relevant header entries\n        compression = i8(s[2])\n\n        # bytes, dimension, zsize\n        layout = i8(s[3]), i16(s[4:]), i16(s[10:])\n\n        # determine mode from bytes/zsize\n        if layout == (1, 2, 1) or layout == (1, 1, 1):\n            self.mode = \"L\"\n        elif layout == (1, 3, 3):\n            self.mode = \"RGB\"\n        elif layout == (1, 3, 4):\n            self.mode = \"RGBA\"\n        else:\n            raise SyntaxError(\"unsupported SGI image mode\")\n\n        # size\n        self.size = i16(s[6:]), i16(s[8:])\n\n        # decoder info\n        if compression == 0:\n            offset = 512\n            pagesize = self.size[0]*self.size[1]*layout[0]\n            self.tile = []\n            for layer in self.mode:\n                self.tile.append(\n                    (\"raw\", (0, 0)+self.size, offset, (layer, 0, -1)))\n                offset = offset + pagesize\n        elif compression == 1:\n            self.tile = [\n                (\"sgi_rle\", (0, 0)+self.size, 512, (self.mode, 0, -1))]\n\n#\n# registry\n\nImage.register_open(\"SGI\", SgiImageFile, _accept)\n\nImage.register_extension(\"SGI\", \".bw\")\nImage.register_extension(\"SGI\", \".rgb\")\nImage.register_extension(\"SGI\", \".rgba\")\n\nImage.register_extension(\"SGI\", \".sgi\")\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:** SGIImagePlugin Fails to Raise Error for Unsupported Compression

**Description:**
When attempting to open SGI image files that use unsupported compression or have unsupported image modes, the `PIL.SgiImagePlugin` does not raise an appropriate error. This results in the image failing to load correctly without providing a clear indication of the issue, making it difficult to debug and handle such cases programmatically.

**Example:**
```python
from PIL import Image

# Attempting to open an SGI image with unsupported compression
Image.open('path/to/unsupported_compression_image.sgi')
```

**Expected Behavior:**
A `ValueError` should be raised with a message indicating that the SGI image file is not supported or that the compression method is unsupported.

**Actual Behavior:**
No error is raised, causing the image loading process to fail silently or behave unpredictably without a clear error message.

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

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

--- BEGIN FILE ---
```
### PIL/SgiImagePlugin.py
#
# The Python Imaging Library.
# $Id$
#
# SGI image file handling
#
# See "The SGI Image File Format (Draft version 0.97)", Paul Haeberli.
# <ftp://ftp.sgi.com/graphics/SGIIMAGESPEC>
#
# History:
# 1995-09-10 fl   Created
#
# Copyright (c) 2008 by Karsten Hiddemann.
# Copyright (c) 1997 by Secret Labs AB.
# Copyright (c) 1995 by Fredrik Lundh.
#
# See the README file for information on usage and redistribution.
#


__version__ = "0.2"


from PIL import Image, ImageFile, _binary

i8 = _binary.i8
i16 = _binary.i16be
i32 = _binary.i32be


def _accept(prefix):
    return i16(prefix) == 474


##
# Image plugin for SGI images.

class SgiImageFile(ImageFile.ImageFile):

    format = "SGI"
    format_description = "SGI Image File Format"

    def _open(self):

        # HEAD
        s = self.fp.read(512)
        if i16(s) != 474:
            raise SyntaxError("not an SGI image file")

        # relevant header entries
        compression = i8(s[2])

        # bytes, dimension, zsize
        layout = i8(s[3]), i16(s[4:]), i16(s[10:])

        # determine mode from bytes/zsize
        if layout == (1, 2, 1) or layout == (1, 1, 1):
            self.mode = "L"
        elif layout == (1, 3, 3):
            self.mode = "RGB"
        elif layout == (1, 3, 4):
            self.mode = "RGBA"
        else:
            raise SyntaxError("unsupported SGI image mode")

        # size
        self.size = i16(s[6:]), i16(s[8:])

        # decoder info
        if compression == 0:
            offset = 512
            pagesize = self.size[0]*self.size[1]*layout[0]
            self.tile = []
            for layer in self.mode:
                self.tile.append(
                    ("raw", (0, 0)+self.size, offset, (layer, 0, -1)))
                offset = offset + pagesize
        elif compression == 1:
            self.tile = [
                ("sgi_rle", (0, 0)+self.size, 512, (self.mode, 0, -1))]

#
# registry

Image.register_open("SGI", SgiImageFile, _accept)

Image.register_extension("SGI", ".bw")
Image.register_extension("SGI", ".rgb")
Image.register_extension("SGI", ".rgba")

Image.register_extension("SGI", ".sgi")

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