{
    "file_diffs": [
        {
            "old_file_content": "#\n# The Python Imaging Library.\n# $Id$\n#\n# standard filters\n#\n# History:\n# 1995-11-27 fl   Created\n# 2002-06-08 fl   Added rank and mode filters\n# 2003-09-15 fl   Fixed rank calculation in rank filter; added expand call\n#\n# Copyright (c) 1997-2003 by Secret Labs AB.\n# Copyright (c) 1995-2002 by Fredrik Lundh.\n#\n# See the README file for information on usage and redistribution.\n#\n\nfrom functools import reduce\n\n\nclass Filter(object):\n    pass\n\n\nclass Kernel(Filter):\n    \"\"\"\n    Create a convolution kernel.  The current version only\n    supports 3x3 and 5x5 integer and floating point kernels.\n\n    In the current version, kernels can only be applied to\n    \"L\" and \"RGB\" images.\n\n    :param size: Kernel size, given as (width, height). In the current\n                    version, this must be (3,3) or (5,5).\n    :param kernel: A sequence containing kernel weights.\n    :param scale: Scale factor. If given, the result for each pixel is\n                    divided by this value.  the default is the sum of the\n                    kernel weights.\n    :param offset: Offset. If given, this value is added to the result,\n                    after it has been divided by the scale factor.\n    \"\"\"\n\n    def __init__(self, size, kernel, scale=None, offset=0):\n        if scale is None:\n            # default scale is sum of kernel\n            scale = reduce(lambda a, b: a+b, kernel)\n        if size[0] * size[1] != len(kernel):\n            raise ValueError(\"not enough coefficients in kernel\")\n        self.filterargs = size, scale, offset, kernel\n\n    def filter(self, image):\n        if image.mode == \"P\":\n            raise ValueError(\"cannot filter palette images\")\n        return image.filter(*self.filterargs)\n\n\nclass BuiltinFilter(Kernel):\n    def __init__(self):\n        pass\n\n\nclass RankFilter(Filter):\n    \"\"\"\n    Create a rank filter.  The rank filter sorts all pixels in\n    a window of the given size, and returns the **rank**'th value.\n\n    :param size: The kernel size, in pixels.\n    :param rank: What pixel value to pick.  Use 0 for a min filter,\n                 ``size * size / 2`` for a median filter, ``size * size - 1``\n                 for a max filter, etc.\n    \"\"\"\n    name = \"Rank\"\n\n    def __init__(self, size, rank):\n        self.size = size\n        self.rank = rank\n\n    def filter(self, image):\n        if image.mode == \"P\":\n            raise ValueError(\"cannot filter palette images\")\n        image = image.expand(self.size//2, self.size//2)\n        return image.rankfilter(self.size, self.rank)\n\n\nclass MedianFilter(RankFilter):\n    \"\"\"\n    Create a median filter. Picks the median pixel value in a window with the\n    given size.\n\n    :param size: The kernel size, in pixels.\n    \"\"\"\n    name = \"Median\"\n\n    def __init__(self, size=3):\n        self.size = size\n        self.rank = size*size//2\n\n\nclass MinFilter(RankFilter):\n    \"\"\"\n    Create a min filter.  Picks the lowest pixel value in a window with the\n    given size.\n\n    :param size: The kernel size, in pixels.\n    \"\"\"\n    name = \"Min\"\n\n    def __init__(self, size=3):\n        self.size = size\n        self.rank = 0\n\n\nclass MaxFilter(RankFilter):\n    \"\"\"\n    Create a max filter.  Picks the largest pixel value in a window with the\n    given size.\n\n    :param size: The kernel size, in pixels.\n    \"\"\"\n    name = \"Max\"\n\n    def __init__(self, size=3):\n        self.size = size\n        self.rank = size*size-1\n\n\nclass ModeFilter(Filter):\n    \"\"\"\n\n    Create a mode filter. Picks the most frequent pixel value in a box with the\n    given size.  Pixel values that occur only once or twice are ignored; if no\n    pixel value occurs more than twice, the original pixel value is preserved.\n\n    :param size: The kernel size, in pixels.\n    \"\"\"\n    name = \"Mode\"\n\n    def __init__(self, size=3):\n        self.size = size\n\n    def filter(self, image):\n        return image.modefilter(self.size)\n\n\nclass GaussianBlur(Filter):\n    \"\"\"Gaussian blur filter.\n\n    :param radius: Blur radius.\n    \"\"\"\n    name = \"GaussianBlur\"\n\n    def __init__(self, radius=2, effective_scale=None):\n        self.radius = radius\n        self.effective_scale = effective_scale\n\n    def filter(self, image):\n        return image.gaussian_blur(self.radius, self.effective_scale)\n\n\nclass UnsharpMask(Filter):\n    \"\"\"Unsharp mask filter.\n\n    See Wikipedia's entry on `digital unsharp masking`_ for an explanation of\n    the parameters.\n\n    .. _digital unsharp masking:\n    https://en.wikipedia.org/wiki/Unsharp_masking#Digital_unsharp_masking\n    \"\"\"\n    name = \"UnsharpMask\"\n\n    def __init__(self, radius=2, percent=150, threshold=3):\n        self.radius = radius\n        self.percent = percent\n        self.threshold = threshold\n\n    def filter(self, image):\n        return image.unsharp_mask(self.radius, self.percent, self.threshold)\n\n\nclass BLUR(BuiltinFilter):\n    name = \"Blur\"\n    filterargs = (5, 5), 16, 0, (\n        1,  1,  1,  1,  1,\n        1,  0,  0,  0,  1,\n        1,  0,  0,  0,  1,\n        1,  0,  0,  0,  1,\n        1,  1,  1,  1,  1\n        )\n\n\nclass CONTOUR(BuiltinFilter):\n    name = \"Contour\"\n    filterargs = (3, 3), 1, 255, (\n        -1, -1, -1,\n        -1,  8, -1,\n        -1, -1, -1\n        )\n\n\nclass DETAIL(BuiltinFilter):\n    name = \"Detail\"\n    filterargs = (3, 3), 6, 0, (\n        0, -1,  0,\n        -1, 10, -1,\n        0, -1,  0\n        )\n\n\nclass EDGE_ENHANCE(BuiltinFilter):\n    name = \"Edge-enhance\"\n    filterargs = (3, 3), 2, 0, (\n        -1, -1, -1,\n        -1, 10, -1,\n        -1, -1, -1\n        )\n\n\nclass EDGE_ENHANCE_MORE(BuiltinFilter):\n    name = \"Edge-enhance More\"\n    filterargs = (3, 3), 1, 0, (\n        -1, -1, -1,\n        -1,  9, -1,\n        -1, -1, -1\n        )\n\n\nclass EMBOSS(BuiltinFilter):\n    name = \"Emboss\"\n    filterargs = (3, 3), 1, 128, (\n        -1,  0,  0,\n        0,  1,  0,\n        0,  0,  0\n        )\n\n\nclass FIND_EDGES(BuiltinFilter):\n    name = \"Find Edges\"\n    filterargs = (3, 3), 1, 0, (\n        -1, -1, -1,\n        -1,  8, -1,\n        -1, -1, -1\n        )\n\n\nclass SMOOTH(BuiltinFilter):\n    name = \"Smooth\"\n    filterargs = (3, 3), 13, 0, (\n        1,  1,  1,\n        1,  5,  1,\n        1,  1,  1\n        )\n\n\nclass SMOOTH_MORE(BuiltinFilter):\n    name = \"Smooth More\"\n    filterargs = (5, 5), 100, 0, (\n        1,  1,  1,  1,  1,\n        1,  5,  5,  5,  1,\n        1,  5, 44,  5,  1,\n        1,  5,  5,  5,  1,\n        1,  1,  1,  1,  1\n        )\n\n\nclass SHARPEN(BuiltinFilter):\n    name = \"Sharpen\"\n    filterargs = (3, 3), 16, 0, (\n        -2, -2, -2,\n        -2, 32, -2,\n        -2, -2, -2\n        )\n",
            "new_file_content": "#\n# The Python Imaging Library.\n# $Id$\n#\n# standard filters\n#\n# History:\n# 1995-11-27 fl   Created\n# 2002-06-08 fl   Added rank and mode filters\n# 2003-09-15 fl   Fixed rank calculation in rank filter; added expand call\n#\n# Copyright (c) 1997-2003 by Secret Labs AB.\n# Copyright (c) 1995-2002 by Fredrik Lundh.\n#\n# See the README file for information on usage and redistribution.\n#\n\nfrom functools import reduce\n\n\nclass Filter(object):\n    pass\n\n\nclass Kernel(Filter):\n    \"\"\"\n    Create a convolution kernel.  The current version only\n    supports 3x3 and 5x5 integer and floating point kernels.\n\n    In the current version, kernels can only be applied to\n    \"L\" and \"RGB\" images.\n\n    :param size: Kernel size, given as (width, height). In the current\n                    version, this must be (3,3) or (5,5).\n    :param kernel: A sequence containing kernel weights.\n    :param scale: Scale factor. If given, the result for each pixel is\n                    divided by this value.  the default is the sum of the\n                    kernel weights.\n    :param offset: Offset. If given, this value is added to the result,\n                    after it has been divided by the scale factor.\n    \"\"\"\n\n    def __init__(self, size, kernel, scale=None, offset=0):\n        if scale is None:\n            # default scale is sum of kernel\n            scale = reduce(lambda a, b: a+b, kernel)\n        if size[0] * size[1] != len(kernel):\n            raise ValueError(\"not enough coefficients in kernel\")\n        self.filterargs = size, scale, offset, kernel\n\n    def filter(self, image):\n        if image.mode == \"P\":\n            raise ValueError(\"cannot filter palette images\")\n        return image.filter(*self.filterargs)\n\n\nclass BuiltinFilter(Kernel):\n    def __init__(self):\n        pass\n\n\nclass RankFilter(Filter):\n    \"\"\"\n    Create a rank filter.  The rank filter sorts all pixels in\n    a window of the given size, and returns the **rank**'th value.\n\n    :param size: The kernel size, in pixels.\n    :param rank: What pixel value to pick.  Use 0 for a min filter,\n                 ``size * size / 2`` for a median filter, ``size * size - 1``\n                 for a max filter, etc.\n    \"\"\"\n    name = \"Rank\"\n\n    def __init__(self, size, rank):\n        self.size = size\n        self.rank = rank\n\n    def filter(self, image):\n        if image.mode == \"P\":\n            raise ValueError(\"cannot filter palette images\")\n        image = image.expand(self.size//2, self.size//2)\n        return image.rankfilter(self.size, self.rank)\n\n\nclass MedianFilter(RankFilter):\n    \"\"\"\n    Create a median filter. Picks the median pixel value in a window with the\n    given size.\n\n    :param size: The kernel size, in pixels.\n    \"\"\"\n    name = \"Median\"\n\n    def __init__(self, size=3):\n        self.size = size\n        self.rank = size*size//2\n\n\nclass MinFilter(RankFilter):\n    \"\"\"\n    Create a min filter.  Picks the lowest pixel value in a window with the\n    given size.\n\n    :param size: The kernel size, in pixels.\n    \"\"\"\n    name = \"Min\"\n\n    def __init__(self, size=3):\n        self.size = size\n        self.rank = 0\n\n\nclass MaxFilter(RankFilter):\n    \"\"\"\n    Create a max filter.  Picks the largest pixel value in a window with the\n    given size.\n\n    :param size: The kernel size, in pixels.\n    \"\"\"\n    name = \"Max\"\n\n    def __init__(self, size=3):\n        self.size = size\n        self.rank = size*size-1\n\n\nclass ModeFilter(Filter):\n    \"\"\"\n\n    Create a mode filter. Picks the most frequent pixel value in a box with the\n    given size.  Pixel values that occur only once or twice are ignored; if no\n    pixel value occurs more than twice, the original pixel value is preserved.\n\n    :param size: The kernel size, in pixels.\n    \"\"\"\n    name = \"Mode\"\n\n    def __init__(self, size=3):\n        self.size = size\n\n    def filter(self, image):\n        return image.modefilter(self.size)\n\n\nclass GaussianBlur(Filter):\n    \"\"\"Gaussian blur filter.\n\n    :param radius: Blur radius.\n    \"\"\"\n    name = \"GaussianBlur\"\n\n    def __init__(self, radius=2, effective_scale=None):\n        self.radius = radius\n        self.effective_scale = effective_scale\n\n    def filter(self, image):\n        return image.gaussian_blur(self.radius, self.effective_scale or 2.6)\n\n\nclass UnsharpMask(Filter):\n    \"\"\"Unsharp mask filter.\n\n    See Wikipedia's entry on `digital unsharp masking`_ for an explanation of\n    the parameters.\n\n    .. _digital unsharp masking:\n    https://en.wikipedia.org/wiki/Unsharp_masking#Digital_unsharp_masking\n    \"\"\"\n    name = \"UnsharpMask\"\n\n    def __init__(self, radius=2, percent=150, threshold=3):\n        self.radius = radius\n        self.percent = percent\n        self.threshold = threshold\n\n    def filter(self, image):\n        return image.unsharp_mask(self.radius, self.percent, self.threshold)\n\n\nclass BLUR(BuiltinFilter):\n    name = \"Blur\"\n    filterargs = (5, 5), 16, 0, (\n        1,  1,  1,  1,  1,\n        1,  0,  0,  0,  1,\n        1,  0,  0,  0,  1,\n        1,  0,  0,  0,  1,\n        1,  1,  1,  1,  1\n        )\n\n\nclass CONTOUR(BuiltinFilter):\n    name = \"Contour\"\n    filterargs = (3, 3), 1, 255, (\n        -1, -1, -1,\n        -1,  8, -1,\n        -1, -1, -1\n        )\n\n\nclass DETAIL(BuiltinFilter):\n    name = \"Detail\"\n    filterargs = (3, 3), 6, 0, (\n        0, -1,  0,\n        -1, 10, -1,\n        0, -1,  0\n        )\n\n\nclass EDGE_ENHANCE(BuiltinFilter):\n    name = \"Edge-enhance\"\n    filterargs = (3, 3), 2, 0, (\n        -1, -1, -1,\n        -1, 10, -1,\n        -1, -1, -1\n        )\n\n\nclass EDGE_ENHANCE_MORE(BuiltinFilter):\n    name = \"Edge-enhance More\"\n    filterargs = (3, 3), 1, 0, (\n        -1, -1, -1,\n        -1,  9, -1,\n        -1, -1, -1\n        )\n\n\nclass EMBOSS(BuiltinFilter):\n    name = \"Emboss\"\n    filterargs = (3, 3), 1, 128, (\n        -1,  0,  0,\n        0,  1,  0,\n        0,  0,  0\n        )\n\n\nclass FIND_EDGES(BuiltinFilter):\n    name = \"Find Edges\"\n    filterargs = (3, 3), 1, 0, (\n        -1, -1, -1,\n        -1,  8, -1,\n        -1, -1, -1\n        )\n\n\nclass SMOOTH(BuiltinFilter):\n    name = \"Smooth\"\n    filterargs = (3, 3), 13, 0, (\n        1,  1,  1,\n        1,  5,  1,\n        1,  1,  1\n        )\n\n\nclass SMOOTH_MORE(BuiltinFilter):\n    name = \"Smooth More\"\n    filterargs = (5, 5), 100, 0, (\n        1,  1,  1,  1,  1,\n        1,  5,  5,  5,  1,\n        1,  5, 44,  5,  1,\n        1,  5,  5,  5,  1,\n        1,  1,  1,  1,  1\n        )\n\n\nclass SHARPEN(BuiltinFilter):\n    name = \"Sharpen\"\n    filterargs = (3, 3), 16, 0, (\n        -2, -2, -2,\n        -2, 32, -2,\n        -2, -2, -2\n        )\n",
            "header": {
                "file": {
                    "path": "PIL/ImageFilter.py"
                },
                "misc_line": null
            },
            "index_line": {
                "old_commit_hash": "fed165831",
                "new_commit_hash": "e3b867737",
                "mode": "100644"
            },
            "is_binary_file": false,
            "binary_line": null,
            "minus_file": {
                "path": "a/PIL/ImageFilter.py"
            },
            "plus_file": {
                "path": "b/PIL/ImageFilter.py"
            },
            "hunks": [
                {
                    "descriptor": {
                        "old_range": {
                            "start": 154,
                            "length": 7
                        },
                        "new_range": {
                            "start": 154,
                            "length": 7
                        },
                        "section": "class GaussianBlur(Filter):"
                    },
                    "line_group": {
                        "all_lines": [
                            {
                                "content": "        self.effective_scale = effective_scale",
                                "type": "context"
                            },
                            {
                                "content": "",
                                "type": "context"
                            },
                            {
                                "content": "    def filter(self, image):",
                                "type": "context"
                            },
                            {
                                "content": "        return image.gaussian_blur(self.radius, self.effective_scale)",
                                "type": "deleted"
                            },
                            {
                                "content": "        return image.gaussian_blur(self.radius, self.effective_scale or 2.6)",
                                "type": "added"
                            },
                            {
                                "content": "",
                                "type": "context"
                            },
                            {
                                "content": "",
                                "type": "context"
                            },
                            {
                                "content": "class UnsharpMask(Filter):",
                                "type": "context"
                            }
                        ]
                    },
                    "modified_entities": [
                        {
                            "file_name": "PIL/ImageFilter.py",
                            "type": "class",
                            "name": "GaussianBlur",
                            "content": "class GaussianBlur(Filter):\n    \"\"\"Gaussian blur filter.\n\n    :param radius: Blur radius.\n    \"\"\"\n    name = \"GaussianBlur\"\n\n    def __init__(self, radius=2, effective_scale=None):\n        self.radius = radius\n        self.effective_scale = effective_scale\n\n    def filter(self, image):\n        return image.gaussian_blur(self.radius, self.effective_scale)",
                            "ast_type_str": "ClassDef",
                            "start_lineno": 145,
                            "end_lineno": 157,
                            "parent": null
                        },
                        {
                            "file_name": "PIL/ImageFilter.py",
                            "type": "method",
                            "name": "GaussianBlur.filter",
                            "content": "class GaussianBlur(Filter):\n    \"\"\"Gaussian blur filter.\n\n    :param radius: Blur radius.\n    \"\"\"\n    name = \"GaussianBlur\"\n\n    def __init__(self, radius=2, effective_scale=None):\n        self.radius = radius\n        self.effective_scale = effective_scale\n\n    def filter(self, image):\n        return image.gaussian_blur(self.radius, self.effective_scale)",
                            "ast_type_str": "ClassDef",
                            "start_lineno": 156,
                            "end_lineno": 157,
                            "parent": {
                                "file_name": "PIL/ImageFilter.py",
                                "type": "class",
                                "name": "GaussianBlur",
                                "content": "class GaussianBlur(Filter):\n    \"\"\"Gaussian blur filter.\n\n    :param radius: Blur radius.\n    \"\"\"\n    name = \"GaussianBlur\"\n\n    def __init__(self, radius=2, effective_scale=None):\n        self.radius = radius\n        self.effective_scale = effective_scale\n\n    def filter(self, image):\n        return image.gaussian_blur(self.radius, self.effective_scale)",
                                "ast_type_str": "ClassDef",
                                "start_lineno": 145,
                                "end_lineno": 157,
                                "parent": null
                            }
                        }
                    ],
                    "added_entities": [],
                    "deleted_entities": []
                }
            ]
        },
        {
            "old_file_content": "from helper import unittest, PillowTestCase\n\nfrom PIL import Image\nfrom PIL import ImageOps\nfrom PIL import ImageFilter\n\nim = Image.open(\"Tests/images/hopper.ppm\")\nsnakes = Image.open(\"Tests/images/color_snakes.png\")\n\n\nclass TestImageOpsUsm(PillowTestCase):\n\n    def test_ops_api(self):\n\n        i = ImageOps.gaussian_blur(im, 2.0)\n        self.assertEqual(i.mode, \"RGB\")\n        self.assertEqual(i.size, (128, 128))\n        # i.save(\"blur.bmp\")\n\n        i = ImageOps.unsharp_mask(im, 2.0, 125, 8)\n        self.assertEqual(i.mode, \"RGB\")\n        self.assertEqual(i.size, (128, 128))\n        # i.save(\"usm.bmp\")\n\n    def test_filter_api(self):\n\n        filter = ImageFilter.GaussianBlur(2.0)\n        i = im.filter(filter)\n        self.assertEqual(i.mode, \"RGB\")\n        self.assertEqual(i.size, (128, 128))\n\n        filter = ImageFilter.UnsharpMask(2.0, 125, 8)\n        i = im.filter(filter)\n        self.assertEqual(i.mode, \"RGB\")\n        self.assertEqual(i.size, (128, 128))\n\n    def test_usm_formats(self):\n\n        usm = ImageOps.unsharp_mask\n        self.assertRaises(ValueError, lambda: usm(im.convert(\"1\")))\n        usm(im.convert(\"L\"))\n        self.assertRaises(ValueError, lambda: usm(im.convert(\"I\")))\n        self.assertRaises(ValueError, lambda: usm(im.convert(\"F\")))\n        usm(im.convert(\"RGB\"))\n        usm(im.convert(\"RGBA\"))\n        usm(im.convert(\"CMYK\"))\n        self.assertRaises(ValueError, lambda: usm(im.convert(\"YCbCr\")))\n\n    def test_blur_formats(self):\n\n        blur = ImageOps.gaussian_blur\n        self.assertRaises(ValueError, lambda: blur(im.convert(\"1\")))\n        blur(im.convert(\"L\"))\n        self.assertRaises(ValueError, lambda: blur(im.convert(\"I\")))\n        self.assertRaises(ValueError, lambda: blur(im.convert(\"F\")))\n        blur(im.convert(\"RGB\"))\n        blur(im.convert(\"RGBA\"))\n        blur(im.convert(\"CMYK\"))\n        self.assertRaises(ValueError, lambda: blur(im.convert(\"YCbCr\")))\n\n    def test_usm_accuracy(self):\n\n        i = snakes._new(ImageOps.unsharp_mask(snakes, 5, 1024, 0))\n        # Image should not be changed because it have only 0 and 255 levels.\n        self.assertEqual(i.tobytes(), snakes.tobytes())\n\n    def test_blur_accuracy(self):\n\n        i = snakes._new(ImageOps.gaussian_blur(snakes, 1))\n        # Alpha channel must match whole.\n        self.assertEqual(i.split()[3], snakes.split()[3])\n        # These pixels surrounded with pixels with 255 intensity.\n        # They must be 255.\n        for x, y, c in [(1, 0, 1), (2, 0, 1), (7, 8, 1), (8, 8, 1), (2, 9, 1),\n                        (7, 3, 0), (8, 3, 0), (5, 8, 0), (5, 9, 0), (1, 3, 0),\n                        (4, 3, 2), (4, 2, 2)]:\n            self.assertEqual(i.im.getpixel((x, y))[c], 255)\n        # Fuzzy match.\n        gp = lambda x, y: i.im.getpixel((x, y))\n        self.assertTrue(211 <= gp(7, 4)[0] <= 213)\n        self.assertTrue(211 <= gp(7, 5)[2] <= 213)\n        self.assertTrue(211 <= gp(7, 6)[2] <= 213)\n        self.assertTrue(211 <= gp(7, 7)[1] <= 213)\n        self.assertTrue(211 <= gp(8, 4)[0] <= 213)\n        self.assertTrue(211 <= gp(8, 5)[2] <= 213)\n        self.assertTrue(211 <= gp(8, 6)[2] <= 213)\n        self.assertTrue(211 <= gp(8, 7)[1] <= 213)\n\nif __name__ == '__main__':\n    unittest.main()\n\n# End of file\n",
            "new_file_content": "from helper import unittest, PillowTestCase\n\nfrom PIL import Image\nfrom PIL import ImageOps\nfrom PIL import ImageFilter\n\nim = Image.open(\"Tests/images/hopper.ppm\")\nsnakes = Image.open(\"Tests/images/color_snakes.png\")\n\n\nclass TestImageOpsUsm(PillowTestCase):\n\n    def test_ops_api(self):\n\n        i = ImageOps.gaussian_blur(im, 2.0)\n        self.assertEqual(i.mode, \"RGB\")\n        self.assertEqual(i.size, (128, 128))\n        # i.save(\"blur.bmp\")\n\n        i = ImageOps.unsharp_mask(im, 2.0, 125, 8)\n        self.assertEqual(i.mode, \"RGB\")\n        self.assertEqual(i.size, (128, 128))\n        # i.save(\"usm.bmp\")\n\n    def test_filter_api(self):\n\n        filter = ImageFilter.GaussianBlur(2.0)\n        i = im.filter(filter)\n        self.assertEqual(i.mode, \"RGB\")\n        self.assertEqual(i.size, (128, 128))\n\n        filter = ImageFilter.UnsharpMask(2.0, 125, 8)\n        i = im.filter(filter)\n        self.assertEqual(i.mode, \"RGB\")\n        self.assertEqual(i.size, (128, 128))\n\n    def test_usm_formats(self):\n\n        usm = ImageOps.unsharp_mask\n        self.assertRaises(ValueError, lambda: usm(im.convert(\"1\")))\n        usm(im.convert(\"L\"))\n        self.assertRaises(ValueError, lambda: usm(im.convert(\"I\")))\n        self.assertRaises(ValueError, lambda: usm(im.convert(\"F\")))\n        usm(im.convert(\"RGB\"))\n        usm(im.convert(\"RGBA\"))\n        usm(im.convert(\"CMYK\"))\n        self.assertRaises(ValueError, lambda: usm(im.convert(\"YCbCr\")))\n\n    def test_blur_formats(self):\n\n        blur = ImageOps.gaussian_blur\n        self.assertRaises(ValueError, lambda: blur(im.convert(\"1\")))\n        blur(im.convert(\"L\"))\n        self.assertRaises(ValueError, lambda: blur(im.convert(\"I\")))\n        self.assertRaises(ValueError, lambda: blur(im.convert(\"F\")))\n        blur(im.convert(\"RGB\"))\n        blur(im.convert(\"RGBA\"))\n        blur(im.convert(\"CMYK\"))\n        self.assertRaises(ValueError, lambda: blur(im.convert(\"YCbCr\")))\n\n    def test_usm_accuracy(self):\n\n        i = snakes._new(ImageOps.unsharp_mask(snakes, 5, 1024, 0))\n        # Image should not be changed because it have only 0 and 255 levels.\n        self.assertEqual(i.tobytes(), snakes.tobytes())\n\n    def test_blur_accuracy(self):\n\n        i = snakes._new(ImageOps.gaussian_blur(snakes, .7))\n        # Alpha channel must match whole.\n        self.assertEqual(i.split()[3], snakes.split()[3])\n        # These pixels surrounded with pixels with 255 intensity.\n        # They must be very close to 255.\n        for x, y, c in [(1, 0, 1), (2, 0, 1), (7, 8, 1), (8, 8, 1), (2, 9, 1),\n                        (7, 3, 0), (8, 3, 0), (5, 8, 0), (5, 9, 0), (1, 3, 0),\n                        (4, 3, 2), (4, 2, 2)]:\n            self.assertGreaterEqual(i.im.getpixel((x, y))[c], 250)\n        # Fuzzy match.\n        gp = lambda x, y: i.im.getpixel((x, y))\n        self.assertTrue(211 <= gp(7, 4)[0] <= 213)\n        self.assertTrue(211 <= gp(7, 5)[2] <= 213)\n        self.assertTrue(211 <= gp(7, 6)[2] <= 213)\n        self.assertTrue(211 <= gp(7, 7)[1] <= 213)\n        self.assertTrue(211 <= gp(8, 4)[0] <= 213)\n        self.assertTrue(211 <= gp(8, 5)[2] <= 213)\n        self.assertTrue(211 <= gp(8, 6)[2] <= 213)\n        self.assertTrue(211 <= gp(8, 7)[1] <= 213)\n\nif __name__ == '__main__':\n    unittest.main()\n\n# End of file\n",
            "header": {
                "file": {
                    "path": "Tests/test_imageops_usm.py"
                },
                "misc_line": null
            },
            "index_line": {
                "old_commit_hash": "5164af015",
                "new_commit_hash": "4645b3d6e",
                "mode": "100644"
            },
            "is_binary_file": false,
            "binary_line": null,
            "minus_file": {
                "path": "a/Tests/test_imageops_usm.py"
            },
            "plus_file": {
                "path": "b/Tests/test_imageops_usm.py"
            },
            "hunks": [
                {
                    "descriptor": {
                        "old_range": {
                            "start": 66,
                            "length": 15
                        },
                        "new_range": {
                            "start": 66,
                            "length": 15
                        },
                        "section": "class TestImageOpsUsm(PillowTestCase):"
                    },
                    "line_group": {
                        "all_lines": [
                            {
                                "content": "",
                                "type": "context"
                            },
                            {
                                "content": "    def test_blur_accuracy(self):",
                                "type": "context"
                            },
                            {
                                "content": "",
                                "type": "context"
                            },
                            {
                                "content": "        i = snakes._new(ImageOps.gaussian_blur(snakes, 1))",
                                "type": "deleted"
                            },
                            {
                                "content": "        i = snakes._new(ImageOps.gaussian_blur(snakes, .7))",
                                "type": "added"
                            },
                            {
                                "content": "        # Alpha channel must match whole.",
                                "type": "context"
                            },
                            {
                                "content": "        self.assertEqual(i.split()[3], snakes.split()[3])",
                                "type": "context"
                            },
                            {
                                "content": "        # These pixels surrounded with pixels with 255 intensity.",
                                "type": "context"
                            },
                            {
                                "content": "        # They must be 255.",
                                "type": "deleted"
                            },
                            {
                                "content": "        # They must be very close to 255.",
                                "type": "added"
                            },
                            {
                                "content": "        for x, y, c in [(1, 0, 1), (2, 0, 1), (7, 8, 1), (8, 8, 1), (2, 9, 1),",
                                "type": "context"
                            },
                            {
                                "content": "                        (7, 3, 0), (8, 3, 0), (5, 8, 0), (5, 9, 0), (1, 3, 0),",
                                "type": "context"
                            },
                            {
                                "content": "                        (4, 3, 2), (4, 2, 2)]:",
                                "type": "context"
                            },
                            {
                                "content": "            self.assertEqual(i.im.getpixel((x, y))[c], 255)",
                                "type": "deleted"
                            },
                            {
                                "content": "            self.assertGreaterEqual(i.im.getpixel((x, y))[c], 250)",
                                "type": "added"
                            },
                            {
                                "content": "        # Fuzzy match.",
                                "type": "context"
                            },
                            {
                                "content": "        gp = lambda x, y: i.im.getpixel((x, y))",
                                "type": "context"
                            },
                            {
                                "content": "        self.assertTrue(211 <= gp(7, 4)[0] <= 213)",
                                "type": "context"
                            },
                            {
                                "content": "",
                                "type": "context"
                            }
                        ]
                    },
                    "modified_entities": [
                        {
                            "file_name": "Tests/test_imageops_usm.py",
                            "type": "class",
                            "name": "TestImageOpsUsm",
                            "content": "class TestImageOpsUsm(PillowTestCase):\n\n    def test_ops_api(self):\n\n        i = ImageOps.gaussian_blur(im, 2.0)\n        self.assertEqual(i.mode, \"RGB\")\n        self.assertEqual(i.size, (128, 128))\n        # i.save(\"blur.bmp\")\n\n        i = ImageOps.unsharp_mask(im, 2.0, 125, 8)\n        self.assertEqual(i.mode, \"RGB\")\n        self.assertEqual(i.size, (128, 128))\n        # i.save(\"usm.bmp\")\n\n    def test_filter_api(self):\n\n        filter = ImageFilter.GaussianBlur(2.0)\n        i = im.filter(filter)\n        self.assertEqual(i.mode, \"RGB\")\n        self.assertEqual(i.size, (128, 128))\n\n        filter = ImageFilter.UnsharpMask(2.0, 125, 8)\n        i = im.filter(filter)\n        self.assertEqual(i.mode, \"RGB\")\n        self.assertEqual(i.size, (128, 128))\n\n    def test_usm_formats(self):\n\n        usm = ImageOps.unsharp_mask\n        self.assertRaises(ValueError, lambda: usm(im.convert(\"1\")))\n        usm(im.convert(\"L\"))\n        self.assertRaises(ValueError, lambda: usm(im.convert(\"I\")))\n        self.assertRaises(ValueError, lambda: usm(im.convert(\"F\")))\n        usm(im.convert(\"RGB\"))\n        usm(im.convert(\"RGBA\"))\n        usm(im.convert(\"CMYK\"))\n        self.assertRaises(ValueError, lambda: usm(im.convert(\"YCbCr\")))\n\n    def test_blur_formats(self):\n\n        blur = ImageOps.gaussian_blur\n        self.assertRaises(ValueError, lambda: blur(im.convert(\"1\")))\n        blur(im.convert(\"L\"))\n        self.assertRaises(ValueError, lambda: blur(im.convert(\"I\")))\n        self.assertRaises(ValueError, lambda: blur(im.convert(\"F\")))\n        blur(im.convert(\"RGB\"))\n        blur(im.convert(\"RGBA\"))\n        blur(im.convert(\"CMYK\"))\n        self.assertRaises(ValueError, lambda: blur(im.convert(\"YCbCr\")))\n\n    def test_usm_accuracy(self):\n\n        i = snakes._new(ImageOps.unsharp_mask(snakes, 5, 1024, 0))\n        # Image should not be changed because it have only 0 and 255 levels.\n        self.assertEqual(i.tobytes(), snakes.tobytes())\n\n    def test_blur_accuracy(self):\n\n        i = snakes._new(ImageOps.gaussian_blur(snakes, 1))\n        # Alpha channel must match whole.\n        self.assertEqual(i.split()[3], snakes.split()[3])\n        # These pixels surrounded with pixels with 255 intensity.\n        # They must be 255.\n        for x, y, c in [(1, 0, 1), (2, 0, 1), (7, 8, 1), (8, 8, 1), (2, 9, 1),\n                        (7, 3, 0), (8, 3, 0), (5, 8, 0), (5, 9, 0), (1, 3, 0),\n                        (4, 3, 2), (4, 2, 2)]:\n            self.assertEqual(i.im.getpixel((x, y))[c], 255)\n        # Fuzzy match.\n        gp = lambda x, y: i.im.getpixel((x, y))\n        self.assertTrue(211 <= gp(7, 4)[0] <= 213)\n        self.assertTrue(211 <= gp(7, 5)[2] <= 213)\n        self.assertTrue(211 <= gp(7, 6)[2] <= 213)\n        self.assertTrue(211 <= gp(7, 7)[1] <= 213)\n        self.assertTrue(211 <= gp(8, 4)[0] <= 213)\n        self.assertTrue(211 <= gp(8, 5)[2] <= 213)\n        self.assertTrue(211 <= gp(8, 6)[2] <= 213)\n        self.assertTrue(211 <= gp(8, 7)[1] <= 213)",
                            "ast_type_str": "ClassDef",
                            "start_lineno": 11,
                            "end_lineno": 87,
                            "parent": null
                        },
                        {
                            "file_name": "Tests/test_imageops_usm.py",
                            "type": "method",
                            "name": "TestImageOpsUsm.test_blur_accuracy",
                            "content": "class TestImageOpsUsm(PillowTestCase):\n\n    def test_ops_api(self):\n\n        i = ImageOps.gaussian_blur(im, 2.0)\n        self.assertEqual(i.mode, \"RGB\")\n        self.assertEqual(i.size, (128, 128))\n        # i.save(\"blur.bmp\")\n\n        i = ImageOps.unsharp_mask(im, 2.0, 125, 8)\n        self.assertEqual(i.mode, \"RGB\")\n        self.assertEqual(i.size, (128, 128))\n        # i.save(\"usm.bmp\")\n\n    def test_filter_api(self):\n\n        filter = ImageFilter.GaussianBlur(2.0)\n        i = im.filter(filter)\n        self.assertEqual(i.mode, \"RGB\")\n        self.assertEqual(i.size, (128, 128))\n\n        filter = ImageFilter.UnsharpMask(2.0, 125, 8)\n        i = im.filter(filter)\n        self.assertEqual(i.mode, \"RGB\")\n        self.assertEqual(i.size, (128, 128))\n\n    def test_usm_formats(self):\n\n        usm = ImageOps.unsharp_mask\n        self.assertRaises(ValueError, lambda: usm(im.convert(\"1\")))\n        usm(im.convert(\"L\"))\n        self.assertRaises(ValueError, lambda: usm(im.convert(\"I\")))\n        self.assertRaises(ValueError, lambda: usm(im.convert(\"F\")))\n        usm(im.convert(\"RGB\"))\n        usm(im.convert(\"RGBA\"))\n        usm(im.convert(\"CMYK\"))\n        self.assertRaises(ValueError, lambda: usm(im.convert(\"YCbCr\")))\n\n    def test_blur_formats(self):\n\n        blur = ImageOps.gaussian_blur\n        self.assertRaises(ValueError, lambda: blur(im.convert(\"1\")))\n        blur(im.convert(\"L\"))\n        self.assertRaises(ValueError, lambda: blur(im.convert(\"I\")))\n        self.assertRaises(ValueError, lambda: blur(im.convert(\"F\")))\n        blur(im.convert(\"RGB\"))\n        blur(im.convert(\"RGBA\"))\n        blur(im.convert(\"CMYK\"))\n        self.assertRaises(ValueError, lambda: blur(im.convert(\"YCbCr\")))\n\n    def test_usm_accuracy(self):\n\n        i = snakes._new(ImageOps.unsharp_mask(snakes, 5, 1024, 0))\n        # Image should not be changed because it have only 0 and 255 levels.\n        self.assertEqual(i.tobytes(), snakes.tobytes())\n\n    def test_blur_accuracy(self):\n\n        i = snakes._new(ImageOps.gaussian_blur(snakes, 1))\n        # Alpha channel must match whole.\n        self.assertEqual(i.split()[3], snakes.split()[3])\n        # These pixels surrounded with pixels with 255 intensity.\n        # They must be 255.\n        for x, y, c in [(1, 0, 1), (2, 0, 1), (7, 8, 1), (8, 8, 1), (2, 9, 1),\n                        (7, 3, 0), (8, 3, 0), (5, 8, 0), (5, 9, 0), (1, 3, 0),\n                        (4, 3, 2), (4, 2, 2)]:\n            self.assertEqual(i.im.getpixel((x, y))[c], 255)\n        # Fuzzy match.\n        gp = lambda x, y: i.im.getpixel((x, y))\n        self.assertTrue(211 <= gp(7, 4)[0] <= 213)\n        self.assertTrue(211 <= gp(7, 5)[2] <= 213)\n        self.assertTrue(211 <= gp(7, 6)[2] <= 213)\n        self.assertTrue(211 <= gp(7, 7)[1] <= 213)\n        self.assertTrue(211 <= gp(8, 4)[0] <= 213)\n        self.assertTrue(211 <= gp(8, 5)[2] <= 213)\n        self.assertTrue(211 <= gp(8, 6)[2] <= 213)\n        self.assertTrue(211 <= gp(8, 7)[1] <= 213)",
                            "ast_type_str": "ClassDef",
                            "start_lineno": 67,
                            "end_lineno": 87,
                            "parent": {
                                "file_name": "Tests/test_imageops_usm.py",
                                "type": "class",
                                "name": "TestImageOpsUsm",
                                "content": "class TestImageOpsUsm(PillowTestCase):\n\n    def test_ops_api(self):\n\n        i = ImageOps.gaussian_blur(im, 2.0)\n        self.assertEqual(i.mode, \"RGB\")\n        self.assertEqual(i.size, (128, 128))\n        # i.save(\"blur.bmp\")\n\n        i = ImageOps.unsharp_mask(im, 2.0, 125, 8)\n        self.assertEqual(i.mode, \"RGB\")\n        self.assertEqual(i.size, (128, 128))\n        # i.save(\"usm.bmp\")\n\n    def test_filter_api(self):\n\n        filter = ImageFilter.GaussianBlur(2.0)\n        i = im.filter(filter)\n        self.assertEqual(i.mode, \"RGB\")\n        self.assertEqual(i.size, (128, 128))\n\n        filter = ImageFilter.UnsharpMask(2.0, 125, 8)\n        i = im.filter(filter)\n        self.assertEqual(i.mode, \"RGB\")\n        self.assertEqual(i.size, (128, 128))\n\n    def test_usm_formats(self):\n\n        usm = ImageOps.unsharp_mask\n        self.assertRaises(ValueError, lambda: usm(im.convert(\"1\")))\n        usm(im.convert(\"L\"))\n        self.assertRaises(ValueError, lambda: usm(im.convert(\"I\")))\n        self.assertRaises(ValueError, lambda: usm(im.convert(\"F\")))\n        usm(im.convert(\"RGB\"))\n        usm(im.convert(\"RGBA\"))\n        usm(im.convert(\"CMYK\"))\n        self.assertRaises(ValueError, lambda: usm(im.convert(\"YCbCr\")))\n\n    def test_blur_formats(self):\n\n        blur = ImageOps.gaussian_blur\n        self.assertRaises(ValueError, lambda: blur(im.convert(\"1\")))\n        blur(im.convert(\"L\"))\n        self.assertRaises(ValueError, lambda: blur(im.convert(\"I\")))\n        self.assertRaises(ValueError, lambda: blur(im.convert(\"F\")))\n        blur(im.convert(\"RGB\"))\n        blur(im.convert(\"RGBA\"))\n        blur(im.convert(\"CMYK\"))\n        self.assertRaises(ValueError, lambda: blur(im.convert(\"YCbCr\")))\n\n    def test_usm_accuracy(self):\n\n        i = snakes._new(ImageOps.unsharp_mask(snakes, 5, 1024, 0))\n        # Image should not be changed because it have only 0 and 255 levels.\n        self.assertEqual(i.tobytes(), snakes.tobytes())\n\n    def test_blur_accuracy(self):\n\n        i = snakes._new(ImageOps.gaussian_blur(snakes, 1))\n        # Alpha channel must match whole.\n        self.assertEqual(i.split()[3], snakes.split()[3])\n        # These pixels surrounded with pixels with 255 intensity.\n        # They must be 255.\n        for x, y, c in [(1, 0, 1), (2, 0, 1), (7, 8, 1), (8, 8, 1), (2, 9, 1),\n                        (7, 3, 0), (8, 3, 0), (5, 8, 0), (5, 9, 0), (1, 3, 0),\n                        (4, 3, 2), (4, 2, 2)]:\n            self.assertEqual(i.im.getpixel((x, y))[c], 255)\n        # Fuzzy match.\n        gp = lambda x, y: i.im.getpixel((x, y))\n        self.assertTrue(211 <= gp(7, 4)[0] <= 213)\n        self.assertTrue(211 <= gp(7, 5)[2] <= 213)\n        self.assertTrue(211 <= gp(7, 6)[2] <= 213)\n        self.assertTrue(211 <= gp(7, 7)[1] <= 213)\n        self.assertTrue(211 <= gp(8, 4)[0] <= 213)\n        self.assertTrue(211 <= gp(8, 5)[2] <= 213)\n        self.assertTrue(211 <= gp(8, 6)[2] <= 213)\n        self.assertTrue(211 <= gp(8, 7)[1] <= 213)",
                                "ast_type_str": "ClassDef",
                                "start_lineno": 11,
                                "end_lineno": 87,
                                "parent": null
                            }
                        }
                    ],
                    "added_entities": [],
                    "deleted_entities": []
                }
            ]
        }
    ],
    "old_commit_hash": "c42991120a96985340d4820d9d9d329fb3d97dee^",
    "new_commit_hash": "c42991120a96985340d4820d9d9d329fb3d97dee",
    "commit_message": "fix tests and set default effective_scale value for gaussian filter",
    "commit_date": "2014-10-12T14:05:22+04:00",
    "metadata": {}
}
{
    "repo_name": "pillow",
    "new_commit_hash": "c42991120a96985340d4820d9d9d329fb3d97dee",
    "test_file_codes": [
        "from helper import unittest, PillowTestCase\n\nfrom PIL import Image\nfrom PIL import ImageOps\nfrom PIL import ImageFilter\n\nim = Image.open(\"Tests/images/hopper.ppm\")\nsnakes = Image.open(\"Tests/images/color_snakes.png\")\n\n\nclass TestImageOpsUsm(PillowTestCase):\n\n    def test_ops_api(self):\n\n        i = ImageOps.gaussian_blur(im, 2.0)\n        self.assertEqual(i.mode, \"RGB\")\n        self.assertEqual(i.size, (128, 128))\n        # i.save(\"blur.bmp\")\n\n        i = ImageOps.unsharp_mask(im, 2.0, 125, 8)\n        self.assertEqual(i.mode, \"RGB\")\n        self.assertEqual(i.size, (128, 128))\n        # i.save(\"usm.bmp\")\n\n    def test_filter_api(self):\n\n        filter = ImageFilter.GaussianBlur(2.0)\n        i = im.filter(filter)\n        self.assertEqual(i.mode, \"RGB\")\n        self.assertEqual(i.size, (128, 128))\n\n        filter = ImageFilter.UnsharpMask(2.0, 125, 8)\n        i = im.filter(filter)\n        self.assertEqual(i.mode, \"RGB\")\n        self.assertEqual(i.size, (128, 128))\n\n    def test_usm_formats(self):\n\n        usm = ImageOps.unsharp_mask\n        self.assertRaises(ValueError, lambda: usm(im.convert(\"1\")))\n        usm(im.convert(\"L\"))\n        self.assertRaises(ValueError, lambda: usm(im.convert(\"I\")))\n        self.assertRaises(ValueError, lambda: usm(im.convert(\"F\")))\n        usm(im.convert(\"RGB\"))\n        usm(im.convert(\"RGBA\"))\n        usm(im.convert(\"CMYK\"))\n        self.assertRaises(ValueError, lambda: usm(im.convert(\"YCbCr\")))\n\n    def test_blur_formats(self):\n\n        blur = ImageOps.gaussian_blur\n        self.assertRaises(ValueError, lambda: blur(im.convert(\"1\")))\n        blur(im.convert(\"L\"))\n        self.assertRaises(ValueError, lambda: blur(im.convert(\"I\")))\n        self.assertRaises(ValueError, lambda: blur(im.convert(\"F\")))\n        blur(im.convert(\"RGB\"))\n        blur(im.convert(\"RGBA\"))\n        blur(im.convert(\"CMYK\"))\n        self.assertRaises(ValueError, lambda: blur(im.convert(\"YCbCr\")))\n\n    def test_usm_accuracy(self):\n\n        i = snakes._new(ImageOps.unsharp_mask(snakes, 5, 1024, 0))\n        # Image should not be changed because it have only 0 and 255 levels.\n        self.assertEqual(i.tobytes(), snakes.tobytes())\n\n    def test_blur_accuracy(self):\n\n        i = snakes._new(ImageOps.gaussian_blur(snakes, .7))\n        # Alpha channel must match whole.\n        self.assertEqual(i.split()[3], snakes.split()[3])\n        # These pixels surrounded with pixels with 255 intensity.\n        # They must be very close to 255.\n        for x, y, c in [(1, 0, 1), (2, 0, 1), (7, 8, 1), (8, 8, 1), (2, 9, 1),\n                        (7, 3, 0), (8, 3, 0), (5, 8, 0), (5, 9, 0), (1, 3, 0),\n                        (4, 3, 2), (4, 2, 2)]:\n            self.assertGreaterEqual(i.im.getpixel((x, y))[c], 250)\n        # Fuzzy match.\n        gp = lambda x, y: i.im.getpixel((x, y))\n        self.assertTrue(211 <= gp(7, 4)[0] <= 213)\n        self.assertTrue(211 <= gp(7, 5)[2] <= 213)\n        self.assertTrue(211 <= gp(7, 6)[2] <= 213)\n        self.assertTrue(211 <= gp(7, 7)[1] <= 213)\n        self.assertTrue(211 <= gp(8, 4)[0] <= 213)\n        self.assertTrue(211 <= gp(8, 5)[2] <= 213)\n        self.assertTrue(211 <= gp(8, 6)[2] <= 213)\n        self.assertTrue(211 <= gp(8, 7)[1] <= 213)\n\nif __name__ == '__main__':\n    unittest.main()\n\n# End of file\n",
        "#!/usr/bin/env python\nimport unittest\nimport sys\nimport time\nimport traceback\nimport platform\nimport os\n\n\nclass PytestLikeResult(unittest.TestResult):\n    def __init__(self, *args, **kwargs):\n        super().__init__(*args, **kwargs)\n        self.start_time = None\n        # Store (test, outcome, info) for each test:\n        #   outcome ∈ { \"passed\", \"failed\", \"error\", \"skipped\" }\n        #   info can hold the exception or skip reason, etc.\n        self.results = []\n\n    def startTestRun(self):\n        \"\"\"Called once before all tests.\"\"\"\n        self.start_time = time.time()\n        # Print a header similar to pytest\n        print(\"=\" * 29 + \" test session starts \" + \"=\" * 29)\n        # You can customize the platform/versions/paths as you like:\n        print(\n            f\"platform {platform.system().lower()} -- Python {platform.python_version()}\"\n        )\n        print(f\"rootdir: {os.path.abspath(os.curdir)}\")\n\n    def stopTestRun(self):\n        \"\"\"Called once after all tests are done.\"\"\"\n        elapsed = time.time() - self.start_time\n        print()  # blank line after final dot\n\n        # Summarize\n        ntests = len(self.results)\n        print(f\"collected {ntests} items\")\n\n        # Show details of failures/errors\n        failures = [r for r in self.results if r[1] == \"failed\"]\n        errors = [r for r in self.results if r[1] == \"error\"]\n\n        if failures:\n            print(\"\\n\" + \"=\" * 35 + \" FAILURES \" + \"=\" * 35)\n            for test, outcome, err_info in failures:\n                test = test.split(\"::\")\n                if len(test) == 3:\n                    test = f\"{test[1]}.{test[2]}\"\n                else:\n                    test = f\"{test[1]}\"\n                print(f\"__________ {test} __________\")\n                self._print_traceback(err_info)\n        if errors:\n            print(\"\\n\" + \"=\" * 35 + \" ERRORS \" + \"=\" * 37)\n            for test, outcome, err_info in errors:\n                test = test.split(\"::\")\n                if len(test) == 3:\n                    test = f\"{test[1]}.{test[2]}\"\n                else:\n                    test = f\"{test[1]}\"\n                print(f\"__________ {test} __________\")\n                self._print_traceback(err_info)\n\n        # Optional short summary lines for passes/fails/skips\n        print(\"\\n==================== short test summary info ====================\")\n        for test, outcome, info in self.results:\n            if outcome in (\"passed\", \"failed\", \"error\", \"skipped\"):\n                print(f\"{outcome.upper()} {test}\")\n\n        # Final one-line summary: “1 failed, 1 errors, 10 passed in 2.04s”\n        passed_count = sum(1 for r in self.results if r[1] == \"passed\")\n        failed_count = len(failures)\n        error_count = len(errors)\n        skipped_count = sum(1 for r in self.results if r[1] == \"skipped\")\n\n        summary_bits = []\n        if failed_count:\n            summary_bits.append(f\"{failed_count} failed\")\n        if error_count:\n            summary_bits.append(f\"{error_count} error{'s' if error_count != 1 else ''}\")\n        if passed_count:\n            summary_bits.append(f\"{passed_count} passed\")\n        if skipped_count:\n            summary_bits.append(f\"{skipped_count} skipped\")\n\n        summary_str = \", \".join(summary_bits) if summary_bits else \"no tests run\"\n        print(\n            f\"=================== {summary_str} in {elapsed:.2f}s ===================\"\n        )\n\n    def startTest(self, test):\n        \"\"\"Called right before each test method.\"\"\"\n        super().startTest(test)\n        # Print a dot or some indicator\n        print(\".\", end=\"\", flush=True)\n\n    def addSuccess(self, test):\n        super().addSuccess(test)\n        self.results.append((self._test_id(test), \"passed\", None))\n\n    def addFailure(self, test, err):\n        super().addFailure(test, err)\n        self.results.append((self._test_id(test), \"failed\", err))\n\n    def addError(self, test, err):\n        super().addError(test, err)\n        self.results.append((self._test_id(test), \"error\", err))\n\n    def addSkip(self, test, reason):\n        super().addSkip(test, reason)\n        self.results.append((self._test_id(test), \"skipped\", reason))\n\n    def _print_traceback(self, err_info):\n        \"\"\"Helper to print the traceback like pytest does.\"\"\"\n        if isinstance(err_info, tuple) and len(err_info) == 3:\n            exc_type, exc_value, tb = err_info\n            traceback.print_exception(exc_type, exc_value, tb, file=sys.stdout)\n        else:\n            print(str(err_info))\n\n    def _test_id(self, test):\n        try:\n            return f\"{test.__class__.__module__}::{test.__class__.__name__}::{test._testMethodName}\"\n        except AttributeError:\n            # Fallback for _ErrorHolder objects\n            return f\"{test.__class__.__module__}::{test.__class__.__name__}\"\n\n\nclass PytestLikeRunner(unittest.TextTestRunner):\n    \"\"\"A custom TextTestRunner that uses the PytestLikeResult.\"\"\"\n\n    resultclass = PytestLikeResult\n\n    def run(self, test):\n        result = self._makeResult()\n        # Overriding run to ensure we call startTestRun/stopTestRun\n        result.startTestRun()\n        test(result)\n        result.stopTestRun()\n        return result\n\n\ndef main():\n    loader = unittest.TestLoader()\n    suite = loader.discover(\"r2e_tests\")  # discover tests in r2e_tests/\n    runner = PytestLikeRunner(verbosity=0)\n    result = runner.run(suite)\n    # Exit with code 0 if all tests passed/skipped, 1 if there were fails/errors\n    sys.exit(not result.wasSuccessful())\n\n\nif __name__ == \"__main__\":\n    main()\n"
    ],
    "test_file_names": [
        "test_1.py",
        "unittest_custom_runner.py"
    ],
    "setup_res_code": 0,
    "setup_res_stdout": "Starting Pillow installation attempts...\nVerifying Pillow installation...\n✅ Pillow installation successful!\nSuccessfully installed Pillow\n",
    "setup_res_stderr": "Using CPython 3.9.21\nCreating virtual environment at: .venv\nActivate with: source .venv/bin/activate\nResolved 12 packages in 10ms\nInstalled 12 packages in 199ms\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 1.41s\nPrepared 1 package in 13.26s\nInstalled 1 package in 2ms\n + pillow==2.6.0 (from file:///home/gcpuser/buckets/local_repoeval_bucket/repos/pillow_c42991120a96985340d4820d9d9d329fb3d97dee)\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_c42991120a96985340d4820d9d9d329fb3d97dee\n......\ncollected 6 items\n\n==================== short test summary info ====================\nPASSED test_1::TestImageOpsUsm::test_blur_accuracy\nPASSED test_1::TestImageOpsUsm::test_blur_formats\nPASSED test_1::TestImageOpsUsm::test_filter_api\nPASSED test_1::TestImageOpsUsm::test_ops_api\nPASSED test_1::TestImageOpsUsm::test_usm_accuracy\nPASSED test_1::TestImageOpsUsm::test_usm_formats\n=================== 6 passed in 0.06s ===================\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_c42991120a96985340d4820d9d9d329fb3d97dee\n......\ncollected 6 items\n\n=================================== ERRORS =====================================\n__________ TestImageOpsUsm.test_filter_api __________\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_c42991120a96985340d4820d9d9d329fb3d97dee/r2e_tests/test_1.py\", line 28, in test_filter_api\n    i = im.filter(filter)\n  File \"/home/gcpuser/buckets/local_repoeval_bucket/repos/pillow_c42991120a96985340d4820d9d9d329fb3d97dee/PIL/Image.py\", line 1057, in filter\n    ims.append(self._new(filter.filter(self.im.getband(c))))\n  File \"/home/gcpuser/buckets/local_repoeval_bucket/repos/pillow_c42991120a96985340d4820d9d9d329fb3d97dee/PIL/ImageFilter.py\", line 157, in filter\n    return image.gaussian_blur(self.radius, self.effective_scale)\nTypeError: must be real number, not NoneType\n\n==================== short test summary info ====================\nPASSED test_1::TestImageOpsUsm::test_blur_accuracy\nPASSED test_1::TestImageOpsUsm::test_blur_formats\nERROR test_1::TestImageOpsUsm::test_filter_api\nPASSED test_1::TestImageOpsUsm::test_ops_api\nPASSED test_1::TestImageOpsUsm::test_usm_accuracy\nPASSED test_1::TestImageOpsUsm::test_usm_formats\n=================== 1 error, 5 passed in 0.05s ===================\n",
    "old_commit_res_stderr": ""
}
PIL/ImageFilter.py Tests/test_imageops_usm.py
We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
[ISSUE]
**Title:** Applying GaussianBlur without `effective_scale` Causes TypeError

