prompt: You will be provided with a partial code base and an issue statement explaining a problem to resolve.
  <issue>
  guard_transform prevents translation of unprojected files
  Where by translation I mean the pattern
  
  ``` python
  with rasterio.open(file1.tif) as src:
      with rasterio.open(file2.tif, 'w', **src.meta) as dst:
          ...
  ```
  
  Traceback snippet:
  
  ```
  Traceback (most recent call last):
    ...
    File "copier.py", line 15, in to_png
      with rio.open(dst_path, "w", **meta) as dst:
    File "xxx/anaconda/lib/python2.7/site-packages/rasterio/__init__.py", line 91, in open
      transform = guard_transform(transform)
    File "xxx/anaconda/lib/python2.7/site-packages/rasterio/transform.py", line 27, in guard_transform
      transform.a, transform.e))
  ValueError: Transform has invalid coefficients a, e: (0.000000, 0.000000)
  ```
  
  
  </issue>
  <code>
  [start of rasterio/transform.py]
  1 
  2 import warnings
  3 
  4 from affine import Affine
  5 
  6 IDENTITY = Affine.identity()
  7 
  8 def tastes_like_gdal(t):
  9     return t[2] == t[4] == 0.0 and t[1] > 0 and t[5] < 0
  10 
  11 def guard_transform(transform):
  12     """Return an Affine transformation instance"""
  13     if not isinstance(transform, Affine):
  14         if tastes_like_gdal(transform):
  15             warnings.warn(
  16                 "GDAL-style transforms are deprecated and will not "
  17                 "be supported in Rasterio 1.0.",
  18                 FutureWarning,
  19                 stacklevel=2)
  20             transform = Affine.from_gdal(*transform)
  21         else:
  22             transform = Affine(*transform)
  23     a, e = transform.a, transform.e
  24     if a == 0.0 or e == 0.0:
  25         raise ValueError(
  26             "Transform has invalid coefficients a, e: (%f, %f)" % (
  27                 transform.a, transform.e))
  28     return transform
  29 
  30
  [end of rasterio/transform.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/rasterio/transform.py b/rasterio/transform.py
  --- a/rasterio/transform.py
  +++ b/rasterio/transform.py
  @@ -1,12 +1,14 @@
  -
   import warnings
   
   from affine import Affine
   
   IDENTITY = Affine.identity()
   
  -def tastes_like_gdal(t):
  -    return t[2] == t[4] == 0.0 and t[1] > 0 and t[5] < 0
  +
  +def tastes_like_gdal(seq):
  +    """Return True if `seq` matches the GDAL geotransform pattern."""
  +    return seq[2] == seq[4] == 0.0 and seq[1] > 0 and seq[5] < 0
  +
   
   def guard_transform(transform):
       """Return an Affine transformation instance"""
  @@ -20,10 +22,4 @@
               transform = Affine.from_gdal(*transform)
           else:
               transform = Affine(*transform)
  -    a, e = transform.a, transform.e
  -    if a == 0.0 or e == 0.0:
  -        raise ValueError(
  -            "Transform has invalid coefficients a, e: (%f, %f)" % (
  -                transform.a, transform.e))
       return transform
  -
  
verification_info: {"golden_diff": "diff --git a/rasterio/transform.py b/rasterio/transform.py\n--- a/rasterio/transform.py\n+++ b/rasterio/transform.py\n@@ -1,12 +1,14 @@\n-\n import warnings\n \n from affine import Affine\n \n IDENTITY = Affine.identity()\n \n-def tastes_like_gdal(t):\n-    return t[2] == t[4] == 0.0 and t[1] > 0 and t[5] < 0\n+\n+def tastes_like_gdal(seq):\n+    \"\"\"Return True if `seq` matches the GDAL geotransform pattern.\"\"\"\n+    return seq[2] == seq[4] == 0.0 and seq[1] > 0 and seq[5] < 0\n+\n \n def guard_transform(transform):\n     \"\"\"Return an Affine transformation instance\"\"\"\n@@ -20,10 +22,4 @@\n             transform = Affine.from_gdal(*transform)\n         else:\n             transform = Affine(*transform)\n-    a, e = transform.a, transform.e\n-    if a == 0.0 or e == 0.0:\n-        raise ValueError(\n-            \"Transform has invalid coefficients a, e: (%f, %f)\" % (\n-                transform.a, transform.e))\n     return transform\n-\n", "issue": "guard_transform prevents translation of unprojected files\nWhere by translation I mean the pattern\n\n``` python\nwith rasterio.open(file1.tif) as src:\n    with rasterio.open(file2.tif, 'w', **src.meta) as dst:\n        ...\n```\n\nTraceback snippet:\n\n```\nTraceback (most recent call last):\n  ...\n  File \"copier.py\", line 15, in to_png\n    with rio.open(dst_path, \"w\", **meta) as dst:\n  File \"xxx/anaconda/lib/python2.7/site-packages/rasterio/__init__.py\", line 91, in open\n    transform = guard_transform(transform)\n  File \"xxx/anaconda/lib/python2.7/site-packages/rasterio/transform.py\", line 27, in guard_transform\n    transform.a, transform.e))\nValueError: Transform has invalid coefficients a, e: (0.000000, 0.000000)\n```\n\n", "before_files": [{"content": "\nimport warnings\n\nfrom affine import Affine\n\nIDENTITY = Affine.identity()\n\ndef tastes_like_gdal(t):\n    return t[2] == t[4] == 0.0 and t[1] > 0 and t[5] < 0\n\ndef guard_transform(transform):\n    \"\"\"Return an Affine transformation instance\"\"\"\n    if not isinstance(transform, Affine):\n        if tastes_like_gdal(transform):\n            warnings.warn(\n                \"GDAL-style transforms are deprecated and will not \"\n                \"be supported in Rasterio 1.0.\",\n                FutureWarning,\n                stacklevel=2)\n            transform = Affine.from_gdal(*transform)\n        else:\n            transform = Affine(*transform)\n    a, e = transform.a, transform.e\n    if a == 0.0 or e == 0.0:\n        raise ValueError(\n            \"Transform has invalid coefficients a, e: (%f, %f)\" % (\n                transform.a, transform.e))\n    return transform\n\n", "path": "rasterio/transform.py"}]}