prompt: You will be provided with a partial code base and an issue statement explaining a problem to resolve.
  <issue>
  polygonize method no longer in use / use shapes instead?
  Hi,
  
  just going through the examples folders.
  If I ran the python interpreter on  `poligonize.py` it complains about a missing attribute:
  
  ```
  (venv)[] ~/Progetti/pyhton-usergroup/rasterio <master> ✗ python examples/polygonize.py
  sys:1: FutureWarning: read_band() is deprecated and will be removed by Rasterio 1.0. Please use read() instead.
  Traceback (most recent call last):
    File "examples/polygonize.py", line 10, in <module>
      list(ftrz.polygonize(image)))
  AttributeError: 'module' object has no attribute 'polygonize'
  ```
  
  But, going trough the commits history w/ @ligthyear it seems like instead of poligonize, one should use shapes.  
  If I ran it in fact with the new method it works smoothly
  
  ```
  pprint.pprint(
   list(ftrz.shapes(image)))
  ```
  
  Cheers
  
  
  </issue>
  <code>
  [start of examples/polygonize.py]
  1 import pprint
  2 
  3 import rasterio
  4 import rasterio._features as ftrz
  5 
  6 with rasterio.open('box.png') as src:
  7     image = src.read_band(1)
  8 
  9 pprint.pprint(
  10     list(ftrz.polygonize(image)))
  11
  [end of examples/polygonize.py]
  </code>
  
  I need you to solve this issue by generating a single patch file that I can apply directly to this repository using git apply. Please respond with a single patch file in the following format.
  <patch>
  diff --git a/file.py b/file.py
  --- a/file.py
  +++ b/file.py
  @@ -1,27 +1,35 @@
   def euclidean(a, b):
  -    while b:
  -        a, b = b, a % b
  -    return a
  +    if b == 0:
  +        return a
  +    return euclidean(b, a % b)
   
   
   def bresenham(x0, y0, x1, y1):
       points = []
       dx = abs(x1 - x0)
       dy = abs(y1 - y0)
  -    sx = 1 if x0 < x1 else -1
  -    sy = 1 if y0 < y1 else -1
  -    err = dx - dy
  +    x, y = x0, y0
  +    sx = -1 if x0 > x1 else 1
  +    sy = -1 if y0 > y1 else 1
   
  -    while True:
  -        points.append((x0, y0))
  -        if x0 == x1 and y0 == y1:
  -            break
  -        e2 = 2 * err
  -        if e2 > -dy:
  -            err -= dy
  -            x0 += sx
  -        if e2 < dx:
  -            err += dx
  -            y0 += sy
  +    if dx > dy:
  +        err = dx / 2.0
  +        while x != x1:
  +            points.append((x, y))
  +            err -= dy
  +            if err < 0:
  +                y += sy
  +                err += dx
  +            x += sx
  +    else:
  +        err = dy / 2.0
  +        while y != y1:
  +            points.append((x, y))
  +            err -= dx
  +            if err < 0:
  +                x += sx
  +                err += dy
  +            y += sy
  +
  +    points.append((x, y))
       return points
  
  </patch>
golden_diff: diff --git a/examples/polygonize.py b/examples/polygonize.py
  --- a/examples/polygonize.py
  +++ b/examples/polygonize.py
  @@ -1,10 +1,12 @@
   import pprint
   
   import rasterio
  -import rasterio._features as ftrz
  +from rasterio.features import shapes
   
  -with rasterio.open('box.png') as src:
  -    image = src.read_band(1)
  +with rasterio.open('tests/data/shade.tif') as src:
  +    image = src.read(1)
   
  +# Print the first two shapes...
   pprint.pprint(
  -    list(ftrz.polygonize(image)))
  +    list(shapes(image))[:2]
  +)
  
verification_info: {"golden_diff": "diff --git a/examples/polygonize.py b/examples/polygonize.py\n--- a/examples/polygonize.py\n+++ b/examples/polygonize.py\n@@ -1,10 +1,12 @@\n import pprint\n \n import rasterio\n-import rasterio._features as ftrz\n+from rasterio.features import shapes\n \n-with rasterio.open('box.png') as src:\n-    image = src.read_band(1)\n+with rasterio.open('tests/data/shade.tif') as src:\n+    image = src.read(1)\n \n+# Print the first two shapes...\n pprint.pprint(\n-    list(ftrz.polygonize(image)))\n+    list(shapes(image))[:2]\n+)\n", "issue": "polygonize method no longer in use / use shapes instead?\nHi,\n\njust going through the examples folders.\nIf I ran the python interpreter on  `poligonize.py` it complains about a missing attribute:\n\n```\n(venv)[] ~/Progetti/pyhton-usergroup/rasterio <master> \u2717 python examples/polygonize.py\nsys:1: FutureWarning: read_band() is deprecated and will be removed by Rasterio 1.0. Please use read() instead.\nTraceback (most recent call last):\n  File \"examples/polygonize.py\", line 10, in <module>\n    list(ftrz.polygonize(image)))\nAttributeError: 'module' object has no attribute 'polygonize'\n```\n\nBut, going trough the commits history w/ @ligthyear it seems like instead of poligonize, one should use shapes.  \nIf I ran it in fact with the new method it works smoothly\n\n```\npprint.pprint(\n list(ftrz.shapes(image)))\n```\n\nCheers\n\n", "before_files": [{"content": "import pprint\n\nimport rasterio\nimport rasterio._features as ftrz\n\nwith rasterio.open('box.png') as src:\n    image = src.read_band(1)\n\npprint.pprint(\n    list(ftrz.polygonize(image)))\n", "path": "examples/polygonize.py"}]}