**Description:**
When using the `GaussianBlur` filter without specifying the `effective_scale` parameter, a `TypeError` is raised because the method receives a `NoneType` instead of a real number.

**Example Code:**
```python
from PIL import Image, ImageFilter

im = Image.open('example.png')
blur_filter = ImageFilter.GaussianBlur(radius=2.0)
blurred_image = im.filter(blur_filter)
```

**Expected Behavior:**
The image should be blurred successfully using a default `effective_scale` value when none is provided.

**Actual Behavior:**
A `TypeError` is raised with the message:
```
TypeError: must be real number, not NoneType
```
This occurs because the `effective_scale` parameter is not set, leading to an invalid value being passed to the `gaussian_blur` method.
[/ISSUE]
--- END ISSUE ---

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

--- BEGIN FILE ---
```
### PIL/ImageFilter.py
#
# The Python Imaging Library.
# $Id$
#
# standard filters
#
# History:
# 1995-11-27 fl   Created
# 2002-06-08 fl   Added rank and mode filters
# 2003-09-15 fl   Fixed rank calculation in rank filter; added expand call
#
# Copyright (c) 1997-2003 by Secret Labs AB.
# Copyright (c) 1995-2002 by Fredrik Lundh.
#
# See the README file for information on usage and redistribution.
#

from functools import reduce


class Filter(object):
    pass


class Kernel(Filter):
    """
    Create a convolution kernel.  The current version only
    supports 3x3 and 5x5 integer and floating point kernels.

    In the current version, kernels can only be applied to
    "L" and "RGB" images.

    :param size: Kernel size, given as (width, height). In the current
                    version, this must be (3,3) or (5,5).
    :param kernel: A sequence containing kernel weights.
    :param scale: Scale factor. If given, the result for each pixel is
                    divided by this value.  the default is the sum of the
                    kernel weights.
    :param offset: Offset. If given, this value is added to the result,
                    after it has been divided by the scale factor.
    """

    def __init__(self, size, kernel, scale=None, offset=0):
        if scale is None:
            # default scale is sum of kernel
            scale = reduce(lambda a, b: a+b, kernel)
        if size[0] * size[1] != len(kernel):
            raise ValueError("not enough coefficients in kernel")
        self.filterargs = size, scale, offset, kernel

    def filter(self, image):
        if image.mode == "P":
            raise ValueError("cannot filter palette images")
        return image.filter(*self.filterargs)


class BuiltinFilter(Kernel):
    def __init__(self):
        pass


class RankFilter(Filter):
    """
    Create a rank filter.  The rank filter sorts all pixels in
    a window of the given size, and returns the **rank**'th value.

    :param size: The kernel size, in pixels.
    :param rank: What pixel value to pick.  Use 0 for a min filter,
                 ``size * size / 2`` for a median filter, ``size * size - 1``
                 for a max filter, etc.
    """
    name = "Rank"

    def __init__(self, size, rank):
        self.size = size
        self.rank = rank

    def filter(self, image):
        if image.mode == "P":
            raise ValueError("cannot filter palette images")
        image = image.expand(self.size//2, self.size//2)
        return image.rankfilter(self.size, self.rank)


class MedianFilter(RankFilter):
    """
    Create a median filter. Picks the median pixel value in a window with the
    given size.

    :param size: The kernel size, in pixels.
    """
    name = "Median"

    def __init__(self, size=3):
        self.size = size
        self.rank = size*size//2


class MinFilter(RankFilter):
    """
    Create a min filter.  Picks the lowest pixel value in a window with the
    given size.

    :param size: The kernel size, in pixels.
    """
    name = "Min"

    def __init__(self, size=3):
        self.size = size
        self.rank = 0


class MaxFilter(RankFilter):
    """
    Create a max filter.  Picks the largest pixel value in a window with the
    given size.

    :param size: The kernel size, in pixels.
    """
    name = "Max"

    def __init__(self, size=3):
        self.size = size
        self.rank = size*size-1


class ModeFilter(Filter):
    """

    Create a mode filter. Picks the most frequent pixel value in a box with the
    given size.  Pixel values that occur only once or twice are ignored; if no
    pixel value occurs more than twice, the original pixel value is preserved.

    :param size: The kernel size, in pixels.
    """
    name = "Mode"

    def __init__(self, size=3):
        self.size = size

    def filter(self, image):
        return image.modefilter(self.size)


class GaussianBlur(Filter):
    """Gaussian blur filter.

    :param radius: Blur radius.
    """
    name = "GaussianBlur"

    def __init__(self, radius=2, effective_scale=None):
        self.radius = radius
        self.effective_scale = effective_scale

    def filter(self, image):
        return image.gaussian_blur(self.radius, self.effective_scale)


class UnsharpMask(Filter):
    """Unsharp mask filter.

    See Wikipedia's entry on `digital unsharp masking`_ for an explanation of
    the parameters.

    .. _digital unsharp masking:
    https://en.wikipedia.org/wiki/Unsharp_masking#Digital_unsharp_masking
    """
    name = "UnsharpMask"

    def __init__(self, radius=2, percent=150, threshold=3):
        self.radius = radius
        self.percent = percent
        self.threshold = threshold

    def filter(self, image):
        return image.unsharp_mask(self.radius, self.percent, self.threshold)


class BLUR(BuiltinFilter):
    name = "Blur"
    filterargs = (5, 5), 16, 0, (
        1,  1,  1,  1,  1,
        1,  0,  0,  0,  1,
        1,  0,  0,  0,  1,
        1,  0,  0,  0,  1,
        1,  1,  1,  1,  1
        )


class CONTOUR(BuiltinFilter):
    name = "Contour"
    filterargs = (3, 3), 1, 255, (
        -1, -1, -1,
        -1,  8, -1,
        -1, -1, -1
        )


class DETAIL(BuiltinFilter):
    name = "Detail"
    filterargs = (3, 3), 6, 0, (
        0, -1,  0,
        -1, 10, -1,
        0, -1,  0
        )


class EDGE_ENHANCE(BuiltinFilter):
    name = "Edge-enhance"
    filterargs = (3, 3), 2, 0, (
        -1, -1, -1,
        -1, 10, -1,
        -1, -1, -1
        )


class EDGE_ENHANCE_MORE(BuiltinFilter):
    name = "Edge-enhance More"
    filterargs = (3, 3), 1, 0, (
        -1, -1, -1,
        -1,  9, -1,
        -1, -1, -1
        )


class EMBOSS(BuiltinFilter):
    name = "Emboss"
    filterargs = (3, 3), 1, 128, (
        -1,  0,  0,
        0,  1,  0,
        0,  0,  0
        )


class FIND_EDGES(BuiltinFilter):
    name = "Find Edges"
    filterargs = (3, 3), 1, 0, (
        -1, -1, -1,
        -1,  8, -1,
        -1, -1, -1
        )


class SMOOTH(BuiltinFilter):
    name = "Smooth"
    filterargs = (3, 3), 13, 0, (
        1,  1,  1,
        1,  5,  1,
        1,  1,  1
        )


class SMOOTH_MORE(BuiltinFilter):
    name = "Smooth More"
    filterargs = (5, 5), 100, 0, (
        1,  1,  1,  1,  1,
        1,  5,  5,  5,  1,
        1,  5, 44,  5,  1,
        1,  5,  5,  5,  1,
        1,  1,  1,  1,  1
        )


class SHARPEN(BuiltinFilter):
    name = "Sharpen"
    filterargs = (3, 3), 16, 0, (
        -2, -2, -2,
        -2, 32, -2,
        -2, -2, -2
        )

```
--- 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:** Applying GaussianBlur without `effective_scale` Causes TypeError

