We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
examples/total.py won't run in Python3
The line `total /= 3` should read instead, `total = total / 3`.


--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `examples/sieve.py`
Content:
```
1 #!/usr/bin/env python
2 #
3 # sieve: demonstrate sieving and polygonizing of raster features.
4 
5 import subprocess
6 
7 import numpy as np
8 import rasterio
9 from rasterio.features import sieve, shapes
10 
11 
12 # Register GDAL and OGR drivers.
13 with rasterio.Env():
14 
15     # Read a raster to be sieved.
16     with rasterio.open('tests/data/shade.tif') as src:
17         shade = src.read(1)
18 
19     # Print the number of shapes in the source raster.
20     print("Slope shapes: %d" % len(list(shapes(shade))))
21 
22     # Sieve out features 13 pixels or smaller.
23     sieved = sieve(shade, 13, out=np.zeros(src.shape, src.dtypes[0]))
24 
25     # Print the number of shapes in the sieved raster.
26     print("Sieved (13) shapes: %d" % len(list(shapes(sieved))))
27 
28     # Write out the sieved raster.
29     kwargs = src.meta
30     kwargs['transform'] = kwargs.pop('affine')
31     with rasterio.open('example-sieved.tif', 'w', **kwargs) as dst:
32         dst.write(sieved, indexes=1)
33 
34 # Dump out gdalinfo's report card and open (or "eog") the TIFF.
35 print(subprocess.check_output(
36     ['gdalinfo', '-stats', 'example-sieved.tif']))
37 subprocess.call(['open', 'example-sieved.tif'])
38
```

