{
    "file_diffs": [
        {
            "old_file_content": "from helper import unittest, PillowTestCase\n\nfrom PIL import Image\nfrom PIL import ImageColor\n\n\nclass TestImageColor(PillowTestCase):\n\n    def test_hash(self):\n        # short 3 components\n        self.assertEqual((255, 0, 0), ImageColor.getrgb(\"#f00\"))\n        self.assertEqual((0, 255, 0), ImageColor.getrgb(\"#0f0\"))\n        self.assertEqual((0, 0, 255), ImageColor.getrgb(\"#00f\"))\n\n        # short 4 components\n        self.assertEqual((255, 0, 0, 0), ImageColor.getrgb(\"#f000\"))\n        self.assertEqual((0, 255, 0, 0), ImageColor.getrgb(\"#0f00\"))\n        self.assertEqual((0, 0, 255, 0), ImageColor.getrgb(\"#00f0\"))\n        self.assertEqual((0, 0, 0, 255), ImageColor.getrgb(\"#000f\"))\n\n        # long 3 components\n        self.assertEqual((222, 0, 0), ImageColor.getrgb(\"#de0000\"))\n        self.assertEqual((0, 222, 0), ImageColor.getrgb(\"#00de00\"))\n        self.assertEqual((0, 0, 222), ImageColor.getrgb(\"#0000de\"))\n\n        # long 4 components\n        self.assertEqual((222, 0, 0, 0), ImageColor.getrgb(\"#de000000\"))\n        self.assertEqual((0, 222, 0, 0), ImageColor.getrgb(\"#00de0000\"))\n        self.assertEqual((0, 0, 222, 0), ImageColor.getrgb(\"#0000de00\"))\n        self.assertEqual((0, 0, 0, 222), ImageColor.getrgb(\"#000000de\"))\n\n        # case insensitivity\n        self.assertEqual(ImageColor.getrgb(\"#DEF\"), ImageColor.getrgb(\"#def\"))\n        self.assertEqual(ImageColor.getrgb(\"#CDEF\"), ImageColor.getrgb(\"#cdef\"))\n        self.assertEqual(ImageColor.getrgb(\"#DEFDEF\"),\n                         ImageColor.getrgb(\"#defdef\"))\n        self.assertEqual(ImageColor.getrgb(\"#CDEFCDEF\"),\n                         ImageColor.getrgb(\"#cdefcdef\"))\n\n        # not a number\n        self.assertRaises(ValueError, ImageColor.getrgb, \"#fo0\")\n        self.assertRaises(ValueError, ImageColor.getrgb, \"#fo00\")\n        self.assertRaises(ValueError, ImageColor.getrgb, \"#fo0000\")\n        self.assertRaises(ValueError, ImageColor.getrgb, \"#fo000000\")\n\n        # wrong number of components\n        self.assertRaises(ValueError, ImageColor.getrgb, \"#f0000\")\n        self.assertRaises(ValueError, ImageColor.getrgb, \"#f000000\")\n        self.assertRaises(ValueError, ImageColor.getrgb, \"#f00000000\")\n        self.assertRaises(ValueError, ImageColor.getrgb, \"#f000000000\")\n        self.assertRaises(ValueError, ImageColor.getrgb, \"#f00000 \")\n\n    def test_colormap(self):\n        self.assertEqual((0, 0, 0), ImageColor.getrgb(\"black\"))\n        self.assertEqual((255, 255, 255), ImageColor.getrgb(\"white\"))\n        self.assertEqual((255, 255, 255), ImageColor.getrgb(\"WHITE\"))\n\n        self.assertRaises(ValueError, ImageColor.getrgb, \"black \")\n\n    def test_functions(self):\n        # rgb numbers\n        self.assertEqual((255, 0, 0), ImageColor.getrgb(\"rgb(255,0,0)\"))\n        self.assertEqual((0, 255, 0), ImageColor.getrgb(\"rgb(0,255,0)\"))\n        self.assertEqual((0, 0, 255), ImageColor.getrgb(\"rgb(0,0,255)\"))\n\n        # percents\n        self.assertEqual((255, 0, 0), ImageColor.getrgb(\"rgb(100%,0%,0%)\"))\n        self.assertEqual((0, 255, 0), ImageColor.getrgb(\"rgb(0%,100%,0%)\"))\n        self.assertEqual((0, 0, 255), ImageColor.getrgb(\"rgb(0%,0%,100%)\"))\n\n        # rgba numbers\n        self.assertEqual((255, 0, 0, 0), ImageColor.getrgb(\"rgba(255,0,0,0)\"))\n        self.assertEqual((0, 255, 0, 0), ImageColor.getrgb(\"rgba(0,255,0,0)\"))\n        self.assertEqual((0, 0, 255, 0), ImageColor.getrgb(\"rgba(0,0,255,0)\"))\n        self.assertEqual((0, 0, 0, 255), ImageColor.getrgb(\"rgba(0,0,0,255)\"))\n\n        self.assertEqual((255, 0, 0), ImageColor.getrgb(\"hsl(0,100%,50%)\"))\n        self.assertEqual((255, 0, 0), ImageColor.getrgb(\"hsl(360,100%,50%)\"))\n        self.assertEqual((0, 255, 255), ImageColor.getrgb(\"hsl(180,100%,50%)\"))\n\n        # floats\n        self.assertEqual((254, 3, 3), ImageColor.getrgb(\"hsl(0.1,99.2%,50.3%)\"))\n        self.assertEqual((255, 0, 0), ImageColor.getrgb(\"hsl(360.,100.0%,50%)\"))\n\n        # case insensitivity\n        self.assertEqual(ImageColor.getrgb(\"RGB(255,0,0)\"),\n                         ImageColor.getrgb(\"rgb(255,0,0)\"))\n        self.assertEqual(ImageColor.getrgb(\"RGB(100%,0%,0%)\"),\n                         ImageColor.getrgb(\"rgb(100%,0%,0%)\"))\n        self.assertEqual(ImageColor.getrgb(\"RGBA(255,0,0,0)\"),\n                         ImageColor.getrgb(\"rgba(255,0,0,0)\"))\n        self.assertEqual(ImageColor.getrgb(\"HSL(0,100%,50%)\"),\n                         ImageColor.getrgb(\"hsl(0,100%,50%)\"))\n\n        # space agnosticism\n        self.assertEqual((255, 0, 0),\n                         ImageColor.getrgb(\"rgb(  255  ,  0  ,  0  )\"))\n        self.assertEqual((255, 0, 0),\n                         ImageColor.getrgb(\"rgb(  100%  ,  0%  ,  0%  )\"))\n        self.assertEqual((255, 0, 0, 0),\n                         ImageColor.getrgb(\"rgba(  255  ,  0  ,  0  ,  0  )\"))\n        self.assertEqual((255, 0, 0),\n                         ImageColor.getrgb(\"hsl(  0  ,  100%  ,  50%  )\"))\n\n        # wrong number of components\n        self.assertRaises(ValueError, ImageColor.getrgb, \"rgb(255,0)\")\n        self.assertRaises(ValueError, ImageColor.getrgb, \"rgb(255,0,0,0)\")\n\n        self.assertRaises(ValueError, ImageColor.getrgb, \"rgb(100%,0%)\")\n        self.assertRaises(ValueError, ImageColor.getrgb, \"rgb(100%,0%,0)\")\n        self.assertRaises(ValueError, ImageColor.getrgb, \"rgb(100%,0%,0 %)\")\n        self.assertRaises(ValueError, ImageColor.getrgb, \"rgb(100%,0%,0%,0%)\")\n\n        self.assertRaises(ValueError, ImageColor.getrgb, \"rgba(255,0,0)\")\n        self.assertRaises(ValueError, ImageColor.getrgb, \"rgba(255,0,0,0,0)\")\n\n        self.assertRaises(ValueError, ImageColor.getrgb, \"hsl(0,100%)\")\n        self.assertRaises(ValueError, ImageColor.getrgb, \"hsl(0,100%,0%,0%)\")\n        self.assertRaises(ValueError, ImageColor.getrgb, \"hsl(0%,100%,50%)\")\n        self.assertRaises(ValueError, ImageColor.getrgb, \"hsl(0,100,50%)\")\n        self.assertRaises(ValueError, ImageColor.getrgb, \"hsl(0,100%,50)\")\n\n    # look for rounding errors (based on code by Tim Hatch)\n    def test_rounding_errors(self):\n\n        for color in ImageColor.colormap:\n            expected = Image.new(\n                \"RGB\", (1, 1), color).convert(\"L\").getpixel((0, 0))\n            actual = ImageColor.getcolor(color, 'L')\n            self.assertEqual(expected, actual)\n\n        self.assertEqual(\n            (0, 255, 115), ImageColor.getcolor(\"rgba(0, 255, 115, 33)\", \"RGB\"))\n        Image.new(\"RGB\", (1, 1), \"white\")\n\n        self.assertEqual((0, 0, 0, 255), ImageColor.getcolor(\"black\", \"RGBA\"))\n        self.assertEqual(\n            (255, 255, 255, 255), ImageColor.getcolor(\"white\", \"RGBA\"))\n        self.assertEqual(\n            (0, 255, 115, 33),\n            ImageColor.getcolor(\"rgba(0, 255, 115, 33)\", \"RGBA\"))\n        Image.new(\"RGBA\", (1, 1), \"white\")\n\n        self.assertEqual(0, ImageColor.getcolor(\"black\", \"L\"))\n        self.assertEqual(255, ImageColor.getcolor(\"white\", \"L\"))\n        self.assertEqual(162,\n                         ImageColor.getcolor(\"rgba(0, 255, 115, 33)\", \"L\"))\n        Image.new(\"L\", (1, 1), \"white\")\n\n        self.assertEqual(0, ImageColor.getcolor(\"black\", \"1\"))\n        self.assertEqual(255, ImageColor.getcolor(\"white\", \"1\"))\n        # The following test is wrong, but is current behavior\n        # The correct result should be 255 due to the mode 1\n        self.assertEqual(\n            162, ImageColor.getcolor(\"rgba(0, 255, 115, 33)\", \"1\"))\n        # Correct behavior\n        # self.assertEqual(\n        #     255, ImageColor.getcolor(\"rgba(0, 255, 115, 33)\", \"1\"))\n        Image.new(\"1\", (1, 1), \"white\")\n\n        self.assertEqual((0, 255), ImageColor.getcolor(\"black\", \"LA\"))\n        self.assertEqual((255, 255), ImageColor.getcolor(\"white\", \"LA\"))\n        self.assertEqual(\n            (162, 33), ImageColor.getcolor(\"rgba(0, 255, 115, 33)\", \"LA\"))\n        Image.new(\"LA\", (1, 1), \"white\")\n\n\nif __name__ == '__main__':\n    unittest.main()\n",
            "new_file_content": "from helper import unittest, PillowTestCase\n\nfrom PIL import Image\nfrom PIL import ImageColor\n\n\nclass TestImageColor(PillowTestCase):\n\n    def test_hash(self):\n        # short 3 components\n        self.assertEqual((255, 0, 0), ImageColor.getrgb(\"#f00\"))\n        self.assertEqual((0, 255, 0), ImageColor.getrgb(\"#0f0\"))\n        self.assertEqual((0, 0, 255), ImageColor.getrgb(\"#00f\"))\n\n        # short 4 components\n        self.assertEqual((255, 0, 0, 0), ImageColor.getrgb(\"#f000\"))\n        self.assertEqual((0, 255, 0, 0), ImageColor.getrgb(\"#0f00\"))\n        self.assertEqual((0, 0, 255, 0), ImageColor.getrgb(\"#00f0\"))\n        self.assertEqual((0, 0, 0, 255), ImageColor.getrgb(\"#000f\"))\n\n        # long 3 components\n        self.assertEqual((222, 0, 0), ImageColor.getrgb(\"#de0000\"))\n        self.assertEqual((0, 222, 0), ImageColor.getrgb(\"#00de00\"))\n        self.assertEqual((0, 0, 222), ImageColor.getrgb(\"#0000de\"))\n\n        # long 4 components\n        self.assertEqual((222, 0, 0, 0), ImageColor.getrgb(\"#de000000\"))\n        self.assertEqual((0, 222, 0, 0), ImageColor.getrgb(\"#00de0000\"))\n        self.assertEqual((0, 0, 222, 0), ImageColor.getrgb(\"#0000de00\"))\n        self.assertEqual((0, 0, 0, 222), ImageColor.getrgb(\"#000000de\"))\n\n        # case insensitivity\n        self.assertEqual(ImageColor.getrgb(\"#DEF\"), ImageColor.getrgb(\"#def\"))\n        self.assertEqual(ImageColor.getrgb(\"#CDEF\"), ImageColor.getrgb(\"#cdef\"))\n        self.assertEqual(ImageColor.getrgb(\"#DEFDEF\"),\n                         ImageColor.getrgb(\"#defdef\"))\n        self.assertEqual(ImageColor.getrgb(\"#CDEFCDEF\"),\n                         ImageColor.getrgb(\"#cdefcdef\"))\n\n        # not a number\n        self.assertRaises(ValueError, ImageColor.getrgb, \"#fo0\")\n        self.assertRaises(ValueError, ImageColor.getrgb, \"#fo00\")\n        self.assertRaises(ValueError, ImageColor.getrgb, \"#fo0000\")\n        self.assertRaises(ValueError, ImageColor.getrgb, \"#fo000000\")\n\n        # wrong number of components\n        self.assertRaises(ValueError, ImageColor.getrgb, \"#f0000\")\n        self.assertRaises(ValueError, ImageColor.getrgb, \"#f000000\")\n        self.assertRaises(ValueError, ImageColor.getrgb, \"#f00000000\")\n        self.assertRaises(ValueError, ImageColor.getrgb, \"#f000000000\")\n        self.assertRaises(ValueError, ImageColor.getrgb, \"#f00000 \")\n\n    def test_colormap(self):\n        self.assertEqual((0, 0, 0), ImageColor.getrgb(\"black\"))\n        self.assertEqual((255, 255, 255), ImageColor.getrgb(\"white\"))\n        self.assertEqual((255, 255, 255), ImageColor.getrgb(\"WHITE\"))\n\n        self.assertRaises(ValueError, ImageColor.getrgb, \"black \")\n\n    def test_functions(self):\n        # rgb numbers\n        self.assertEqual((255, 0, 0), ImageColor.getrgb(\"rgb(255,0,0)\"))\n        self.assertEqual((0, 255, 0), ImageColor.getrgb(\"rgb(0,255,0)\"))\n        self.assertEqual((0, 0, 255), ImageColor.getrgb(\"rgb(0,0,255)\"))\n\n        # percents\n        self.assertEqual((255, 0, 0), ImageColor.getrgb(\"rgb(100%,0%,0%)\"))\n        self.assertEqual((0, 255, 0), ImageColor.getrgb(\"rgb(0%,100%,0%)\"))\n        self.assertEqual((0, 0, 255), ImageColor.getrgb(\"rgb(0%,0%,100%)\"))\n\n        # rgba numbers\n        self.assertEqual((255, 0, 0, 0), ImageColor.getrgb(\"rgba(255,0,0,0)\"))\n        self.assertEqual((0, 255, 0, 0), ImageColor.getrgb(\"rgba(0,255,0,0)\"))\n        self.assertEqual((0, 0, 255, 0), ImageColor.getrgb(\"rgba(0,0,255,0)\"))\n        self.assertEqual((0, 0, 0, 255), ImageColor.getrgb(\"rgba(0,0,0,255)\"))\n\n        self.assertEqual((255, 0, 0), ImageColor.getrgb(\"hsl(0,100%,50%)\"))\n        self.assertEqual((255, 0, 0), ImageColor.getrgb(\"hsl(360,100%,50%)\"))\n        self.assertEqual((0, 255, 255), ImageColor.getrgb(\"hsl(180,100%,50%)\"))\n\n        self.assertEqual((255, 0, 0), ImageColor.getrgb(\"hsv(0,100%,100%)\"))\n        self.assertEqual((255, 0, 0), ImageColor.getrgb(\"hsv(360,100%,100%)\"))\n        self.assertEqual((0, 255, 255), ImageColor.getrgb(\"hsv(180,100%,100%)\"))\n\n        # alternate format\n        self.assertEqual(ImageColor.getrgb(\"hsb(0,100%,50%)\"),\n                         ImageColor.getrgb(\"hsv(0,100%,50%)\"))\n\n        # floats\n        self.assertEqual((254, 3, 3), ImageColor.getrgb(\"hsl(0.1,99.2%,50.3%)\"))\n        self.assertEqual((255, 0, 0), ImageColor.getrgb(\"hsl(360.,100.0%,50%)\"))\n\n        self.assertEqual((253, 2, 2), ImageColor.getrgb(\"hsv(0.1,99.2%,99.3%)\"))\n        self.assertEqual((255, 0, 0), ImageColor.getrgb(\"hsv(360.,100.0%,100%)\"))\n\n        # case insensitivity\n        self.assertEqual(ImageColor.getrgb(\"RGB(255,0,0)\"),\n                         ImageColor.getrgb(\"rgb(255,0,0)\"))\n        self.assertEqual(ImageColor.getrgb(\"RGB(100%,0%,0%)\"),\n                         ImageColor.getrgb(\"rgb(100%,0%,0%)\"))\n        self.assertEqual(ImageColor.getrgb(\"RGBA(255,0,0,0)\"),\n                         ImageColor.getrgb(\"rgba(255,0,0,0)\"))\n        self.assertEqual(ImageColor.getrgb(\"HSL(0,100%,50%)\"),\n                         ImageColor.getrgb(\"hsl(0,100%,50%)\"))\n        self.assertEqual(ImageColor.getrgb(\"HSV(0,100%,50%)\"),\n                         ImageColor.getrgb(\"hsv(0,100%,50%)\"))\n        self.assertEqual(ImageColor.getrgb(\"HSB(0,100%,50%)\"),\n                         ImageColor.getrgb(\"hsb(0,100%,50%)\"))\n\n        # space agnosticism\n        self.assertEqual((255, 0, 0),\n                         ImageColor.getrgb(\"rgb(  255  ,  0  ,  0  )\"))\n        self.assertEqual((255, 0, 0),\n                         ImageColor.getrgb(\"rgb(  100%  ,  0%  ,  0%  )\"))\n        self.assertEqual((255, 0, 0, 0),\n                         ImageColor.getrgb(\"rgba(  255  ,  0  ,  0  ,  0  )\"))\n        self.assertEqual((255, 0, 0),\n                         ImageColor.getrgb(\"hsl(  0  ,  100%  ,  50%  )\"))\n        self.assertEqual((255, 0, 0),\n                         ImageColor.getrgb(\"hsv(  0  ,  100%  ,  100%  )\"))\n\n        # wrong number of components\n        self.assertRaises(ValueError, ImageColor.getrgb, \"rgb(255,0)\")\n        self.assertRaises(ValueError, ImageColor.getrgb, \"rgb(255,0,0,0)\")\n\n        self.assertRaises(ValueError, ImageColor.getrgb, \"rgb(100%,0%)\")\n        self.assertRaises(ValueError, ImageColor.getrgb, \"rgb(100%,0%,0)\")\n        self.assertRaises(ValueError, ImageColor.getrgb, \"rgb(100%,0%,0 %)\")\n        self.assertRaises(ValueError, ImageColor.getrgb, \"rgb(100%,0%,0%,0%)\")\n\n        self.assertRaises(ValueError, ImageColor.getrgb, \"rgba(255,0,0)\")\n        self.assertRaises(ValueError, ImageColor.getrgb, \"rgba(255,0,0,0,0)\")\n\n        self.assertRaises(ValueError, ImageColor.getrgb, \"hsl(0,100%)\")\n        self.assertRaises(ValueError, ImageColor.getrgb, \"hsl(0,100%,0%,0%)\")\n        self.assertRaises(ValueError, ImageColor.getrgb, \"hsl(0%,100%,50%)\")\n        self.assertRaises(ValueError, ImageColor.getrgb, \"hsl(0,100,50%)\")\n        self.assertRaises(ValueError, ImageColor.getrgb, \"hsl(0,100%,50)\")\n\n        self.assertRaises(ValueError, ImageColor.getrgb, \"hsv(0,100%)\")\n        self.assertRaises(ValueError, ImageColor.getrgb, \"hsv(0,100%,0%,0%)\")\n        self.assertRaises(ValueError, ImageColor.getrgb, \"hsv(0%,100%,50%)\")\n        self.assertRaises(ValueError, ImageColor.getrgb, \"hsv(0,100,50%)\")\n        self.assertRaises(ValueError, ImageColor.getrgb, \"hsv(0,100%,50)\")\n\n    # look for rounding errors (based on code by Tim Hatch)\n    def test_rounding_errors(self):\n\n        for color in ImageColor.colormap:\n            expected = Image.new(\n                \"RGB\", (1, 1), color).convert(\"L\").getpixel((0, 0))\n            actual = ImageColor.getcolor(color, 'L')\n            self.assertEqual(expected, actual)\n\n        self.assertEqual(\n            (0, 255, 115), ImageColor.getcolor(\"rgba(0, 255, 115, 33)\", \"RGB\"))\n        Image.new(\"RGB\", (1, 1), \"white\")\n\n        self.assertEqual((0, 0, 0, 255), ImageColor.getcolor(\"black\", \"RGBA\"))\n        self.assertEqual(\n            (255, 255, 255, 255), ImageColor.getcolor(\"white\", \"RGBA\"))\n        self.assertEqual(\n            (0, 255, 115, 33),\n            ImageColor.getcolor(\"rgba(0, 255, 115, 33)\", \"RGBA\"))\n        Image.new(\"RGBA\", (1, 1), \"white\")\n\n        self.assertEqual(0, ImageColor.getcolor(\"black\", \"L\"))\n        self.assertEqual(255, ImageColor.getcolor(\"white\", \"L\"))\n        self.assertEqual(162,\n                         ImageColor.getcolor(\"rgba(0, 255, 115, 33)\", \"L\"))\n        Image.new(\"L\", (1, 1), \"white\")\n\n        self.assertEqual(0, ImageColor.getcolor(\"black\", \"1\"))\n        self.assertEqual(255, ImageColor.getcolor(\"white\", \"1\"))\n        # The following test is wrong, but is current behavior\n        # The correct result should be 255 due to the mode 1\n        self.assertEqual(\n            162, ImageColor.getcolor(\"rgba(0, 255, 115, 33)\", \"1\"))\n        # Correct behavior\n        # self.assertEqual(\n        #     255, ImageColor.getcolor(\"rgba(0, 255, 115, 33)\", \"1\"))\n        Image.new(\"1\", (1, 1), \"white\")\n\n        self.assertEqual((0, 255), ImageColor.getcolor(\"black\", \"LA\"))\n        self.assertEqual((255, 255), ImageColor.getcolor(\"white\", \"LA\"))\n        self.assertEqual(\n            (162, 33), ImageColor.getcolor(\"rgba(0, 255, 115, 33)\", \"LA\"))\n        Image.new(\"LA\", (1, 1), \"white\")\n\n\nif __name__ == '__main__':\n    unittest.main()\n",
            "header": {
                "file": {
                    "path": "Tests/test_imagecolor.py"
                },
                "misc_line": null
            },
            "index_line": {
                "old_commit_hash": "81ad179e6",
                "new_commit_hash": "0aac21278",
                "mode": "100644"
            },
            "is_binary_file": false,
            "binary_line": null,
            "minus_file": {
                "path": "a/Tests/test_imagecolor.py"
            },
            "plus_file": {
                "path": "b/Tests/test_imagecolor.py"
            },
            "hunks": [
                {
                    "descriptor": {
                        "old_range": {
                            "start": 78,
                            "length": 10
                        },
                        "new_range": {
                            "start": 78,
                            "length": 21
                        },
                        "section": "class TestImageColor(PillowTestCase):"
                    },
                    "line_group": {
                        "all_lines": [
                            {
                                "content": "        self.assertEqual((255, 0, 0), ImageColor.getrgb(\"hsl(360,100%,50%)\"))",
                                "type": "context"
                            },
                            {
                                "content": "        self.assertEqual((0, 255, 255), ImageColor.getrgb(\"hsl(180,100%,50%)\"))",
                                "type": "context"
                            },
                            {
                                "content": "",
                                "type": "context"
                            },
                            {
                                "content": "        self.assertEqual((255, 0, 0), ImageColor.getrgb(\"hsv(0,100%,100%)\"))",
                                "type": "added"
                            },
                            {
                                "content": "        self.assertEqual((255, 0, 0), ImageColor.getrgb(\"hsv(360,100%,100%)\"))",
                                "type": "added"
                            },
                            {
                                "content": "        self.assertEqual((0, 255, 255), ImageColor.getrgb(\"hsv(180,100%,100%)\"))",
                                "type": "added"
                            },
                            {
                                "content": "",
                                "type": "added"
                            },
                            {
                                "content": "        # alternate format",
                                "type": "added"
                            },
                            {
                                "content": "        self.assertEqual(ImageColor.getrgb(\"hsb(0,100%,50%)\"),",
                                "type": "added"
                            },
                            {
                                "content": "                         ImageColor.getrgb(\"hsv(0,100%,50%)\"))",
                                "type": "added"
                            },
                            {
                                "content": "",
                                "type": "added"
                            },
                            {
                                "content": "        # floats",
                                "type": "context"
                            },
                            {
                                "content": "        self.assertEqual((254, 3, 3), ImageColor.getrgb(\"hsl(0.1,99.2%,50.3%)\"))",
                                "type": "context"
                            },
                            {
                                "content": "        self.assertEqual((255, 0, 0), ImageColor.getrgb(\"hsl(360.,100.0%,50%)\"))",
                                "type": "context"
                            },
                            {
                                "content": "",
                                "type": "context"
                            },
                            {
                                "content": "        self.assertEqual((253, 2, 2), ImageColor.getrgb(\"hsv(0.1,99.2%,99.3%)\"))",
                                "type": "added"
                            },
                            {
                                "content": "        self.assertEqual((255, 0, 0), ImageColor.getrgb(\"hsv(360.,100.0%,100%)\"))",
                                "type": "added"
                            },
                            {
                                "content": "",
                                "type": "added"
                            },
                            {
                                "content": "        # case insensitivity",
                                "type": "context"
                            },
                            {
                                "content": "        self.assertEqual(ImageColor.getrgb(\"RGB(255,0,0)\"),",
                                "type": "context"
                            },
                            {
                                "content": "                         ImageColor.getrgb(\"rgb(255,0,0)\"))",
                                "type": "context"
                            }
                        ]
                    },
                    "modified_entities": [
                        {
                            "file_name": "Tests/test_imagecolor.py",
                            "type": "class",
                            "name": "TestImageColor",
                            "content": "class TestImageColor(PillowTestCase):\n\n    def test_hash(self):\n        # short 3 components\n        self.assertEqual((255, 0, 0), ImageColor.getrgb(\"#f00\"))\n        self.assertEqual((0, 255, 0), ImageColor.getrgb(\"#0f0\"))\n        self.assertEqual((0, 0, 255), ImageColor.getrgb(\"#00f\"))\n\n        # short 4 components\n        self.assertEqual((255, 0, 0, 0), ImageColor.getrgb(\"#f000\"))\n        self.assertEqual((0, 255, 0, 0), ImageColor.getrgb(\"#0f00\"))\n        self.assertEqual((0, 0, 255, 0), ImageColor.getrgb(\"#00f0\"))\n        self.assertEqual((0, 0, 0, 255), ImageColor.getrgb(\"#000f\"))\n\n        # long 3 components\n        self.assertEqual((222, 0, 0), ImageColor.getrgb(\"#de0000\"))\n        self.assertEqual((0, 222, 0), ImageColor.getrgb(\"#00de00\"))\n        self.assertEqual((0, 0, 222), ImageColor.getrgb(\"#0000de\"))\n\n        # long 4 components\n        self.assertEqual((222, 0, 0, 0), ImageColor.getrgb(\"#de000000\"))\n        self.assertEqual((0, 222, 0, 0), ImageColor.getrgb(\"#00de0000\"))\n        self.assertEqual((0, 0, 222, 0), ImageColor.getrgb(\"#0000de00\"))\n        self.assertEqual((0, 0, 0, 222), ImageColor.getrgb(\"#000000de\"))\n\n        # case insensitivity\n        self.assertEqual(ImageColor.getrgb(\"#DEF\"), ImageColor.getrgb(\"#def\"))\n        self.assertEqual(ImageColor.getrgb(\"#CDEF\"), ImageColor.getrgb(\"#cdef\"))\n        self.assertEqual(ImageColor.getrgb(\"#DEFDEF\"),\n                         ImageColor.getrgb(\"#defdef\"))\n        self.assertEqual(ImageColor.getrgb(\"#CDEFCDEF\"),\n                         ImageColor.getrgb(\"#cdefcdef\"))\n\n        # not a number\n        self.assertRaises(ValueError, ImageColor.getrgb, \"#fo0\")\n        self.assertRaises(ValueError, ImageColor.getrgb, \"#fo00\")\n        self.assertRaises(ValueError, ImageColor.getrgb, \"#fo0000\")\n        self.assertRaises(ValueError, ImageColor.getrgb, \"#fo000000\")\n\n        # wrong number of components\n        self.assertRaises(ValueError, ImageColor.getrgb, \"#f0000\")\n        self.assertRaises(ValueError, ImageColor.getrgb, \"#f000000\")\n        self.assertRaises(ValueError, ImageColor.getrgb, \"#f00000000\")\n        self.assertRaises(ValueError, ImageColor.getrgb, \"#f000000000\")\n        self.assertRaises(ValueError, ImageColor.getrgb, \"#f00000 \")\n\n    def test_colormap(self):\n        self.assertEqual((0, 0, 0), ImageColor.getrgb(\"black\"))\n        self.assertEqual((255, 255, 255), ImageColor.getrgb(\"white\"))\n        self.assertEqual((255, 255, 255), ImageColor.getrgb(\"WHITE\"))\n\n        self.assertRaises(ValueError, ImageColor.getrgb, \"black \")\n\n    def test_functions(self):\n        # rgb numbers\n        self.assertEqual((255, 0, 0), ImageColor.getrgb(\"rgb(255,0,0)\"))\n        self.assertEqual((0, 255, 0), ImageColor.getrgb(\"rgb(0,255,0)\"))\n        self.assertEqual((0, 0, 255), ImageColor.getrgb(\"rgb(0,0,255)\"))\n\n        # percents\n        self.assertEqual((255, 0, 0), ImageColor.getrgb(\"rgb(100%,0%,0%)\"))\n        self.assertEqual((0, 255, 0), ImageColor.getrgb(\"rgb(0%,100%,0%)\"))\n        self.assertEqual((0, 0, 255), ImageColor.getrgb(\"rgb(0%,0%,100%)\"))\n\n        # rgba numbers\n        self.assertEqual((255, 0, 0, 0), ImageColor.getrgb(\"rgba(255,0,0,0)\"))\n        self.assertEqual((0, 255, 0, 0), ImageColor.getrgb(\"rgba(0,255,0,0)\"))\n        self.assertEqual((0, 0, 255, 0), ImageColor.getrgb(\"rgba(0,0,255,0)\"))\n        self.assertEqual((0, 0, 0, 255), ImageColor.getrgb(\"rgba(0,0,0,255)\"))\n\n        self.assertEqual((255, 0, 0), ImageColor.getrgb(\"hsl(0,100%,50%)\"))\n        self.assertEqual((255, 0, 0), ImageColor.getrgb(\"hsl(360,100%,50%)\"))\n        self.assertEqual((0, 255, 255), ImageColor.getrgb(\"hsl(180,100%,50%)\"))\n\n        self.assertEqual((255, 0, 0), ImageColor.getrgb(\"hsv(0,100%,100%)\"))\n        self.assertEqual((255, 0, 0), ImageColor.getrgb(\"hsv(360,100%,100%)\"))\n        self.assertEqual((0, 255, 255), ImageColor.getrgb(\"hsv(180,100%,100%)\"))\n\n        # alternate format\n        self.assertEqual(ImageColor.getrgb(\"hsb(0,100%,50%)\"),\n                         ImageColor.getrgb(\"hsv(0,100%,50%)\"))\n\n        # floats\n        self.assertEqual((254, 3, 3), ImageColor.getrgb(\"hsl(0.1,99.2%,50.3%)\"))\n        self.assertEqual((255, 0, 0), ImageColor.getrgb(\"hsl(360.,100.0%,50%)\"))\n\n        self.assertEqual((253, 2, 2), ImageColor.getrgb(\"hsv(0.1,99.2%,99.3%)\"))\n        self.assertEqual((255, 0, 0), ImageColor.getrgb(\"hsv(360.,100.0%,100%)\"))\n\n        # case insensitivity\n        self.assertEqual(ImageColor.getrgb(\"RGB(255,0,0)\"),\n                         ImageColor.getrgb(\"rgb(255,0,0)\"))\n        self.assertEqual(ImageColor.getrgb(\"RGB(100%,0%,0%)\"),\n                         ImageColor.getrgb(\"rgb(100%,0%,0%)\"))\n        self.assertEqual(ImageColor.getrgb(\"RGBA(255,0,0,0)\"),\n                         ImageColor.getrgb(\"rgba(255,0,0,0)\"))\n        self.assertEqual(ImageColor.getrgb(\"HSL(0,100%,50%)\"),\n                         ImageColor.getrgb(\"hsl(0,100%,50%)\"))\n        self.assertEqual(ImageColor.getrgb(\"HSV(0,100%,50%)\"),\n                         ImageColor.getrgb(\"hsv(0,100%,50%)\"))\n        self.assertEqual(ImageColor.getrgb(\"HSB(0,100%,50%)\"),\n                         ImageColor.getrgb(\"hsb(0,100%,50%)\"))\n\n        # space agnosticism\n        self.assertEqual((255, 0, 0),\n                         ImageColor.getrgb(\"rgb(  255  ,  0  ,  0  )\"))\n        self.assertEqual((255, 0, 0),\n                         ImageColor.getrgb(\"rgb(  100%  ,  0%  ,  0%  )\"))\n        self.assertEqual((255, 0, 0, 0),\n                         ImageColor.getrgb(\"rgba(  255  ,  0  ,  0  ,  0  )\"))\n        self.assertEqual((255, 0, 0),\n                         ImageColor.getrgb(\"hsl(  0  ,  100%  ,  50%  )\"))\n        self.assertEqual((255, 0, 0),\n                         ImageColor.getrgb(\"hsv(  0  ,  100%  ,  100%  )\"))\n\n        # wrong number of components\n        self.assertRaises(ValueError, ImageColor.getrgb, \"rgb(255,0)\")\n        self.assertRaises(ValueError, ImageColor.getrgb, \"rgb(255,0,0,0)\")\n\n        self.assertRaises(ValueError, ImageColor.getrgb, \"rgb(100%,0%)\")\n        self.assertRaises(ValueError, ImageColor.getrgb, \"rgb(100%,0%,0)\")\n        self.assertRaises(ValueError, ImageColor.getrgb, \"rgb(100%,0%,0 %)\")\n        self.assertRaises(ValueError, ImageColor.getrgb, \"rgb(100%,0%,0%,0%)\")\n\n        self.assertRaises(ValueError, ImageColor.getrgb, \"rgba(255,0,0)\")\n        self.assertRaises(ValueError, ImageColor.getrgb, \"rgba(255,0,0,0,0)\")\n\n        self.assertRaises(ValueError, ImageColor.getrgb, \"hsl(0,100%)\")\n        self.assertRaises(ValueError, ImageColor.getrgb, \"hsl(0,100%,0%,0%)\")\n        self.assertRaises(ValueError, ImageColor.getrgb, \"hsl(0%,100%,50%)\")\n        self.assertRaises(ValueError, ImageColor.getrgb, \"hsl(0,100,50%)\")\n        self.assertRaises(ValueError, ImageColor.getrgb, \"hsl(0,100%,50)\")\n\n        self.assertRaises(ValueError, ImageColor.getrgb, \"hsv(0,100%)\")\n        self.assertRaises(ValueError, ImageColor.getrgb, \"hsv(0,100%,0%,0%)\")\n        self.assertRaises(ValueError, ImageColor.getrgb, \"hsv(0%,100%,50%)\")\n        self.assertRaises(ValueError, ImageColor.getrgb, \"hsv(0,100,50%)\")\n        self.assertRaises(ValueError, ImageColor.getrgb, \"hsv(0,100%,50)\")\n\n    # look for rounding errors (based on code by Tim Hatch)\n    def test_rounding_errors(self):\n\n        for color in ImageColor.colormap:\n            expected = Image.new(\n                \"RGB\", (1, 1), color).convert(\"L\").getpixel((0, 0))\n            actual = ImageColor.getcolor(color, 'L')\n            self.assertEqual(expected, actual)\n\n        self.assertEqual(\n            (0, 255, 115), ImageColor.getcolor(\"rgba(0, 255, 115, 33)\", \"RGB\"))\n        Image.new(\"RGB\", (1, 1), \"white\")\n\n        self.assertEqual((0, 0, 0, 255), ImageColor.getcolor(\"black\", \"RGBA\"))\n        self.assertEqual(\n            (255, 255, 255, 255), ImageColor.getcolor(\"white\", \"RGBA\"))\n        self.assertEqual(\n            (0, 255, 115, 33),\n            ImageColor.getcolor(\"rgba(0, 255, 115, 33)\", \"RGBA\"))\n        Image.new(\"RGBA\", (1, 1), \"white\")\n\n        self.assertEqual(0, ImageColor.getcolor(\"black\", \"L\"))\n        self.assertEqual(255, ImageColor.getcolor(\"white\", \"L\"))\n        self.assertEqual(162,\n                         ImageColor.getcolor(\"rgba(0, 255, 115, 33)\", \"L\"))\n        Image.new(\"L\", (1, 1), \"white\")\n\n        self.assertEqual(0, ImageColor.getcolor(\"black\", \"1\"))\n        self.assertEqual(255, ImageColor.getcolor(\"white\", \"1\"))\n        # The following test is wrong, but is current behavior\n        # The correct result should be 255 due to the mode 1\n        self.assertEqual(\n            162, ImageColor.getcolor(\"rgba(0, 255, 115, 33)\", \"1\"))\n        # Correct behavior\n        # self.assertEqual(\n        #     255, ImageColor.getcolor(\"rgba(0, 255, 115, 33)\", \"1\"))\n        Image.new(\"1\", (1, 1), \"white\")\n\n        self.assertEqual((0, 255), ImageColor.getcolor(\"black\", \"LA\"))\n        self.assertEqual((255, 255), ImageColor.getcolor(\"white\", \"LA\"))\n        self.assertEqual(\n            (162, 33), ImageColor.getcolor(\"rgba(0, 255, 115, 33)\", \"LA\"))\n        Image.new(\"LA\", (1, 1), \"white\")",
                            "ast_type_str": "ClassDef",
                            "start_lineno": 7,
                            "end_lineno": 188,
                            "parent": null
                        },
                        {
                            "file_name": "Tests/test_imagecolor.py",
                            "type": "method",
                            "name": "TestImageColor.test_functions",
                            "content": "class TestImageColor(PillowTestCase):\n\n    def test_hash(self):\n        # short 3 components\n        self.assertEqual((255, 0, 0), ImageColor.getrgb(\"#f00\"))\n        self.assertEqual((0, 255, 0), ImageColor.getrgb(\"#0f0\"))\n        self.assertEqual((0, 0, 255), ImageColor.getrgb(\"#00f\"))\n\n        # short 4 components\n        self.assertEqual((255, 0, 0, 0), ImageColor.getrgb(\"#f000\"))\n        self.assertEqual((0, 255, 0, 0), ImageColor.getrgb(\"#0f00\"))\n        self.assertEqual((0, 0, 255, 0), ImageColor.getrgb(\"#00f0\"))\n        self.assertEqual((0, 0, 0, 255), ImageColor.getrgb(\"#000f\"))\n\n        # long 3 components\n        self.assertEqual((222, 0, 0), ImageColor.getrgb(\"#de0000\"))\n        self.assertEqual((0, 222, 0), ImageColor.getrgb(\"#00de00\"))\n        self.assertEqual((0, 0, 222), ImageColor.getrgb(\"#0000de\"))\n\n        # long 4 components\n        self.assertEqual((222, 0, 0, 0), ImageColor.getrgb(\"#de000000\"))\n        self.assertEqual((0, 222, 0, 0), ImageColor.getrgb(\"#00de0000\"))\n        self.assertEqual((0, 0, 222, 0), ImageColor.getrgb(\"#0000de00\"))\n        self.assertEqual((0, 0, 0, 222), ImageColor.getrgb(\"#000000de\"))\n\n        # case insensitivity\n        self.assertEqual(ImageColor.getrgb(\"#DEF\"), ImageColor.getrgb(\"#def\"))\n        self.assertEqual(ImageColor.getrgb(\"#CDEF\"), ImageColor.getrgb(\"#cdef\"))\n        self.assertEqual(ImageColor.getrgb(\"#DEFDEF\"),\n                         ImageColor.getrgb(\"#defdef\"))\n        self.assertEqual(ImageColor.getrgb(\"#CDEFCDEF\"),\n                         ImageColor.getrgb(\"#cdefcdef\"))\n\n        # not a number\n        self.assertRaises(ValueError, ImageColor.getrgb, \"#fo0\")\n        self.assertRaises(ValueError, ImageColor.getrgb, \"#fo00\")\n        self.assertRaises(ValueError, ImageColor.getrgb, \"#fo0000\")\n        self.assertRaises(ValueError, ImageColor.getrgb, \"#fo000000\")\n\n        # wrong number of components\n        self.assertRaises(ValueError, ImageColor.getrgb, \"#f0000\")\n        self.assertRaises(ValueError, ImageColor.getrgb, \"#f000000\")\n        self.assertRaises(ValueError, ImageColor.getrgb, \"#f00000000\")\n        self.assertRaises(ValueError, ImageColor.getrgb, \"#f000000000\")\n        self.assertRaises(ValueError, ImageColor.getrgb, \"#f00000 \")\n\n    def test_colormap(self):\n        self.assertEqual((0, 0, 0), ImageColor.getrgb(\"black\"))\n        self.assertEqual((255, 255, 255), ImageColor.getrgb(\"white\"))\n        self.assertEqual((255, 255, 255), ImageColor.getrgb(\"WHITE\"))\n\n        self.assertRaises(ValueError, ImageColor.getrgb, \"black \")\n\n    def test_functions(self):\n        # rgb numbers\n        self.assertEqual((255, 0, 0), ImageColor.getrgb(\"rgb(255,0,0)\"))\n        self.assertEqual((0, 255, 0), ImageColor.getrgb(\"rgb(0,255,0)\"))\n        self.assertEqual((0, 0, 255), ImageColor.getrgb(\"rgb(0,0,255)\"))\n\n        # percents\n        self.assertEqual((255, 0, 0), ImageColor.getrgb(\"rgb(100%,0%,0%)\"))\n        self.assertEqual((0, 255, 0), ImageColor.getrgb(\"rgb(0%,100%,0%)\"))\n        self.assertEqual((0, 0, 255), ImageColor.getrgb(\"rgb(0%,0%,100%)\"))\n\n        # rgba numbers\n        self.assertEqual((255, 0, 0, 0), ImageColor.getrgb(\"rgba(255,0,0,0)\"))\n        self.assertEqual((0, 255, 0, 0), ImageColor.getrgb(\"rgba(0,255,0,0)\"))\n        self.assertEqual((0, 0, 255, 0), ImageColor.getrgb(\"rgba(0,0,255,0)\"))\n        self.assertEqual((0, 0, 0, 255), ImageColor.getrgb(\"rgba(0,0,0,255)\"))\n\n        self.assertEqual((255, 0, 0), ImageColor.getrgb(\"hsl(0,100%,50%)\"))\n        self.assertEqual((255, 0, 0), ImageColor.getrgb(\"hsl(360,100%,50%)\"))\n        self.assertEqual((0, 255, 255), ImageColor.getrgb(\"hsl(180,100%,50%)\"))\n\n        self.assertEqual((255, 0, 0), ImageColor.getrgb(\"hsv(0,100%,100%)\"))\n        self.assertEqual((255, 0, 0), ImageColor.getrgb(\"hsv(360,100%,100%)\"))\n        self.assertEqual((0, 255, 255), ImageColor.getrgb(\"hsv(180,100%,100%)\"))\n\n        # alternate format\n        self.assertEqual(ImageColor.getrgb(\"hsb(0,100%,50%)\"),\n                         ImageColor.getrgb(\"hsv(0,100%,50%)\"))\n\n        # floats\n        self.assertEqual((254, 3, 3), ImageColor.getrgb(\"hsl(0.1,99.2%,50.3%)\"))\n        self.assertEqual((255, 0, 0), ImageColor.getrgb(\"hsl(360.,100.0%,50%)\"))\n\n        self.assertEqual((253, 2, 2), ImageColor.getrgb(\"hsv(0.1,99.2%,99.3%)\"))\n        self.assertEqual((255, 0, 0), ImageColor.getrgb(\"hsv(360.,100.0%,100%)\"))\n\n        # case insensitivity\n        self.assertEqual(ImageColor.getrgb(\"RGB(255,0,0)\"),\n                         ImageColor.getrgb(\"rgb(255,0,0)\"))\n        self.assertEqual(ImageColor.getrgb(\"RGB(100%,0%,0%)\"),\n                         ImageColor.getrgb(\"rgb(100%,0%,0%)\"))\n        self.assertEqual(ImageColor.getrgb(\"RGBA(255,0,0,0)\"),\n                         ImageColor.getrgb(\"rgba(255,0,0,0)\"))\n        self.assertEqual(ImageColor.getrgb(\"HSL(0,100%,50%)\"),\n                         ImageColor.getrgb(\"hsl(0,100%,50%)\"))\n        self.assertEqual(ImageColor.getrgb(\"HSV(0,100%,50%)\"),\n                         ImageColor.getrgb(\"hsv(0,100%,50%)\"))\n        self.assertEqual(ImageColor.getrgb(\"HSB(0,100%,50%)\"),\n                         ImageColor.getrgb(\"hsb(0,100%,50%)\"))\n\n        # space agnosticism\n        self.assertEqual((255, 0, 0),\n                         ImageColor.getrgb(\"rgb(  255  ,  0  ,  0  )\"))\n        self.assertEqual((255, 0, 0),\n                         ImageColor.getrgb(\"rgb(  100%  ,  0%  ,  0%  )\"))\n        self.assertEqual((255, 0, 0, 0),\n                         ImageColor.getrgb(\"rgba(  255  ,  0  ,  0  ,  0  )\"))\n        self.assertEqual((255, 0, 0),\n                         ImageColor.getrgb(\"hsl(  0  ,  100%  ,  50%  )\"))\n        self.assertEqual((255, 0, 0),\n                         ImageColor.getrgb(\"hsv(  0  ,  100%  ,  100%  )\"))\n\n        # wrong number of components\n        self.assertRaises(ValueError, ImageColor.getrgb, \"rgb(255,0)\")\n        self.assertRaises(ValueError, ImageColor.getrgb, \"rgb(255,0,0,0)\")\n\n        self.assertRaises(ValueError, ImageColor.getrgb, \"rgb(100%,0%)\")\n        self.assertRaises(ValueError, ImageColor.getrgb, \"rgb(100%,0%,0)\")\n        self.assertRaises(ValueError, ImageColor.getrgb, \"rgb(100%,0%,0 %)\")\n        self.assertRaises(ValueError, ImageColor.getrgb, \"rgb(100%,0%,0%,0%)\")\n\n        self.assertRaises(ValueError, ImageColor.getrgb, \"rgba(255,0,0)\")\n        self.assertRaises(ValueError, ImageColor.getrgb, \"rgba(255,0,0,0,0)\")\n\n        self.assertRaises(ValueError, ImageColor.getrgb, \"hsl(0,100%)\")\n        self.assertRaises(ValueError, ImageColor.getrgb, \"hsl(0,100%,0%,0%)\")\n        self.assertRaises(ValueError, ImageColor.getrgb, \"hsl(0%,100%,50%)\")\n        self.assertRaises(ValueError, ImageColor.getrgb, \"hsl(0,100,50%)\")\n        self.assertRaises(ValueError, ImageColor.getrgb, \"hsl(0,100%,50)\")\n\n        self.assertRaises(ValueError, ImageColor.getrgb, \"hsv(0,100%)\")\n        self.assertRaises(ValueError, ImageColor.getrgb, \"hsv(0,100%,0%,0%)\")\n        self.assertRaises(ValueError, ImageColor.getrgb, \"hsv(0%,100%,50%)\")\n        self.assertRaises(ValueError, ImageColor.getrgb, \"hsv(0,100,50%)\")\n        self.assertRaises(ValueError, ImageColor.getrgb, \"hsv(0,100%,50)\")\n\n    # look for rounding errors (based on code by Tim Hatch)\n    def test_rounding_errors(self):\n\n        for color in ImageColor.colormap:\n            expected = Image.new(\n                \"RGB\", (1, 1), color).convert(\"L\").getpixel((0, 0))\n            actual = ImageColor.getcolor(color, 'L')\n            self.assertEqual(expected, actual)\n\n        self.assertEqual(\n            (0, 255, 115), ImageColor.getcolor(\"rgba(0, 255, 115, 33)\", \"RGB\"))\n        Image.new(\"RGB\", (1, 1), \"white\")\n\n        self.assertEqual((0, 0, 0, 255), ImageColor.getcolor(\"black\", \"RGBA\"))\n        self.assertEqual(\n            (255, 255, 255, 255), ImageColor.getcolor(\"white\", \"RGBA\"))\n        self.assertEqual(\n            (0, 255, 115, 33),\n            ImageColor.getcolor(\"rgba(0, 255, 115, 33)\", \"RGBA\"))\n        Image.new(\"RGBA\", (1, 1), \"white\")\n\n        self.assertEqual(0, ImageColor.getcolor(\"black\", \"L\"))\n        self.assertEqual(255, ImageColor.getcolor(\"white\", \"L\"))\n        self.assertEqual(162,\n                         ImageColor.getcolor(\"rgba(0, 255, 115, 33)\", \"L\"))\n        Image.new(\"L\", (1, 1), \"white\")\n\n        self.assertEqual(0, ImageColor.getcolor(\"black\", \"1\"))\n        self.assertEqual(255, ImageColor.getcolor(\"white\", \"1\"))\n        # The following test is wrong, but is current behavior\n        # The correct result should be 255 due to the mode 1\n        self.assertEqual(\n            162, ImageColor.getcolor(\"rgba(0, 255, 115, 33)\", \"1\"))\n        # Correct behavior\n        # self.assertEqual(\n        #     255, ImageColor.getcolor(\"rgba(0, 255, 115, 33)\", \"1\"))\n        Image.new(\"1\", (1, 1), \"white\")\n\n        self.assertEqual((0, 255), ImageColor.getcolor(\"black\", \"LA\"))\n        self.assertEqual((255, 255), ImageColor.getcolor(\"white\", \"LA\"))\n        self.assertEqual(\n            (162, 33), ImageColor.getcolor(\"rgba(0, 255, 115, 33)\", \"LA\"))\n        Image.new(\"LA\", (1, 1), \"white\")",
                            "ast_type_str": "ClassDef",
                            "start_lineno": 60,
                            "end_lineno": 144,
                            "parent": {
                                "file_name": "Tests/test_imagecolor.py",
                                "type": "class",
                                "name": "TestImageColor",
                                "content": "class TestImageColor(PillowTestCase):\n\n    def test_hash(self):\n        # short 3 components\n        self.assertEqual((255, 0, 0), ImageColor.getrgb(\"#f00\"))\n        self.assertEqual((0, 255, 0), ImageColor.getrgb(\"#0f0\"))\n        self.assertEqual((0, 0, 255), ImageColor.getrgb(\"#00f\"))\n\n        # short 4 components\n        self.assertEqual((255, 0, 0, 0), ImageColor.getrgb(\"#f000\"))\n        self.assertEqual((0, 255, 0, 0), ImageColor.getrgb(\"#0f00\"))\n        self.assertEqual((0, 0, 255, 0), ImageColor.getrgb(\"#00f0\"))\n        self.assertEqual((0, 0, 0, 255), ImageColor.getrgb(\"#000f\"))\n\n        # long 3 components\n        self.assertEqual((222, 0, 0), ImageColor.getrgb(\"#de0000\"))\n        self.assertEqual((0, 222, 0), ImageColor.getrgb(\"#00de00\"))\n        self.assertEqual((0, 0, 222), ImageColor.getrgb(\"#0000de\"))\n\n        # long 4 components\n        self.assertEqual((222, 0, 0, 0), ImageColor.getrgb(\"#de000000\"))\n        self.assertEqual((0, 222, 0, 0), ImageColor.getrgb(\"#00de0000\"))\n        self.assertEqual((0, 0, 222, 0), ImageColor.getrgb(\"#0000de00\"))\n        self.assertEqual((0, 0, 0, 222), ImageColor.getrgb(\"#000000de\"))\n\n        # case insensitivity\n        self.assertEqual(ImageColor.getrgb(\"#DEF\"), ImageColor.getrgb(\"#def\"))\n        self.assertEqual(ImageColor.getrgb(\"#CDEF\"), ImageColor.getrgb(\"#cdef\"))\n        self.assertEqual(ImageColor.getrgb(\"#DEFDEF\"),\n                         ImageColor.getrgb(\"#defdef\"))\n        self.assertEqual(ImageColor.getrgb(\"#CDEFCDEF\"),\n                         ImageColor.getrgb(\"#cdefcdef\"))\n\n        # not a number\n        self.assertRaises(ValueError, ImageColor.getrgb, \"#fo0\")\n        self.assertRaises(ValueError, ImageColor.getrgb, \"#fo00\")\n        self.assertRaises(ValueError, ImageColor.getrgb, \"#fo0000\")\n        self.assertRaises(ValueError, ImageColor.getrgb, \"#fo000000\")\n\n        # wrong number of components\n        self.assertRaises(ValueError, ImageColor.getrgb, \"#f0000\")\n        self.assertRaises(ValueError, ImageColor.getrgb, \"#f000000\")\n        self.assertRaises(ValueError, ImageColor.getrgb, \"#f00000000\")\n        self.assertRaises(ValueError, ImageColor.getrgb, \"#f000000000\")\n        self.assertRaises(ValueError, ImageColor.getrgb, \"#f00000 \")\n\n    def test_colormap(self):\n        self.assertEqual((0, 0, 0), ImageColor.getrgb(\"black\"))\n        self.assertEqual((255, 255, 255), ImageColor.getrgb(\"white\"))\n        self.assertEqual((255, 255, 255), ImageColor.getrgb(\"WHITE\"))\n\n        self.assertRaises(ValueError, ImageColor.getrgb, \"black \")\n\n    def test_functions(self):\n        # rgb numbers\n        self.assertEqual((255, 0, 0), ImageColor.getrgb(\"rgb(255,0,0)\"))\n        self.assertEqual((0, 255, 0), ImageColor.getrgb(\"rgb(0,255,0)\"))\n        self.assertEqual((0, 0, 255), ImageColor.getrgb(\"rgb(0,0,255)\"))\n\n        # percents\n        self.assertEqual((255, 0, 0), ImageColor.getrgb(\"rgb(100%,0%,0%)\"))\n        self.assertEqual((0, 255, 0), ImageColor.getrgb(\"rgb(0%,100%,0%)\"))\n        self.assertEqual((0, 0, 255), ImageColor.getrgb(\"rgb(0%,0%,100%)\"))\n\n        # rgba numbers\n        self.assertEqual((255, 0, 0, 0), ImageColor.getrgb(\"rgba(255,0,0,0)\"))\n        self.assertEqual((0, 255, 0, 0), ImageColor.getrgb(\"rgba(0,255,0,0)\"))\n        self.assertEqual((0, 0, 255, 0), ImageColor.getrgb(\"rgba(0,0,255,0)\"))\n        self.assertEqual((0, 0, 0, 255), ImageColor.getrgb(\"rgba(0,0,0,255)\"))\n\n        self.assertEqual((255, 0, 0), ImageColor.getrgb(\"hsl(0,100%,50%)\"))\n        self.assertEqual((255, 0, 0), ImageColor.getrgb(\"hsl(360,100%,50%)\"))\n        self.assertEqual((0, 255, 255), ImageColor.getrgb(\"hsl(180,100%,50%)\"))\n\n        self.assertEqual((255, 0, 0), ImageColor.getrgb(\"hsv(0,100%,100%)\"))\n        self.assertEqual((255, 0, 0), ImageColor.getrgb(\"hsv(360,100%,100%)\"))\n        self.assertEqual((0, 255, 255), ImageColor.getrgb(\"hsv(180,100%,100%)\"))\n\n        # alternate format\n        self.assertEqual(ImageColor.getrgb(\"hsb(0,100%,50%)\"),\n                         ImageColor.getrgb(\"hsv(0,100%,50%)\"))\n\n        # floats\n        self.assertEqual((254, 3, 3), ImageColor.getrgb(\"hsl(0.1,99.2%,50.3%)\"))\n        self.assertEqual((255, 0, 0), ImageColor.getrgb(\"hsl(360.,100.0%,50%)\"))\n\n        self.assertEqual((253, 2, 2), ImageColor.getrgb(\"hsv(0.1,99.2%,99.3%)\"))\n        self.assertEqual((255, 0, 0), ImageColor.getrgb(\"hsv(360.,100.0%,100%)\"))\n\n        # case insensitivity\n        self.assertEqual(ImageColor.getrgb(\"RGB(255,0,0)\"),\n                         ImageColor.getrgb(\"rgb(255,0,0)\"))\n        self.assertEqual(ImageColor.getrgb(\"RGB(100%,0%,0%)\"),\n                         ImageColor.getrgb(\"rgb(100%,0%,0%)\"))\n        self.assertEqual(ImageColor.getrgb(\"RGBA(255,0,0,0)\"),\n                         ImageColor.getrgb(\"rgba(255,0,0,0)\"))\n        self.assertEqual(ImageColor.getrgb(\"HSL(0,100%,50%)\"),\n                         ImageColor.getrgb(\"hsl(0,100%,50%)\"))\n        self.assertEqual(ImageColor.getrgb(\"HSV(0,100%,50%)\"),\n                         ImageColor.getrgb(\"hsv(0,100%,50%)\"))\n        self.assertEqual(ImageColor.getrgb(\"HSB(0,100%,50%)\"),\n                         ImageColor.getrgb(\"hsb(0,100%,50%)\"))\n\n        # space agnosticism\n        self.assertEqual((255, 0, 0),\n                         ImageColor.getrgb(\"rgb(  255  ,  0  ,  0  )\"))\n        self.assertEqual((255, 0, 0),\n                         ImageColor.getrgb(\"rgb(  100%  ,  0%  ,  0%  )\"))\n        self.assertEqual((255, 0, 0, 0),\n                         ImageColor.getrgb(\"rgba(  255  ,  0  ,  0  ,  0  )\"))\n        self.assertEqual((255, 0, 0),\n                         ImageColor.getrgb(\"hsl(  0  ,  100%  ,  50%  )\"))\n        self.assertEqual((255, 0, 0),\n                         ImageColor.getrgb(\"hsv(  0  ,  100%  ,  100%  )\"))\n\n        # wrong number of components\n        self.assertRaises(ValueError, ImageColor.getrgb, \"rgb(255,0)\")\n        self.assertRaises(ValueError, ImageColor.getrgb, \"rgb(255,0,0,0)\")\n\n        self.assertRaises(ValueError, ImageColor.getrgb, \"rgb(100%,0%)\")\n        self.assertRaises(ValueError, ImageColor.getrgb, \"rgb(100%,0%,0)\")\n        self.assertRaises(ValueError, ImageColor.getrgb, \"rgb(100%,0%,0 %)\")\n        self.assertRaises(ValueError, ImageColor.getrgb, \"rgb(100%,0%,0%,0%)\")\n\n        self.assertRaises(ValueError, ImageColor.getrgb, \"rgba(255,0,0)\")\n        self.assertRaises(ValueError, ImageColor.getrgb, \"rgba(255,0,0,0,0)\")\n\n        self.assertRaises(ValueError, ImageColor.getrgb, \"hsl(0,100%)\")\n        self.assertRaises(ValueError, ImageColor.getrgb, \"hsl(0,100%,0%,0%)\")\n        self.assertRaises(ValueError, ImageColor.getrgb, \"hsl(0%,100%,50%)\")\n        self.assertRaises(ValueError, ImageColor.getrgb, \"hsl(0,100,50%)\")\n        self.assertRaises(ValueError, ImageColor.getrgb, \"hsl(0,100%,50)\")\n\n        self.assertRaises(ValueError, ImageColor.getrgb, \"hsv(0,100%)\")\n        self.assertRaises(ValueError, ImageColor.getrgb, \"hsv(0,100%,0%,0%)\")\n        self.assertRaises(ValueError, ImageColor.getrgb, \"hsv(0%,100%,50%)\")\n        self.assertRaises(ValueError, ImageColor.getrgb, \"hsv(0,100,50%)\")\n        self.assertRaises(ValueError, ImageColor.getrgb, \"hsv(0,100%,50)\")\n\n    # look for rounding errors (based on code by Tim Hatch)\n    def test_rounding_errors(self):\n\n        for color in ImageColor.colormap:\n            expected = Image.new(\n                \"RGB\", (1, 1), color).convert(\"L\").getpixel((0, 0))\n            actual = ImageColor.getcolor(color, 'L')\n            self.assertEqual(expected, actual)\n\n        self.assertEqual(\n            (0, 255, 115), ImageColor.getcolor(\"rgba(0, 255, 115, 33)\", \"RGB\"))\n        Image.new(\"RGB\", (1, 1), \"white\")\n\n        self.assertEqual((0, 0, 0, 255), ImageColor.getcolor(\"black\", \"RGBA\"))\n        self.assertEqual(\n            (255, 255, 255, 255), ImageColor.getcolor(\"white\", \"RGBA\"))\n        self.assertEqual(\n            (0, 255, 115, 33),\n            ImageColor.getcolor(\"rgba(0, 255, 115, 33)\", \"RGBA\"))\n        Image.new(\"RGBA\", (1, 1), \"white\")\n\n        self.assertEqual(0, ImageColor.getcolor(\"black\", \"L\"))\n        self.assertEqual(255, ImageColor.getcolor(\"white\", \"L\"))\n        self.assertEqual(162,\n                         ImageColor.getcolor(\"rgba(0, 255, 115, 33)\", \"L\"))\n        Image.new(\"L\", (1, 1), \"white\")\n\n        self.assertEqual(0, ImageColor.getcolor(\"black\", \"1\"))\n        self.assertEqual(255, ImageColor.getcolor(\"white\", \"1\"))\n        # The following test is wrong, but is current behavior\n        # The correct result should be 255 due to the mode 1\n        self.assertEqual(\n            162, ImageColor.getcolor(\"rgba(0, 255, 115, 33)\", \"1\"))\n        # Correct behavior\n        # self.assertEqual(\n        #     255, ImageColor.getcolor(\"rgba(0, 255, 115, 33)\", \"1\"))\n        Image.new(\"1\", (1, 1), \"white\")\n\n        self.assertEqual((0, 255), ImageColor.getcolor(\"black\", \"LA\"))\n        self.assertEqual((255, 255), ImageColor.getcolor(\"white\", \"LA\"))\n        self.assertEqual(\n            (162, 33), ImageColor.getcolor(\"rgba(0, 255, 115, 33)\", \"LA\"))\n        Image.new(\"LA\", (1, 1), \"white\")",
                                "ast_type_str": "ClassDef",
                                "start_lineno": 7,
                                "end_lineno": 188,
                                "parent": null
                            }
                        }
                    ],
                    "added_entities": [],
                    "deleted_entities": []
                },
                {
                    "descriptor": {
                        "old_range": {
                            "start": 91,
                            "length": 6
                        },
                        "new_range": {
                            "start": 102,
                            "length": 10
                        },
                        "section": "class TestImageColor(PillowTestCase):"
                    },
                    "line_group": {
                        "all_lines": [
                            {
                                "content": "                         ImageColor.getrgb(\"rgba(255,0,0,0)\"))",
                                "type": "context"
                            },
                            {
                                "content": "        self.assertEqual(ImageColor.getrgb(\"HSL(0,100%,50%)\"),",
                                "type": "context"
                            },
                            {
                                "content": "                         ImageColor.getrgb(\"hsl(0,100%,50%)\"))",
                                "type": "context"
                            },
                            {
                                "content": "        self.assertEqual(ImageColor.getrgb(\"HSV(0,100%,50%)\"),",
                                "type": "added"
                            },
                            {
                                "content": "                         ImageColor.getrgb(\"hsv(0,100%,50%)\"))",
                                "type": "added"
                            },
                            {
                                "content": "        self.assertEqual(ImageColor.getrgb(\"HSB(0,100%,50%)\"),",
                                "type": "added"
                            },
                            {
                                "content": "                         ImageColor.getrgb(\"hsb(0,100%,50%)\"))",
                                "type": "added"
                            },
                            {
                                "content": "",
                                "type": "context"
                            },
                            {
                                "content": "        # space agnosticism",
                                "type": "context"
                            },
                            {
                                "content": "        self.assertEqual((255, 0, 0),",
                                "type": "context"
                            }
                        ]
                    },
                    "modified_entities": [
                        {
                            "file_name": "Tests/test_imagecolor.py",
                            "type": "class",
                            "name": "TestImageColor",
                            "content": "class TestImageColor(PillowTestCase):\n\n    def test_hash(self):\n        # short 3 components\n        self.assertEqual((255, 0, 0), ImageColor.getrgb(\"#f00\"))\n        self.assertEqual((0, 255, 0), ImageColor.getrgb(\"#0f0\"))\n        self.assertEqual((0, 0, 255), ImageColor.getrgb(\"#00f\"))\n\n        # short 4 components\n        self.assertEqual((255, 0, 0, 0), ImageColor.getrgb(\"#f000\"))\n        self.assertEqual((0, 255, 0, 0), ImageColor.getrgb(\"#0f00\"))\n        self.assertEqual((0, 0, 255, 0), ImageColor.getrgb(\"#00f0\"))\n        self.assertEqual((0, 0, 0, 255), ImageColor.getrgb(\"#000f\"))\n\n        # long 3 components\n        self.assertEqual((222, 0, 0), ImageColor.getrgb(\"#de0000\"))\n        self.assertEqual((0, 222, 0), ImageColor.getrgb(\"#00de00\"))\n        self.assertEqual((0, 0, 222), ImageColor.getrgb(\"#0000de\"))\n\n        # long 4 components\n        self.assertEqual((222, 0, 0, 0), ImageColor.getrgb(\"#de000000\"))\n        self.assertEqual((0, 222, 0, 0), ImageColor.getrgb(\"#00de0000\"))\n        self.assertEqual((0, 0, 222, 0), ImageColor.getrgb(\"#0000de00\"))\n        self.assertEqual((0, 0, 0, 222), ImageColor.getrgb(\"#000000de\"))\n\n        # case insensitivity\n        self.assertEqual(ImageColor.getrgb(\"#DEF\"), ImageColor.getrgb(\"#def\"))\n        self.assertEqual(ImageColor.getrgb(\"#CDEF\"), ImageColor.getrgb(\"#cdef\"))\n        self.assertEqual(ImageColor.getrgb(\"#DEFDEF\"),\n                         ImageColor.getrgb(\"#defdef\"))\n        self.assertEqual(ImageColor.getrgb(\"#CDEFCDEF\"),\n                         ImageColor.getrgb(\"#cdefcdef\"))\n\n        # not a number\n        self.assertRaises(ValueError, ImageColor.getrgb, \"#fo0\")\n        self.assertRaises(ValueError, ImageColor.getrgb, \"#fo00\")\n        self.assertRaises(ValueError, ImageColor.getrgb, \"#fo0000\")\n        self.assertRaises(ValueError, ImageColor.getrgb, \"#fo000000\")\n\n        # wrong number of components\n        self.assertRaises(ValueError, ImageColor.getrgb, \"#f0000\")\n        self.assertRaises(ValueError, ImageColor.getrgb, \"#f000000\")\n        self.assertRaises(ValueError, ImageColor.getrgb, \"#f00000000\")\n        self.assertRaises(ValueError, ImageColor.getrgb, \"#f000000000\")\n        self.assertRaises(ValueError, ImageColor.getrgb, \"#f00000 \")\n\n    def test_colormap(self):\n        self.assertEqual((0, 0, 0), ImageColor.getrgb(\"black\"))\n        self.assertEqual((255, 255, 255), ImageColor.getrgb(\"white\"))\n        self.assertEqual((255, 255, 255), ImageColor.getrgb(\"WHITE\"))\n\n        self.assertRaises(ValueError, ImageColor.getrgb, \"black \")\n\n    def test_functions(self):\n        # rgb numbers\n        self.assertEqual((255, 0, 0), ImageColor.getrgb(\"rgb(255,0,0)\"))\n        self.assertEqual((0, 255, 0), ImageColor.getrgb(\"rgb(0,255,0)\"))\n        self.assertEqual((0, 0, 255), ImageColor.getrgb(\"rgb(0,0,255)\"))\n\n        # percents\n        self.assertEqual((255, 0, 0), ImageColor.getrgb(\"rgb(100%,0%,0%)\"))\n        self.assertEqual((0, 255, 0), ImageColor.getrgb(\"rgb(0%,100%,0%)\"))\n        self.assertEqual((0, 0, 255), ImageColor.getrgb(\"rgb(0%,0%,100%)\"))\n\n        # rgba numbers\n        self.assertEqual((255, 0, 0, 0), ImageColor.getrgb(\"rgba(255,0,0,0)\"))\n        self.assertEqual((0, 255, 0, 0), ImageColor.getrgb(\"rgba(0,255,0,0)\"))\n        self.assertEqual((0, 0, 255, 0), ImageColor.getrgb(\"rgba(0,0,255,0)\"))\n        self.assertEqual((0, 0, 0, 255), ImageColor.getrgb(\"rgba(0,0,0,255)\"))\n\n        self.assertEqual((255, 0, 0), ImageColor.getrgb(\"hsl(0,100%,50%)\"))\n        self.assertEqual((255, 0, 0), ImageColor.getrgb(\"hsl(360,100%,50%)\"))\n        self.assertEqual((0, 255, 255), ImageColor.getrgb(\"hsl(180,100%,50%)\"))\n\n        self.assertEqual((255, 0, 0), ImageColor.getrgb(\"hsv(0,100%,100%)\"))\n        self.assertEqual((255, 0, 0), ImageColor.getrgb(\"hsv(360,100%,100%)\"))\n        self.assertEqual((0, 255, 255), ImageColor.getrgb(\"hsv(180,100%,100%)\"))\n\n        # alternate format\n        self.assertEqual(ImageColor.getrgb(\"hsb(0,100%,50%)\"),\n                         ImageColor.getrgb(\"hsv(0,100%,50%)\"))\n\n        # floats\n        self.assertEqual((254, 3, 3), ImageColor.getrgb(\"hsl(0.1,99.2%,50.3%)\"))\n        self.assertEqual((255, 0, 0), ImageColor.getrgb(\"hsl(360.,100.0%,50%)\"))\n\n        self.assertEqual((253, 2, 2), ImageColor.getrgb(\"hsv(0.1,99.2%,99.3%)\"))\n        self.assertEqual((255, 0, 0), ImageColor.getrgb(\"hsv(360.,100.0%,100%)\"))\n\n        # case insensitivity\n        self.assertEqual(ImageColor.getrgb(\"RGB(255,0,0)\"),\n                         ImageColor.getrgb(\"rgb(255,0,0)\"))\n        self.assertEqual(ImageColor.getrgb(\"RGB(100%,0%,0%)\"),\n                         ImageColor.getrgb(\"rgb(100%,0%,0%)\"))\n        self.assertEqual(ImageColor.getrgb(\"RGBA(255,0,0,0)\"),\n                         ImageColor.getrgb(\"rgba(255,0,0,0)\"))\n        self.assertEqual(ImageColor.getrgb(\"HSL(0,100%,50%)\"),\n                         ImageColor.getrgb(\"hsl(0,100%,50%)\"))\n        self.assertEqual(ImageColor.getrgb(\"HSV(0,100%,50%)\"),\n                         ImageColor.getrgb(\"hsv(0,100%,50%)\"))\n        self.assertEqual(ImageColor.getrgb(\"HSB(0,100%,50%)\"),\n                         ImageColor.getrgb(\"hsb(0,100%,50%)\"))\n\n        # space agnosticism\n        self.assertEqual((255, 0, 0),\n                         ImageColor.getrgb(\"rgb(  255  ,  0  ,  0  )\"))\n        self.assertEqual((255, 0, 0),\n                         ImageColor.getrgb(\"rgb(  100%  ,  0%  ,  0%  )\"))\n        self.assertEqual((255, 0, 0, 0),\n                         ImageColor.getrgb(\"rgba(  255  ,  0  ,  0  ,  0  )\"))\n        self.assertEqual((255, 0, 0),\n                         ImageColor.getrgb(\"hsl(  0  ,  100%  ,  50%  )\"))\n        self.assertEqual((255, 0, 0),\n                         ImageColor.getrgb(\"hsv(  0  ,  100%  ,  100%  )\"))\n\n        # wrong number of components\n        self.assertRaises(ValueError, ImageColor.getrgb, \"rgb(255,0)\")\n        self.assertRaises(ValueError, ImageColor.getrgb, \"rgb(255,0,0,0)\")\n\n        self.assertRaises(ValueError, ImageColor.getrgb, \"rgb(100%,0%)\")\n        self.assertRaises(ValueError, ImageColor.getrgb, \"rgb(100%,0%,0)\")\n        self.assertRaises(ValueError, ImageColor.getrgb, \"rgb(100%,0%,0 %)\")\n        self.assertRaises(ValueError, ImageColor.getrgb, \"rgb(100%,0%,0%,0%)\")\n\n        self.assertRaises(ValueError, ImageColor.getrgb, \"rgba(255,0,0)\")\n        self.assertRaises(ValueError, ImageColor.getrgb, \"rgba(255,0,0,0,0)\")\n\n        self.assertRaises(ValueError, ImageColor.getrgb, \"hsl(0,100%)\")\n        self.assertRaises(ValueError, ImageColor.getrgb, \"hsl(0,100%,0%,0%)\")\n        self.assertRaises(ValueError, ImageColor.getrgb, \"hsl(0%,100%,50%)\")\n        self.assertRaises(ValueError, ImageColor.getrgb, \"hsl(0,100,50%)\")\n        self.assertRaises(ValueError, ImageColor.getrgb, \"hsl(0,100%,50)\")\n\n        self.assertRaises(ValueError, ImageColor.getrgb, \"hsv(0,100%)\")\n        self.assertRaises(ValueError, ImageColor.getrgb, \"hsv(0,100%,0%,0%)\")\n        self.assertRaises(ValueError, ImageColor.getrgb, \"hsv(0%,100%,50%)\")\n        self.assertRaises(ValueError, ImageColor.getrgb, \"hsv(0,100,50%)\")\n        self.assertRaises(ValueError, ImageColor.getrgb, \"hsv(0,100%,50)\")\n\n    # look for rounding errors (based on code by Tim Hatch)\n    def test_rounding_errors(self):\n\n        for color in ImageColor.colormap:\n            expected = Image.new(\n                \"RGB\", (1, 1), color).convert(\"L\").getpixel((0, 0))\n            actual = ImageColor.getcolor(color, 'L')\n            self.assertEqual(expected, actual)\n\n        self.assertEqual(\n            (0, 255, 115), ImageColor.getcolor(\"rgba(0, 255, 115, 33)\", \"RGB\"))\n        Image.new(\"RGB\", (1, 1), \"white\")\n\n        self.assertEqual((0, 0, 0, 255), ImageColor.getcolor(\"black\", \"RGBA\"))\n        self.assertEqual(\n            (255, 255, 255, 255), ImageColor.getcolor(\"white\", \"RGBA\"))\n        self.assertEqual(\n            (0, 255, 115, 33),\n            ImageColor.getcolor(\"rgba(0, 255, 115, 33)\", \"RGBA\"))\n        Image.new(\"RGBA\", (1, 1), \"white\")\n\n        self.assertEqual(0, ImageColor.getcolor(\"black\", \"L\"))\n        self.assertEqual(255, ImageColor.getcolor(\"white\", \"L\"))\n        self.assertEqual(162,\n                         ImageColor.getcolor(\"rgba(0, 255, 115, 33)\", \"L\"))\n        Image.new(\"L\", (1, 1), \"white\")\n\n        self.assertEqual(0, ImageColor.getcolor(\"black\", \"1\"))\n        self.assertEqual(255, ImageColor.getcolor(\"white\", \"1\"))\n        # The following test is wrong, but is current behavior\n        # The correct result should be 255 due to the mode 1\n        self.assertEqual(\n            162, ImageColor.getcolor(\"rgba(0, 255, 115, 33)\", \"1\"))\n        # Correct behavior\n        # self.assertEqual(\n        #     255, ImageColor.getcolor(\"rgba(0, 255, 115, 33)\", \"1\"))\n        Image.new(\"1\", (1, 1), \"white\")\n\n        self.assertEqual((0, 255), ImageColor.getcolor(\"black\", \"LA\"))\n        self.assertEqual((255, 255), ImageColor.getcolor(\"white\", \"LA\"))\n        self.assertEqual(\n            (162, 33), ImageColor.getcolor(\"rgba(0, 255, 115, 33)\", \"LA\"))\n        Image.new(\"LA\", (1, 1), \"white\")",
                            "ast_type_str": "ClassDef",
                            "start_lineno": 7,
                            "end_lineno": 188,
                            "parent": null
                        },
                        {
                            "file_name": "Tests/test_imagecolor.py",
                            "type": "method",
                            "name": "TestImageColor.test_functions",
                            "content": "class TestImageColor(PillowTestCase):\n\n    def test_hash(self):\n        # short 3 components\n        self.assertEqual((255, 0, 0), ImageColor.getrgb(\"#f00\"))\n        self.assertEqual((0, 255, 0), ImageColor.getrgb(\"#0f0\"))\n        self.assertEqual((0, 0, 255), ImageColor.getrgb(\"#00f\"))\n\n        # short 4 components\n        self.assertEqual((255, 0, 0, 0), ImageColor.getrgb(\"#f000\"))\n        self.assertEqual((0, 255, 0, 0), ImageColor.getrgb(\"#0f00\"))\n        self.assertEqual((0, 0, 255, 0), ImageColor.getrgb(\"#00f0\"))\n        self.assertEqual((0, 0, 0, 255), ImageColor.getrgb(\"#000f\"))\n\n        # long 3 components\n        self.assertEqual((222, 0, 0), ImageColor.getrgb(\"#de0000\"))\n        self.assertEqual((0, 222, 0), ImageColor.getrgb(\"#00de00\"))\n        self.assertEqual((0, 0, 222), ImageColor.getrgb(\"#0000de\"))\n\n        # long 4 components\n        self.assertEqual((222, 0, 0, 0), ImageColor.getrgb(\"#de000000\"))\n        self.assertEqual((0, 222, 0, 0), ImageColor.getrgb(\"#00de0000\"))\n        self.assertEqual((0, 0, 222, 0), ImageColor.getrgb(\"#0000de00\"))\n        self.assertEqual((0, 0, 0, 222), ImageColor.getrgb(\"#000000de\"))\n\n        # case insensitivity\n        self.assertEqual(ImageColor.getrgb(\"#DEF\"), ImageColor.getrgb(\"#def\"))\n        self.assertEqual(ImageColor.getrgb(\"#CDEF\"), ImageColor.getrgb(\"#cdef\"))\n        self.assertEqual(ImageColor.getrgb(\"#DEFDEF\"),\n                         ImageColor.getrgb(\"#defdef\"))\n        self.assertEqual(ImageColor.getrgb(\"#CDEFCDEF\"),\n                         ImageColor.getrgb(\"#cdefcdef\"))\n\n        # not a number\n        self.assertRaises(ValueError, ImageColor.getrgb, \"#fo0\")\n        self.assertRaises(ValueError, ImageColor.getrgb, \"#fo00\")\n        self.assertRaises(ValueError, ImageColor.getrgb, \"#fo0000\")\n        self.assertRaises(ValueError, ImageColor.getrgb, \"#fo000000\")\n\n        # wrong number of components\n        self.assertRaises(ValueError, ImageColor.getrgb, \"#f0000\")\n        self.assertRaises(ValueError, ImageColor.getrgb, \"#f000000\")\n        self.assertRaises(ValueError, ImageColor.getrgb, \"#f00000000\")\n        self.assertRaises(ValueError, ImageColor.getrgb, \"#f000000000\")\n        self.assertRaises(ValueError, ImageColor.getrgb, \"#f00000 \")\n\n    def test_colormap(self):\n        self.assertEqual((0, 0, 0), ImageColor.getrgb(\"black\"))\n        self.assertEqual((255, 255, 255), ImageColor.getrgb(\"white\"))\n        self.assertEqual((255, 255, 255), ImageColor.getrgb(\"WHITE\"))\n\n        self.assertRaises(ValueError, ImageColor.getrgb, \"black \")\n\n    def test_functions(self):\n        # rgb numbers\n        self.assertEqual((255, 0, 0), ImageColor.getrgb(\"rgb(255,0,0)\"))\n        self.assertEqual((0, 255, 0), ImageColor.getrgb(\"rgb(0,255,0)\"))\n        self.assertEqual((0, 0, 255), ImageColor.getrgb(\"rgb(0,0,255)\"))\n\n        # percents\n        self.assertEqual((255, 0, 0), ImageColor.getrgb(\"rgb(100%,0%,0%)\"))\n        self.assertEqual((0, 255, 0), ImageColor.getrgb(\"rgb(0%,100%,0%)\"))\n        self.assertEqual((0, 0, 255), ImageColor.getrgb(\"rgb(0%,0%,100%)\"))\n\n        # rgba numbers\n        self.assertEqual((255, 0, 0, 0), ImageColor.getrgb(\"rgba(255,0,0,0)\"))\n        self.assertEqual((0, 255, 0, 0), ImageColor.getrgb(\"rgba(0,255,0,0)\"))\n        self.assertEqual((0, 0, 255, 0), ImageColor.getrgb(\"rgba(0,0,255,0)\"))\n        self.assertEqual((0, 0, 0, 255), ImageColor.getrgb(\"rgba(0,0,0,255)\"))\n\n        self.assertEqual((255, 0, 0), ImageColor.getrgb(\"hsl(0,100%,50%)\"))\n        self.assertEqual((255, 0, 0), ImageColor.getrgb(\"hsl(360,100%,50%)\"))\n        self.assertEqual((0, 255, 255), ImageColor.getrgb(\"hsl(180,100%,50%)\"))\n\n        self.assertEqual((255, 0, 0), ImageColor.getrgb(\"hsv(0,100%,100%)\"))\n        self.assertEqual((255, 0, 0), ImageColor.getrgb(\"hsv(360,100%,100%)\"))\n        self.assertEqual((0, 255, 255), ImageColor.getrgb(\"hsv(180,100%,100%)\"))\n\n        # alternate format\n        self.assertEqual(ImageColor.getrgb(\"hsb(0,100%,50%)\"),\n                         ImageColor.getrgb(\"hsv(0,100%,50%)\"))\n\n        # floats\n        self.assertEqual((254, 3, 3), ImageColor.getrgb(\"hsl(0.1,99.2%,50.3%)\"))\n        self.assertEqual((255, 0, 0), ImageColor.getrgb(\"hsl(360.,100.0%,50%)\"))\n\n        self.assertEqual((253, 2, 2), ImageColor.getrgb(\"hsv(0.1,99.2%,99.3%)\"))\n        self.assertEqual((255, 0, 0), ImageColor.getrgb(\"hsv(360.,100.0%,100%)\"))\n\n        # case insensitivity\n        self.assertEqual(ImageColor.getrgb(\"RGB(255,0,0)\"),\n                         ImageColor.getrgb(\"rgb(255,0,0)\"))\n        self.assertEqual(ImageColor.getrgb(\"RGB(100%,0%,0%)\"),\n                         ImageColor.getrgb(\"rgb(100%,0%,0%)\"))\n        self.assertEqual(ImageColor.getrgb(\"RGBA(255,0,0,0)\"),\n                         ImageColor.getrgb(\"rgba(255,0,0,0)\"))\n        self.assertEqual(ImageColor.getrgb(\"HSL(0,100%,50%)\"),\n                         ImageColor.getrgb(\"hsl(0,100%,50%)\"))\n        self.assertEqual(ImageColor.getrgb(\"HSV(0,100%,50%)\"),\n                         ImageColor.getrgb(\"hsv(0,100%,50%)\"))\n        self.assertEqual(ImageColor.getrgb(\"HSB(0,100%,50%)\"),\n                         ImageColor.getrgb(\"hsb(0,100%,50%)\"))\n\n        # space agnosticism\n        self.assertEqual((255, 0, 0),\n                         ImageColor.getrgb(\"rgb(  255  ,  0  ,  0  )\"))\n        self.assertEqual((255, 0, 0),\n                         ImageColor.getrgb(\"rgb(  100%  ,  0%  ,  0%  )\"))\n        self.assertEqual((255, 0, 0, 0),\n                         ImageColor.getrgb(\"rgba(  255  ,  0  ,  0  ,  0  )\"))\n        self.assertEqual((255, 0, 0),\n                         ImageColor.getrgb(\"hsl(  0  ,  100%  ,  50%  )\"))\n        self.assertEqual((255, 0, 0),\n                         ImageColor.getrgb(\"hsv(  0  ,  100%  ,  100%  )\"))\n\n        # wrong number of components\n        self.assertRaises(ValueError, ImageColor.getrgb, \"rgb(255,0)\")\n        self.assertRaises(ValueError, ImageColor.getrgb, \"rgb(255,0,0,0)\")\n\n        self.assertRaises(ValueError, ImageColor.getrgb, \"rgb(100%,0%)\")\n        self.assertRaises(ValueError, ImageColor.getrgb, \"rgb(100%,0%,0)\")\n        self.assertRaises(ValueError, ImageColor.getrgb, \"rgb(100%,0%,0 %)\")\n        self.assertRaises(ValueError, ImageColor.getrgb, \"rgb(100%,0%,0%,0%)\")\n\n        self.assertRaises(ValueError, ImageColor.getrgb, \"rgba(255,0,0)\")\n        self.assertRaises(ValueError, ImageColor.getrgb, \"rgba(255,0,0,0,0)\")\n\n        self.assertRaises(ValueError, ImageColor.getrgb, \"hsl(0,100%)\")\n        self.assertRaises(ValueError, ImageColor.getrgb, \"hsl(0,100%,0%,0%)\")\n        self.assertRaises(ValueError, ImageColor.getrgb, \"hsl(0%,100%,50%)\")\n        self.assertRaises(ValueError, ImageColor.getrgb, \"hsl(0,100,50%)\")\n        self.assertRaises(ValueError, ImageColor.getrgb, \"hsl(0,100%,50)\")\n\n        self.assertRaises(ValueError, ImageColor.getrgb, \"hsv(0,100%)\")\n        self.assertRaises(ValueError, ImageColor.getrgb, \"hsv(0,100%,0%,0%)\")\n        self.assertRaises(ValueError, ImageColor.getrgb, \"hsv(0%,100%,50%)\")\n        self.assertRaises(ValueError, ImageColor.getrgb, \"hsv(0,100,50%)\")\n        self.assertRaises(ValueError, ImageColor.getrgb, \"hsv(0,100%,50)\")\n\n    # look for rounding errors (based on code by Tim Hatch)\n    def test_rounding_errors(self):\n\n        for color in ImageColor.colormap:\n            expected = Image.new(\n                \"RGB\", (1, 1), color).convert(\"L\").getpixel((0, 0))\n            actual = ImageColor.getcolor(color, 'L')\n            self.assertEqual(expected, actual)\n\n        self.assertEqual(\n            (0, 255, 115), ImageColor.getcolor(\"rgba(0, 255, 115, 33)\", \"RGB\"))\n        Image.new(\"RGB\", (1, 1), \"white\")\n\n        self.assertEqual((0, 0, 0, 255), ImageColor.getcolor(\"black\", \"RGBA\"))\n        self.assertEqual(\n            (255, 255, 255, 255), ImageColor.getcolor(\"white\", \"RGBA\"))\n        self.assertEqual(\n            (0, 255, 115, 33),\n            ImageColor.getcolor(\"rgba(0, 255, 115, 33)\", \"RGBA\"))\n        Image.new(\"RGBA\", (1, 1), \"white\")\n\n        self.assertEqual(0, ImageColor.getcolor(\"black\", \"L\"))\n        self.assertEqual(255, ImageColor.getcolor(\"white\", \"L\"))\n        self.assertEqual(162,\n                         ImageColor.getcolor(\"rgba(0, 255, 115, 33)\", \"L\"))\n        Image.new(\"L\", (1, 1), \"white\")\n\n        self.assertEqual(0, ImageColor.getcolor(\"black\", \"1\"))\n        self.assertEqual(255, ImageColor.getcolor(\"white\", \"1\"))\n        # The following test is wrong, but is current behavior\n        # The correct result should be 255 due to the mode 1\n        self.assertEqual(\n            162, ImageColor.getcolor(\"rgba(0, 255, 115, 33)\", \"1\"))\n        # Correct behavior\n        # self.assertEqual(\n        #     255, ImageColor.getcolor(\"rgba(0, 255, 115, 33)\", \"1\"))\n        Image.new(\"1\", (1, 1), \"white\")\n\n        self.assertEqual((0, 255), ImageColor.getcolor(\"black\", \"LA\"))\n        self.assertEqual((255, 255), ImageColor.getcolor(\"white\", \"LA\"))\n        self.assertEqual(\n            (162, 33), ImageColor.getcolor(\"rgba(0, 255, 115, 33)\", \"LA\"))\n        Image.new(\"LA\", (1, 1), \"white\")",
                            "ast_type_str": "ClassDef",
                            "start_lineno": 60,
                            "end_lineno": 144,
                            "parent": {
                                "file_name": "Tests/test_imagecolor.py",
                                "type": "class",
                                "name": "TestImageColor",
                                "content": "class TestImageColor(PillowTestCase):\n\n    def test_hash(self):\n        # short 3 components\n        self.assertEqual((255, 0, 0), ImageColor.getrgb(\"#f00\"))\n        self.assertEqual((0, 255, 0), ImageColor.getrgb(\"#0f0\"))\n        self.assertEqual((0, 0, 255), ImageColor.getrgb(\"#00f\"))\n\n        # short 4 components\n        self.assertEqual((255, 0, 0, 0), ImageColor.getrgb(\"#f000\"))\n        self.assertEqual((0, 255, 0, 0), ImageColor.getrgb(\"#0f00\"))\n        self.assertEqual((0, 0, 255, 0), ImageColor.getrgb(\"#00f0\"))\n        self.assertEqual((0, 0, 0, 255), ImageColor.getrgb(\"#000f\"))\n\n        # long 3 components\n        self.assertEqual((222, 0, 0), ImageColor.getrgb(\"#de0000\"))\n        self.assertEqual((0, 222, 0), ImageColor.getrgb(\"#00de00\"))\n        self.assertEqual((0, 0, 222), ImageColor.getrgb(\"#0000de\"))\n\n        # long 4 components\n        self.assertEqual((222, 0, 0, 0), ImageColor.getrgb(\"#de000000\"))\n        self.assertEqual((0, 222, 0, 0), ImageColor.getrgb(\"#00de0000\"))\n        self.assertEqual((0, 0, 222, 0), ImageColor.getrgb(\"#0000de00\"))\n        self.assertEqual((0, 0, 0, 222), ImageColor.getrgb(\"#000000de\"))\n\n        # case insensitivity\n        self.assertEqual(ImageColor.getrgb(\"#DEF\"), ImageColor.getrgb(\"#def\"))\n        self.assertEqual(ImageColor.getrgb(\"#CDEF\"), ImageColor.getrgb(\"#cdef\"))\n        self.assertEqual(ImageColor.getrgb(\"#DEFDEF\"),\n                         ImageColor.getrgb(\"#defdef\"))\n        self.assertEqual(ImageColor.getrgb(\"#CDEFCDEF\"),\n                         ImageColor.getrgb(\"#cdefcdef\"))\n\n        # not a number\n        self.assertRaises(ValueError, ImageColor.getrgb, \"#fo0\")\n        self.assertRaises(ValueError, ImageColor.getrgb, \"#fo00\")\n        self.assertRaises(ValueError, ImageColor.getrgb, \"#fo0000\")\n        self.assertRaises(ValueError, ImageColor.getrgb, \"#fo000000\")\n\n        # wrong number of components\n        self.assertRaises(ValueError, ImageColor.getrgb, \"#f0000\")\n        self.assertRaises(ValueError, ImageColor.getrgb, \"#f000000\")\n        self.assertRaises(ValueError, ImageColor.getrgb, \"#f00000000\")\n        self.assertRaises(ValueError, ImageColor.getrgb, \"#f000000000\")\n        self.assertRaises(ValueError, ImageColor.getrgb, \"#f00000 \")\n\n    def test_colormap(self):\n        self.assertEqual((0, 0, 0), ImageColor.getrgb(\"black\"))\n        self.assertEqual((255, 255, 255), ImageColor.getrgb(\"white\"))\n        self.assertEqual((255, 255, 255), ImageColor.getrgb(\"WHITE\"))\n\n        self.assertRaises(ValueError, ImageColor.getrgb, \"black \")\n\n    def test_functions(self):\n        # rgb numbers\n        self.assertEqual((255, 0, 0), ImageColor.getrgb(\"rgb(255,0,0)\"))\n        self.assertEqual((0, 255, 0), ImageColor.getrgb(\"rgb(0,255,0)\"))\n        self.assertEqual((0, 0, 255), ImageColor.getrgb(\"rgb(0,0,255)\"))\n\n        # percents\n        self.assertEqual((255, 0, 0), ImageColor.getrgb(\"rgb(100%,0%,0%)\"))\n        self.assertEqual((0, 255, 0), ImageColor.getrgb(\"rgb(0%,100%,0%)\"))\n        self.assertEqual((0, 0, 255), ImageColor.getrgb(\"rgb(0%,0%,100%)\"))\n\n        # rgba numbers\n        self.assertEqual((255, 0, 0, 0), ImageColor.getrgb(\"rgba(255,0,0,0)\"))\n        self.assertEqual((0, 255, 0, 0), ImageColor.getrgb(\"rgba(0,255,0,0)\"))\n        self.assertEqual((0, 0, 255, 0), ImageColor.getrgb(\"rgba(0,0,255,0)\"))\n        self.assertEqual((0, 0, 0, 255), ImageColor.getrgb(\"rgba(0,0,0,255)\"))\n\n        self.assertEqual((255, 0, 0), ImageColor.getrgb(\"hsl(0,100%,50%)\"))\n        self.assertEqual((255, 0, 0), ImageColor.getrgb(\"hsl(360,100%,50%)\"))\n        self.assertEqual((0, 255, 255), ImageColor.getrgb(\"hsl(180,100%,50%)\"))\n\n        self.assertEqual((255, 0, 0), ImageColor.getrgb(\"hsv(0,100%,100%)\"))\n        self.assertEqual((255, 0, 0), ImageColor.getrgb(\"hsv(360,100%,100%)\"))\n        self.assertEqual((0, 255, 255), ImageColor.getrgb(\"hsv(180,100%,100%)\"))\n\n        # alternate format\n        self.assertEqual(ImageColor.getrgb(\"hsb(0,100%,50%)\"),\n                         ImageColor.getrgb(\"hsv(0,100%,50%)\"))\n\n        # floats\n        self.assertEqual((254, 3, 3), ImageColor.getrgb(\"hsl(0.1,99.2%,50.3%)\"))\n        self.assertEqual((255, 0, 0), ImageColor.getrgb(\"hsl(360.,100.0%,50%)\"))\n\n        self.assertEqual((253, 2, 2), ImageColor.getrgb(\"hsv(0.1,99.2%,99.3%)\"))\n        self.assertEqual((255, 0, 0), ImageColor.getrgb(\"hsv(360.,100.0%,100%)\"))\n\n        # case insensitivity\n        self.assertEqual(ImageColor.getrgb(\"RGB(255,0,0)\"),\n                         ImageColor.getrgb(\"rgb(255,0,0)\"))\n        self.assertEqual(ImageColor.getrgb(\"RGB(100%,0%,0%)\"),\n                         ImageColor.getrgb(\"rgb(100%,0%,0%)\"))\n        self.assertEqual(ImageColor.getrgb(\"RGBA(255,0,0,0)\"),\n                         ImageColor.getrgb(\"rgba(255,0,0,0)\"))\n        self.assertEqual(ImageColor.getrgb(\"HSL(0,100%,50%)\"),\n                         ImageColor.getrgb(\"hsl(0,100%,50%)\"))\n        self.assertEqual(ImageColor.getrgb(\"HSV(0,100%,50%)\"),\n                         ImageColor.getrgb(\"hsv(0,100%,50%)\"))\n        self.assertEqual(ImageColor.getrgb(\"HSB(0,100%,50%)\"),\n                         ImageColor.getrgb(\"hsb(0,100%,50%)\"))\n\n        # space agnosticism\n        self.assertEqual((255, 0, 0),\n                         ImageColor.getrgb(\"rgb(  255  ,  0  ,  0  )\"))\n        self.assertEqual((255, 0, 0),\n                         ImageColor.getrgb(\"rgb(  100%  ,  0%  ,  0%  )\"))\n        self.assertEqual((255, 0, 0, 0),\n                         ImageColor.getrgb(\"rgba(  255  ,  0  ,  0  ,  0  )\"))\n        self.assertEqual((255, 0, 0),\n                         ImageColor.getrgb(\"hsl(  0  ,  100%  ,  50%  )\"))\n        self.assertEqual((255, 0, 0),\n                         ImageColor.getrgb(\"hsv(  0  ,  100%  ,  100%  )\"))\n\n        # wrong number of components\n        self.assertRaises(ValueError, ImageColor.getrgb, \"rgb(255,0)\")\n        self.assertRaises(ValueError, ImageColor.getrgb, \"rgb(255,0,0,0)\")\n\n        self.assertRaises(ValueError, ImageColor.getrgb, \"rgb(100%,0%)\")\n        self.assertRaises(ValueError, ImageColor.getrgb, \"rgb(100%,0%,0)\")\n        self.assertRaises(ValueError, ImageColor.getrgb, \"rgb(100%,0%,0 %)\")\n        self.assertRaises(ValueError, ImageColor.getrgb, \"rgb(100%,0%,0%,0%)\")\n\n        self.assertRaises(ValueError, ImageColor.getrgb, \"rgba(255,0,0)\")\n        self.assertRaises(ValueError, ImageColor.getrgb, \"rgba(255,0,0,0,0)\")\n\n        self.assertRaises(ValueError, ImageColor.getrgb, \"hsl(0,100%)\")\n        self.assertRaises(ValueError, ImageColor.getrgb, \"hsl(0,100%,0%,0%)\")\n        self.assertRaises(ValueError, ImageColor.getrgb, \"hsl(0%,100%,50%)\")\n        self.assertRaises(ValueError, ImageColor.getrgb, \"hsl(0,100,50%)\")\n        self.assertRaises(ValueError, ImageColor.getrgb, \"hsl(0,100%,50)\")\n\n        self.assertRaises(ValueError, ImageColor.getrgb, \"hsv(0,100%)\")\n        self.assertRaises(ValueError, ImageColor.getrgb, \"hsv(0,100%,0%,0%)\")\n        self.assertRaises(ValueError, ImageColor.getrgb, \"hsv(0%,100%,50%)\")\n        self.assertRaises(ValueError, ImageColor.getrgb, \"hsv(0,100,50%)\")\n        self.assertRaises(ValueError, ImageColor.getrgb, \"hsv(0,100%,50)\")\n\n    # look for rounding errors (based on code by Tim Hatch)\n    def test_rounding_errors(self):\n\n        for color in ImageColor.colormap:\n            expected = Image.new(\n                \"RGB\", (1, 1), color).convert(\"L\").getpixel((0, 0))\n            actual = ImageColor.getcolor(color, 'L')\n            self.assertEqual(expected, actual)\n\n        self.assertEqual(\n            (0, 255, 115), ImageColor.getcolor(\"rgba(0, 255, 115, 33)\", \"RGB\"))\n        Image.new(\"RGB\", (1, 1), \"white\")\n\n        self.assertEqual((0, 0, 0, 255), ImageColor.getcolor(\"black\", \"RGBA\"))\n        self.assertEqual(\n            (255, 255, 255, 255), ImageColor.getcolor(\"white\", \"RGBA\"))\n        self.assertEqual(\n            (0, 255, 115, 33),\n            ImageColor.getcolor(\"rgba(0, 255, 115, 33)\", \"RGBA\"))\n        Image.new(\"RGBA\", (1, 1), \"white\")\n\n        self.assertEqual(0, ImageColor.getcolor(\"black\", \"L\"))\n        self.assertEqual(255, ImageColor.getcolor(\"white\", \"L\"))\n        self.assertEqual(162,\n                         ImageColor.getcolor(\"rgba(0, 255, 115, 33)\", \"L\"))\n        Image.new(\"L\", (1, 1), \"white\")\n\n        self.assertEqual(0, ImageColor.getcolor(\"black\", \"1\"))\n        self.assertEqual(255, ImageColor.getcolor(\"white\", \"1\"))\n        # The following test is wrong, but is current behavior\n        # The correct result should be 255 due to the mode 1\n        self.assertEqual(\n            162, ImageColor.getcolor(\"rgba(0, 255, 115, 33)\", \"1\"))\n        # Correct behavior\n        # self.assertEqual(\n        #     255, ImageColor.getcolor(\"rgba(0, 255, 115, 33)\", \"1\"))\n        Image.new(\"1\", (1, 1), \"white\")\n\n        self.assertEqual((0, 255), ImageColor.getcolor(\"black\", \"LA\"))\n        self.assertEqual((255, 255), ImageColor.getcolor(\"white\", \"LA\"))\n        self.assertEqual(\n            (162, 33), ImageColor.getcolor(\"rgba(0, 255, 115, 33)\", \"LA\"))\n        Image.new(\"LA\", (1, 1), \"white\")",
                                "ast_type_str": "ClassDef",
                                "start_lineno": 7,
                                "end_lineno": 188,
                                "parent": null
                            }
                        }
                    ],
                    "added_entities": [],
                    "deleted_entities": []
                },
                {
                    "descriptor": {
                        "old_range": {
                            "start": 101,
                            "length": 6
                        },
                        "new_range": {
                            "start": 116,
                            "length": 8
                        },
                        "section": "class TestImageColor(PillowTestCase):"
                    },
                    "line_group": {
                        "all_lines": [
                            {
                                "content": "                         ImageColor.getrgb(\"rgba(  255  ,  0  ,  0  ,  0  )\"))",
                                "type": "context"
                            },
                            {
                                "content": "        self.assertEqual((255, 0, 0),",
                                "type": "context"
                            },
                            {
                                "content": "                         ImageColor.getrgb(\"hsl(  0  ,  100%  ,  50%  )\"))",
                                "type": "context"
                            },
                            {
                                "content": "        self.assertEqual((255, 0, 0),",
                                "type": "added"
                            },
                            {
                                "content": "                         ImageColor.getrgb(\"hsv(  0  ,  100%  ,  100%  )\"))",
                                "type": "added"
                            },
                            {
                                "content": "",
                                "type": "context"
                            },
                            {
                                "content": "        # wrong number of components",
                                "type": "context"
                            },
                            {
                                "content": "        self.assertRaises(ValueError, ImageColor.getrgb, \"rgb(255,0)\")",
                                "type": "context"
                            }
                        ]
                    },
                    "modified_entities": [
                        {
                            "file_name": "Tests/test_imagecolor.py",
                            "type": "class",
                            "name": "TestImageColor",
                            "content": "class TestImageColor(PillowTestCase):\n\n    def test_hash(self):\n        # short 3 components\n        self.assertEqual((255, 0, 0), ImageColor.getrgb(\"#f00\"))\n        self.assertEqual((0, 255, 0), ImageColor.getrgb(\"#0f0\"))\n        self.assertEqual((0, 0, 255), ImageColor.getrgb(\"#00f\"))\n\n        # short 4 components\n        self.assertEqual((255, 0, 0, 0), ImageColor.getrgb(\"#f000\"))\n        self.assertEqual((0, 255, 0, 0), ImageColor.getrgb(\"#0f00\"))\n        self.assertEqual((0, 0, 255, 0), ImageColor.getrgb(\"#00f0\"))\n        self.assertEqual((0, 0, 0, 255), ImageColor.getrgb(\"#000f\"))\n\n        # long 3 components\n        self.assertEqual((222, 0, 0), ImageColor.getrgb(\"#de0000\"))\n        self.assertEqual((0, 222, 0), ImageColor.getrgb(\"#00de00\"))\n        self.assertEqual((0, 0, 222), ImageColor.getrgb(\"#0000de\"))\n\n        # long 4 components\n        self.assertEqual((222, 0, 0, 0), ImageColor.getrgb(\"#de000000\"))\n        self.assertEqual((0, 222, 0, 0), ImageColor.getrgb(\"#00de0000\"))\n        self.assertEqual((0, 0, 222, 0), ImageColor.getrgb(\"#0000de00\"))\n        self.assertEqual((0, 0, 0, 222), ImageColor.getrgb(\"#000000de\"))\n\n        # case insensitivity\n        self.assertEqual(ImageColor.getrgb(\"#DEF\"), ImageColor.getrgb(\"#def\"))\n        self.assertEqual(ImageColor.getrgb(\"#CDEF\"), ImageColor.getrgb(\"#cdef\"))\n        self.assertEqual(ImageColor.getrgb(\"#DEFDEF\"),\n                         ImageColor.getrgb(\"#defdef\"))\n        self.assertEqual(ImageColor.getrgb(\"#CDEFCDEF\"),\n                         ImageColor.getrgb(\"#cdefcdef\"))\n\n        # not a number\n        self.assertRaises(ValueError, ImageColor.getrgb, \"#fo0\")\n        self.assertRaises(ValueError, ImageColor.getrgb, \"#fo00\")\n        self.assertRaises(ValueError, ImageColor.getrgb, \"#fo0000\")\n        self.assertRaises(ValueError, ImageColor.getrgb, \"#fo000000\")\n\n        # wrong number of components\n        self.assertRaises(ValueError, ImageColor.getrgb, \"#f0000\")\n        self.assertRaises(ValueError, ImageColor.getrgb, \"#f000000\")\n        self.assertRaises(ValueError, ImageColor.getrgb, \"#f00000000\")\n        self.assertRaises(ValueError, ImageColor.getrgb, \"#f000000000\")\n        self.assertRaises(ValueError, ImageColor.getrgb, \"#f00000 \")\n\n    def test_colormap(self):\n        self.assertEqual((0, 0, 0), ImageColor.getrgb(\"black\"))\n        self.assertEqual((255, 255, 255), ImageColor.getrgb(\"white\"))\n        self.assertEqual((255, 255, 255), ImageColor.getrgb(\"WHITE\"))\n\n        self.assertRaises(ValueError, ImageColor.getrgb, \"black \")\n\n    def test_functions(self):\n        # rgb numbers\n        self.assertEqual((255, 0, 0), ImageColor.getrgb(\"rgb(255,0,0)\"))\n        self.assertEqual((0, 255, 0), ImageColor.getrgb(\"rgb(0,255,0)\"))\n        self.assertEqual((0, 0, 255), ImageColor.getrgb(\"rgb(0,0,255)\"))\n\n        # percents\n        self.assertEqual((255, 0, 0), ImageColor.getrgb(\"rgb(100%,0%,0%)\"))\n        self.assertEqual((0, 255, 0), ImageColor.getrgb(\"rgb(0%,100%,0%)\"))\n        self.assertEqual((0, 0, 255), ImageColor.getrgb(\"rgb(0%,0%,100%)\"))\n\n        # rgba numbers\n        self.assertEqual((255, 0, 0, 0), ImageColor.getrgb(\"rgba(255,0,0,0)\"))\n        self.assertEqual((0, 255, 0, 0), ImageColor.getrgb(\"rgba(0,255,0,0)\"))\n        self.assertEqual((0, 0, 255, 0), ImageColor.getrgb(\"rgba(0,0,255,0)\"))\n        self.assertEqual((0, 0, 0, 255), ImageColor.getrgb(\"rgba(0,0,0,255)\"))\n\n        self.assertEqual((255, 0, 0), ImageColor.getrgb(\"hsl(0,100%,50%)\"))\n        self.assertEqual((255, 0, 0), ImageColor.getrgb(\"hsl(360,100%,50%)\"))\n        self.assertEqual((0, 255, 255), ImageColor.getrgb(\"hsl(180,100%,50%)\"))\n\n        self.assertEqual((255, 0, 0), ImageColor.getrgb(\"hsv(0,100%,100%)\"))\n        self.assertEqual((255, 0, 0), ImageColor.getrgb(\"hsv(360,100%,100%)\"))\n        self.assertEqual((0, 255, 255), ImageColor.getrgb(\"hsv(180,100%,100%)\"))\n\n        # alternate format\n        self.assertEqual(ImageColor.getrgb(\"hsb(0,100%,50%)\"),\n                         ImageColor.getrgb(\"hsv(0,100%,50%)\"))\n\n        # floats\n        self.assertEqual((254, 3, 3), ImageColor.getrgb(\"hsl(0.1,99.2%,50.3%)\"))\n        self.assertEqual((255, 0, 0), ImageColor.getrgb(\"hsl(360.,100.0%,50%)\"))\n\n        self.assertEqual((253, 2, 2), ImageColor.getrgb(\"hsv(0.1,99.2%,99.3%)\"))\n        self.assertEqual((255, 0, 0), ImageColor.getrgb(\"hsv(360.,100.0%,100%)\"))\n\n        # case insensitivity\n        self.assertEqual(ImageColor.getrgb(\"RGB(255,0,0)\"),\n                         ImageColor.getrgb(\"rgb(255,0,0)\"))\n        self.assertEqual(ImageColor.getrgb(\"RGB(100%,0%,0%)\"),\n                         ImageColor.getrgb(\"rgb(100%,0%,0%)\"))\n        self.assertEqual(ImageColor.getrgb(\"RGBA(255,0,0,0)\"),\n                         ImageColor.getrgb(\"rgba(255,0,0,0)\"))\n        self.assertEqual(ImageColor.getrgb(\"HSL(0,100%,50%)\"),\n                         ImageColor.getrgb(\"hsl(0,100%,50%)\"))\n        self.assertEqual(ImageColor.getrgb(\"HSV(0,100%,50%)\"),\n                         ImageColor.getrgb(\"hsv(0,100%,50%)\"))\n        self.assertEqual(ImageColor.getrgb(\"HSB(0,100%,50%)\"),\n                         ImageColor.getrgb(\"hsb(0,100%,50%)\"))\n\n        # space agnosticism\n        self.assertEqual((255, 0, 0),\n                         ImageColor.getrgb(\"rgb(  255  ,  0  ,  0  )\"))\n        self.assertEqual((255, 0, 0),\n                         ImageColor.getrgb(\"rgb(  100%  ,  0%  ,  0%  )\"))\n        self.assertEqual((255, 0, 0, 0),\n                         ImageColor.getrgb(\"rgba(  255  ,  0  ,  0  ,  0  )\"))\n        self.assertEqual((255, 0, 0),\n                         ImageColor.getrgb(\"hsl(  0  ,  100%  ,  50%  )\"))\n        self.assertEqual((255, 0, 0),\n                         ImageColor.getrgb(\"hsv(  0  ,  100%  ,  100%  )\"))\n\n        # wrong number of components\n        self.assertRaises(ValueError, ImageColor.getrgb, \"rgb(255,0)\")\n        self.assertRaises(ValueError, ImageColor.getrgb, \"rgb(255,0,0,0)\")\n\n        self.assertRaises(ValueError, ImageColor.getrgb, \"rgb(100%,0%)\")\n        self.assertRaises(ValueError, ImageColor.getrgb, \"rgb(100%,0%,0)\")\n        self.assertRaises(ValueError, ImageColor.getrgb, \"rgb(100%,0%,0 %)\")\n        self.assertRaises(ValueError, ImageColor.getrgb, \"rgb(100%,0%,0%,0%)\")\n\n        self.assertRaises(ValueError, ImageColor.getrgb, \"rgba(255,0,0)\")\n        self.assertRaises(ValueError, ImageColor.getrgb, \"rgba(255,0,0,0,0)\")\n\n        self.assertRaises(ValueError, ImageColor.getrgb, \"hsl(0,100%)\")\n        self.assertRaises(ValueError, ImageColor.getrgb, \"hsl(0,100%,0%,0%)\")\n        self.assertRaises(ValueError, ImageColor.getrgb, \"hsl(0%,100%,50%)\")\n        self.assertRaises(ValueError, ImageColor.getrgb, \"hsl(0,100,50%)\")\n        self.assertRaises(ValueError, ImageColor.getrgb, \"hsl(0,100%,50)\")\n\n        self.assertRaises(ValueError, ImageColor.getrgb, \"hsv(0,100%)\")\n        self.assertRaises(ValueError, ImageColor.getrgb, \"hsv(0,100%,0%,0%)\")\n        self.assertRaises(ValueError, ImageColor.getrgb, \"hsv(0%,100%,50%)\")\n        self.assertRaises(ValueError, ImageColor.getrgb, \"hsv(0,100,50%)\")\n        self.assertRaises(ValueError, ImageColor.getrgb, \"hsv(0,100%,50)\")\n\n    # look for rounding errors (based on code by Tim Hatch)\n    def test_rounding_errors(self):\n\n        for color in ImageColor.colormap:\n            expected = Image.new(\n                \"RGB\", (1, 1), color).convert(\"L\").getpixel((0, 0))\n            actual = ImageColor.getcolor(color, 'L')\n            self.assertEqual(expected, actual)\n\n        self.assertEqual(\n            (0, 255, 115), ImageColor.getcolor(\"rgba(0, 255, 115, 33)\", \"RGB\"))\n        Image.new(\"RGB\", (1, 1), \"white\")\n\n        self.assertEqual((0, 0, 0, 255), ImageColor.getcolor(\"black\", \"RGBA\"))\n        self.assertEqual(\n            (255, 255, 255, 255), ImageColor.getcolor(\"white\", \"RGBA\"))\n        self.assertEqual(\n            (0, 255, 115, 33),\n            ImageColor.getcolor(\"rgba(0, 255, 115, 33)\", \"RGBA\"))\n        Image.new(\"RGBA\", (1, 1), \"white\")\n\n        self.assertEqual(0, ImageColor.getcolor(\"black\", \"L\"))\n        self.assertEqual(255, ImageColor.getcolor(\"white\", \"L\"))\n        self.assertEqual(162,\n                         ImageColor.getcolor(\"rgba(0, 255, 115, 33)\", \"L\"))\n        Image.new(\"L\", (1, 1), \"white\")\n\n        self.assertEqual(0, ImageColor.getcolor(\"black\", \"1\"))\n        self.assertEqual(255, ImageColor.getcolor(\"white\", \"1\"))\n        # The following test is wrong, but is current behavior\n        # The correct result should be 255 due to the mode 1\n        self.assertEqual(\n            162, ImageColor.getcolor(\"rgba(0, 255, 115, 33)\", \"1\"))\n        # Correct behavior\n        # self.assertEqual(\n        #     255, ImageColor.getcolor(\"rgba(0, 255, 115, 33)\", \"1\"))\n        Image.new(\"1\", (1, 1), \"white\")\n\n        self.assertEqual((0, 255), ImageColor.getcolor(\"black\", \"LA\"))\n        self.assertEqual((255, 255), ImageColor.getcolor(\"white\", \"LA\"))\n        self.assertEqual(\n            (162, 33), ImageColor.getcolor(\"rgba(0, 255, 115, 33)\", \"LA\"))\n        Image.new(\"LA\", (1, 1), \"white\")",
                            "ast_type_str": "ClassDef",
                            "start_lineno": 7,
                            "end_lineno": 188,
                            "parent": null
                        },
                        {
                            "file_name": "Tests/test_imagecolor.py",
                            "type": "method",
                            "name": "TestImageColor.test_functions",
                            "content": "class TestImageColor(PillowTestCase):\n\n    def test_hash(self):\n        # short 3 components\n        self.assertEqual((255, 0, 0), ImageColor.getrgb(\"#f00\"))\n        self.assertEqual((0, 255, 0), ImageColor.getrgb(\"#0f0\"))\n        self.assertEqual((0, 0, 255), ImageColor.getrgb(\"#00f\"))\n\n        # short 4 components\n        self.assertEqual((255, 0, 0, 0), ImageColor.getrgb(\"#f000\"))\n        self.assertEqual((0, 255, 0, 0), ImageColor.getrgb(\"#0f00\"))\n        self.assertEqual((0, 0, 255, 0), ImageColor.getrgb(\"#00f0\"))\n        self.assertEqual((0, 0, 0, 255), ImageColor.getrgb(\"#000f\"))\n\n        # long 3 components\n        self.assertEqual((222, 0, 0), ImageColor.getrgb(\"#de0000\"))\n        self.assertEqual((0, 222, 0), ImageColor.getrgb(\"#00de00\"))\n        self.assertEqual((0, 0, 222), ImageColor.getrgb(\"#0000de\"))\n\n        # long 4 components\n        self.assertEqual((222, 0, 0, 0), ImageColor.getrgb(\"#de000000\"))\n        self.assertEqual((0, 222, 0, 0), ImageColor.getrgb(\"#00de0000\"))\n        self.assertEqual((0, 0, 222, 0), ImageColor.getrgb(\"#0000de00\"))\n        self.assertEqual((0, 0, 0, 222), ImageColor.getrgb(\"#000000de\"))\n\n        # case insensitivity\n        self.assertEqual(ImageColor.getrgb(\"#DEF\"), ImageColor.getrgb(\"#def\"))\n        self.assertEqual(ImageColor.getrgb(\"#CDEF\"), ImageColor.getrgb(\"#cdef\"))\n        self.assertEqual(ImageColor.getrgb(\"#DEFDEF\"),\n                         ImageColor.getrgb(\"#defdef\"))\n        self.assertEqual(ImageColor.getrgb(\"#CDEFCDEF\"),\n                         ImageColor.getrgb(\"#cdefcdef\"))\n\n        # not a number\n        self.assertRaises(ValueError, ImageColor.getrgb, \"#fo0\")\n        self.assertRaises(ValueError, ImageColor.getrgb, \"#fo00\")\n        self.assertRaises(ValueError, ImageColor.getrgb, \"#fo0000\")\n        self.assertRaises(ValueError, ImageColor.getrgb, \"#fo000000\")\n\n        # wrong number of components\n        self.assertRaises(ValueError, ImageColor.getrgb, \"#f0000\")\n        self.assertRaises(ValueError, ImageColor.getrgb, \"#f000000\")\n        self.assertRaises(ValueError, ImageColor.getrgb, \"#f00000000\")\n        self.assertRaises(ValueError, ImageColor.getrgb, \"#f000000000\")\n        self.assertRaises(ValueError, ImageColor.getrgb, \"#f00000 \")\n\n    def test_colormap(self):\n        self.assertEqual((0, 0, 0), ImageColor.getrgb(\"black\"))\n        self.assertEqual((255, 255, 255), ImageColor.getrgb(\"white\"))\n        self.assertEqual((255, 255, 255), ImageColor.getrgb(\"WHITE\"))\n\n        self.assertRaises(ValueError, ImageColor.getrgb, \"black \")\n\n    def test_functions(self):\n        # rgb numbers\n        self.assertEqual((255, 0, 0), ImageColor.getrgb(\"rgb(255,0,0)\"))\n        self.assertEqual((0, 255, 0), ImageColor.getrgb(\"rgb(0,255,0)\"))\n        self.assertEqual((0, 0, 255), ImageColor.getrgb(\"rgb(0,0,255)\"))\n\n        # percents\n        self.assertEqual((255, 0, 0), ImageColor.getrgb(\"rgb(100%,0%,0%)\"))\n        self.assertEqual((0, 255, 0), ImageColor.getrgb(\"rgb(0%,100%,0%)\"))\n        self.assertEqual((0, 0, 255), ImageColor.getrgb(\"rgb(0%,0%,100%)\"))\n\n        # rgba numbers\n        self.assertEqual((255, 0, 0, 0), ImageColor.getrgb(\"rgba(255,0,0,0)\"))\n        self.assertEqual((0, 255, 0, 0), ImageColor.getrgb(\"rgba(0,255,0,0)\"))\n        self.assertEqual((0, 0, 255, 0), ImageColor.getrgb(\"rgba(0,0,255,0)\"))\n        self.assertEqual((0, 0, 0, 255), ImageColor.getrgb(\"rgba(0,0,0,255)\"))\n\n        self.assertEqual((255, 0, 0), ImageColor.getrgb(\"hsl(0,100%,50%)\"))\n        self.assertEqual((255, 0, 0), ImageColor.getrgb(\"hsl(360,100%,50%)\"))\n        self.assertEqual((0, 255, 255), ImageColor.getrgb(\"hsl(180,100%,50%)\"))\n\n        self.assertEqual((255, 0, 0), ImageColor.getrgb(\"hsv(0,100%,100%)\"))\n        self.assertEqual((255, 0, 0), ImageColor.getrgb(\"hsv(360,100%,100%)\"))\n        self.assertEqual((0, 255, 255), ImageColor.getrgb(\"hsv(180,100%,100%)\"))\n\n        # alternate format\n        self.assertEqual(ImageColor.getrgb(\"hsb(0,100%,50%)\"),\n                         ImageColor.getrgb(\"hsv(0,100%,50%)\"))\n\n        # floats\n        self.assertEqual((254, 3, 3), ImageColor.getrgb(\"hsl(0.1,99.2%,50.3%)\"))\n        self.assertEqual((255, 0, 0), ImageColor.getrgb(\"hsl(360.,100.0%,50%)\"))\n\n        self.assertEqual((253, 2, 2), ImageColor.getrgb(\"hsv(0.1,99.2%,99.3%)\"))\n        self.assertEqual((255, 0, 0), ImageColor.getrgb(\"hsv(360.,100.0%,100%)\"))\n\n        # case insensitivity\n        self.assertEqual(ImageColor.getrgb(\"RGB(255,0,0)\"),\n                         ImageColor.getrgb(\"rgb(255,0,0)\"))\n        self.assertEqual(ImageColor.getrgb(\"RGB(100%,0%,0%)\"),\n                         ImageColor.getrgb(\"rgb(100%,0%,0%)\"))\n        self.assertEqual(ImageColor.getrgb(\"RGBA(255,0,0,0)\"),\n                         ImageColor.getrgb(\"rgba(255,0,0,0)\"))\n        self.assertEqual(ImageColor.getrgb(\"HSL(0,100%,50%)\"),\n                         ImageColor.getrgb(\"hsl(0,100%,50%)\"))\n        self.assertEqual(ImageColor.getrgb(\"HSV(0,100%,50%)\"),\n                         ImageColor.getrgb(\"hsv(0,100%,50%)\"))\n        self.assertEqual(ImageColor.getrgb(\"HSB(0,100%,50%)\"),\n                         ImageColor.getrgb(\"hsb(0,100%,50%)\"))\n\n        # space agnosticism\n        self.assertEqual((255, 0, 0),\n                         ImageColor.getrgb(\"rgb(  255  ,  0  ,  0  )\"))\n        self.assertEqual((255, 0, 0),\n                         ImageColor.getrgb(\"rgb(  100%  ,  0%  ,  0%  )\"))\n        self.assertEqual((255, 0, 0, 0),\n                         ImageColor.getrgb(\"rgba(  255  ,  0  ,  0  ,  0  )\"))\n        self.assertEqual((255, 0, 0),\n                         ImageColor.getrgb(\"hsl(  0  ,  100%  ,  50%  )\"))\n        self.assertEqual((255, 0, 0),\n                         ImageColor.getrgb(\"hsv(  0  ,  100%  ,  100%  )\"))\n\n        # wrong number of components\n        self.assertRaises(ValueError, ImageColor.getrgb, \"rgb(255,0)\")\n        self.assertRaises(ValueError, ImageColor.getrgb, \"rgb(255,0,0,0)\")\n\n        self.assertRaises(ValueError, ImageColor.getrgb, \"rgb(100%,0%)\")\n        self.assertRaises(ValueError, ImageColor.getrgb, \"rgb(100%,0%,0)\")\n        self.assertRaises(ValueError, ImageColor.getrgb, \"rgb(100%,0%,0 %)\")\n        self.assertRaises(ValueError, ImageColor.getrgb, \"rgb(100%,0%,0%,0%)\")\n\n        self.assertRaises(ValueError, ImageColor.getrgb, \"rgba(255,0,0)\")\n        self.assertRaises(ValueError, ImageColor.getrgb, \"rgba(255,0,0,0,0)\")\n\n        self.assertRaises(ValueError, ImageColor.getrgb, \"hsl(0,100%)\")\n        self.assertRaises(ValueError, ImageColor.getrgb, \"hsl(0,100%,0%,0%)\")\n        self.assertRaises(ValueError, ImageColor.getrgb, \"hsl(0%,100%,50%)\")\n        self.assertRaises(ValueError, ImageColor.getrgb, \"hsl(0,100,50%)\")\n        self.assertRaises(ValueError, ImageColor.getrgb, \"hsl(0,100%,50)\")\n\n        self.assertRaises(ValueError, ImageColor.getrgb, \"hsv(0,100%)\")\n        self.assertRaises(ValueError, ImageColor.getrgb, \"hsv(0,100%,0%,0%)\")\n        self.assertRaises(ValueError, ImageColor.getrgb, \"hsv(0%,100%,50%)\")\n        self.assertRaises(ValueError, ImageColor.getrgb, \"hsv(0,100,50%)\")\n        self.assertRaises(ValueError, ImageColor.getrgb, \"hsv(0,100%,50)\")\n\n    # look for rounding errors (based on code by Tim Hatch)\n    def test_rounding_errors(self):\n\n        for color in ImageColor.colormap:\n            expected = Image.new(\n                \"RGB\", (1, 1), color).convert(\"L\").getpixel((0, 0))\n            actual = ImageColor.getcolor(color, 'L')\n            self.assertEqual(expected, actual)\n\n        self.assertEqual(\n            (0, 255, 115), ImageColor.getcolor(\"rgba(0, 255, 115, 33)\", \"RGB\"))\n        Image.new(\"RGB\", (1, 1), \"white\")\n\n        self.assertEqual((0, 0, 0, 255), ImageColor.getcolor(\"black\", \"RGBA\"))\n        self.assertEqual(\n            (255, 255, 255, 255), ImageColor.getcolor(\"white\", \"RGBA\"))\n        self.assertEqual(\n            (0, 255, 115, 33),\n            ImageColor.getcolor(\"rgba(0, 255, 115, 33)\", \"RGBA\"))\n        Image.new(\"RGBA\", (1, 1), \"white\")\n\n        self.assertEqual(0, ImageColor.getcolor(\"black\", \"L\"))\n        self.assertEqual(255, ImageColor.getcolor(\"white\", \"L\"))\n        self.assertEqual(162,\n                         ImageColor.getcolor(\"rgba(0, 255, 115, 33)\", \"L\"))\n        Image.new(\"L\", (1, 1), \"white\")\n\n        self.assertEqual(0, ImageColor.getcolor(\"black\", \"1\"))\n        self.assertEqual(255, ImageColor.getcolor(\"white\", \"1\"))\n        # The following test is wrong, but is current behavior\n        # The correct result should be 255 due to the mode 1\n        self.assertEqual(\n            162, ImageColor.getcolor(\"rgba(0, 255, 115, 33)\", \"1\"))\n        # Correct behavior\n        # self.assertEqual(\n        #     255, ImageColor.getcolor(\"rgba(0, 255, 115, 33)\", \"1\"))\n        Image.new(\"1\", (1, 1), \"white\")\n\n        self.assertEqual((0, 255), ImageColor.getcolor(\"black\", \"LA\"))\n        self.assertEqual((255, 255), ImageColor.getcolor(\"white\", \"LA\"))\n        self.assertEqual(\n            (162, 33), ImageColor.getcolor(\"rgba(0, 255, 115, 33)\", \"LA\"))\n        Image.new(\"LA\", (1, 1), \"white\")",
                            "ast_type_str": "ClassDef",
                            "start_lineno": 60,
                            "end_lineno": 144,
                            "parent": {
                                "file_name": "Tests/test_imagecolor.py",
                                "type": "class",
                                "name": "TestImageColor",
                                "content": "class TestImageColor(PillowTestCase):\n\n    def test_hash(self):\n        # short 3 components\n        self.assertEqual((255, 0, 0), ImageColor.getrgb(\"#f00\"))\n        self.assertEqual((0, 255, 0), ImageColor.getrgb(\"#0f0\"))\n        self.assertEqual((0, 0, 255), ImageColor.getrgb(\"#00f\"))\n\n        # short 4 components\n        self.assertEqual((255, 0, 0, 0), ImageColor.getrgb(\"#f000\"))\n        self.assertEqual((0, 255, 0, 0), ImageColor.getrgb(\"#0f00\"))\n        self.assertEqual((0, 0, 255, 0), ImageColor.getrgb(\"#00f0\"))\n        self.assertEqual((0, 0, 0, 255), ImageColor.getrgb(\"#000f\"))\n\n        # long 3 components\n        self.assertEqual((222, 0, 0), ImageColor.getrgb(\"#de0000\"))\n        self.assertEqual((0, 222, 0), ImageColor.getrgb(\"#00de00\"))\n        self.assertEqual((0, 0, 222), ImageColor.getrgb(\"#0000de\"))\n\n        # long 4 components\n        self.assertEqual((222, 0, 0, 0), ImageColor.getrgb(\"#de000000\"))\n        self.assertEqual((0, 222, 0, 0), ImageColor.getrgb(\"#00de0000\"))\n        self.assertEqual((0, 0, 222, 0), ImageColor.getrgb(\"#0000de00\"))\n        self.assertEqual((0, 0, 0, 222), ImageColor.getrgb(\"#000000de\"))\n\n        # case insensitivity\n        self.assertEqual(ImageColor.getrgb(\"#DEF\"), ImageColor.getrgb(\"#def\"))\n        self.assertEqual(ImageColor.getrgb(\"#CDEF\"), ImageColor.getrgb(\"#cdef\"))\n        self.assertEqual(ImageColor.getrgb(\"#DEFDEF\"),\n                         ImageColor.getrgb(\"#defdef\"))\n        self.assertEqual(ImageColor.getrgb(\"#CDEFCDEF\"),\n                         ImageColor.getrgb(\"#cdefcdef\"))\n\n        # not a number\n        self.assertRaises(ValueError, ImageColor.getrgb, \"#fo0\")\n        self.assertRaises(ValueError, ImageColor.getrgb, \"#fo00\")\n        self.assertRaises(ValueError, ImageColor.getrgb, \"#fo0000\")\n        self.assertRaises(ValueError, ImageColor.getrgb, \"#fo000000\")\n\n        # wrong number of components\n        self.assertRaises(ValueError, ImageColor.getrgb, \"#f0000\")\n        self.assertRaises(ValueError, ImageColor.getrgb, \"#f000000\")\n        self.assertRaises(ValueError, ImageColor.getrgb, \"#f00000000\")\n        self.assertRaises(ValueError, ImageColor.getrgb, \"#f000000000\")\n        self.assertRaises(ValueError, ImageColor.getrgb, \"#f00000 \")\n\n    def test_colormap(self):\n        self.assertEqual((0, 0, 0), ImageColor.getrgb(\"black\"))\n        self.assertEqual((255, 255, 255), ImageColor.getrgb(\"white\"))\n        self.assertEqual((255, 255, 255), ImageColor.getrgb(\"WHITE\"))\n\n        self.assertRaises(ValueError, ImageColor.getrgb, \"black \")\n\n    def test_functions(self):\n        # rgb numbers\n        self.assertEqual((255, 0, 0), ImageColor.getrgb(\"rgb(255,0,0)\"))\n        self.assertEqual((0, 255, 0), ImageColor.getrgb(\"rgb(0,255,0)\"))\n        self.assertEqual((0, 0, 255), ImageColor.getrgb(\"rgb(0,0,255)\"))\n\n        # percents\n        self.assertEqual((255, 0, 0), ImageColor.getrgb(\"rgb(100%,0%,0%)\"))\n        self.assertEqual((0, 255, 0), ImageColor.getrgb(\"rgb(0%,100%,0%)\"))\n        self.assertEqual((0, 0, 255), ImageColor.getrgb(\"rgb(0%,0%,100%)\"))\n\n        # rgba numbers\n        self.assertEqual((255, 0, 0, 0), ImageColor.getrgb(\"rgba(255,0,0,0)\"))\n        self.assertEqual((0, 255, 0, 0), ImageColor.getrgb(\"rgba(0,255,0,0)\"))\n        self.assertEqual((0, 0, 255, 0), ImageColor.getrgb(\"rgba(0,0,255,0)\"))\n        self.assertEqual((0, 0, 0, 255), ImageColor.getrgb(\"rgba(0,0,0,255)\"))\n\n        self.assertEqual((255, 0, 0), ImageColor.getrgb(\"hsl(0,100%,50%)\"))\n        self.assertEqual((255, 0, 0), ImageColor.getrgb(\"hsl(360,100%,50%)\"))\n        self.assertEqual((0, 255, 255), ImageColor.getrgb(\"hsl(180,100%,50%)\"))\n\n        self.assertEqual((255, 0, 0), ImageColor.getrgb(\"hsv(0,100%,100%)\"))\n        self.assertEqual((255, 0, 0), ImageColor.getrgb(\"hsv(360,100%,100%)\"))\n        self.assertEqual((0, 255, 255), ImageColor.getrgb(\"hsv(180,100%,100%)\"))\n\n        # alternate format\n        self.assertEqual(ImageColor.getrgb(\"hsb(0,100%,50%)\"),\n                         ImageColor.getrgb(\"hsv(0,100%,50%)\"))\n\n        # floats\n        self.assertEqual((254, 3, 3), ImageColor.getrgb(\"hsl(0.1,99.2%,50.3%)\"))\n        self.assertEqual((255, 0, 0), ImageColor.getrgb(\"hsl(360.,100.0%,50%)\"))\n\n        self.assertEqual((253, 2, 2), ImageColor.getrgb(\"hsv(0.1,99.2%,99.3%)\"))\n        self.assertEqual((255, 0, 0), ImageColor.getrgb(\"hsv(360.,100.0%,100%)\"))\n\n        # case insensitivity\n        self.assertEqual(ImageColor.getrgb(\"RGB(255,0,0)\"),\n                         ImageColor.getrgb(\"rgb(255,0,0)\"))\n        self.assertEqual(ImageColor.getrgb(\"RGB(100%,0%,0%)\"),\n                         ImageColor.getrgb(\"rgb(100%,0%,0%)\"))\n        self.assertEqual(ImageColor.getrgb(\"RGBA(255,0,0,0)\"),\n                         ImageColor.getrgb(\"rgba(255,0,0,0)\"))\n        self.assertEqual(ImageColor.getrgb(\"HSL(0,100%,50%)\"),\n                         ImageColor.getrgb(\"hsl(0,100%,50%)\"))\n        self.assertEqual(ImageColor.getrgb(\"HSV(0,100%,50%)\"),\n                         ImageColor.getrgb(\"hsv(0,100%,50%)\"))\n        self.assertEqual(ImageColor.getrgb(\"HSB(0,100%,50%)\"),\n                         ImageColor.getrgb(\"hsb(0,100%,50%)\"))\n\n        # space agnosticism\n        self.assertEqual((255, 0, 0),\n                         ImageColor.getrgb(\"rgb(  255  ,  0  ,  0  )\"))\n        self.assertEqual((255, 0, 0),\n                         ImageColor.getrgb(\"rgb(  100%  ,  0%  ,  0%  )\"))\n        self.assertEqual((255, 0, 0, 0),\n                         ImageColor.getrgb(\"rgba(  255  ,  0  ,  0  ,  0  )\"))\n        self.assertEqual((255, 0, 0),\n                         ImageColor.getrgb(\"hsl(  0  ,  100%  ,  50%  )\"))\n        self.assertEqual((255, 0, 0),\n                         ImageColor.getrgb(\"hsv(  0  ,  100%  ,  100%  )\"))\n\n        # wrong number of components\n        self.assertRaises(ValueError, ImageColor.getrgb, \"rgb(255,0)\")\n        self.assertRaises(ValueError, ImageColor.getrgb, \"rgb(255,0,0,0)\")\n\n        self.assertRaises(ValueError, ImageColor.getrgb, \"rgb(100%,0%)\")\n        self.assertRaises(ValueError, ImageColor.getrgb, \"rgb(100%,0%,0)\")\n        self.assertRaises(ValueError, ImageColor.getrgb, \"rgb(100%,0%,0 %)\")\n        self.assertRaises(ValueError, ImageColor.getrgb, \"rgb(100%,0%,0%,0%)\")\n\n        self.assertRaises(ValueError, ImageColor.getrgb, \"rgba(255,0,0)\")\n        self.assertRaises(ValueError, ImageColor.getrgb, \"rgba(255,0,0,0,0)\")\n\n        self.assertRaises(ValueError, ImageColor.getrgb, \"hsl(0,100%)\")\n        self.assertRaises(ValueError, ImageColor.getrgb, \"hsl(0,100%,0%,0%)\")\n        self.assertRaises(ValueError, ImageColor.getrgb, \"hsl(0%,100%,50%)\")\n        self.assertRaises(ValueError, ImageColor.getrgb, \"hsl(0,100,50%)\")\n        self.assertRaises(ValueError, ImageColor.getrgb, \"hsl(0,100%,50)\")\n\n        self.assertRaises(ValueError, ImageColor.getrgb, \"hsv(0,100%)\")\n        self.assertRaises(ValueError, ImageColor.getrgb, \"hsv(0,100%,0%,0%)\")\n        self.assertRaises(ValueError, ImageColor.getrgb, \"hsv(0%,100%,50%)\")\n        self.assertRaises(ValueError, ImageColor.getrgb, \"hsv(0,100,50%)\")\n        self.assertRaises(ValueError, ImageColor.getrgb, \"hsv(0,100%,50)\")\n\n    # look for rounding errors (based on code by Tim Hatch)\n    def test_rounding_errors(self):\n\n        for color in ImageColor.colormap:\n            expected = Image.new(\n                \"RGB\", (1, 1), color).convert(\"L\").getpixel((0, 0))\n            actual = ImageColor.getcolor(color, 'L')\n            self.assertEqual(expected, actual)\n\n        self.assertEqual(\n            (0, 255, 115), ImageColor.getcolor(\"rgba(0, 255, 115, 33)\", \"RGB\"))\n        Image.new(\"RGB\", (1, 1), \"white\")\n\n        self.assertEqual((0, 0, 0, 255), ImageColor.getcolor(\"black\", \"RGBA\"))\n        self.assertEqual(\n            (255, 255, 255, 255), ImageColor.getcolor(\"white\", \"RGBA\"))\n        self.assertEqual(\n            (0, 255, 115, 33),\n            ImageColor.getcolor(\"rgba(0, 255, 115, 33)\", \"RGBA\"))\n        Image.new(\"RGBA\", (1, 1), \"white\")\n\n        self.assertEqual(0, ImageColor.getcolor(\"black\", \"L\"))\n        self.assertEqual(255, ImageColor.getcolor(\"white\", \"L\"))\n        self.assertEqual(162,\n                         ImageColor.getcolor(\"rgba(0, 255, 115, 33)\", \"L\"))\n        Image.new(\"L\", (1, 1), \"white\")\n\n        self.assertEqual(0, ImageColor.getcolor(\"black\", \"1\"))\n        self.assertEqual(255, ImageColor.getcolor(\"white\", \"1\"))\n        # The following test is wrong, but is current behavior\n        # The correct result should be 255 due to the mode 1\n        self.assertEqual(\n            162, ImageColor.getcolor(\"rgba(0, 255, 115, 33)\", \"1\"))\n        # Correct behavior\n        # self.assertEqual(\n        #     255, ImageColor.getcolor(\"rgba(0, 255, 115, 33)\", \"1\"))\n        Image.new(\"1\", (1, 1), \"white\")\n\n        self.assertEqual((0, 255), ImageColor.getcolor(\"black\", \"LA\"))\n        self.assertEqual((255, 255), ImageColor.getcolor(\"white\", \"LA\"))\n        self.assertEqual(\n            (162, 33), ImageColor.getcolor(\"rgba(0, 255, 115, 33)\", \"LA\"))\n        Image.new(\"LA\", (1, 1), \"white\")",
                                "ast_type_str": "ClassDef",
                                "start_lineno": 7,
                                "end_lineno": 188,
                                "parent": null
                            }
                        }
                    ],
                    "added_entities": [],
                    "deleted_entities": []
                },
                {
                    "descriptor": {
                        "old_range": {
                            "start": 120,
                            "length": 6
                        },
                        "new_range": {
                            "start": 137,
                            "length": 12
                        },
                        "section": "class TestImageColor(PillowTestCase):"
                    },
                    "line_group": {
                        "all_lines": [
                            {
                                "content": "        self.assertRaises(ValueError, ImageColor.getrgb, \"hsl(0,100,50%)\")",
                                "type": "context"
                            },
                            {
                                "content": "        self.assertRaises(ValueError, ImageColor.getrgb, \"hsl(0,100%,50)\")",
                                "type": "context"
                            },
                            {
                                "content": "",
                                "type": "context"
                            },
                            {
                                "content": "        self.assertRaises(ValueError, ImageColor.getrgb, \"hsv(0,100%)\")",
                                "type": "added"
                            },
                            {
                                "content": "        self.assertRaises(ValueError, ImageColor.getrgb, \"hsv(0,100%,0%,0%)\")",
                                "type": "added"
                            },
                            {
                                "content": "        self.assertRaises(ValueError, ImageColor.getrgb, \"hsv(0%,100%,50%)\")",
                                "type": "added"
                            },
                            {
                                "content": "        self.assertRaises(ValueError, ImageColor.getrgb, \"hsv(0,100,50%)\")",
                                "type": "added"
                            },
                            {
                                "content": "        self.assertRaises(ValueError, ImageColor.getrgb, \"hsv(0,100%,50)\")",
                                "type": "added"
                            },
                            {
                                "content": "",
                                "type": "added"
                            },
                            {
                                "content": "    # look for rounding errors (based on code by Tim Hatch)",
                                "type": "context"
                            },
                            {
                                "content": "    def test_rounding_errors(self):",
                                "type": "context"
                            },
                            {
                                "content": "",
                                "type": "context"
                            }
                        ]
                    },
                    "modified_entities": [
                        {
                            "file_name": "Tests/test_imagecolor.py",
                            "type": "class",
                            "name": "TestImageColor",
                            "content": "class TestImageColor(PillowTestCase):\n\n    def test_hash(self):\n        # short 3 components\n        self.assertEqual((255, 0, 0), ImageColor.getrgb(\"#f00\"))\n        self.assertEqual((0, 255, 0), ImageColor.getrgb(\"#0f0\"))\n        self.assertEqual((0, 0, 255), ImageColor.getrgb(\"#00f\"))\n\n        # short 4 components\n        self.assertEqual((255, 0, 0, 0), ImageColor.getrgb(\"#f000\"))\n        self.assertEqual((0, 255, 0, 0), ImageColor.getrgb(\"#0f00\"))\n        self.assertEqual((0, 0, 255, 0), ImageColor.getrgb(\"#00f0\"))\n        self.assertEqual((0, 0, 0, 255), ImageColor.getrgb(\"#000f\"))\n\n        # long 3 components\n        self.assertEqual((222, 0, 0), ImageColor.getrgb(\"#de0000\"))\n        self.assertEqual((0, 222, 0), ImageColor.getrgb(\"#00de00\"))\n        self.assertEqual((0, 0, 222), ImageColor.getrgb(\"#0000de\"))\n\n        # long 4 components\n        self.assertEqual((222, 0, 0, 0), ImageColor.getrgb(\"#de000000\"))\n        self.assertEqual((0, 222, 0, 0), ImageColor.getrgb(\"#00de0000\"))\n        self.assertEqual((0, 0, 222, 0), ImageColor.getrgb(\"#0000de00\"))\n        self.assertEqual((0, 0, 0, 222), ImageColor.getrgb(\"#000000de\"))\n\n        # case insensitivity\n        self.assertEqual(ImageColor.getrgb(\"#DEF\"), ImageColor.getrgb(\"#def\"))\n        self.assertEqual(ImageColor.getrgb(\"#CDEF\"), ImageColor.getrgb(\"#cdef\"))\n        self.assertEqual(ImageColor.getrgb(\"#DEFDEF\"),\n                         ImageColor.getrgb(\"#defdef\"))\n        self.assertEqual(ImageColor.getrgb(\"#CDEFCDEF\"),\n                         ImageColor.getrgb(\"#cdefcdef\"))\n\n        # not a number\n        self.assertRaises(ValueError, ImageColor.getrgb, \"#fo0\")\n        self.assertRaises(ValueError, ImageColor.getrgb, \"#fo00\")\n        self.assertRaises(ValueError, ImageColor.getrgb, \"#fo0000\")\n        self.assertRaises(ValueError, ImageColor.getrgb, \"#fo000000\")\n\n        # wrong number of components\n        self.assertRaises(ValueError, ImageColor.getrgb, \"#f0000\")\n        self.assertRaises(ValueError, ImageColor.getrgb, \"#f000000\")\n        self.assertRaises(ValueError, ImageColor.getrgb, \"#f00000000\")\n        self.assertRaises(ValueError, ImageColor.getrgb, \"#f000000000\")\n        self.assertRaises(ValueError, ImageColor.getrgb, \"#f00000 \")\n\n    def test_colormap(self):\n        self.assertEqual((0, 0, 0), ImageColor.getrgb(\"black\"))\n        self.assertEqual((255, 255, 255), ImageColor.getrgb(\"white\"))\n        self.assertEqual((255, 255, 255), ImageColor.getrgb(\"WHITE\"))\n\n        self.assertRaises(ValueError, ImageColor.getrgb, \"black \")\n\n    def test_functions(self):\n        # rgb numbers\n        self.assertEqual((255, 0, 0), ImageColor.getrgb(\"rgb(255,0,0)\"))\n        self.assertEqual((0, 255, 0), ImageColor.getrgb(\"rgb(0,255,0)\"))\n        self.assertEqual((0, 0, 255), ImageColor.getrgb(\"rgb(0,0,255)\"))\n\n        # percents\n        self.assertEqual((255, 0, 0), ImageColor.getrgb(\"rgb(100%,0%,0%)\"))\n        self.assertEqual((0, 255, 0), ImageColor.getrgb(\"rgb(0%,100%,0%)\"))\n        self.assertEqual((0, 0, 255), ImageColor.getrgb(\"rgb(0%,0%,100%)\"))\n\n        # rgba numbers\n        self.assertEqual((255, 0, 0, 0), ImageColor.getrgb(\"rgba(255,0,0,0)\"))\n        self.assertEqual((0, 255, 0, 0), ImageColor.getrgb(\"rgba(0,255,0,0)\"))\n        self.assertEqual((0, 0, 255, 0), ImageColor.getrgb(\"rgba(0,0,255,0)\"))\n        self.assertEqual((0, 0, 0, 255), ImageColor.getrgb(\"rgba(0,0,0,255)\"))\n\n        self.assertEqual((255, 0, 0), ImageColor.getrgb(\"hsl(0,100%,50%)\"))\n        self.assertEqual((255, 0, 0), ImageColor.getrgb(\"hsl(360,100%,50%)\"))\n        self.assertEqual((0, 255, 255), ImageColor.getrgb(\"hsl(180,100%,50%)\"))\n\n        self.assertEqual((255, 0, 0), ImageColor.getrgb(\"hsv(0,100%,100%)\"))\n        self.assertEqual((255, 0, 0), ImageColor.getrgb(\"hsv(360,100%,100%)\"))\n        self.assertEqual((0, 255, 255), ImageColor.getrgb(\"hsv(180,100%,100%)\"))\n\n        # alternate format\n        self.assertEqual(ImageColor.getrgb(\"hsb(0,100%,50%)\"),\n                         ImageColor.getrgb(\"hsv(0,100%,50%)\"))\n\n        # floats\n        self.assertEqual((254, 3, 3), ImageColor.getrgb(\"hsl(0.1,99.2%,50.3%)\"))\n        self.assertEqual((255, 0, 0), ImageColor.getrgb(\"hsl(360.,100.0%,50%)\"))\n\n        self.assertEqual((253, 2, 2), ImageColor.getrgb(\"hsv(0.1,99.2%,99.3%)\"))\n        self.assertEqual((255, 0, 0), ImageColor.getrgb(\"hsv(360.,100.0%,100%)\"))\n\n        # case insensitivity\n        self.assertEqual(ImageColor.getrgb(\"RGB(255,0,0)\"),\n                         ImageColor.getrgb(\"rgb(255,0,0)\"))\n        self.assertEqual(ImageColor.getrgb(\"RGB(100%,0%,0%)\"),\n                         ImageColor.getrgb(\"rgb(100%,0%,0%)\"))\n        self.assertEqual(ImageColor.getrgb(\"RGBA(255,0,0,0)\"),\n                         ImageColor.getrgb(\"rgba(255,0,0,0)\"))\n        self.assertEqual(ImageColor.getrgb(\"HSL(0,100%,50%)\"),\n                         ImageColor.getrgb(\"hsl(0,100%,50%)\"))\n        self.assertEqual(ImageColor.getrgb(\"HSV(0,100%,50%)\"),\n                         ImageColor.getrgb(\"hsv(0,100%,50%)\"))\n        self.assertEqual(ImageColor.getrgb(\"HSB(0,100%,50%)\"),\n                         ImageColor.getrgb(\"hsb(0,100%,50%)\"))\n\n        # space agnosticism\n        self.assertEqual((255, 0, 0),\n                         ImageColor.getrgb(\"rgb(  255  ,  0  ,  0  )\"))\n        self.assertEqual((255, 0, 0),\n                         ImageColor.getrgb(\"rgb(  100%  ,  0%  ,  0%  )\"))\n        self.assertEqual((255, 0, 0, 0),\n                         ImageColor.getrgb(\"rgba(  255  ,  0  ,  0  ,  0  )\"))\n        self.assertEqual((255, 0, 0),\n                         ImageColor.getrgb(\"hsl(  0  ,  100%  ,  50%  )\"))\n        self.assertEqual((255, 0, 0),\n                         ImageColor.getrgb(\"hsv(  0  ,  100%  ,  100%  )\"))\n\n        # wrong number of components\n        self.assertRaises(ValueError, ImageColor.getrgb, \"rgb(255,0)\")\n        self.assertRaises(ValueError, ImageColor.getrgb, \"rgb(255,0,0,0)\")\n\n        self.assertRaises(ValueError, ImageColor.getrgb, \"rgb(100%,0%)\")\n        self.assertRaises(ValueError, ImageColor.getrgb, \"rgb(100%,0%,0)\")\n        self.assertRaises(ValueError, ImageColor.getrgb, \"rgb(100%,0%,0 %)\")\n        self.assertRaises(ValueError, ImageColor.getrgb, \"rgb(100%,0%,0%,0%)\")\n\n        self.assertRaises(ValueError, ImageColor.getrgb, \"rgba(255,0,0)\")\n        self.assertRaises(ValueError, ImageColor.getrgb, \"rgba(255,0,0,0,0)\")\n\n        self.assertRaises(ValueError, ImageColor.getrgb, \"hsl(0,100%)\")\n        self.assertRaises(ValueError, ImageColor.getrgb, \"hsl(0,100%,0%,0%)\")\n        self.assertRaises(ValueError, ImageColor.getrgb, \"hsl(0%,100%,50%)\")\n        self.assertRaises(ValueError, ImageColor.getrgb, \"hsl(0,100,50%)\")\n        self.assertRaises(ValueError, ImageColor.getrgb, \"hsl(0,100%,50)\")\n\n        self.assertRaises(ValueError, ImageColor.getrgb, \"hsv(0,100%)\")\n        self.assertRaises(ValueError, ImageColor.getrgb, \"hsv(0,100%,0%,0%)\")\n        self.assertRaises(ValueError, ImageColor.getrgb, \"hsv(0%,100%,50%)\")\n        self.assertRaises(ValueError, ImageColor.getrgb, \"hsv(0,100,50%)\")\n        self.assertRaises(ValueError, ImageColor.getrgb, \"hsv(0,100%,50)\")\n\n    # look for rounding errors (based on code by Tim Hatch)\n    def test_rounding_errors(self):\n\n        for color in ImageColor.colormap:\n            expected = Image.new(\n                \"RGB\", (1, 1), color).convert(\"L\").getpixel((0, 0))\n            actual = ImageColor.getcolor(color, 'L')\n            self.assertEqual(expected, actual)\n\n        self.assertEqual(\n            (0, 255, 115), ImageColor.getcolor(\"rgba(0, 255, 115, 33)\", \"RGB\"))\n        Image.new(\"RGB\", (1, 1), \"white\")\n\n        self.assertEqual((0, 0, 0, 255), ImageColor.getcolor(\"black\", \"RGBA\"))\n        self.assertEqual(\n            (255, 255, 255, 255), ImageColor.getcolor(\"white\", \"RGBA\"))\n        self.assertEqual(\n            (0, 255, 115, 33),\n            ImageColor.getcolor(\"rgba(0, 255, 115, 33)\", \"RGBA\"))\n        Image.new(\"RGBA\", (1, 1), \"white\")\n\n        self.assertEqual(0, ImageColor.getcolor(\"black\", \"L\"))\n        self.assertEqual(255, ImageColor.getcolor(\"white\", \"L\"))\n        self.assertEqual(162,\n                         ImageColor.getcolor(\"rgba(0, 255, 115, 33)\", \"L\"))\n        Image.new(\"L\", (1, 1), \"white\")\n\n        self.assertEqual(0, ImageColor.getcolor(\"black\", \"1\"))\n        self.assertEqual(255, ImageColor.getcolor(\"white\", \"1\"))\n        # The following test is wrong, but is current behavior\n        # The correct result should be 255 due to the mode 1\n        self.assertEqual(\n            162, ImageColor.getcolor(\"rgba(0, 255, 115, 33)\", \"1\"))\n        # Correct behavior\n        # self.assertEqual(\n        #     255, ImageColor.getcolor(\"rgba(0, 255, 115, 33)\", \"1\"))\n        Image.new(\"1\", (1, 1), \"white\")\n\n        self.assertEqual((0, 255), ImageColor.getcolor(\"black\", \"LA\"))\n        self.assertEqual((255, 255), ImageColor.getcolor(\"white\", \"LA\"))\n        self.assertEqual(\n            (162, 33), ImageColor.getcolor(\"rgba(0, 255, 115, 33)\", \"LA\"))\n        Image.new(\"LA\", (1, 1), \"white\")",
                            "ast_type_str": "ClassDef",
                            "start_lineno": 7,
                            "end_lineno": 188,
                            "parent": null
                        },
                        {
                            "file_name": "Tests/test_imagecolor.py",
                            "type": "method",
                            "name": "TestImageColor.test_functions",
                            "content": "class TestImageColor(PillowTestCase):\n\n    def test_hash(self):\n        # short 3 components\n        self.assertEqual((255, 0, 0), ImageColor.getrgb(\"#f00\"))\n        self.assertEqual((0, 255, 0), ImageColor.getrgb(\"#0f0\"))\n        self.assertEqual((0, 0, 255), ImageColor.getrgb(\"#00f\"))\n\n        # short 4 components\n        self.assertEqual((255, 0, 0, 0), ImageColor.getrgb(\"#f000\"))\n        self.assertEqual((0, 255, 0, 0), ImageColor.getrgb(\"#0f00\"))\n        self.assertEqual((0, 0, 255, 0), ImageColor.getrgb(\"#00f0\"))\n        self.assertEqual((0, 0, 0, 255), ImageColor.getrgb(\"#000f\"))\n\n        # long 3 components\n        self.assertEqual((222, 0, 0), ImageColor.getrgb(\"#de0000\"))\n        self.assertEqual((0, 222, 0), ImageColor.getrgb(\"#00de00\"))\n        self.assertEqual((0, 0, 222), ImageColor.getrgb(\"#0000de\"))\n\n        # long 4 components\n        self.assertEqual((222, 0, 0, 0), ImageColor.getrgb(\"#de000000\"))\n        self.assertEqual((0, 222, 0, 0), ImageColor.getrgb(\"#00de0000\"))\n        self.assertEqual((0, 0, 222, 0), ImageColor.getrgb(\"#0000de00\"))\n        self.assertEqual((0, 0, 0, 222), ImageColor.getrgb(\"#000000de\"))\n\n        # case insensitivity\n        self.assertEqual(ImageColor.getrgb(\"#DEF\"), ImageColor.getrgb(\"#def\"))\n        self.assertEqual(ImageColor.getrgb(\"#CDEF\"), ImageColor.getrgb(\"#cdef\"))\n        self.assertEqual(ImageColor.getrgb(\"#DEFDEF\"),\n                         ImageColor.getrgb(\"#defdef\"))\n        self.assertEqual(ImageColor.getrgb(\"#CDEFCDEF\"),\n                         ImageColor.getrgb(\"#cdefcdef\"))\n\n        # not a number\n        self.assertRaises(ValueError, ImageColor.getrgb, \"#fo0\")\n        self.assertRaises(ValueError, ImageColor.getrgb, \"#fo00\")\n        self.assertRaises(ValueError, ImageColor.getrgb, \"#fo0000\")\n        self.assertRaises(ValueError, ImageColor.getrgb, \"#fo000000\")\n\n        # wrong number of components\n        self.assertRaises(ValueError, ImageColor.getrgb, \"#f0000\")\n        self.assertRaises(ValueError, ImageColor.getrgb, \"#f000000\")\n        self.assertRaises(ValueError, ImageColor.getrgb, \"#f00000000\")\n        self.assertRaises(ValueError, ImageColor.getrgb, \"#f000000000\")\n        self.assertRaises(ValueError, ImageColor.getrgb, \"#f00000 \")\n\n    def test_colormap(self):\n        self.assertEqual((0, 0, 0), ImageColor.getrgb(\"black\"))\n        self.assertEqual((255, 255, 255), ImageColor.getrgb(\"white\"))\n        self.assertEqual((255, 255, 255), ImageColor.getrgb(\"WHITE\"))\n\n        self.assertRaises(ValueError, ImageColor.getrgb, \"black \")\n\n    def test_functions(self):\n        # rgb numbers\n        self.assertEqual((255, 0, 0), ImageColor.getrgb(\"rgb(255,0,0)\"))\n        self.assertEqual((0, 255, 0), ImageColor.getrgb(\"rgb(0,255,0)\"))\n        self.assertEqual((0, 0, 255), ImageColor.getrgb(\"rgb(0,0,255)\"))\n\n        # percents\n        self.assertEqual((255, 0, 0), ImageColor.getrgb(\"rgb(100%,0%,0%)\"))\n        self.assertEqual((0, 255, 0), ImageColor.getrgb(\"rgb(0%,100%,0%)\"))\n        self.assertEqual((0, 0, 255), ImageColor.getrgb(\"rgb(0%,0%,100%)\"))\n\n        # rgba numbers\n        self.assertEqual((255, 0, 0, 0), ImageColor.getrgb(\"rgba(255,0,0,0)\"))\n        self.assertEqual((0, 255, 0, 0), ImageColor.getrgb(\"rgba(0,255,0,0)\"))\n        self.assertEqual((0, 0, 255, 0), ImageColor.getrgb(\"rgba(0,0,255,0)\"))\n        self.assertEqual((0, 0, 0, 255), ImageColor.getrgb(\"rgba(0,0,0,255)\"))\n\n        self.assertEqual((255, 0, 0), ImageColor.getrgb(\"hsl(0,100%,50%)\"))\n        self.assertEqual((255, 0, 0), ImageColor.getrgb(\"hsl(360,100%,50%)\"))\n        self.assertEqual((0, 255, 255), ImageColor.getrgb(\"hsl(180,100%,50%)\"))\n\n        self.assertEqual((255, 0, 0), ImageColor.getrgb(\"hsv(0,100%,100%)\"))\n        self.assertEqual((255, 0, 0), ImageColor.getrgb(\"hsv(360,100%,100%)\"))\n        self.assertEqual((0, 255, 255), ImageColor.getrgb(\"hsv(180,100%,100%)\"))\n\n        # alternate format\n        self.assertEqual(ImageColor.getrgb(\"hsb(0,100%,50%)\"),\n                         ImageColor.getrgb(\"hsv(0,100%,50%)\"))\n\n        # floats\n        self.assertEqual((254, 3, 3), ImageColor.getrgb(\"hsl(0.1,99.2%,50.3%)\"))\n        self.assertEqual((255, 0, 0), ImageColor.getrgb(\"hsl(360.,100.0%,50%)\"))\n\n        self.assertEqual((253, 2, 2), ImageColor.getrgb(\"hsv(0.1,99.2%,99.3%)\"))\n        self.assertEqual((255, 0, 0), ImageColor.getrgb(\"hsv(360.,100.0%,100%)\"))\n\n        # case insensitivity\n        self.assertEqual(ImageColor.getrgb(\"RGB(255,0,0)\"),\n                         ImageColor.getrgb(\"rgb(255,0,0)\"))\n        self.assertEqual(ImageColor.getrgb(\"RGB(100%,0%,0%)\"),\n                         ImageColor.getrgb(\"rgb(100%,0%,0%)\"))\n        self.assertEqual(ImageColor.getrgb(\"RGBA(255,0,0,0)\"),\n                         ImageColor.getrgb(\"rgba(255,0,0,0)\"))\n        self.assertEqual(ImageColor.getrgb(\"HSL(0,100%,50%)\"),\n                         ImageColor.getrgb(\"hsl(0,100%,50%)\"))\n        self.assertEqual(ImageColor.getrgb(\"HSV(0,100%,50%)\"),\n                         ImageColor.getrgb(\"hsv(0,100%,50%)\"))\n        self.assertEqual(ImageColor.getrgb(\"HSB(0,100%,50%)\"),\n                         ImageColor.getrgb(\"hsb(0,100%,50%)\"))\n\n        # space agnosticism\n        self.assertEqual((255, 0, 0),\n                         ImageColor.getrgb(\"rgb(  255  ,  0  ,  0  )\"))\n        self.assertEqual((255, 0, 0),\n                         ImageColor.getrgb(\"rgb(  100%  ,  0%  ,  0%  )\"))\n        self.assertEqual((255, 0, 0, 0),\n                         ImageColor.getrgb(\"rgba(  255  ,  0  ,  0  ,  0  )\"))\n        self.assertEqual((255, 0, 0),\n                         ImageColor.getrgb(\"hsl(  0  ,  100%  ,  50%  )\"))\n        self.assertEqual((255, 0, 0),\n                         ImageColor.getrgb(\"hsv(  0  ,  100%  ,  100%  )\"))\n\n        # wrong number of components\n        self.assertRaises(ValueError, ImageColor.getrgb, \"rgb(255,0)\")\n        self.assertRaises(ValueError, ImageColor.getrgb, \"rgb(255,0,0,0)\")\n\n        self.assertRaises(ValueError, ImageColor.getrgb, \"rgb(100%,0%)\")\n        self.assertRaises(ValueError, ImageColor.getrgb, \"rgb(100%,0%,0)\")\n        self.assertRaises(ValueError, ImageColor.getrgb, \"rgb(100%,0%,0 %)\")\n        self.assertRaises(ValueError, ImageColor.getrgb, \"rgb(100%,0%,0%,0%)\")\n\n        self.assertRaises(ValueError, ImageColor.getrgb, \"rgba(255,0,0)\")\n        self.assertRaises(ValueError, ImageColor.getrgb, \"rgba(255,0,0,0,0)\")\n\n        self.assertRaises(ValueError, ImageColor.getrgb, \"hsl(0,100%)\")\n        self.assertRaises(ValueError, ImageColor.getrgb, \"hsl(0,100%,0%,0%)\")\n        self.assertRaises(ValueError, ImageColor.getrgb, \"hsl(0%,100%,50%)\")\n        self.assertRaises(ValueError, ImageColor.getrgb, \"hsl(0,100,50%)\")\n        self.assertRaises(ValueError, ImageColor.getrgb, \"hsl(0,100%,50)\")\n\n        self.assertRaises(ValueError, ImageColor.getrgb, \"hsv(0,100%)\")\n        self.assertRaises(ValueError, ImageColor.getrgb, \"hsv(0,100%,0%,0%)\")\n        self.assertRaises(ValueError, ImageColor.getrgb, \"hsv(0%,100%,50%)\")\n        self.assertRaises(ValueError, ImageColor.getrgb, \"hsv(0,100,50%)\")\n        self.assertRaises(ValueError, ImageColor.getrgb, \"hsv(0,100%,50)\")\n\n    # look for rounding errors (based on code by Tim Hatch)\n    def test_rounding_errors(self):\n\n        for color in ImageColor.colormap:\n            expected = Image.new(\n                \"RGB\", (1, 1), color).convert(\"L\").getpixel((0, 0))\n            actual = ImageColor.getcolor(color, 'L')\n            self.assertEqual(expected, actual)\n\n        self.assertEqual(\n            (0, 255, 115), ImageColor.getcolor(\"rgba(0, 255, 115, 33)\", \"RGB\"))\n        Image.new(\"RGB\", (1, 1), \"white\")\n\n        self.assertEqual((0, 0, 0, 255), ImageColor.getcolor(\"black\", \"RGBA\"))\n        self.assertEqual(\n            (255, 255, 255, 255), ImageColor.getcolor(\"white\", \"RGBA\"))\n        self.assertEqual(\n            (0, 255, 115, 33),\n            ImageColor.getcolor(\"rgba(0, 255, 115, 33)\", \"RGBA\"))\n        Image.new(\"RGBA\", (1, 1), \"white\")\n\n        self.assertEqual(0, ImageColor.getcolor(\"black\", \"L\"))\n        self.assertEqual(255, ImageColor.getcolor(\"white\", \"L\"))\n        self.assertEqual(162,\n                         ImageColor.getcolor(\"rgba(0, 255, 115, 33)\", \"L\"))\n        Image.new(\"L\", (1, 1), \"white\")\n\n        self.assertEqual(0, ImageColor.getcolor(\"black\", \"1\"))\n        self.assertEqual(255, ImageColor.getcolor(\"white\", \"1\"))\n        # The following test is wrong, but is current behavior\n        # The correct result should be 255 due to the mode 1\n        self.assertEqual(\n            162, ImageColor.getcolor(\"rgba(0, 255, 115, 33)\", \"1\"))\n        # Correct behavior\n        # self.assertEqual(\n        #     255, ImageColor.getcolor(\"rgba(0, 255, 115, 33)\", \"1\"))\n        Image.new(\"1\", (1, 1), \"white\")\n\n        self.assertEqual((0, 255), ImageColor.getcolor(\"black\", \"LA\"))\n        self.assertEqual((255, 255), ImageColor.getcolor(\"white\", \"LA\"))\n        self.assertEqual(\n            (162, 33), ImageColor.getcolor(\"rgba(0, 255, 115, 33)\", \"LA\"))\n        Image.new(\"LA\", (1, 1), \"white\")",
                            "ast_type_str": "ClassDef",
                            "start_lineno": 60,
                            "end_lineno": 144,
                            "parent": {
                                "file_name": "Tests/test_imagecolor.py",
                                "type": "class",
                                "name": "TestImageColor",
                                "content": "class TestImageColor(PillowTestCase):\n\n    def test_hash(self):\n        # short 3 components\n        self.assertEqual((255, 0, 0), ImageColor.getrgb(\"#f00\"))\n        self.assertEqual((0, 255, 0), ImageColor.getrgb(\"#0f0\"))\n        self.assertEqual((0, 0, 255), ImageColor.getrgb(\"#00f\"))\n\n        # short 4 components\n        self.assertEqual((255, 0, 0, 0), ImageColor.getrgb(\"#f000\"))\n        self.assertEqual((0, 255, 0, 0), ImageColor.getrgb(\"#0f00\"))\n        self.assertEqual((0, 0, 255, 0), ImageColor.getrgb(\"#00f0\"))\n        self.assertEqual((0, 0, 0, 255), ImageColor.getrgb(\"#000f\"))\n\n        # long 3 components\n        self.assertEqual((222, 0, 0), ImageColor.getrgb(\"#de0000\"))\n        self.assertEqual((0, 222, 0), ImageColor.getrgb(\"#00de00\"))\n        self.assertEqual((0, 0, 222), ImageColor.getrgb(\"#0000de\"))\n\n        # long 4 components\n        self.assertEqual((222, 0, 0, 0), ImageColor.getrgb(\"#de000000\"))\n        self.assertEqual((0, 222, 0, 0), ImageColor.getrgb(\"#00de0000\"))\n        self.assertEqual((0, 0, 222, 0), ImageColor.getrgb(\"#0000de00\"))\n        self.assertEqual((0, 0, 0, 222), ImageColor.getrgb(\"#000000de\"))\n\n        # case insensitivity\n        self.assertEqual(ImageColor.getrgb(\"#DEF\"), ImageColor.getrgb(\"#def\"))\n        self.assertEqual(ImageColor.getrgb(\"#CDEF\"), ImageColor.getrgb(\"#cdef\"))\n        self.assertEqual(ImageColor.getrgb(\"#DEFDEF\"),\n                         ImageColor.getrgb(\"#defdef\"))\n        self.assertEqual(ImageColor.getrgb(\"#CDEFCDEF\"),\n                         ImageColor.getrgb(\"#cdefcdef\"))\n\n        # not a number\n        self.assertRaises(ValueError, ImageColor.getrgb, \"#fo0\")\n        self.assertRaises(ValueError, ImageColor.getrgb, \"#fo00\")\n        self.assertRaises(ValueError, ImageColor.getrgb, \"#fo0000\")\n        self.assertRaises(ValueError, ImageColor.getrgb, \"#fo000000\")\n\n        # wrong number of components\n        self.assertRaises(ValueError, ImageColor.getrgb, \"#f0000\")\n        self.assertRaises(ValueError, ImageColor.getrgb, \"#f000000\")\n        self.assertRaises(ValueError, ImageColor.getrgb, \"#f00000000\")\n        self.assertRaises(ValueError, ImageColor.getrgb, \"#f000000000\")\n        self.assertRaises(ValueError, ImageColor.getrgb, \"#f00000 \")\n\n    def test_colormap(self):\n        self.assertEqual((0, 0, 0), ImageColor.getrgb(\"black\"))\n        self.assertEqual((255, 255, 255), ImageColor.getrgb(\"white\"))\n        self.assertEqual((255, 255, 255), ImageColor.getrgb(\"WHITE\"))\n\n        self.assertRaises(ValueError, ImageColor.getrgb, \"black \")\n\n    def test_functions(self):\n        # rgb numbers\n        self.assertEqual((255, 0, 0), ImageColor.getrgb(\"rgb(255,0,0)\"))\n        self.assertEqual((0, 255, 0), ImageColor.getrgb(\"rgb(0,255,0)\"))\n        self.assertEqual((0, 0, 255), ImageColor.getrgb(\"rgb(0,0,255)\"))\n\n        # percents\n        self.assertEqual((255, 0, 0), ImageColor.getrgb(\"rgb(100%,0%,0%)\"))\n        self.assertEqual((0, 255, 0), ImageColor.getrgb(\"rgb(0%,100%,0%)\"))\n        self.assertEqual((0, 0, 255), ImageColor.getrgb(\"rgb(0%,0%,100%)\"))\n\n        # rgba numbers\n        self.assertEqual((255, 0, 0, 0), ImageColor.getrgb(\"rgba(255,0,0,0)\"))\n        self.assertEqual((0, 255, 0, 0), ImageColor.getrgb(\"rgba(0,255,0,0)\"))\n        self.assertEqual((0, 0, 255, 0), ImageColor.getrgb(\"rgba(0,0,255,0)\"))\n        self.assertEqual((0, 0, 0, 255), ImageColor.getrgb(\"rgba(0,0,0,255)\"))\n\n        self.assertEqual((255, 0, 0), ImageColor.getrgb(\"hsl(0,100%,50%)\"))\n        self.assertEqual((255, 0, 0), ImageColor.getrgb(\"hsl(360,100%,50%)\"))\n        self.assertEqual((0, 255, 255), ImageColor.getrgb(\"hsl(180,100%,50%)\"))\n\n        self.assertEqual((255, 0, 0), ImageColor.getrgb(\"hsv(0,100%,100%)\"))\n        self.assertEqual((255, 0, 0), ImageColor.getrgb(\"hsv(360,100%,100%)\"))\n        self.assertEqual((0, 255, 255), ImageColor.getrgb(\"hsv(180,100%,100%)\"))\n\n        # alternate format\n        self.assertEqual(ImageColor.getrgb(\"hsb(0,100%,50%)\"),\n                         ImageColor.getrgb(\"hsv(0,100%,50%)\"))\n\n        # floats\n        self.assertEqual((254, 3, 3), ImageColor.getrgb(\"hsl(0.1,99.2%,50.3%)\"))\n        self.assertEqual((255, 0, 0), ImageColor.getrgb(\"hsl(360.,100.0%,50%)\"))\n\n        self.assertEqual((253, 2, 2), ImageColor.getrgb(\"hsv(0.1,99.2%,99.3%)\"))\n        self.assertEqual((255, 0, 0), ImageColor.getrgb(\"hsv(360.,100.0%,100%)\"))\n\n        # case insensitivity\n        self.assertEqual(ImageColor.getrgb(\"RGB(255,0,0)\"),\n                         ImageColor.getrgb(\"rgb(255,0,0)\"))\n        self.assertEqual(ImageColor.getrgb(\"RGB(100%,0%,0%)\"),\n                         ImageColor.getrgb(\"rgb(100%,0%,0%)\"))\n        self.assertEqual(ImageColor.getrgb(\"RGBA(255,0,0,0)\"),\n                         ImageColor.getrgb(\"rgba(255,0,0,0)\"))\n        self.assertEqual(ImageColor.getrgb(\"HSL(0,100%,50%)\"),\n                         ImageColor.getrgb(\"hsl(0,100%,50%)\"))\n        self.assertEqual(ImageColor.getrgb(\"HSV(0,100%,50%)\"),\n                         ImageColor.getrgb(\"hsv(0,100%,50%)\"))\n        self.assertEqual(ImageColor.getrgb(\"HSB(0,100%,50%)\"),\n                         ImageColor.getrgb(\"hsb(0,100%,50%)\"))\n\n        # space agnosticism\n        self.assertEqual((255, 0, 0),\n                         ImageColor.getrgb(\"rgb(  255  ,  0  ,  0  )\"))\n        self.assertEqual((255, 0, 0),\n                         ImageColor.getrgb(\"rgb(  100%  ,  0%  ,  0%  )\"))\n        self.assertEqual((255, 0, 0, 0),\n                         ImageColor.getrgb(\"rgba(  255  ,  0  ,  0  ,  0  )\"))\n        self.assertEqual((255, 0, 0),\n                         ImageColor.getrgb(\"hsl(  0  ,  100%  ,  50%  )\"))\n        self.assertEqual((255, 0, 0),\n                         ImageColor.getrgb(\"hsv(  0  ,  100%  ,  100%  )\"))\n\n        # wrong number of components\n        self.assertRaises(ValueError, ImageColor.getrgb, \"rgb(255,0)\")\n        self.assertRaises(ValueError, ImageColor.getrgb, \"rgb(255,0,0,0)\")\n\n        self.assertRaises(ValueError, ImageColor.getrgb, \"rgb(100%,0%)\")\n        self.assertRaises(ValueError, ImageColor.getrgb, \"rgb(100%,0%,0)\")\n        self.assertRaises(ValueError, ImageColor.getrgb, \"rgb(100%,0%,0 %)\")\n        self.assertRaises(ValueError, ImageColor.getrgb, \"rgb(100%,0%,0%,0%)\")\n\n        self.assertRaises(ValueError, ImageColor.getrgb, \"rgba(255,0,0)\")\n        self.assertRaises(ValueError, ImageColor.getrgb, \"rgba(255,0,0,0,0)\")\n\n        self.assertRaises(ValueError, ImageColor.getrgb, \"hsl(0,100%)\")\n        self.assertRaises(ValueError, ImageColor.getrgb, \"hsl(0,100%,0%,0%)\")\n        self.assertRaises(ValueError, ImageColor.getrgb, \"hsl(0%,100%,50%)\")\n        self.assertRaises(ValueError, ImageColor.getrgb, \"hsl(0,100,50%)\")\n        self.assertRaises(ValueError, ImageColor.getrgb, \"hsl(0,100%,50)\")\n\n        self.assertRaises(ValueError, ImageColor.getrgb, \"hsv(0,100%)\")\n        self.assertRaises(ValueError, ImageColor.getrgb, \"hsv(0,100%,0%,0%)\")\n        self.assertRaises(ValueError, ImageColor.getrgb, \"hsv(0%,100%,50%)\")\n        self.assertRaises(ValueError, ImageColor.getrgb, \"hsv(0,100,50%)\")\n        self.assertRaises(ValueError, ImageColor.getrgb, \"hsv(0,100%,50)\")\n\n    # look for rounding errors (based on code by Tim Hatch)\n    def test_rounding_errors(self):\n\n        for color in ImageColor.colormap:\n            expected = Image.new(\n                \"RGB\", (1, 1), color).convert(\"L\").getpixel((0, 0))\n            actual = ImageColor.getcolor(color, 'L')\n            self.assertEqual(expected, actual)\n\n        self.assertEqual(\n            (0, 255, 115), ImageColor.getcolor(\"rgba(0, 255, 115, 33)\", \"RGB\"))\n        Image.new(\"RGB\", (1, 1), \"white\")\n\n        self.assertEqual((0, 0, 0, 255), ImageColor.getcolor(\"black\", \"RGBA\"))\n        self.assertEqual(\n            (255, 255, 255, 255), ImageColor.getcolor(\"white\", \"RGBA\"))\n        self.assertEqual(\n            (0, 255, 115, 33),\n            ImageColor.getcolor(\"rgba(0, 255, 115, 33)\", \"RGBA\"))\n        Image.new(\"RGBA\", (1, 1), \"white\")\n\n        self.assertEqual(0, ImageColor.getcolor(\"black\", \"L\"))\n        self.assertEqual(255, ImageColor.getcolor(\"white\", \"L\"))\n        self.assertEqual(162,\n                         ImageColor.getcolor(\"rgba(0, 255, 115, 33)\", \"L\"))\n        Image.new(\"L\", (1, 1), \"white\")\n\n        self.assertEqual(0, ImageColor.getcolor(\"black\", \"1\"))\n        self.assertEqual(255, ImageColor.getcolor(\"white\", \"1\"))\n        # The following test is wrong, but is current behavior\n        # The correct result should be 255 due to the mode 1\n        self.assertEqual(\n            162, ImageColor.getcolor(\"rgba(0, 255, 115, 33)\", \"1\"))\n        # Correct behavior\n        # self.assertEqual(\n        #     255, ImageColor.getcolor(\"rgba(0, 255, 115, 33)\", \"1\"))\n        Image.new(\"1\", (1, 1), \"white\")\n\n        self.assertEqual((0, 255), ImageColor.getcolor(\"black\", \"LA\"))\n        self.assertEqual((255, 255), ImageColor.getcolor(\"white\", \"LA\"))\n        self.assertEqual(\n            (162, 33), ImageColor.getcolor(\"rgba(0, 255, 115, 33)\", \"LA\"))\n        Image.new(\"LA\", (1, 1), \"white\")",
                                "ast_type_str": "ClassDef",
                                "start_lineno": 7,
                                "end_lineno": 188,
                                "parent": null
                            }
                        }
                    ],
                    "added_entities": [],
                    "deleted_entities": []
                }
            ]
        },
        {
            "old_file_content": ".. py:module:: PIL.ImageColor\n.. py:currentmodule:: PIL.ImageColor\n\n:py:mod:`ImageColor` Module\n===========================\n\nThe :py:mod:`ImageColor` module contains color tables and converters from\nCSS3-style color specifiers to RGB tuples. This module is used by\n:py:meth:`PIL.Image.new` and the :py:mod:`~PIL.ImageDraw` module, among\nothers.\n\n.. _color-names:\n\nColor Names\n-----------\n\nThe ImageColor module supports the following string formats:\n\n* Hexadecimal color specifiers, given as ``#rgb`` or ``#rrggbb``. For example,\n  ``#ff0000`` specifies pure red.\n\n* RGB functions, given as ``rgb(red, green, blue)`` where the color values are\n  integers in the range 0 to 255. Alternatively, the color values can be given\n  as three percentages (0% to 100%). For example, ``rgb(255,0,0)`` and\n  ``rgb(100%,0%,0%)`` both specify pure red.\n\n* Hue-Saturation-Lightness (HSL) functions, given as ``hsl(hue, saturation%,\n  lightness%)`` where hue is the color given as an angle between 0 and 360\n  (red=0, green=120, blue=240), saturation is a value between 0% and 100%\n  (gray=0%, full color=100%), and lightness is a value between 0% and 100%\n  (black=0%, normal=50%, white=100%). For example, ``hsl(0,100%,50%)`` is pure\n  red.\n\n* Common HTML color names. The :py:mod:`~PIL.ImageColor` module provides some\n  140 standard color names, based on the colors supported by the X Window\n  system and most web browsers. color names are case insensitive. For example,\n  ``red`` and ``Red`` both specify pure red.\n\nFunctions\n---------\n\n.. py:method:: getrgb(color)\n\n    Convert a color string to an RGB tuple. If the string cannot be parsed,\n    this function raises a :py:exc:`ValueError` exception.\n\n    .. versionadded:: 1.1.4\n\n.. py:method:: getcolor(color, mode)\n\n    Same as :py:func:`~PIL.ImageColor.getrgb`, but converts the RGB value to a\n    greyscale value if the mode is not color or a palette image. If the string\n    cannot be parsed, this function raises a :py:exc:`ValueError` exception.\n\n    .. versionadded:: 1.1.4\n",
            "new_file_content": ".. py:module:: PIL.ImageColor\n.. py:currentmodule:: PIL.ImageColor\n\n:py:mod:`ImageColor` Module\n===========================\n\nThe :py:mod:`ImageColor` module contains color tables and converters from\nCSS3-style color specifiers to RGB tuples. This module is used by\n:py:meth:`PIL.Image.new` and the :py:mod:`~PIL.ImageDraw` module, among\nothers.\n\n.. _color-names:\n\nColor Names\n-----------\n\nThe ImageColor module supports the following string formats:\n\n* Hexadecimal color specifiers, given as ``#rgb`` or ``#rrggbb``. For example,\n  ``#ff0000`` specifies pure red.\n\n* RGB functions, given as ``rgb(red, green, blue)`` where the color values are\n  integers in the range 0 to 255. Alternatively, the color values can be given\n  as three percentages (0% to 100%). For example, ``rgb(255,0,0)`` and\n  ``rgb(100%,0%,0%)`` both specify pure red.\n\n* Hue-Saturation-Lightness (HSL) functions, given as ``hsl(hue, saturation%,\n  lightness%)`` where hue is the color given as an angle between 0 and 360\n  (red=0, green=120, blue=240), saturation is a value between 0% and 100%\n  (gray=0%, full color=100%), and lightness is a value between 0% and 100%\n  (black=0%, normal=50%, white=100%). For example, ``hsl(0,100%,50%)`` is pure\n  red.\n\n* Hue-Saturation-Value (HSV) functions, given as ``hsv(hue, saturation%,\n  value%)`` where hue and saturation are the same as HSL, and value is between\n  0% and 100% (black=0%, normal=100%). For example, ``hsv(0,100%,100%)`` is\n  pure red. This format is also known as Hue-Saturation-Brightness (HSB), and\n  can be given as ``hsb(hue, saturation%, brightness%)``, where each of the\n  values are used as they are in HSV.\n\n* Common HTML color names. The :py:mod:`~PIL.ImageColor` module provides some\n  140 standard color names, based on the colors supported by the X Window\n  system and most web browsers. color names are case insensitive. For example,\n  ``red`` and ``Red`` both specify pure red.\n\nFunctions\n---------\n\n.. py:method:: getrgb(color)\n\n    Convert a color string to an RGB tuple. If the string cannot be parsed,\n    this function raises a :py:exc:`ValueError` exception.\n\n    .. versionadded:: 1.1.4\n\n.. py:method:: getcolor(color, mode)\n\n    Same as :py:func:`~PIL.ImageColor.getrgb`, but converts the RGB value to a\n    greyscale value if the mode is not color or a palette image. If the string\n    cannot be parsed, this function raises a :py:exc:`ValueError` exception.\n\n    .. versionadded:: 1.1.4\n",
            "header": {
                "file": {
                    "path": "docs/reference/ImageColor.rst"
                },
                "misc_line": null
            },
            "index_line": {
                "old_commit_hash": "f3e6a6f90",
                "new_commit_hash": "187306f1b",
                "mode": "100644"
            },
            "is_binary_file": false,
            "binary_line": null,
            "minus_file": {
                "path": "a/docs/reference/ImageColor.rst"
            },
            "plus_file": {
                "path": "b/docs/reference/ImageColor.rst"
            },
            "hunks": [
                {
                    "descriptor": {
                        "old_range": {
                            "start": 31,
                            "length": 6
                        },
                        "new_range": {
                            "start": 31,
                            "length": 13
                        },
                        "section": "The ImageColor module supports the following string formats:"
                    },
                    "line_group": {
                        "all_lines": [
                            {
                                "content": "  (black=0%, normal=50%, white=100%). For example, ``hsl(0,100%,50%)`` is pure",
                                "type": "context"
                            },
                            {
                                "content": "  red.",
                                "type": "context"
                            },
                            {
                                "content": "",
                                "type": "context"
                            },
                            {
                                "content": "* Hue-Saturation-Value (HSV) functions, given as ``hsv(hue, saturation%,",
                                "type": "added"
                            },
                            {
                                "content": "  value%)`` where hue and saturation are the same as HSL, and value is between",
                                "type": "added"
                            },
                            {
                                "content": "  0% and 100% (black=0%, normal=100%). For example, ``hsv(0,100%,100%)`` is",
                                "type": "added"
                            },
                            {
                                "content": "  pure red. This format is also known as Hue-Saturation-Brightness (HSB), and",
                                "type": "added"
                            },
                            {
                                "content": "  can be given as ``hsb(hue, saturation%, brightness%)``, where each of the",
                                "type": "added"
                            },
                            {
                                "content": "  values are used as they are in HSV.",
                                "type": "added"
                            },
                            {
                                "content": "",
                                "type": "added"
                            },
                            {
                                "content": "* Common HTML color names. The :py:mod:`~PIL.ImageColor` module provides some",
                                "type": "context"
                            },
                            {
                                "content": "  140 standard color names, based on the colors supported by the X Window",
                                "type": "context"
                            },
                            {
                                "content": "  system and most web browsers. color names are case insensitive. For example,",
                                "type": "context"
                            }
                        ]
                    },
                    "modified_entities": [],
                    "added_entities": [],
                    "deleted_entities": []
                }
            ]
        },
        {
            "old_file_content": "#\n# The Python Imaging Library\n# $Id$\n#\n# map CSS3-style colour description strings to RGB\n#\n# History:\n# 2002-10-24 fl   Added support for CSS-style color strings\n# 2002-12-15 fl   Added RGBA support\n# 2004-03-27 fl   Fixed remaining int() problems for Python 1.5.2\n# 2004-07-19 fl   Fixed gray/grey spelling issues\n# 2009-03-05 fl   Fixed rounding error in grayscale calculation\n#\n# Copyright (c) 2002-2004 by Secret Labs AB\n# Copyright (c) 2002-2004 by Fredrik Lundh\n#\n# See the README file for information on usage and redistribution.\n#\n\nfrom . import Image\nimport re\n\n\ndef getrgb(color):\n    \"\"\"\n     Convert a color string to an RGB tuple. If the string cannot be parsed,\n     this function raises a :py:exc:`ValueError` exception.\n\n    .. versionadded:: 1.1.4\n\n    :param color: A color string\n    :return: ``(red, green, blue[, alpha])``\n    \"\"\"\n    color = color.lower()\n\n    rgb = colormap.get(color, None)\n    if rgb:\n        if isinstance(rgb, tuple):\n            return rgb\n        colormap[color] = rgb = getrgb(rgb)\n        return rgb\n\n    # check for known string formats\n    if re.match('#[a-f0-9]{3}$', color):\n        return (\n            int(color[1]*2, 16),\n            int(color[2]*2, 16),\n            int(color[3]*2, 16),\n            )\n\n    if re.match('#[a-f0-9]{4}$', color):\n        return (\n            int(color[1]*2, 16),\n            int(color[2]*2, 16),\n            int(color[3]*2, 16),\n            int(color[4]*2, 16),\n            )\n\n    if re.match('#[a-f0-9]{6}$', color):\n        return (\n            int(color[1:3], 16),\n            int(color[3:5], 16),\n            int(color[5:7], 16),\n            )\n\n    if re.match('#[a-f0-9]{8}$', color):\n        return (\n            int(color[1:3], 16),\n            int(color[3:5], 16),\n            int(color[5:7], 16),\n            int(color[7:9], 16),\n            )\n\n    m = re.match(r\"rgb\\(\\s*(\\d+)\\s*,\\s*(\\d+)\\s*,\\s*(\\d+)\\s*\\)$\", color)\n    if m:\n        return (\n            int(m.group(1)),\n            int(m.group(2)),\n            int(m.group(3))\n            )\n\n    m = re.match(r\"rgb\\(\\s*(\\d+)%\\s*,\\s*(\\d+)%\\s*,\\s*(\\d+)%\\s*\\)$\", color)\n    if m:\n        return (\n            int((int(m.group(1)) * 255) / 100.0 + 0.5),\n            int((int(m.group(2)) * 255) / 100.0 + 0.5),\n            int((int(m.group(3)) * 255) / 100.0 + 0.5)\n            )\n\n    m = re.match(r\"hsl\\(\\s*(\\d+\\.?\\d*)\\s*,\\s*(\\d+\\.?\\d*)%\\s*,\\s*(\\d+\\.?\\d*)%\\s*\\)$\", color)\n    if m:\n        from colorsys import hls_to_rgb\n        rgb = hls_to_rgb(\n            float(m.group(1)) / 360.0,\n            float(m.group(3)) / 100.0,\n            float(m.group(2)) / 100.0,\n            )\n        return (\n            int(rgb[0] * 255 + 0.5),\n            int(rgb[1] * 255 + 0.5),\n            int(rgb[2] * 255 + 0.5)\n            )\n\n    m = re.match(r\"rgba\\(\\s*(\\d+)\\s*,\\s*(\\d+)\\s*,\\s*(\\d+)\\s*,\\s*(\\d+)\\s*\\)$\",\n                 color)\n    if m:\n        return (\n            int(m.group(1)),\n            int(m.group(2)),\n            int(m.group(3)),\n            int(m.group(4))\n            )\n    raise ValueError(\"unknown color specifier: %r\" % color)\n\n\ndef getcolor(color, mode):\n    \"\"\"\n    Same as :py:func:`~PIL.ImageColor.getrgb`, but converts the RGB value to a\n    greyscale value if the mode is not color or a palette image. If the string\n    cannot be parsed, this function raises a :py:exc:`ValueError` exception.\n\n    .. versionadded:: 1.1.4\n\n    :param color: A color string\n    :return: ``(graylevel [, alpha]) or (red, green, blue[, alpha])``\n    \"\"\"\n    # same as getrgb, but converts the result to the given mode\n    color, alpha = getrgb(color), 255\n    if len(color) == 4:\n        color, alpha = color[0:3], color[3]\n\n    if Image.getmodebase(mode) == \"L\":\n        r, g, b = color\n        color = (r*299 + g*587 + b*114)//1000\n        if mode[-1] == 'A':\n            return (color, alpha)\n    else:\n        if mode[-1] == 'A':\n            return color + (alpha,)\n    return color\n\n\ncolormap = {\n    # X11 colour table from https://drafts.csswg.org/css-color-4/, with\n    # gray/grey spelling issues fixed.  This is a superset of HTML 4.0\n    # colour names used in CSS 1.\n    \"aliceblue\": \"#f0f8ff\",\n    \"antiquewhite\": \"#faebd7\",\n    \"aqua\": \"#00ffff\",\n    \"aquamarine\": \"#7fffd4\",\n    \"azure\": \"#f0ffff\",\n    \"beige\": \"#f5f5dc\",\n    \"bisque\": \"#ffe4c4\",\n    \"black\": \"#000000\",\n    \"blanchedalmond\": \"#ffebcd\",\n    \"blue\": \"#0000ff\",\n    \"blueviolet\": \"#8a2be2\",\n    \"brown\": \"#a52a2a\",\n    \"burlywood\": \"#deb887\",\n    \"cadetblue\": \"#5f9ea0\",\n    \"chartreuse\": \"#7fff00\",\n    \"chocolate\": \"#d2691e\",\n    \"coral\": \"#ff7f50\",\n    \"cornflowerblue\": \"#6495ed\",\n    \"cornsilk\": \"#fff8dc\",\n    \"crimson\": \"#dc143c\",\n    \"cyan\": \"#00ffff\",\n    \"darkblue\": \"#00008b\",\n    \"darkcyan\": \"#008b8b\",\n    \"darkgoldenrod\": \"#b8860b\",\n    \"darkgray\": \"#a9a9a9\",\n    \"darkgrey\": \"#a9a9a9\",\n    \"darkgreen\": \"#006400\",\n    \"darkkhaki\": \"#bdb76b\",\n    \"darkmagenta\": \"#8b008b\",\n    \"darkolivegreen\": \"#556b2f\",\n    \"darkorange\": \"#ff8c00\",\n    \"darkorchid\": \"#9932cc\",\n    \"darkred\": \"#8b0000\",\n    \"darksalmon\": \"#e9967a\",\n    \"darkseagreen\": \"#8fbc8f\",\n    \"darkslateblue\": \"#483d8b\",\n    \"darkslategray\": \"#2f4f4f\",\n    \"darkslategrey\": \"#2f4f4f\",\n    \"darkturquoise\": \"#00ced1\",\n    \"darkviolet\": \"#9400d3\",\n    \"deeppink\": \"#ff1493\",\n    \"deepskyblue\": \"#00bfff\",\n    \"dimgray\": \"#696969\",\n    \"dimgrey\": \"#696969\",\n    \"dodgerblue\": \"#1e90ff\",\n    \"firebrick\": \"#b22222\",\n    \"floralwhite\": \"#fffaf0\",\n    \"forestgreen\": \"#228b22\",\n    \"fuchsia\": \"#ff00ff\",\n    \"gainsboro\": \"#dcdcdc\",\n    \"ghostwhite\": \"#f8f8ff\",\n    \"gold\": \"#ffd700\",\n    \"goldenrod\": \"#daa520\",\n    \"gray\": \"#808080\",\n    \"grey\": \"#808080\",\n    \"green\": \"#008000\",\n    \"greenyellow\": \"#adff2f\",\n    \"honeydew\": \"#f0fff0\",\n    \"hotpink\": \"#ff69b4\",\n    \"indianred\": \"#cd5c5c\",\n    \"indigo\": \"#4b0082\",\n    \"ivory\": \"#fffff0\",\n    \"khaki\": \"#f0e68c\",\n    \"lavender\": \"#e6e6fa\",\n    \"lavenderblush\": \"#fff0f5\",\n    \"lawngreen\": \"#7cfc00\",\n    \"lemonchiffon\": \"#fffacd\",\n    \"lightblue\": \"#add8e6\",\n    \"lightcoral\": \"#f08080\",\n    \"lightcyan\": \"#e0ffff\",\n    \"lightgoldenrodyellow\": \"#fafad2\",\n    \"lightgreen\": \"#90ee90\",\n    \"lightgray\": \"#d3d3d3\",\n    \"lightgrey\": \"#d3d3d3\",\n    \"lightpink\": \"#ffb6c1\",\n    \"lightsalmon\": \"#ffa07a\",\n    \"lightseagreen\": \"#20b2aa\",\n    \"lightskyblue\": \"#87cefa\",\n    \"lightslategray\": \"#778899\",\n    \"lightslategrey\": \"#778899\",\n    \"lightsteelblue\": \"#b0c4de\",\n    \"lightyellow\": \"#ffffe0\",\n    \"lime\": \"#00ff00\",\n    \"limegreen\": \"#32cd32\",\n    \"linen\": \"#faf0e6\",\n    \"magenta\": \"#ff00ff\",\n    \"maroon\": \"#800000\",\n    \"mediumaquamarine\": \"#66cdaa\",\n    \"mediumblue\": \"#0000cd\",\n    \"mediumorchid\": \"#ba55d3\",\n    \"mediumpurple\": \"#9370db\",\n    \"mediumseagreen\": \"#3cb371\",\n    \"mediumslateblue\": \"#7b68ee\",\n    \"mediumspringgreen\": \"#00fa9a\",\n    \"mediumturquoise\": \"#48d1cc\",\n    \"mediumvioletred\": \"#c71585\",\n    \"midnightblue\": \"#191970\",\n    \"mintcream\": \"#f5fffa\",\n    \"mistyrose\": \"#ffe4e1\",\n    \"moccasin\": \"#ffe4b5\",\n    \"navajowhite\": \"#ffdead\",\n    \"navy\": \"#000080\",\n    \"oldlace\": \"#fdf5e6\",\n    \"olive\": \"#808000\",\n    \"olivedrab\": \"#6b8e23\",\n    \"orange\": \"#ffa500\",\n    \"orangered\": \"#ff4500\",\n    \"orchid\": \"#da70d6\",\n    \"palegoldenrod\": \"#eee8aa\",\n    \"palegreen\": \"#98fb98\",\n    \"paleturquoise\": \"#afeeee\",\n    \"palevioletred\": \"#db7093\",\n    \"papayawhip\": \"#ffefd5\",\n    \"peachpuff\": \"#ffdab9\",\n    \"peru\": \"#cd853f\",\n    \"pink\": \"#ffc0cb\",\n    \"plum\": \"#dda0dd\",\n    \"powderblue\": \"#b0e0e6\",\n    \"purple\": \"#800080\",\n    \"rebeccapurple\": \"#663399\",\n    \"red\": \"#ff0000\",\n    \"rosybrown\": \"#bc8f8f\",\n    \"royalblue\": \"#4169e1\",\n    \"saddlebrown\": \"#8b4513\",\n    \"salmon\": \"#fa8072\",\n    \"sandybrown\": \"#f4a460\",\n    \"seagreen\": \"#2e8b57\",\n    \"seashell\": \"#fff5ee\",\n    \"sienna\": \"#a0522d\",\n    \"silver\": \"#c0c0c0\",\n    \"skyblue\": \"#87ceeb\",\n    \"slateblue\": \"#6a5acd\",\n    \"slategray\": \"#708090\",\n    \"slategrey\": \"#708090\",\n    \"snow\": \"#fffafa\",\n    \"springgreen\": \"#00ff7f\",\n    \"steelblue\": \"#4682b4\",\n    \"tan\": \"#d2b48c\",\n    \"teal\": \"#008080\",\n    \"thistle\": \"#d8bfd8\",\n    \"tomato\": \"#ff6347\",\n    \"turquoise\": \"#40e0d0\",\n    \"violet\": \"#ee82ee\",\n    \"wheat\": \"#f5deb3\",\n    \"white\": \"#ffffff\",\n    \"whitesmoke\": \"#f5f5f5\",\n    \"yellow\": \"#ffff00\",\n    \"yellowgreen\": \"#9acd32\",\n}\n",
            "new_file_content": "#\n# The Python Imaging Library\n# $Id$\n#\n# map CSS3-style colour description strings to RGB\n#\n# History:\n# 2002-10-24 fl   Added support for CSS-style color strings\n# 2002-12-15 fl   Added RGBA support\n# 2004-03-27 fl   Fixed remaining int() problems for Python 1.5.2\n# 2004-07-19 fl   Fixed gray/grey spelling issues\n# 2009-03-05 fl   Fixed rounding error in grayscale calculation\n#\n# Copyright (c) 2002-2004 by Secret Labs AB\n# Copyright (c) 2002-2004 by Fredrik Lundh\n#\n# See the README file for information on usage and redistribution.\n#\n\nfrom . import Image\nimport re\n\n\ndef getrgb(color):\n    \"\"\"\n     Convert a color string to an RGB tuple. If the string cannot be parsed,\n     this function raises a :py:exc:`ValueError` exception.\n\n    .. versionadded:: 1.1.4\n\n    :param color: A color string\n    :return: ``(red, green, blue[, alpha])``\n    \"\"\"\n    color = color.lower()\n\n    rgb = colormap.get(color, None)\n    if rgb:\n        if isinstance(rgb, tuple):\n            return rgb\n        colormap[color] = rgb = getrgb(rgb)\n        return rgb\n\n    # check for known string formats\n    if re.match('#[a-f0-9]{3}$', color):\n        return (\n            int(color[1]*2, 16),\n            int(color[2]*2, 16),\n            int(color[3]*2, 16),\n            )\n\n    if re.match('#[a-f0-9]{4}$', color):\n        return (\n            int(color[1]*2, 16),\n            int(color[2]*2, 16),\n            int(color[3]*2, 16),\n            int(color[4]*2, 16),\n            )\n\n    if re.match('#[a-f0-9]{6}$', color):\n        return (\n            int(color[1:3], 16),\n            int(color[3:5], 16),\n            int(color[5:7], 16),\n            )\n\n    if re.match('#[a-f0-9]{8}$', color):\n        return (\n            int(color[1:3], 16),\n            int(color[3:5], 16),\n            int(color[5:7], 16),\n            int(color[7:9], 16),\n            )\n\n    m = re.match(r\"rgb\\(\\s*(\\d+)\\s*,\\s*(\\d+)\\s*,\\s*(\\d+)\\s*\\)$\", color)\n    if m:\n        return (\n            int(m.group(1)),\n            int(m.group(2)),\n            int(m.group(3))\n            )\n\n    m = re.match(r\"rgb\\(\\s*(\\d+)%\\s*,\\s*(\\d+)%\\s*,\\s*(\\d+)%\\s*\\)$\", color)\n    if m:\n        return (\n            int((int(m.group(1)) * 255) / 100.0 + 0.5),\n            int((int(m.group(2)) * 255) / 100.0 + 0.5),\n            int((int(m.group(3)) * 255) / 100.0 + 0.5)\n            )\n\n    m = re.match(r\"hsl\\(\\s*(\\d+\\.?\\d*)\\s*,\\s*(\\d+\\.?\\d*)%\\s*,\\s*(\\d+\\.?\\d*)%\\s*\\)$\", color)\n    if m:\n        from colorsys import hls_to_rgb\n        rgb = hls_to_rgb(\n            float(m.group(1)) / 360.0,\n            float(m.group(3)) / 100.0,\n            float(m.group(2)) / 100.0,\n            )\n        return (\n            int(rgb[0] * 255 + 0.5),\n            int(rgb[1] * 255 + 0.5),\n            int(rgb[2] * 255 + 0.5)\n            )\n\n    m = re.match(r\"hs[bv]\\(\\s*(\\d+\\.?\\d*)\\s*,\\s*(\\d+\\.?\\d*)%\\s*,\\s*(\\d+\\.?\\d*)%\\s*\\)$\", color)\n    if m:\n        from colorsys import hsv_to_rgb\n        rgb = hsv_to_rgb(\n            float(m.group(1)) / 360.0,\n            float(m.group(2)) / 100.0,\n            float(m.group(3)) / 100.0,\n            )\n        return (\n            int(rgb[0] * 255 + 0.5),\n            int(rgb[1] * 255 + 0.5),\n            int(rgb[2] * 255 + 0.5)\n            )\n\n    m = re.match(r\"rgba\\(\\s*(\\d+)\\s*,\\s*(\\d+)\\s*,\\s*(\\d+)\\s*,\\s*(\\d+)\\s*\\)$\",\n                 color)\n    if m:\n        return (\n            int(m.group(1)),\n            int(m.group(2)),\n            int(m.group(3)),\n            int(m.group(4))\n            )\n    raise ValueError(\"unknown color specifier: %r\" % color)\n\n\ndef getcolor(color, mode):\n    \"\"\"\n    Same as :py:func:`~PIL.ImageColor.getrgb`, but converts the RGB value to a\n    greyscale value if the mode is not color or a palette image. If the string\n    cannot be parsed, this function raises a :py:exc:`ValueError` exception.\n\n    .. versionadded:: 1.1.4\n\n    :param color: A color string\n    :return: ``(graylevel [, alpha]) or (red, green, blue[, alpha])``\n    \"\"\"\n    # same as getrgb, but converts the result to the given mode\n    color, alpha = getrgb(color), 255\n    if len(color) == 4:\n        color, alpha = color[0:3], color[3]\n\n    if Image.getmodebase(mode) == \"L\":\n        r, g, b = color\n        color = (r*299 + g*587 + b*114)//1000\n        if mode[-1] == 'A':\n            return (color, alpha)\n    else:\n        if mode[-1] == 'A':\n            return color + (alpha,)\n    return color\n\n\ncolormap = {\n    # X11 colour table from https://drafts.csswg.org/css-color-4/, with\n    # gray/grey spelling issues fixed.  This is a superset of HTML 4.0\n    # colour names used in CSS 1.\n    \"aliceblue\": \"#f0f8ff\",\n    \"antiquewhite\": \"#faebd7\",\n    \"aqua\": \"#00ffff\",\n    \"aquamarine\": \"#7fffd4\",\n    \"azure\": \"#f0ffff\",\n    \"beige\": \"#f5f5dc\",\n    \"bisque\": \"#ffe4c4\",\n    \"black\": \"#000000\",\n    \"blanchedalmond\": \"#ffebcd\",\n    \"blue\": \"#0000ff\",\n    \"blueviolet\": \"#8a2be2\",\n    \"brown\": \"#a52a2a\",\n    \"burlywood\": \"#deb887\",\n    \"cadetblue\": \"#5f9ea0\",\n    \"chartreuse\": \"#7fff00\",\n    \"chocolate\": \"#d2691e\",\n    \"coral\": \"#ff7f50\",\n    \"cornflowerblue\": \"#6495ed\",\n    \"cornsilk\": \"#fff8dc\",\n    \"crimson\": \"#dc143c\",\n    \"cyan\": \"#00ffff\",\n    \"darkblue\": \"#00008b\",\n    \"darkcyan\": \"#008b8b\",\n    \"darkgoldenrod\": \"#b8860b\",\n    \"darkgray\": \"#a9a9a9\",\n    \"darkgrey\": \"#a9a9a9\",\n    \"darkgreen\": \"#006400\",\n    \"darkkhaki\": \"#bdb76b\",\n    \"darkmagenta\": \"#8b008b\",\n    \"darkolivegreen\": \"#556b2f\",\n    \"darkorange\": \"#ff8c00\",\n    \"darkorchid\": \"#9932cc\",\n    \"darkred\": \"#8b0000\",\n    \"darksalmon\": \"#e9967a\",\n    \"darkseagreen\": \"#8fbc8f\",\n    \"darkslateblue\": \"#483d8b\",\n    \"darkslategray\": \"#2f4f4f\",\n    \"darkslategrey\": \"#2f4f4f\",\n    \"darkturquoise\": \"#00ced1\",\n    \"darkviolet\": \"#9400d3\",\n    \"deeppink\": \"#ff1493\",\n    \"deepskyblue\": \"#00bfff\",\n    \"dimgray\": \"#696969\",\n    \"dimgrey\": \"#696969\",\n    \"dodgerblue\": \"#1e90ff\",\n    \"firebrick\": \"#b22222\",\n    \"floralwhite\": \"#fffaf0\",\n    \"forestgreen\": \"#228b22\",\n    \"fuchsia\": \"#ff00ff\",\n    \"gainsboro\": \"#dcdcdc\",\n    \"ghostwhite\": \"#f8f8ff\",\n    \"gold\": \"#ffd700\",\n    \"goldenrod\": \"#daa520\",\n    \"gray\": \"#808080\",\n    \"grey\": \"#808080\",\n    \"green\": \"#008000\",\n    \"greenyellow\": \"#adff2f\",\n    \"honeydew\": \"#f0fff0\",\n    \"hotpink\": \"#ff69b4\",\n    \"indianred\": \"#cd5c5c\",\n    \"indigo\": \"#4b0082\",\n    \"ivory\": \"#fffff0\",\n    \"khaki\": \"#f0e68c\",\n    \"lavender\": \"#e6e6fa\",\n    \"lavenderblush\": \"#fff0f5\",\n    \"lawngreen\": \"#7cfc00\",\n    \"lemonchiffon\": \"#fffacd\",\n    \"lightblue\": \"#add8e6\",\n    \"lightcoral\": \"#f08080\",\n    \"lightcyan\": \"#e0ffff\",\n    \"lightgoldenrodyellow\": \"#fafad2\",\n    \"lightgreen\": \"#90ee90\",\n    \"lightgray\": \"#d3d3d3\",\n    \"lightgrey\": \"#d3d3d3\",\n    \"lightpink\": \"#ffb6c1\",\n    \"lightsalmon\": \"#ffa07a\",\n    \"lightseagreen\": \"#20b2aa\",\n    \"lightskyblue\": \"#87cefa\",\n    \"lightslategray\": \"#778899\",\n    \"lightslategrey\": \"#778899\",\n    \"lightsteelblue\": \"#b0c4de\",\n    \"lightyellow\": \"#ffffe0\",\n    \"lime\": \"#00ff00\",\n    \"limegreen\": \"#32cd32\",\n    \"linen\": \"#faf0e6\",\n    \"magenta\": \"#ff00ff\",\n    \"maroon\": \"#800000\",\n    \"mediumaquamarine\": \"#66cdaa\",\n    \"mediumblue\": \"#0000cd\",\n    \"mediumorchid\": \"#ba55d3\",\n    \"mediumpurple\": \"#9370db\",\n    \"mediumseagreen\": \"#3cb371\",\n    \"mediumslateblue\": \"#7b68ee\",\n    \"mediumspringgreen\": \"#00fa9a\",\n    \"mediumturquoise\": \"#48d1cc\",\n    \"mediumvioletred\": \"#c71585\",\n    \"midnightblue\": \"#191970\",\n    \"mintcream\": \"#f5fffa\",\n    \"mistyrose\": \"#ffe4e1\",\n    \"moccasin\": \"#ffe4b5\",\n    \"navajowhite\": \"#ffdead\",\n    \"navy\": \"#000080\",\n    \"oldlace\": \"#fdf5e6\",\n    \"olive\": \"#808000\",\n    \"olivedrab\": \"#6b8e23\",\n    \"orange\": \"#ffa500\",\n    \"orangered\": \"#ff4500\",\n    \"orchid\": \"#da70d6\",\n    \"palegoldenrod\": \"#eee8aa\",\n    \"palegreen\": \"#98fb98\",\n    \"paleturquoise\": \"#afeeee\",\n    \"palevioletred\": \"#db7093\",\n    \"papayawhip\": \"#ffefd5\",\n    \"peachpuff\": \"#ffdab9\",\n    \"peru\": \"#cd853f\",\n    \"pink\": \"#ffc0cb\",\n    \"plum\": \"#dda0dd\",\n    \"powderblue\": \"#b0e0e6\",\n    \"purple\": \"#800080\",\n    \"rebeccapurple\": \"#663399\",\n    \"red\": \"#ff0000\",\n    \"rosybrown\": \"#bc8f8f\",\n    \"royalblue\": \"#4169e1\",\n    \"saddlebrown\": \"#8b4513\",\n    \"salmon\": \"#fa8072\",\n    \"sandybrown\": \"#f4a460\",\n    \"seagreen\": \"#2e8b57\",\n    \"seashell\": \"#fff5ee\",\n    \"sienna\": \"#a0522d\",\n    \"silver\": \"#c0c0c0\",\n    \"skyblue\": \"#87ceeb\",\n    \"slateblue\": \"#6a5acd\",\n    \"slategray\": \"#708090\",\n    \"slategrey\": \"#708090\",\n    \"snow\": \"#fffafa\",\n    \"springgreen\": \"#00ff7f\",\n    \"steelblue\": \"#4682b4\",\n    \"tan\": \"#d2b48c\",\n    \"teal\": \"#008080\",\n    \"thistle\": \"#d8bfd8\",\n    \"tomato\": \"#ff6347\",\n    \"turquoise\": \"#40e0d0\",\n    \"violet\": \"#ee82ee\",\n    \"wheat\": \"#f5deb3\",\n    \"white\": \"#ffffff\",\n    \"whitesmoke\": \"#f5f5f5\",\n    \"yellow\": \"#ffff00\",\n    \"yellowgreen\": \"#9acd32\",\n}\n",
            "header": {
                "file": {
                    "path": "src/PIL/ImageColor.py"
                },
                "misc_line": null
            },
            "index_line": {
                "old_commit_hash": "0e9702228",
                "new_commit_hash": "08c00fd54",
                "mode": "100644"
            },
            "is_binary_file": false,
            "binary_line": null,
            "minus_file": {
                "path": "a/src/PIL/ImageColor.py"
            },
            "plus_file": {
                "path": "b/src/PIL/ImageColor.py"
            },
            "hunks": [
                {
                    "descriptor": {
                        "old_range": {
                            "start": 101,
                            "length": 6
                        },
                        "new_range": {
                            "start": 101,
                            "length": 20
                        },
                        "section": "def getrgb(color):"
                    },
                    "line_group": {
                        "all_lines": [
                            {
                                "content": "            int(rgb[2] * 255 + 0.5)",
                                "type": "context"
                            },
                            {
                                "content": "            )",
                                "type": "context"
                            },
                            {
                                "content": "",
                                "type": "context"
                            },
                            {
                                "content": "    m = re.match(r\"hs[bv]\\(\\s*(\\d+\\.?\\d*)\\s*,\\s*(\\d+\\.?\\d*)%\\s*,\\s*(\\d+\\.?\\d*)%\\s*\\)$\", color)",
                                "type": "added"
                            },
                            {
                                "content": "    if m:",
                                "type": "added"
                            },
                            {
                                "content": "        from colorsys import hsv_to_rgb",
                                "type": "added"
                            },
                            {
                                "content": "        rgb = hsv_to_rgb(",
                                "type": "added"
                            },
                            {
                                "content": "            float(m.group(1)) / 360.0,",
                                "type": "added"
                            },
                            {
                                "content": "            float(m.group(2)) / 100.0,",
                                "type": "added"
                            },
                            {
                                "content": "            float(m.group(3)) / 100.0,",
                                "type": "added"
                            },
                            {
                                "content": "            )",
                                "type": "added"
                            },
                            {
                                "content": "        return (",
                                "type": "added"
                            },
                            {
                                "content": "            int(rgb[0] * 255 + 0.5),",
                                "type": "added"
                            },
                            {
                                "content": "            int(rgb[1] * 255 + 0.5),",
                                "type": "added"
                            },
                            {
                                "content": "            int(rgb[2] * 255 + 0.5)",
                                "type": "added"
                            },
                            {
                                "content": "            )",
                                "type": "added"
                            },
                            {
                                "content": "",
                                "type": "added"
                            },
                            {
                                "content": "    m = re.match(r\"rgba\\(\\s*(\\d+)\\s*,\\s*(\\d+)\\s*,\\s*(\\d+)\\s*,\\s*(\\d+)\\s*\\)$\",",
                                "type": "context"
                            },
                            {
                                "content": "                 color)",
                                "type": "context"
                            },
                            {
                                "content": "    if m:",
                                "type": "context"
                            },
                            {
                                "content": "",
                                "type": "context"
                            }
                        ]
                    },
                    "modified_entities": [
                        {
                            "file_name": "src/PIL/ImageColor.py",
                            "type": "function",
                            "name": "getrgb",
                            "content": "def getrgb(color):\n    \"\"\"\n     Convert a color string to an RGB tuple. If the string cannot be parsed,\n     this function raises a :py:exc:`ValueError` exception.\n\n    .. versionadded:: 1.1.4\n\n    :param color: A color string\n    :return: ``(red, green, blue[, alpha])``\n    \"\"\"\n    color = color.lower()\n\n    rgb = colormap.get(color, None)\n    if rgb:\n        if isinstance(rgb, tuple):\n            return rgb\n        colormap[color] = rgb = getrgb(rgb)\n        return rgb\n\n    # check for known string formats\n    if re.match('#[a-f0-9]{3}$', color):\n        return (\n            int(color[1]*2, 16),\n            int(color[2]*2, 16),\n            int(color[3]*2, 16),\n            )\n\n    if re.match('#[a-f0-9]{4}$', color):\n        return (\n            int(color[1]*2, 16),\n            int(color[2]*2, 16),\n            int(color[3]*2, 16),\n            int(color[4]*2, 16),\n            )\n\n    if re.match('#[a-f0-9]{6}$', color):\n        return (\n            int(color[1:3], 16),\n            int(color[3:5], 16),\n            int(color[5:7], 16),\n            )\n\n    if re.match('#[a-f0-9]{8}$', color):\n        return (\n            int(color[1:3], 16),\n            int(color[3:5], 16),\n            int(color[5:7], 16),\n            int(color[7:9], 16),\n            )\n\n    m = re.match(r\"rgb\\(\\s*(\\d+)\\s*,\\s*(\\d+)\\s*,\\s*(\\d+)\\s*\\)$\", color)\n    if m:\n        return (\n            int(m.group(1)),\n            int(m.group(2)),\n            int(m.group(3))\n            )\n\n    m = re.match(r\"rgb\\(\\s*(\\d+)%\\s*,\\s*(\\d+)%\\s*,\\s*(\\d+)%\\s*\\)$\", color)\n    if m:\n        return (\n            int((int(m.group(1)) * 255) / 100.0 + 0.5),\n            int((int(m.group(2)) * 255) / 100.0 + 0.5),\n            int((int(m.group(3)) * 255) / 100.0 + 0.5)\n            )\n\n    m = re.match(r\"hsl\\(\\s*(\\d+\\.?\\d*)\\s*,\\s*(\\d+\\.?\\d*)%\\s*,\\s*(\\d+\\.?\\d*)%\\s*\\)$\", color)\n    if m:\n        from colorsys import hls_to_rgb\n        rgb = hls_to_rgb(\n            float(m.group(1)) / 360.0,\n            float(m.group(3)) / 100.0,\n            float(m.group(2)) / 100.0,\n            )\n        return (\n            int(rgb[0] * 255 + 0.5),\n            int(rgb[1] * 255 + 0.5),\n            int(rgb[2] * 255 + 0.5)\n            )\n\n    m = re.match(r\"hs[bv]\\(\\s*(\\d+\\.?\\d*)\\s*,\\s*(\\d+\\.?\\d*)%\\s*,\\s*(\\d+\\.?\\d*)%\\s*\\)$\", color)\n    if m:\n        from colorsys import hsv_to_rgb\n        rgb = hsv_to_rgb(\n            float(m.group(1)) / 360.0,\n            float(m.group(2)) / 100.0,\n            float(m.group(3)) / 100.0,\n            )\n        return (\n            int(rgb[0] * 255 + 0.5),\n            int(rgb[1] * 255 + 0.5),\n            int(rgb[2] * 255 + 0.5)\n            )\n\n    m = re.match(r\"rgba\\(\\s*(\\d+)\\s*,\\s*(\\d+)\\s*,\\s*(\\d+)\\s*,\\s*(\\d+)\\s*\\)$\",\n                 color)\n    if m:\n        return (\n            int(m.group(1)),\n            int(m.group(2)),\n            int(m.group(3)),\n            int(m.group(4))\n            )\n    raise ValueError(\"unknown color specifier: %r\" % color)",
                            "ast_type_str": "FunctionDef",
                            "start_lineno": 24,
                            "end_lineno": 127,
                            "parent": null
                        }
                    ],
                    "added_entities": [],
                    "deleted_entities": []
                }
            ]
        }
    ],
    "old_commit_hash": "e514a60d82429a4669159176471013adb0fa8b94^",
    "new_commit_hash": "e514a60d82429a4669159176471013adb0fa8b94",
    "commit_message": "Merge pull request #3148 from radarhere/hsv\n\nAdded getrgb HSB/HSV color strings",
    "commit_date": "2018-05-31T09:05:08+03:00",
    "metadata": {}
}
{
    "repo_name": "pillow",
    "new_commit_hash": "e514a60d82429a4669159176471013adb0fa8b94",
    "test_file_codes": [
        "from helper import unittest, PillowTestCase\n\nfrom PIL import Image\nfrom PIL import ImageColor\n\n\nclass TestImageColor(PillowTestCase):\n\n    def test_hash(self):\n        # short 3 components\n        self.assertEqual((255, 0, 0), ImageColor.getrgb(\"#f00\"))\n        self.assertEqual((0, 255, 0), ImageColor.getrgb(\"#0f0\"))\n        self.assertEqual((0, 0, 255), ImageColor.getrgb(\"#00f\"))\n\n        # short 4 components\n        self.assertEqual((255, 0, 0, 0), ImageColor.getrgb(\"#f000\"))\n        self.assertEqual((0, 255, 0, 0), ImageColor.getrgb(\"#0f00\"))\n        self.assertEqual((0, 0, 255, 0), ImageColor.getrgb(\"#00f0\"))\n        self.assertEqual((0, 0, 0, 255), ImageColor.getrgb(\"#000f\"))\n\n        # long 3 components\n        self.assertEqual((222, 0, 0), ImageColor.getrgb(\"#de0000\"))\n        self.assertEqual((0, 222, 0), ImageColor.getrgb(\"#00de00\"))\n        self.assertEqual((0, 0, 222), ImageColor.getrgb(\"#0000de\"))\n\n        # long 4 components\n        self.assertEqual((222, 0, 0, 0), ImageColor.getrgb(\"#de000000\"))\n        self.assertEqual((0, 222, 0, 0), ImageColor.getrgb(\"#00de0000\"))\n        self.assertEqual((0, 0, 222, 0), ImageColor.getrgb(\"#0000de00\"))\n        self.assertEqual((0, 0, 0, 222), ImageColor.getrgb(\"#000000de\"))\n\n        # case insensitivity\n        self.assertEqual(ImageColor.getrgb(\"#DEF\"), ImageColor.getrgb(\"#def\"))\n        self.assertEqual(ImageColor.getrgb(\"#CDEF\"), ImageColor.getrgb(\"#cdef\"))\n        self.assertEqual(ImageColor.getrgb(\"#DEFDEF\"),\n                         ImageColor.getrgb(\"#defdef\"))\n        self.assertEqual(ImageColor.getrgb(\"#CDEFCDEF\"),\n                         ImageColor.getrgb(\"#cdefcdef\"))\n\n        # not a number\n        self.assertRaises(ValueError, ImageColor.getrgb, \"#fo0\")\n        self.assertRaises(ValueError, ImageColor.getrgb, \"#fo00\")\n        self.assertRaises(ValueError, ImageColor.getrgb, \"#fo0000\")\n        self.assertRaises(ValueError, ImageColor.getrgb, \"#fo000000\")\n\n        # wrong number of components\n        self.assertRaises(ValueError, ImageColor.getrgb, \"#f0000\")\n        self.assertRaises(ValueError, ImageColor.getrgb, \"#f000000\")\n        self.assertRaises(ValueError, ImageColor.getrgb, \"#f00000000\")\n        self.assertRaises(ValueError, ImageColor.getrgb, \"#f000000000\")\n        self.assertRaises(ValueError, ImageColor.getrgb, \"#f00000 \")\n\n    def test_colormap(self):\n        self.assertEqual((0, 0, 0), ImageColor.getrgb(\"black\"))\n        self.assertEqual((255, 255, 255), ImageColor.getrgb(\"white\"))\n        self.assertEqual((255, 255, 255), ImageColor.getrgb(\"WHITE\"))\n\n        self.assertRaises(ValueError, ImageColor.getrgb, \"black \")\n\n    def test_functions(self):\n        # rgb numbers\n        self.assertEqual((255, 0, 0), ImageColor.getrgb(\"rgb(255,0,0)\"))\n        self.assertEqual((0, 255, 0), ImageColor.getrgb(\"rgb(0,255,0)\"))\n        self.assertEqual((0, 0, 255), ImageColor.getrgb(\"rgb(0,0,255)\"))\n\n        # percents\n        self.assertEqual((255, 0, 0), ImageColor.getrgb(\"rgb(100%,0%,0%)\"))\n        self.assertEqual((0, 255, 0), ImageColor.getrgb(\"rgb(0%,100%,0%)\"))\n        self.assertEqual((0, 0, 255), ImageColor.getrgb(\"rgb(0%,0%,100%)\"))\n\n        # rgba numbers\n        self.assertEqual((255, 0, 0, 0), ImageColor.getrgb(\"rgba(255,0,0,0)\"))\n        self.assertEqual((0, 255, 0, 0), ImageColor.getrgb(\"rgba(0,255,0,0)\"))\n        self.assertEqual((0, 0, 255, 0), ImageColor.getrgb(\"rgba(0,0,255,0)\"))\n        self.assertEqual((0, 0, 0, 255), ImageColor.getrgb(\"rgba(0,0,0,255)\"))\n\n        self.assertEqual((255, 0, 0), ImageColor.getrgb(\"hsl(0,100%,50%)\"))\n        self.assertEqual((255, 0, 0), ImageColor.getrgb(\"hsl(360,100%,50%)\"))\n        self.assertEqual((0, 255, 255), ImageColor.getrgb(\"hsl(180,100%,50%)\"))\n\n        self.assertEqual((255, 0, 0), ImageColor.getrgb(\"hsv(0,100%,100%)\"))\n        self.assertEqual((255, 0, 0), ImageColor.getrgb(\"hsv(360,100%,100%)\"))\n        self.assertEqual((0, 255, 255), ImageColor.getrgb(\"hsv(180,100%,100%)\"))\n\n        # alternate format\n        self.assertEqual(ImageColor.getrgb(\"hsb(0,100%,50%)\"),\n                         ImageColor.getrgb(\"hsv(0,100%,50%)\"))\n\n        # floats\n        self.assertEqual((254, 3, 3), ImageColor.getrgb(\"hsl(0.1,99.2%,50.3%)\"))\n        self.assertEqual((255, 0, 0), ImageColor.getrgb(\"hsl(360.,100.0%,50%)\"))\n\n        self.assertEqual((253, 2, 2), ImageColor.getrgb(\"hsv(0.1,99.2%,99.3%)\"))\n        self.assertEqual((255, 0, 0), ImageColor.getrgb(\"hsv(360.,100.0%,100%)\"))\n\n        # case insensitivity\n        self.assertEqual(ImageColor.getrgb(\"RGB(255,0,0)\"),\n                         ImageColor.getrgb(\"rgb(255,0,0)\"))\n        self.assertEqual(ImageColor.getrgb(\"RGB(100%,0%,0%)\"),\n                         ImageColor.getrgb(\"rgb(100%,0%,0%)\"))\n        self.assertEqual(ImageColor.getrgb(\"RGBA(255,0,0,0)\"),\n                         ImageColor.getrgb(\"rgba(255,0,0,0)\"))\n        self.assertEqual(ImageColor.getrgb(\"HSL(0,100%,50%)\"),\n                         ImageColor.getrgb(\"hsl(0,100%,50%)\"))\n        self.assertEqual(ImageColor.getrgb(\"HSV(0,100%,50%)\"),\n                         ImageColor.getrgb(\"hsv(0,100%,50%)\"))\n        self.assertEqual(ImageColor.getrgb(\"HSB(0,100%,50%)\"),\n                         ImageColor.getrgb(\"hsb(0,100%,50%)\"))\n\n        # space agnosticism\n        self.assertEqual((255, 0, 0),\n                         ImageColor.getrgb(\"rgb(  255  ,  0  ,  0  )\"))\n        self.assertEqual((255, 0, 0),\n                         ImageColor.getrgb(\"rgb(  100%  ,  0%  ,  0%  )\"))\n        self.assertEqual((255, 0, 0, 0),\n                         ImageColor.getrgb(\"rgba(  255  ,  0  ,  0  ,  0  )\"))\n        self.assertEqual((255, 0, 0),\n                         ImageColor.getrgb(\"hsl(  0  ,  100%  ,  50%  )\"))\n        self.assertEqual((255, 0, 0),\n                         ImageColor.getrgb(\"hsv(  0  ,  100%  ,  100%  )\"))\n\n        # wrong number of components\n        self.assertRaises(ValueError, ImageColor.getrgb, \"rgb(255,0)\")\n        self.assertRaises(ValueError, ImageColor.getrgb, \"rgb(255,0,0,0)\")\n\n        self.assertRaises(ValueError, ImageColor.getrgb, \"rgb(100%,0%)\")\n        self.assertRaises(ValueError, ImageColor.getrgb, \"rgb(100%,0%,0)\")\n        self.assertRaises(ValueError, ImageColor.getrgb, \"rgb(100%,0%,0 %)\")\n        self.assertRaises(ValueError, ImageColor.getrgb, \"rgb(100%,0%,0%,0%)\")\n\n        self.assertRaises(ValueError, ImageColor.getrgb, \"rgba(255,0,0)\")\n        self.assertRaises(ValueError, ImageColor.getrgb, \"rgba(255,0,0,0,0)\")\n\n        self.assertRaises(ValueError, ImageColor.getrgb, \"hsl(0,100%)\")\n        self.assertRaises(ValueError, ImageColor.getrgb, \"hsl(0,100%,0%,0%)\")\n        self.assertRaises(ValueError, ImageColor.getrgb, \"hsl(0%,100%,50%)\")\n        self.assertRaises(ValueError, ImageColor.getrgb, \"hsl(0,100,50%)\")\n        self.assertRaises(ValueError, ImageColor.getrgb, \"hsl(0,100%,50)\")\n\n        self.assertRaises(ValueError, ImageColor.getrgb, \"hsv(0,100%)\")\n        self.assertRaises(ValueError, ImageColor.getrgb, \"hsv(0,100%,0%,0%)\")\n        self.assertRaises(ValueError, ImageColor.getrgb, \"hsv(0%,100%,50%)\")\n        self.assertRaises(ValueError, ImageColor.getrgb, \"hsv(0,100,50%)\")\n        self.assertRaises(ValueError, ImageColor.getrgb, \"hsv(0,100%,50)\")\n\n    # look for rounding errors (based on code by Tim Hatch)\n    def test_rounding_errors(self):\n\n        for color in ImageColor.colormap:\n            expected = Image.new(\n                \"RGB\", (1, 1), color).convert(\"L\").getpixel((0, 0))\n            actual = ImageColor.getcolor(color, 'L')\n            self.assertEqual(expected, actual)\n\n        self.assertEqual(\n            (0, 255, 115), ImageColor.getcolor(\"rgba(0, 255, 115, 33)\", \"RGB\"))\n        Image.new(\"RGB\", (1, 1), \"white\")\n\n        self.assertEqual((0, 0, 0, 255), ImageColor.getcolor(\"black\", \"RGBA\"))\n        self.assertEqual(\n            (255, 255, 255, 255), ImageColor.getcolor(\"white\", \"RGBA\"))\n        self.assertEqual(\n            (0, 255, 115, 33),\n            ImageColor.getcolor(\"rgba(0, 255, 115, 33)\", \"RGBA\"))\n        Image.new(\"RGBA\", (1, 1), \"white\")\n\n        self.assertEqual(0, ImageColor.getcolor(\"black\", \"L\"))\n        self.assertEqual(255, ImageColor.getcolor(\"white\", \"L\"))\n        self.assertEqual(162,\n                         ImageColor.getcolor(\"rgba(0, 255, 115, 33)\", \"L\"))\n        Image.new(\"L\", (1, 1), \"white\")\n\n        self.assertEqual(0, ImageColor.getcolor(\"black\", \"1\"))\n        self.assertEqual(255, ImageColor.getcolor(\"white\", \"1\"))\n        # The following test is wrong, but is current behavior\n        # The correct result should be 255 due to the mode 1\n        self.assertEqual(\n            162, ImageColor.getcolor(\"rgba(0, 255, 115, 33)\", \"1\"))\n        # Correct behavior\n        # self.assertEqual(\n        #     255, ImageColor.getcolor(\"rgba(0, 255, 115, 33)\", \"1\"))\n        Image.new(\"1\", (1, 1), \"white\")\n\n        self.assertEqual((0, 255), ImageColor.getcolor(\"black\", \"LA\"))\n        self.assertEqual((255, 255), ImageColor.getcolor(\"white\", \"LA\"))\n        self.assertEqual(\n            (162, 33), ImageColor.getcolor(\"rgba(0, 255, 115, 33)\", \"LA\"))\n        Image.new(\"LA\", (1, 1), \"white\")\n\n\nif __name__ == '__main__':\n    unittest.main()\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 16ms\nInstalled 12 packages in 143ms\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 751ms\nPrepared 1 package in 17.35s\nInstalled 1 package in 2ms\n + pillow==5.2.0.dev0 (from file:///home/gcpuser/buckets/local_repoeval_bucket/repos/pillow_e514a60d82429a4669159176471013adb0fa8b94)\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_e514a60d82429a4669159176471013adb0fa8b94\n....\ncollected 4 items\n\n==================== short test summary info ====================\nPASSED test_1::TestImageColor::test_colormap\nPASSED test_1::TestImageColor::test_functions\nPASSED test_1::TestImageColor::test_hash\nPASSED test_1::TestImageColor::test_rounding_errors\n=================== 4 passed in 0.01s ===================\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_e514a60d82429a4669159176471013adb0fa8b94\n....\ncollected 4 items\n\n=================================== ERRORS =====================================\n__________ TestImageColor.test_functions __________\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_e514a60d82429a4669159176471013adb0fa8b94/r2e_tests/test_1.py\", line 81, in test_functions\n    self.assertEqual((255, 0, 0), ImageColor.getrgb(\"hsv(0,100%,100%)\"))\n  File \"/home/gcpuser/buckets/local_repoeval_bucket/repos/pillow_e514a60d82429a4669159176471013adb0fa8b94/src/PIL/ImageColor.py\", line 113, in getrgb\n    raise ValueError(\"unknown color specifier: %r\" % color)\nValueError: unknown color specifier: 'hsv(0,100%,100%)'\n\n==================== short test summary info ====================\nPASSED test_1::TestImageColor::test_colormap\nERROR test_1::TestImageColor::test_functions\nPASSED test_1::TestImageColor::test_hash\nPASSED test_1::TestImageColor::test_rounding_errors\n=================== 1 error, 3 passed in 0.01s ===================\n",
    "old_commit_res_stderr": ""
}
Tests/test_imagecolor.py docs/reference/ImageColor.rst src/PIL/ImageColor.py
We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
[ISSUE]

**Title:** `ImageColor.getrgb` Fails to Parse HSV Color Strings

**Description:**

When attempting to use HSV color strings with `ImageColor.getrgb`, the function raises a `ValueError`, indicating that the color specifier is unknown. This prevents the conversion of HSV values to RGB, limiting color handling capabilities.

**Example Buggy Code:**
```python
from PIL import ImageColor

color = "hsv(0,100%,100%)"
rgb = ImageColor.getrgb(color)
print(rgb)
```

**Expected Behavior:**
The `getrgb` function should correctly parse the HSV color string and return the corresponding RGB tuple. For example, `"hsv(0,100%,100%)"` should be converted to `(255, 0, 0)`.

**Actual Behavior:**
Executing the above code results in the following error:
```
ValueError: unknown color specifier: 'hsv(0,100%,100%)'
```

This error indicates that the function does not recognize the `hsv` format, preventing proper color conversion.

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

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

--- BEGIN FILE ---
```
### src/PIL/ImageColor.py
#
# The Python Imaging Library
# $Id$
#
# map CSS3-style colour description strings to RGB
#
# History:
# 2002-10-24 fl   Added support for CSS-style color strings
# 2002-12-15 fl   Added RGBA support
# 2004-03-27 fl   Fixed remaining int() problems for Python 1.5.2
# 2004-07-19 fl   Fixed gray/grey spelling issues
# 2009-03-05 fl   Fixed rounding error in grayscale calculation
#
# Copyright (c) 2002-2004 by Secret Labs AB
# Copyright (c) 2002-2004 by Fredrik Lundh
#
# See the README file for information on usage and redistribution.
#

from . import Image
import re


def getrgb(color):
    """
     Convert a color string to an RGB tuple. If the string cannot be parsed,
     this function raises a :py:exc:`ValueError` exception.

    .. versionadded:: 1.1.4

    :param color: A color string
    :return: ``(red, green, blue[, alpha])``
    """
    color = color.lower()

    rgb = colormap.get(color, None)
    if rgb:
        if isinstance(rgb, tuple):
            return rgb
        colormap[color] = rgb = getrgb(rgb)
        return rgb

    # check for known string formats
    if re.match('#[a-f0-9]{3}$', color):
        return (
            int(color[1]*2, 16),
            int(color[2]*2, 16),
            int(color[3]*2, 16),
            )

    if re.match('#[a-f0-9]{4}$', color):
        return (
            int(color[1]*2, 16),
            int(color[2]*2, 16),
            int(color[3]*2, 16),
            int(color[4]*2, 16),
            )

    if re.match('#[a-f0-9]{6}$', color):
        return (
            int(color[1:3], 16),
            int(color[3:5], 16),
            int(color[5:7], 16),
            )

    if re.match('#[a-f0-9]{8}$', color):
        return (
            int(color[1:3], 16),
            int(color[3:5], 16),
            int(color[5:7], 16),
            int(color[7:9], 16),
            )

    m = re.match(r"rgb\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)$", color)
    if m:
        return (
            int(m.group(1)),
            int(m.group(2)),
            int(m.group(3))
            )

    m = re.match(r"rgb\(\s*(\d+)%\s*,\s*(\d+)%\s*,\s*(\d+)%\s*\)$", color)
    if m:
        return (
            int((int(m.group(1)) * 255) / 100.0 + 0.5),
            int((int(m.group(2)) * 255) / 100.0 + 0.5),
            int((int(m.group(3)) * 255) / 100.0 + 0.5)
            )

    m = re.match(r"hsl\(\s*(\d+\.?\d*)\s*,\s*(\d+\.?\d*)%\s*,\s*(\d+\.?\d*)%\s*\)$", color)
    if m:
        from colorsys import hls_to_rgb
        rgb = hls_to_rgb(
            float(m.group(1)) / 360.0,
            float(m.group(3)) / 100.0,
            float(m.group(2)) / 100.0,
            )
        return (
            int(rgb[0] * 255 + 0.5),
            int(rgb[1] * 255 + 0.5),
            int(rgb[2] * 255 + 0.5)
            )

    m = re.match(r"rgba\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)$",
                 color)
    if m:
        return (
            int(m.group(1)),
            int(m.group(2)),
            int(m.group(3)),
            int(m.group(4))
            )
    raise ValueError("unknown color specifier: %r" % color)


def getcolor(color, mode):
    """
    Same as :py:func:`~PIL.ImageColor.getrgb`, but converts the RGB value to a
    greyscale value if the mode is not color or a palette image. If the string
    cannot be parsed, this function raises a :py:exc:`ValueError` exception.

    .. versionadded:: 1.1.4

    :param color: A color string
    :return: ``(graylevel [, alpha]) or (red, green, blue[, alpha])``
    """
    # same as getrgb, but converts the result to the given mode
    color, alpha = getrgb(color), 255
    if len(color) == 4:
        color, alpha = color[0:3], color[3]

    if Image.getmodebase(mode) == "L":
        r, g, b = color
        color = (r*299 + g*587 + b*114)//1000
        if mode[-1] == 'A':
            return (color, alpha)
    else:
        if mode[-1] == 'A':
            return color + (alpha,)
    return color


colormap = {
    # X11 colour table from https://drafts.csswg.org/css-color-4/, with
    # gray/grey spelling issues fixed.  This is a superset of HTML 4.0
    # colour names used in CSS 1.
    "aliceblue": "#f0f8ff",
    "antiquewhite": "#faebd7",
    "aqua": "#00ffff",
    "aquamarine": "#7fffd4",
    "azure": "#f0ffff",
    "beige": "#f5f5dc",
    "bisque": "#ffe4c4",
    "black": "#000000",
    "blanchedalmond": "#ffebcd",
    "blue": "#0000ff",
    "blueviolet": "#8a2be2",
    "brown": "#a52a2a",
    "burlywood": "#deb887",
    "cadetblue": "#5f9ea0",
    "chartreuse": "#7fff00",
    "chocolate": "#d2691e",
    "coral": "#ff7f50",
    "cornflowerblue": "#6495ed",
    "cornsilk": "#fff8dc",
    "crimson": "#dc143c",
    "cyan": "#00ffff",
    "darkblue": "#00008b",
    "darkcyan": "#008b8b",
    "darkgoldenrod": "#b8860b",
    "darkgray": "#a9a9a9",
    "darkgrey": "#a9a9a9",
    "darkgreen": "#006400",
    "darkkhaki": "#bdb76b",
    "darkmagenta": "#8b008b",
    "darkolivegreen": "#556b2f",
    "darkorange": "#ff8c00",
    "darkorchid": "#9932cc",
    "darkred": "#8b0000",
    "darksalmon": "#e9967a",
    "darkseagreen": "#8fbc8f",
    "darkslateblue": "#483d8b",
    "darkslategray": "#2f4f4f",
    "darkslategrey": "#2f4f4f",
    "darkturquoise": "#00ced1",
    "darkviolet": "#9400d3",
    "deeppink": "#ff1493",
    "deepskyblue": "#00bfff",
    "dimgray": "#696969",
    "dimgrey": "#696969",
    "dodgerblue": "#1e90ff",
    "firebrick": "#b22222",
    "floralwhite": "#fffaf0",
    "forestgreen": "#228b22",
    "fuchsia": "#ff00ff",
    "gainsboro": "#dcdcdc",
    "ghostwhite": "#f8f8ff",
    "gold": "#ffd700",
    "goldenrod": "#daa520",
    "gray": "#808080",
    "grey": "#808080",
    "green": "#008000",
    "greenyellow": "#adff2f",
    "honeydew": "#f0fff0",
    "hotpink": "#ff69b4",
    "indianred": "#cd5c5c",
    "indigo": "#4b0082",
    "ivory": "#fffff0",
    "khaki": "#f0e68c",
    "lavender": "#e6e6fa",
    "lavenderblush": "#fff0f5",
    "lawngreen": "#7cfc00",
    "lemonchiffon": "#fffacd",
    "lightblue": "#add8e6",
    "lightcoral": "#f08080",
    "lightcyan": "#e0ffff",
    "lightgoldenrodyellow": "#fafad2",
    "lightgreen": "#90ee90",
    "lightgray": "#d3d3d3",
    "lightgrey": "#d3d3d3",
    "lightpink": "#ffb6c1",
    "lightsalmon": "#ffa07a",
    "lightseagreen": "#20b2aa",
    "lightskyblue": "#87cefa",
    "lightslategray": "#778899",
    "lightslategrey": "#778899",
    "lightsteelblue": "#b0c4de",
    "lightyellow": "#ffffe0",
    "lime": "#00ff00",
    "limegreen": "#32cd32",
    "linen": "#faf0e6",
    "magenta": "#ff00ff",
    "maroon": "#800000",
    "mediumaquamarine": "#66cdaa",
    "mediumblue": "#0000cd",
    "mediumorchid": "#ba55d3",
    "mediumpurple": "#9370db",
    "mediumseagreen": "#3cb371",
    "mediumslateblue": "#7b68ee",
    "mediumspringgreen": "#00fa9a",
    "mediumturquoise": "#48d1cc",
    "mediumvioletred": "#c71585",
    "midnightblue": "#191970",
    "mintcream": "#f5fffa",
    "mistyrose": "#ffe4e1",
    "moccasin": "#ffe4b5",
    "navajowhite": "#ffdead",
    "navy": "#000080",
    "oldlace": "#fdf5e6",
    "olive": "#808000",
    "olivedrab": "#6b8e23",
    "orange": "#ffa500",
    "orangered": "#ff4500",
    "orchid": "#da70d6",
    "palegoldenrod": "#eee8aa",
    "palegreen": "#98fb98",
    "paleturquoise": "#afeeee",
    "palevioletred": "#db7093",
    "papayawhip": "#ffefd5",
    "peachpuff": "#ffdab9",
    "peru": "#cd853f",
    "pink": "#ffc0cb",
    "plum": "#dda0dd",
    "powderblue": "#b0e0e6",
    "purple": "#800080",
    "rebeccapurple": "#663399",
    "red": "#ff0000",
    "rosybrown": "#bc8f8f",
    "royalblue": "#4169e1",
    "saddlebrown": "#8b4513",
    "salmon": "#fa8072",
    "sandybrown": "#f4a460",
    "seagreen": "#2e8b57",
    "seashell": "#fff5ee",
    "sienna": "#a0522d",
    "silver": "#c0c0c0",
    "skyblue": "#87ceeb",
    "slateblue": "#6a5acd",
    "slategray": "#708090",
    "slategrey": "#708090",
    "snow": "#fffafa",
    "springgreen": "#00ff7f",
    "steelblue": "#4682b4",
    "tan": "#d2b48c",
    "teal": "#008080",
    "thistle": "#d8bfd8",
    "tomato": "#ff6347",
    "turquoise": "#40e0d0",
    "violet": "#ee82ee",
    "wheat": "#f5deb3",
    "white": "#ffffff",
    "whitesmoke": "#f5f5f5",
    "yellow": "#ffff00",
    "yellowgreen": "#9acd32",
}

```
--- 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:** `ImageColor.getrgb` Fails to Parse HSV Color Strings

**Description:**

When attempting to use HSV color strings with `ImageColor.getrgb`, the function raises a `ValueError`, indicating that the color specifier is unknown. This prevents the conversion of HSV values to RGB, limiting color handling capabilities.

**Example Buggy Code:**
```python
from PIL import ImageColor

color = "hsv(0,100%,100%)"
rgb = ImageColor.getrgb(color)
print(rgb)
```

**Expected Behavior:**
The `getrgb` function should correctly parse the HSV color string and return the corresponding RGB tuple. For example, `"hsv(0,100%,100%)"` should be converted to `(255, 0, 0)`.

**Actual Behavior:**
Executing the above code results in the following error:
```
ValueError: unknown color specifier: 'hsv(0,100%,100%)'
```

This error indicates that the function does not recognize the `hsv` format, preventing proper color conversion.

[/ISSUE]
{
    "TestImageColor.test_colormap": "PASSED",
    "TestImageColor.test_functions": "PASSED",
    "TestImageColor.test_hash": "PASSED",
    "TestImageColor.test_rounding_errors": "PASSED"
}
diff --git a/src/PIL/ImageColor.py b/src/PIL/ImageColor.py
index 0e9702228..08c00fd54 100644
--- a/src/PIL/ImageColor.py
+++ b/src/PIL/ImageColor.py
@@ -101,6 +101,20 @@ def getrgb(color):
             int(rgb[2] * 255 + 0.5)
             )
 