**Description:**
When using the `GaussianBlur` filter without specifying the `effective_scale` parameter, a `TypeError` is raised because the method receives a `NoneType` instead of a real number.

**Example Code:**
```python
from PIL import Image, ImageFilter

im = Image.open('example.png')
blur_filter = ImageFilter.GaussianBlur(radius=2.0)
blurred_image = im.filter(blur_filter)
```

**Expected Behavior:**
The image should be blurred successfully using a default `effective_scale` value when none is provided.

**Actual Behavior:**
A `TypeError` is raised with the message:
```
TypeError: must be real number, not NoneType
```
This occurs because the `effective_scale` parameter is not set, leading to an invalid value being passed to the `gaussian_blur` method.
[/ISSUE]
{
    "TestImageOpsUsm.test_blur_accuracy": "PASSED",
    "TestImageOpsUsm.test_blur_formats": "PASSED",
    "TestImageOpsUsm.test_filter_api": "PASSED",
    "TestImageOpsUsm.test_ops_api": "PASSED",
    "TestImageOpsUsm.test_usm_accuracy": "PASSED",
    "TestImageOpsUsm.test_usm_formats": "PASSED"
}
diff --git a/PIL/ImageFilter.py b/PIL/ImageFilter.py
index fed165831..e3b867737 100644
--- a/PIL/ImageFilter.py
+++ b/PIL/ImageFilter.py
@@ -154,7 +154,7 @@ class GaussianBlur(Filter):
         self.effective_scale = effective_scale
 
     def filter(self, image):