Path: `examples/total.py`
Content:
```
1 import numpy as np
2 import rasterio
3 import subprocess
4 
5 with rasterio.Env(CPL_DEBUG=True):
6 
7     # Read raster bands directly to Numpy arrays.
8     with rasterio.open('tests/data/RGB.byte.tif') as src:
9         r, g, b = src.read()
10 
11     # Combine arrays using the 'iadd' ufunc. Expecting that the sum will
12     # exceed the 8-bit integer range, initialize it as 16-bit. Adding other
13     # arrays to it in-place converts those arrays up and preserves the type
14     # of the total array.
15     total = np.zeros(r.shape, dtype=rasterio.uint16)
16     for band in (r, g, b):
17         total += band
18     total /= 3
19 
20     # Write the product as a raster band to a new 8-bit file. For keyword
21     # arguments, we start with the meta attributes of the source file, but
22     # then change the band count to 1, set the dtype to uint8, and specify
23     # LZW compression.
24     kwargs = src.meta
25     kwargs.update(
26         dtype=rasterio.uint8,
27         count=1,
28         compress='lzw')
29 
30     with rasterio.open('example-total.tif', 'w', **kwargs) as dst:
31         dst.write(total.astype(rasterio.uint8), indexes=1)
32 
33 # Dump out gdalinfo's report card and open the image.
34 info = subprocess.check_output(
35     ['gdalinfo', '-stats', 'example-total.tif'])
36 print(info)
37 subprocess.call(['open', 'example-total.tif'])
38
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/examples/sieve.py b/examples/sieve.py
--- a/examples/sieve.py
+++ b/examples/sieve.py
@@ -27,7 +27,7 @@
 
     # Write out the sieved raster.
     kwargs = src.meta
-    kwargs['transform'] = kwargs.pop('affine')
+    kwargs['transform'] = rasterio.transform.guard_transform(kwargs['transform'])
     with rasterio.open('example-sieved.tif', 'w', **kwargs) as dst:
         dst.write(sieved, indexes=1)
 
diff --git a/examples/total.py b/examples/total.py
--- a/examples/total.py
+++ b/examples/total.py
@@ -1,3 +1,4 @@
+from __future__ import division
 import numpy as np
 import rasterio
 import subprocess
@@ -15,7 +16,7 @@
     total = np.zeros(r.shape, dtype=rasterio.uint16)
     for band in (r, g, b):
         total += band
-    total /= 3
+    total = total // 3
 
     # Write the product as a raster band to a new 8-bit file. For keyword
     # arguments, we start with the meta attributes of the source file, but

{"golden_diff": "diff --git a/examples/sieve.py b/examples/sieve.py\n--- a/examples/sieve.py\n+++ b/examples/sieve.py\n@@ -27,7 +27,7 @@\n \n     # Write out the sieved raster.\n     kwargs = src.meta\n-    kwargs['transform'] = kwargs.pop('affine')\n+    kwargs['transform'] = rasterio.transform.guard_transform(kwargs['transform'])\n     with rasterio.open('example-sieved.tif', 'w', **kwargs) as dst:\n         dst.write(sieved, indexes=1)\n \ndiff --git a/examples/total.py b/examples/total.py\n--- a/examples/total.py\n+++ b/examples/total.py\n@@ -1,3 +1,4 @@\n+from __future__ import division\n import numpy as np\n import rasterio\n import subprocess\n@@ -15,7 +16,7 @@\n     total = np.zeros(r.shape, dtype=rasterio.uint16)\n     for band in (r, g, b):\n         total += band\n-    total /= 3\n+    total = total // 3\n \n     # Write the product as a raster band to a new 8-bit file. For keyword\n     # arguments, we start with the meta attributes of the source file, but\n", "issue": "examples/total.py won't run in Python3\nThe line `total /= 3` should read instead, `total = total / 3`.\r\n\n", "before_files": [{"content": "#!/usr/bin/env python\n#\n# sieve: demonstrate sieving and polygonizing of raster features.\n\nimport subprocess\n\nimport numpy as np\nimport rasterio\nfrom rasterio.features import sieve, shapes\n\n\n# Register GDAL and OGR drivers.\nwith rasterio.Env():\n\n    # Read a raster to be sieved.\n    with rasterio.open('tests/data/shade.tif') as src:\n        shade = src.read(1)\n\n    # Print the number of shapes in the source raster.\n    print(\"Slope shapes: %d\" % len(list(shapes(shade))))\n\n    # Sieve out features 13 pixels or smaller.\n    sieved = sieve(shade, 13, out=np.zeros(src.shape, src.dtypes[0]))\n\n    # Print the number of shapes in the sieved raster.\n    print(\"Sieved (13) shapes: %d\" % len(list(shapes(sieved))))\n\n    # Write out the sieved raster.\n    kwargs = src.meta\n    kwargs['transform'] = kwargs.pop('affine')\n    with rasterio.open('example-sieved.tif', 'w', **kwargs) as dst:\n        dst.write(sieved, indexes=1)\n\n# Dump out gdalinfo's report card and open (or \"eog\") the TIFF.\nprint(subprocess.check_output(\n    ['gdalinfo', '-stats', 'example-sieved.tif']))\nsubprocess.call(['open', 'example-sieved.tif'])\n", "path": "examples/sieve.py"}, {"content": "import numpy as np\nimport rasterio\nimport subprocess\n\nwith rasterio.Env(CPL_DEBUG=True):\n\n    # Read raster bands directly to Numpy arrays.\n    with rasterio.open('tests/data/RGB.byte.tif') as src:\n        r, g, b = src.read()\n\n    # Combine arrays using the 'iadd' ufunc. Expecting that the sum will\n    # exceed the 8-bit integer range, initialize it as 16-bit. Adding other\n    # arrays to it in-place converts those arrays up and preserves the type\n    # of the total array.\n    total = np.zeros(r.shape, dtype=rasterio.uint16)\n    for band in (r, g, b):\n        total += band\n    total /= 3\n\n    # Write the product as a raster band to a new 8-bit file. For keyword\n    # arguments, we start with the meta attributes of the source file, but\n    # then change the band count to 1, set the dtype to uint8, and specify\n    # LZW compression.\n    kwargs = src.meta\n    kwargs.update(\n        dtype=rasterio.uint8,\n        count=1,\n        compress='lzw')\n\n    with rasterio.open('example-total.tif', 'w', **kwargs) as dst:\n        dst.write(total.astype(rasterio.uint8), indexes=1)\n\n# Dump out gdalinfo's report card and open the image.\ninfo = subprocess.check_output(\n    ['gdalinfo', '-stats', 'example-total.tif'])\nprint(info)\nsubprocess.call(['open', 'example-total.tif'])\n", "path": "examples/total.py"}], "after_files": [{"content": "#!/usr/bin/env python\n#\n# sieve: demonstrate sieving and polygonizing of raster features.\n\nimport subprocess\n\nimport numpy as np\nimport rasterio\nfrom rasterio.features import sieve, shapes\n\n\n# Register GDAL and OGR drivers.\nwith rasterio.Env():\n\n    # Read a raster to be sieved.\n    with rasterio.open('tests/data/shade.tif') as src:\n        shade = src.read(1)\n\n    # Print the number of shapes in the source raster.\n    print(\"Slope shapes: %d\" % len(list(shapes(shade))))\n\n    # Sieve out features 13 pixels or smaller.\n    sieved = sieve(shade, 13, out=np.zeros(src.shape, src.dtypes[0]))\n\n    # Print the number of shapes in the sieved raster.\n    print(\"Sieved (13) shapes: %d\" % len(list(shapes(sieved))))\n\n    # Write out the sieved raster.\n    kwargs = src.meta\n    kwargs['transform'] = rasterio.transform.guard_transform(kwargs['transform'])\n    with rasterio.open('example-sieved.tif', 'w', **kwargs) as dst:\n        dst.write(sieved, indexes=1)\n\n# Dump out gdalinfo's report card and open (or \"eog\") the TIFF.\nprint(subprocess.check_output(\n    ['gdalinfo', '-stats', 'example-sieved.tif']))\nsubprocess.call(['open', 'example-sieved.tif'])\n", "path": "examples/sieve.py"}, {"content": "from __future__ import division\nimport numpy as np\nimport rasterio\nimport subprocess\n\nwith rasterio.Env(CPL_DEBUG=True):\n\n    # Read raster bands directly to Numpy arrays.\n    with rasterio.open('tests/data/RGB.byte.tif') as src:\n        r, g, b = src.read()\n\n    # Combine arrays using the 'iadd' ufunc. Expecting that the sum will\n    # exceed the 8-bit integer range, initialize it as 16-bit. Adding other\n    # arrays to it in-place converts those arrays up and preserves the type\n    # of the total array.\n    total = np.zeros(r.shape, dtype=rasterio.uint16)\n    for band in (r, g, b):\n        total += band\n    total = total // 3\n\n    # Write the product as a raster band to a new 8-bit file. For keyword\n    # arguments, we start with the meta attributes of the source file, but\n    # then change the band count to 1, set the dtype to uint8, and specify\n    # LZW compression.\n    kwargs = src.meta\n    kwargs.update(\n        dtype=rasterio.uint8,\n        count=1,\n        compress='lzw')\n\n    with rasterio.open('example-total.tif', 'w', **kwargs) as dst:\n        dst.write(total.astype(rasterio.uint8), indexes=1)\n\n# Dump out gdalinfo's report card and open the image.\ninfo = subprocess.check_output(\n    ['gdalinfo', '-stats', 'example-total.tif'])\nprint(info)\nsubprocess.call(['open', 'example-total.tif'])\n", "path": "examples/total.py"}]}