+    m = re.match(r"hs[bv]\(\s*(\d+\.?\d*)\s*,\s*(\d+\.?\d*)%\s*,\s*(\d+\.?\d*)%\s*\)$", color)
+    if m:
+        from colorsys import hsv_to_rgb
+        rgb = hsv_to_rgb(
+            float(m.group(1)) / 360.0,
+            float(m.group(2)) / 100.0,
+            float(m.group(3)) / 100.0,
+            )
+        return (
+            int(rgb[0] * 255 + 0.5),
+            int(rgb[1] * 255 + 0.5),
+            int(rgb[2] * 255 + 0.5)
+            )
+
     m = re.match(r"rgba\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)$",
                  color)
     if m:
 

{"src/PIL/ImageColor.py": "#\n# The Python Imaging Library\n# $Id$\n#\n# map CSS3-style colour description strings to RGB\n#\n# History:\n# 2002-10-24 fl   Added support for CSS-style color strings\n# 2002-12-15 fl   Added RGBA support\n# 2004-03-27 fl   Fixed remaining int() problems for Python 1.5.2\n# 2004-07-19 fl   Fixed gray/grey spelling issues\n# 2009-03-05 fl   Fixed rounding error in grayscale calculation\n#\n# Copyright (c) 2002-2004 by Secret Labs AB\n# Copyright (c) 2002-2004 by Fredrik Lundh\n#\n# See the README file for information on usage and redistribution.\n#\n\nfrom . import Image\nimport re\n\n\ndef getrgb(color):\n    \"\"\"\n     Convert a color string to an RGB tuple. If the string cannot be parsed,\n     this function raises a :py:exc:`ValueError` exception.\n\n    .. versionadded:: 1.1.4\n\n    :param color: A color string\n    :return: ``(red, green, blue[, alpha])``\n    \"\"\"\n    color = color.lower()\n\n    rgb = colormap.get(color, None)\n    if rgb:\n        if isinstance(rgb, tuple):\n            return rgb\n        colormap[color] = rgb = getrgb(rgb)\n        return rgb\n\n    # check for known string formats\n    if re.match('#[a-f0-9]{3}$', color):\n        return (\n            int(color[1]*2, 16),\n            int(color[2]*2, 16),\n            int(color[3]*2, 16),\n            )\n\n    if re.match('#[a-f0-9]{4}$', color):\n        return (\n            int(color[1]*2, 16),\n            int(color[2]*2, 16),\n            int(color[3]*2, 16),\n            int(color[4]*2, 16),\n            )\n\n    if re.match('#[a-f0-9]{6}$', color):\n        return (\n            int(color[1:3], 16),\n            int(color[3:5], 16),\n            int(color[5:7], 16),\n            )\n\n    if re.match('#[a-f0-9]{8}$', color):\n        return (\n            int(color[1:3], 16),\n            int(color[3:5], 16),\n            int(color[5:7], 16),\n            int(color[7:9], 16),\n            )\n\n    m = re.match(r\"rgb\\(\\s*(\\d+)\\s*,\\s*(\\d+)\\s*,\\s*(\\d+)\\s*\\)$\", color)\n    if m:\n        return (\n            int(m.group(1)),\n            int(m.group(2)),\n            int(m.group(3))\n            )\n\n    m = re.match(r\"rgb\\(\\s*(\\d+)%\\s*,\\s*(\\d+)%\\s*,\\s*(\\d+)%\\s*\\)$\", color)\n    if m:\n        return (\n            int((int(m.group(1)) * 255) / 100.0 + 0.5),\n            int((int(m.group(2)) * 255) / 100.0 + 0.5),\n            int((int(m.group(3)) * 255) / 100.0 + 0.5)\n            )\n\n    m = re.match(r\"hsl\\(\\s*(\\d+\\.?\\d*)\\s*,\\s*(\\d+\\.?\\d*)%\\s*,\\s*(\\d+\\.?\\d*)%\\s*\\)$\", color)\n    if m:\n        from colorsys import hls_to_rgb\n        rgb = hls_to_rgb(\n            float(m.group(1)) / 360.0,\n            float(m.group(3)) / 100.0,\n            float(m.group(2)) / 100.0,\n            )\n        return (\n            int(rgb[0] * 255 + 0.5),\n            int(rgb[1] * 255 + 0.5),\n            int(rgb[2] * 255 + 0.5)\n            )\n\n    m = re.match(r\"rgba\\(\\s*(\\d+)\\s*,\\s*(\\d+)\\s*,\\s*(\\d+)\\s*,\\s*(\\d+)\\s*\\)$\",\n                 color)\n    if m:\n        return (\n            int(m.group(1)),\n            int(m.group(2)),\n            int(m.group(3)),\n            int(m.group(4))\n            )\n    raise ValueError(\"unknown color specifier: %r\" % color)\n\n\ndef getcolor(color, mode):\n    \"\"\"\n    Same as :py:func:`~PIL.ImageColor.getrgb`, but converts the RGB value to a\n    greyscale value if the mode is not color or a palette image. If the string\n    cannot be parsed, this function raises a :py:exc:`ValueError` exception.\n\n    .. versionadded:: 1.1.4\n\n    :param color: A color string\n    :return: ``(graylevel [, alpha]) or (red, green, blue[, alpha])``\n    \"\"\"\n    # same as getrgb, but converts the result to the given mode\n    color, alpha = getrgb(color), 255\n    if len(color) == 4:\n        color, alpha = color[0:3], color[3]\n\n    if Image.getmodebase(mode) == \"L\":\n        r, g, b = color\n        color = (r*299 + g*587 + b*114)//1000\n        if mode[-1] == 'A':\n            return (color, alpha)\n    else:\n        if mode[-1] == 'A':\n            return color + (alpha,)\n    return color\n\n\ncolormap = {\n    # X11 colour table from https://drafts.csswg.org/css-color-4/, with\n    # gray/grey spelling issues fixed.  This is a superset of HTML 4.0\n    # colour names used in CSS 1.\n    \"aliceblue\": \"#f0f8ff\",\n    \"antiquewhite\": \"#faebd7\",\n    \"aqua\": \"#00ffff\",\n    \"aquamarine\": \"#7fffd4\",\n    \"azure\": \"#f0ffff\",\n    \"beige\": \"#f5f5dc\",\n    \"bisque\": \"#ffe4c4\",\n    \"black\": \"#000000\",\n    \"blanchedalmond\": \"#ffebcd\",\n    \"blue\": \"#0000ff\",\n    \"blueviolet\": \"#8a2be2\",\n    \"brown\": \"#a52a2a\",\n    \"burlywood\": \"#deb887\",\n    \"cadetblue\": \"#5f9ea0\",\n    \"chartreuse\": \"#7fff00\",\n    \"chocolate\": \"#d2691e\",\n    \"coral\": \"#ff7f50\",\n    \"cornflowerblue\": \"#6495ed\",\n    \"cornsilk\": \"#fff8dc\",\n    \"crimson\": \"#dc143c\",\n    \"cyan\": \"#00ffff\",\n    \"darkblue\": \"#00008b\",\n    \"darkcyan\": \"#008b8b\",\n    \"darkgoldenrod\": \"#b8860b\",\n    \"darkgray\": \"#a9a9a9\",\n    \"darkgrey\": \"#a9a9a9\",\n    \"darkgreen\": \"#006400\",\n    \"darkkhaki\": \"#bdb76b\",\n    \"darkmagenta\": \"#8b008b\",\n    \"darkolivegreen\": \"#556b2f\",\n    \"darkorange\": \"#ff8c00\",\n    \"darkorchid\": \"#9932cc\",\n    \"darkred\": \"#8b0000\",\n    \"darksalmon\": \"#e9967a\",\n    \"darkseagreen\": \"#8fbc8f\",\n    \"darkslateblue\": \"#483d8b\",\n    \"darkslategray\": \"#2f4f4f\",\n    \"darkslategrey\": \"#2f4f4f\",\n    \"darkturquoise\": \"#00ced1\",\n    \"darkviolet\": \"#9400d3\",\n    \"deeppink\": \"#ff1493\",\n    \"deepskyblue\": \"#00bfff\",\n    \"dimgray\": \"#696969\",\n    \"dimgrey\": \"#696969\",\n    \"dodgerblue\": \"#1e90ff\",\n    \"firebrick\": \"#b22222\",\n    \"floralwhite\": \"#fffaf0\",\n    \"forestgreen\": \"#228b22\",\n    \"fuchsia\": \"#ff00ff\",\n    \"gainsboro\": \"#dcdcdc\",\n    \"ghostwhite\": \"#f8f8ff\",\n    \"gold\": \"#ffd700\",\n    \"goldenrod\": \"#daa520\",\n    \"gray\": \"#808080\",\n    \"grey\": \"#808080\",\n    \"green\": \"#008000\",\n    \"greenyellow\": \"#adff2f\",\n    \"honeydew\": \"#f0fff0\",\n    \"hotpink\": \"#ff69b4\",\n    \"indianred\": \"#cd5c5c\",\n    \"indigo\": \"#4b0082\",\n    \"ivory\": \"#fffff0\",\n    \"khaki\": \"#f0e68c\",\n    \"lavender\": \"#e6e6fa\",\n    \"lavenderblush\": \"#fff0f5\",\n    \"lawngreen\": \"#7cfc00\",\n    \"lemonchiffon\": \"#fffacd\",\n    \"lightblue\": \"#add8e6\",\n    \"lightcoral\": \"#f08080\",\n    \"lightcyan\": \"#e0ffff\",\n    \"lightgoldenrodyellow\": \"#fafad2\",\n    \"lightgreen\": \"#90ee90\",\n    \"lightgray\": \"#d3d3d3\",\n    \"lightgrey\": \"#d3d3d3\",\n    \"lightpink\": \"#ffb6c1\",\n    \"lightsalmon\": \"#ffa07a\",\n    \"lightseagreen\": \"#20b2aa\",\n    \"lightskyblue\": \"#87cefa\",\n    \"lightslategray\": \"#778899\",\n    \"lightslategrey\": \"#778899\",\n    \"lightsteelblue\": \"#b0c4de\",\n    \"lightyellow\": \"#ffffe0\",\n    \"lime\": \"#00ff00\",\n    \"limegreen\": \"#32cd32\",\n    \"linen\": \"#faf0e6\",\n    \"magenta\": \"#ff00ff\",\n    \"maroon\": \"#800000\",\n    \"mediumaquamarine\": \"#66cdaa\",\n    \"mediumblue\": \"#0000cd\",\n    \"mediumorchid\": \"#ba55d3\",\n    \"mediumpurple\": \"#9370db\",\n    \"mediumseagreen\": \"#3cb371\",\n    \"mediumslateblue\": \"#7b68ee\",\n    \"mediumspringgreen\": \"#00fa9a\",\n    \"mediumturquoise\": \"#48d1cc\",\n    \"mediumvioletred\": \"#c71585\",\n    \"midnightblue\": \"#191970\",\n    \"mintcream\": \"#f5fffa\",\n    \"mistyrose\": \"#ffe4e1\",\n    \"moccasin\": \"#ffe4b5\",\n    \"navajowhite\": \"#ffdead\",\n    \"navy\": \"#000080\",\n    \"oldlace\": \"#fdf5e6\",\n    \"olive\": \"#808000\",\n    \"olivedrab\": \"#6b8e23\",\n    \"orange\": \"#ffa500\",\n    \"orangered\": \"#ff4500\",\n    \"orchid\": \"#da70d6\",\n    \"palegoldenrod\": \"#eee8aa\",\n    \"palegreen\": \"#98fb98\",\n    \"paleturquoise\": \"#afeeee\",\n    \"palevioletred\": \"#db7093\",\n    \"papayawhip\": \"#ffefd5\",\n    \"peachpuff\": \"#ffdab9\",\n    \"peru\": \"#cd853f\",\n    \"pink\": \"#ffc0cb\",\n    \"plum\": \"#dda0dd\",\n    \"powderblue\": \"#b0e0e6\",\n    \"purple\": \"#800080\",\n    \"rebeccapurple\": \"#663399\",\n    \"red\": \"#ff0000\",\n    \"rosybrown\": \"#bc8f8f\",\n    \"royalblue\": \"#4169e1\",\n    \"saddlebrown\": \"#8b4513\",\n    \"salmon\": \"#fa8072\",\n    \"sandybrown\": \"#f4a460\",\n    \"seagreen\": \"#2e8b57\",\n    \"seashell\": \"#fff5ee\",\n    \"sienna\": \"#a0522d\",\n    \"silver\": \"#c0c0c0\",\n    \"skyblue\": \"#87ceeb\",\n    \"slateblue\": \"#6a5acd\",\n    \"slategray\": \"#708090\",\n    \"slategrey\": \"#708090\",\n    \"snow\": \"#fffafa\",\n    \"springgreen\": \"#00ff7f\",\n    \"steelblue\": \"#4682b4\",\n    \"tan\": \"#d2b48c\",\n    \"teal\": \"#008080\",\n    \"thistle\": \"#d8bfd8\",\n    \"tomato\": \"#ff6347\",\n    \"turquoise\": \"#40e0d0\",\n    \"violet\": \"#ee82ee\",\n    \"wheat\": \"#f5deb3\",\n    \"white\": \"#ffffff\",\n    \"whitesmoke\": \"#f5f5f5\",\n    \"yellow\": \"#ffff00\",\n    \"yellowgreen\": \"#9acd32\",\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:** `ImageColor.getrgb` Fails to Parse HSV Color Strings

**Description:**

When attempting to use HSV color strings with `ImageColor.getrgb`, the function raises a `ValueError`, indicating that the color specifier is unknown. This prevents the conversion of HSV values to RGB, limiting color handling capabilities.

**Example Buggy Code:**
```python
from PIL import ImageColor

color = "hsv(0,100%,100%)"
rgb = ImageColor.getrgb(color)
print(rgb)
```

**Expected Behavior:**
The `getrgb` function should correctly parse the HSV color string and return the corresponding RGB tuple. For example, `"hsv(0,100%,100%)"` should be converted to `(255, 0, 0)`.

**Actual Behavior:**
Executing the above code results in the following error:
```
ValueError: unknown color specifier: 'hsv(0,100%,100%)'
```

This error indicates that the function does not recognize the `hsv` format, preventing proper color conversion.

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

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

--- BEGIN FILE ---
```
### src/PIL/ImageColor.py
#
# The Python Imaging Library
# $Id$
#
# map CSS3-style colour description strings to RGB
#
# History:
# 2002-10-24 fl   Added support for CSS-style color strings
# 2002-12-15 fl   Added RGBA support
# 2004-03-27 fl   Fixed remaining int() problems for Python 1.5.2
# 2004-07-19 fl   Fixed gray/grey spelling issues
# 2009-03-05 fl   Fixed rounding error in grayscale calculation
#
# Copyright (c) 2002-2004 by Secret Labs AB
# Copyright (c) 2002-2004 by Fredrik Lundh
#
# See the README file for information on usage and redistribution.
#

from . import Image
import re


def getrgb(color):
    """
     Convert a color string to an RGB tuple. If the string cannot be parsed,
     this function raises a :py:exc:`ValueError` exception.

    .. versionadded:: 1.1.4

    :param color: A color string
    :return: ``(red, green, blue[, alpha])``
    """
    color = color.lower()

    rgb = colormap.get(color, None)
    if rgb:
        if isinstance(rgb, tuple):
            return rgb
        colormap[color] = rgb = getrgb(rgb)
        return rgb

    # check for known string formats
    if re.match('#[a-f0-9]{3}$', color):
        return (
            int(color[1]*2, 16),
            int(color[2]*2, 16),
            int(color[3]*2, 16),
            )

    if re.match('#[a-f0-9]{4}$', color):
        return (
            int(color[1]*2, 16),
            int(color[2]*2, 16),
            int(color[3]*2, 16),
            int(color[4]*2, 16),
            )

    if re.match('#[a-f0-9]{6}$', color):
        return (
            int(color[1:3], 16),
            int(color[3:5], 16),
            int(color[5:7], 16),
            )

    if re.match('#[a-f0-9]{8}$', color):
        return (
            int(color[1:3], 16),
            int(color[3:5], 16),
            int(color[5:7], 16),
            int(color[7:9], 16),
            )

    m = re.match(r"rgb\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)$", color)
    if m:
        return (
            int(m.group(1)),
            int(m.group(2)),
            int(m.group(3))
            )

    m = re.match(r"rgb\(\s*(\d+)%\s*,\s*(\d+)%\s*,\s*(\d+)%\s*\)$", color)
    if m:
        return (
            int((int(m.group(1)) * 255) / 100.0 + 0.5),
            int((int(m.group(2)) * 255) / 100.0 + 0.5),
            int((int(m.group(3)) * 255) / 100.0 + 0.5)
            )

    m = re.match(r"hsl\(\s*(\d+\.?\d*)\s*,\s*(\d+\.?\d*)%\s*,\s*(\d+\.?\d*)%\s*\)$", color)
    if m:
        from colorsys import hls_to_rgb
        rgb = hls_to_rgb(
            float(m.group(1)) / 360.0,
            float(m.group(3)) / 100.0,
            float(m.group(2)) / 100.0,
            )
        return (
            int(rgb[0] * 255 + 0.5),
            int(rgb[1] * 255 + 0.5),
            int(rgb[2] * 255 + 0.5)
            )

    m = re.match(r"rgba\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)$",
                 color)
    if m:
        return (
            int(m.group(1)),
            int(m.group(2)),
            int(m.group(3)),
            int(m.group(4))
            )
    raise ValueError("unknown color specifier: %r" % color)


def getcolor(color, mode):
    """
    Same as :py:func:`~PIL.ImageColor.getrgb`, but converts the RGB value to a
    greyscale value if the mode is not color or a palette image. If the string
    cannot be parsed, this function raises a :py:exc:`ValueError` exception.

    .. versionadded:: 1.1.4

    :param color: A color string
    :return: ``(graylevel [, alpha]) or (red, green, blue[, alpha])``
    """
    # same as getrgb, but converts the result to the given mode
    color, alpha = getrgb(color), 255
    if len(color) == 4:
        color, alpha = color[0:3], color[3]

    if Image.getmodebase(mode) == "L":
        r, g, b = color
        color = (r*299 + g*587 + b*114)//1000
        if mode[-1] == 'A':
            return (color, alpha)
    else:
        if mode[-1] == 'A':
            return color + (alpha,)
    return color


colormap = {
    # X11 colour table from https://drafts.csswg.org/css-color-4/, with
    # gray/grey spelling issues fixed.  This is a superset of HTML 4.0
    # colour names used in CSS 1.
    "aliceblue": "#f0f8ff",
    "antiquewhite": "#faebd7",
    "aqua": "#00ffff",
    "aquamarine": "#7fffd4",
    "azure": "#f0ffff",
    "beige": "#f5f5dc",
    "bisque": "#ffe4c4",
    "black": "#000000",
    "blanchedalmond": "#ffebcd",
    "blue": "#0000ff",
    "blueviolet": "#8a2be2",
    "brown": "#a52a2a",
    "burlywood": "#deb887",
    "cadetblue": "#5f9ea0",
    "chartreuse": "#7fff00",
    "chocolate": "#d2691e",
    "coral": "#ff7f50",
    "cornflowerblue": "#6495ed",
    "cornsilk": "#fff8dc",
    "crimson": "#dc143c",
    "cyan": "#00ffff",
    "darkblue": "#00008b",
    "darkcyan": "#008b8b",
    "darkgoldenrod": "#b8860b",
    "darkgray": "#a9a9a9",
    "darkgrey": "#a9a9a9",
    "darkgreen": "#006400",
    "darkkhaki": "#bdb76b",
    "darkmagenta": "#8b008b",
    "darkolivegreen": "#556b2f",
    "darkorange": "#ff8c00",
    "darkorchid": "#9932cc",
    "darkred": "#8b0000",
    "darksalmon": "#e9967a",
    "darkseagreen": "#8fbc8f",
    "darkslateblue": "#483d8b",
    "darkslategray": "#2f4f4f",
    "darkslategrey": "#2f4f4f",
    "darkturquoise": "#00ced1",
    "darkviolet": "#9400d3",
    "deeppink": "#ff1493",
    "deepskyblue": "#00bfff",
    "dimgray": "#696969",
    "dimgrey": "#696969",
    "dodgerblue": "#1e90ff",
    "firebrick": "#b22222",
    "floralwhite": "#fffaf0",
    "forestgreen": "#228b22",
    "fuchsia": "#ff00ff",
    "gainsboro": "#dcdcdc",
    "ghostwhite": "#f8f8ff",
    "gold": "#ffd700",
    "goldenrod": "#daa520",
    "gray": "#808080",
    "grey": "#808080",
    "green": "#008000",
    "greenyellow": "#adff2f",
    "honeydew": "#f0fff0",
    "hotpink": "#ff69b4",
    "indianred": "#cd5c5c",
    "indigo": "#4b0082",
    "ivory": "#fffff0",
    "khaki": "#f0e68c",
    "lavender": "#e6e6fa",
    "lavenderblush": "#fff0f5",
    "lawngreen": "#7cfc00",
    "lemonchiffon": "#fffacd",
    "lightblue": "#add8e6",
    "lightcoral": "#f08080",
    "lightcyan": "#e0ffff",
    "lightgoldenrodyellow": "#fafad2",
    "lightgreen": "#90ee90",
    "lightgray": "#d3d3d3",
    "lightgrey": "#d3d3d3",
    "lightpink": "#ffb6c1",
    "lightsalmon": "#ffa07a",
    "lightseagreen": "#20b2aa",
    "lightskyblue": "#87cefa",
    "lightslategray": "#778899",
    "lightslategrey": "#778899",
    "lightsteelblue": "#b0c4de",
    "lightyellow": "#ffffe0",
    "lime": "#00ff00",
    "limegreen": "#32cd32",
    "linen": "#faf0e6",
    "magenta": "#ff00ff",
    "maroon": "#800000",
    "mediumaquamarine": "#66cdaa",
    "mediumblue": "#0000cd",
    "mediumorchid": "#ba55d3",
    "mediumpurple": "#9370db",
    "mediumseagreen": "#3cb371",
    "mediumslateblue": "#7b68ee",
    "mediumspringgreen": "#00fa9a",
    "mediumturquoise": "#48d1cc",
    "mediumvioletred": "#c71585",
    "midnightblue": "#191970",
    "mintcream": "#f5fffa",
    "mistyrose": "#ffe4e1",
    "moccasin": "#ffe4b5",
    "navajowhite": "#ffdead",
    "navy": "#000080",
    "oldlace": "#fdf5e6",
    "olive": "#808000",
    "olivedrab": "#6b8e23",
    "orange": "#ffa500",
    "orangered": "#ff4500",
    "orchid": "#da70d6",
    "palegoldenrod": "#eee8aa",
    "palegreen": "#98fb98",
    "paleturquoise": "#afeeee",
    "palevioletred": "#db7093",
    "papayawhip": "#ffefd5",
    "peachpuff": "#ffdab9",
    "peru": "#cd853f",
    "pink": "#ffc0cb",
    "plum": "#dda0dd",
    "powderblue": "#b0e0e6",
    "purple": "#800080",
    "rebeccapurple": "#663399",
    "red": "#ff0000",
    "rosybrown": "#bc8f8f",
    "royalblue": "#4169e1",
    "saddlebrown": "#8b4513",
    "salmon": "#fa8072",
    "sandybrown": "#f4a460",
    "seagreen": "#2e8b57",
    "seashell": "#fff5ee",
    "sienna": "#a0522d",
    "silver": "#c0c0c0",
    "skyblue": "#87ceeb",
    "slateblue": "#6a5acd",
    "slategray": "#708090",
    "slategrey": "#708090",
    "snow": "#fffafa",
    "springgreen": "#00ff7f",
    "steelblue": "#4682b4",
    "tan": "#d2b48c",
    "teal": "#008080",
    "thistle": "#d8bfd8",
    "tomato": "#ff6347",
    "turquoise": "#40e0d0",
    "violet": "#ee82ee",
    "wheat": "#f5deb3",
    "white": "#ffffff",
    "whitesmoke": "#f5f5f5",
    "yellow": "#ffff00",
    "yellowgreen": "#9acd32",
}

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