-        return image.gaussian_blur(self.radius, self.effective_scale)
+        return image.gaussian_blur(self.radius, self.effective_scale or 2.6)
 
 
 class UnsharpMask(Filter):

{"PIL/ImageFilter.py": "#\n# The Python Imaging Library.\n# $Id$\n#\n# standard filters\n#\n# History:\n# 1995-11-27 fl   Created\n# 2002-06-08 fl   Added rank and mode filters\n# 2003-09-15 fl   Fixed rank calculation in rank filter; added expand call\n#\n# Copyright (c) 1997-2003 by Secret Labs AB.\n# Copyright (c) 1995-2002 by Fredrik Lundh.\n#\n# See the README file for information on usage and redistribution.\n#\n\nfrom functools import reduce\n\n\nclass Filter(object):\n    pass\n\n\nclass Kernel(Filter):\n    \"\"\"\n    Create a convolution kernel.  The current version only\n    supports 3x3 and 5x5 integer and floating point kernels.\n\n    In the current version, kernels can only be applied to\n    \"L\" and \"RGB\" images.\n\n    :param size: Kernel size, given as (width, height). In the current\n                    version, this must be (3,3) or (5,5).\n    :param kernel: A sequence containing kernel weights.\n    :param scale: Scale factor. If given, the result for each pixel is\n                    divided by this value.  the default is the sum of the\n                    kernel weights.\n    :param offset: Offset. If given, this value is added to the result,\n                    after it has been divided by the scale factor.\n    \"\"\"\n\n    def __init__(self, size, kernel, scale=None, offset=0):\n        if scale is None:\n            # default scale is sum of kernel\n            scale = reduce(lambda a, b: a+b, kernel)\n        if size[0] * size[1] != len(kernel):\n            raise ValueError(\"not enough coefficients in kernel\")\n        self.filterargs = size, scale, offset, kernel\n\n    def filter(self, image):\n        if image.mode == \"P\":\n            raise ValueError(\"cannot filter palette images\")\n        return image.filter(*self.filterargs)\n\n\nclass BuiltinFilter(Kernel):\n    def __init__(self):\n        pass\n\n\nclass RankFilter(Filter):\n    \"\"\"\n    Create a rank filter.  The rank filter sorts all pixels in\n    a window of the given size, and returns the **rank**'th value.\n\n    :param size: The kernel size, in pixels.\n    :param rank: What pixel value to pick.  Use 0 for a min filter,\n                 ``size * size / 2`` for a median filter, ``size * size - 1``\n                 for a max filter, etc.\n    \"\"\"\n    name = \"Rank\"\n\n    def __init__(self, size, rank):\n        self.size = size\n        self.rank = rank\n\n    def filter(self, image):\n        if image.mode == \"P\":\n            raise ValueError(\"cannot filter palette images\")\n        image = image.expand(self.size//2, self.size//2)\n        return image.rankfilter(self.size, self.rank)\n\n\nclass MedianFilter(RankFilter):\n    \"\"\"\n    Create a median filter. Picks the median pixel value in a window with the\n    given size.\n\n    :param size: The kernel size, in pixels.\n    \"\"\"\n    name = \"Median\"\n\n    def __init__(self, size=3):\n        self.size = size\n        self.rank = size*size//2\n\n\nclass MinFilter(RankFilter):\n    \"\"\"\n    Create a min filter.  Picks the lowest pixel value in a window with the\n    given size.\n\n    :param size: The kernel size, in pixels.\n    \"\"\"\n    name = \"Min\"\n\n    def __init__(self, size=3):\n        self.size = size\n        self.rank = 0\n\n\nclass MaxFilter(RankFilter):\n    \"\"\"\n    Create a max filter.  Picks the largest pixel value in a window with the\n    given size.\n\n    :param size: The kernel size, in pixels.\n    \"\"\"\n    name = \"Max\"\n\n    def __init__(self, size=3):\n        self.size = size\n        self.rank = size*size-1\n\n\nclass ModeFilter(Filter):\n    \"\"\"\n\n    Create a mode filter. Picks the most frequent pixel value in a box with the\n    given size.  Pixel values that occur only once or twice are ignored; if no\n    pixel value occurs more than twice, the original pixel value is preserved.\n\n    :param size: The kernel size, in pixels.\n    \"\"\"\n    name = \"Mode\"\n\n    def __init__(self, size=3):\n        self.size = size\n\n    def filter(self, image):\n        return image.modefilter(self.size)\n\n\nclass GaussianBlur(Filter):\n    \"\"\"Gaussian blur filter.\n\n    :param radius: Blur radius.\n    \"\"\"\n    name = \"GaussianBlur\"\n\n    def __init__(self, radius=2, effective_scale=None):\n        self.radius = radius\n        self.effective_scale = effective_scale\n\n    def filter(self, image):\n        return image.gaussian_blur(self.radius, self.effective_scale)\n\n\nclass UnsharpMask(Filter):\n    \"\"\"Unsharp mask filter.\n\n    See Wikipedia's entry on `digital unsharp masking`_ for an explanation of\n    the parameters.\n\n    .. _digital unsharp masking:\n    https://en.wikipedia.org/wiki/Unsharp_masking#Digital_unsharp_masking\n    \"\"\"\n    name = \"UnsharpMask\"\n\n    def __init__(self, radius=2, percent=150, threshold=3):\n        self.radius = radius\n        self.percent = percent\n        self.threshold = threshold\n\n    def filter(self, image):\n        return image.unsharp_mask(self.radius, self.percent, self.threshold)\n\n\nclass BLUR(BuiltinFilter):\n    name = \"Blur\"\n    filterargs = (5, 5), 16, 0, (\n        1,  1,  1,  1,  1,\n        1,  0,  0,  0,  1,\n        1,  0,  0,  0,  1,\n        1,  0,  0,  0,  1,\n        1,  1,  1,  1,  1\n        )\n\n\nclass CONTOUR(BuiltinFilter):\n    name = \"Contour\"\n    filterargs = (3, 3), 1, 255, (\n        -1, -1, -1,\n        -1,  8, -1,\n        -1, -1, -1\n        )\n\n\nclass DETAIL(BuiltinFilter):\n    name = \"Detail\"\n    filterargs = (3, 3), 6, 0, (\n        0, -1,  0,\n        -1, 10, -1,\n        0, -1,  0\n        )\n\n\nclass EDGE_ENHANCE(BuiltinFilter):\n    name = \"Edge-enhance\"\n    filterargs = (3, 3), 2, 0, (\n        -1, -1, -1,\n        -1, 10, -1,\n        -1, -1, -1\n        )\n\n\nclass EDGE_ENHANCE_MORE(BuiltinFilter):\n    name = \"Edge-enhance More\"\n    filterargs = (3, 3), 1, 0, (\n        -1, -1, -1,\n        -1,  9, -1,\n        -1, -1, -1\n        )\n\n\nclass EMBOSS(BuiltinFilter):\n    name = \"Emboss\"\n    filterargs = (3, 3), 1, 128, (\n        -1,  0,  0,\n        0,  1,  0,\n        0,  0,  0\n        )\n\n\nclass FIND_EDGES(BuiltinFilter):\n    name = \"Find Edges\"\n    filterargs = (3, 3), 1, 0, (\n        -1, -1, -1,\n        -1,  8, -1,\n        -1, -1, -1\n        )\n\n\nclass SMOOTH(BuiltinFilter):\n    name = \"Smooth\"\n    filterargs = (3, 3), 13, 0, (\n        1,  1,  1,\n        1,  5,  1,\n        1,  1,  1\n        )\n\n\nclass SMOOTH_MORE(BuiltinFilter):\n    name = \"Smooth More\"\n    filterargs = (5, 5), 100, 0, (\n        1,  1,  1,  1,  1,\n        1,  5,  5,  5,  1,\n        1,  5, 44,  5,  1,\n        1,  5,  5,  5,  1,\n        1,  1,  1,  1,  1\n        )\n\n\nclass SHARPEN(BuiltinFilter):\n    name = \"Sharpen\"\n    filterargs = (3, 3), 16, 0, (\n        -2, -2, -2,\n        -2, 32, -2,\n        -2, -2, -2\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:** Applying GaussianBlur without `effective_scale` Causes TypeError

**Description:**
When using the `GaussianBlur` filter without specifying the `effective_scale` parameter, a `TypeError` is raised because the method receives a `NoneType` instead of a real number.

**Example Code:**
```python
from PIL import Image, ImageFilter

im = Image.open('example.png')
blur_filter = ImageFilter.GaussianBlur(radius=2.0)
blurred_image = im.filter(blur_filter)
```

**Expected Behavior:**
The image should be blurred successfully using a default `effective_scale` value when none is provided.

**Actual Behavior:**
A `TypeError` is raised with the message:
```
TypeError: must be real number, not NoneType
```
This occurs because the `effective_scale` parameter is not set, leading to an invalid value being passed to the `gaussian_blur` method.
[/ISSUE]
--- END ISSUE ---

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

--- BEGIN FILE ---
```
### PIL/ImageFilter.py
#
# The Python Imaging Library.
# $Id$
#
# standard filters
#
# History:
# 1995-11-27 fl   Created
# 2002-06-08 fl   Added rank and mode filters
# 2003-09-15 fl   Fixed rank calculation in rank filter; added expand call
#
# Copyright (c) 1997-2003 by Secret Labs AB.
# Copyright (c) 1995-2002 by Fredrik Lundh.
#
# See the README file for information on usage and redistribution.
#

from functools import reduce


class Filter(object):
    pass


class Kernel(Filter):
    """
    Create a convolution kernel.  The current version only
    supports 3x3 and 5x5 integer and floating point kernels.

    In the current version, kernels can only be applied to
    "L" and "RGB" images.

    :param size: Kernel size, given as (width, height). In the current
                    version, this must be (3,3) or (5,5).
    :param kernel: A sequence containing kernel weights.
    :param scale: Scale factor. If given, the result for each pixel is
                    divided by this value.  the default is the sum of the
                    kernel weights.
    :param offset: Offset. If given, this value is added to the result,
                    after it has been divided by the scale factor.
    """

    def __init__(self, size, kernel, scale=None, offset=0):
        if scale is None:
            # default scale is sum of kernel
            scale = reduce(lambda a, b: a+b, kernel)
        if size[0] * size[1] != len(kernel):
            raise ValueError("not enough coefficients in kernel")
        self.filterargs = size, scale, offset, kernel

    def filter(self, image):
        if image.mode == "P":
            raise ValueError("cannot filter palette images")
        return image.filter(*self.filterargs)


class BuiltinFilter(Kernel):
    def __init__(self):
        pass


class RankFilter(Filter):
    """
    Create a rank filter.  The rank filter sorts all pixels in
    a window of the given size, and returns the **rank**'th value.

    :param size: The kernel size, in pixels.
    :param rank: What pixel value to pick.  Use 0 for a min filter,
                 ``size * size / 2`` for a median filter, ``size * size - 1``
                 for a max filter, etc.
    """
    name = "Rank"

    def __init__(self, size, rank):
        self.size = size
        self.rank = rank

    def filter(self, image):
        if image.mode == "P":
            raise ValueError("cannot filter palette images")
        image = image.expand(self.size//2, self.size//2)
        return image.rankfilter(self.size, self.rank)


class MedianFilter(RankFilter):
    """
    Create a median filter. Picks the median pixel value in a window with the
    given size.

    :param size: The kernel size, in pixels.
    """
    name = "Median"

    def __init__(self, size=3):
        self.size = size
        self.rank = size*size//2


class MinFilter(RankFilter):
    """
    Create a min filter.  Picks the lowest pixel value in a window with the
    given size.

    :param size: The kernel size, in pixels.
    """
    name = "Min"

    def __init__(self, size=3):
        self.size = size
        self.rank = 0


class MaxFilter(RankFilter):
    """
    Create a max filter.  Picks the largest pixel value in a window with the
    given size.

    :param size: The kernel size, in pixels.
    """
    name = "Max"

    def __init__(self, size=3):
        self.size = size
        self.rank = size*size-1


class ModeFilter(Filter):
    """

    Create a mode filter. Picks the most frequent pixel value in a box with the
    given size.  Pixel values that occur only once or twice are ignored; if no
    pixel value occurs more than twice, the original pixel value is preserved.

    :param size: The kernel size, in pixels.
    """
    name = "Mode"

    def __init__(self, size=3):
        self.size = size

    def filter(self, image):
        return image.modefilter(self.size)


class GaussianBlur(Filter):
    """Gaussian blur filter.

    :param radius: Blur radius.
    """
    name = "GaussianBlur"

    def __init__(self, radius=2, effective_scale=None):
        self.radius = radius
        self.effective_scale = effective_scale

    def filter(self, image):
        return image.gaussian_blur(self.radius, self.effective_scale)


class UnsharpMask(Filter):
    """Unsharp mask filter.

    See Wikipedia's entry on `digital unsharp masking`_ for an explanation of
    the parameters.

    .. _digital unsharp masking:
    https://en.wikipedia.org/wiki/Unsharp_masking#Digital_unsharp_masking
    """
    name = "UnsharpMask"

    def __init__(self, radius=2, percent=150, threshold=3):
        self.radius = radius
        self.percent = percent
        self.threshold = threshold

    def filter(self, image):
        return image.unsharp_mask(self.radius, self.percent, self.threshold)


class BLUR(BuiltinFilter):
    name = "Blur"
    filterargs = (5, 5), 16, 0, (
        1,  1,  1,  1,  1,
        1,  0,  0,  0,  1,
        1,  0,  0,  0,  1,
        1,  0,  0,  0,  1,
        1,  1,  1,  1,  1
        )


class CONTOUR(BuiltinFilter):
    name = "Contour"
    filterargs = (3, 3), 1, 255, (
        -1, -1, -1,
        -1,  8, -1,
        -1, -1, -1
        )


class DETAIL(BuiltinFilter):
    name = "Detail"
    filterargs = (3, 3), 6, 0, (
        0, -1,  0,
        -1, 10, -1,
        0, -1,  0
        )


class EDGE_ENHANCE(BuiltinFilter):
    name = "Edge-enhance"
    filterargs = (3, 3), 2, 0, (
        -1, -1, -1,
        -1, 10, -1,
        -1, -1, -1
        )


class EDGE_ENHANCE_MORE(BuiltinFilter):
    name = "Edge-enhance More"
    filterargs = (3, 3), 1, 0, (
        -1, -1, -1,
        -1,  9, -1,
        -1, -1, -1
        )


class EMBOSS(BuiltinFilter):
    name = "Emboss"
    filterargs = (3, 3), 1, 128, (
        -1,  0,  0,
        0,  1,  0,
        0,  0,  0
        )


class FIND_EDGES(BuiltinFilter):
    name = "Find Edges"
    filterargs = (3, 3), 1, 0, (
        -1, -1, -1,
        -1,  8, -1,
        -1, -1, -1
        )


class SMOOTH(BuiltinFilter):
    name = "Smooth"
    filterargs = (3, 3), 13, 0, (
        1,  1,  1,
        1,  5,  1,
        1,  1,  1
        )


class SMOOTH_MORE(BuiltinFilter):
    name = "Smooth More"
    filterargs = (5, 5), 100, 0, (
        1,  1,  1,  1,  1,
        1,  5,  5,  5,  1,
        1,  5, 44,  5,  1,
        1,  5,  5,  5,  1,
        1,  1,  1,  1,  1
        )


class SHARPEN(BuiltinFilter):
    name = "Sharpen"
    filterargs = (3, 3), 16, 0, (
        -2, -2, -2,
        -2, 32, -2,
        -2, -2, -2
        )

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