[GRASS-SVN] r74128 - in grass/trunk: doc/python lib/python/pygrass/modules/interface lib/python/pygrass/raster lib/python/pygrass/vector lib/python/temporal
svn_grass at osgeo.org
svn_grass at osgeo.org
Sat Feb 23 20:59:47 PST 2019
Author: annakrat
Date: 2019-02-23 20:59:47 -0800 (Sat, 23 Feb 2019)
New Revision: 74128
Modified:
grass/trunk/doc/python/raster_example_ctypes.py
grass/trunk/lib/python/pygrass/modules/interface/module.py
grass/trunk/lib/python/pygrass/raster/__init__.py
grass/trunk/lib/python/pygrass/vector/basic.py
grass/trunk/lib/python/temporal/abstract_space_time_dataset.py
Log:
fix #3757: replace xrange with range
Modified: grass/trunk/doc/python/raster_example_ctypes.py
===================================================================
--- grass/trunk/doc/python/raster_example_ctypes.py 2019-02-23 14:01:46 UTC (rev 74127)
+++ grass/trunk/doc/python/raster_example_ctypes.py 2019-02-24 04:59:47 UTC (rev 74128)
@@ -64,7 +64,7 @@
# iterate through map rows
print "Map data:"
-for row_n in xrange(rows):
+for row_n in range(rows):
# read a row of raster data into memory, then print it
Rast_get_row(in_fd, in_rast, row_n, data_type)
print row_n, in_rast[0:cols]
Modified: grass/trunk/lib/python/pygrass/modules/interface/module.py
===================================================================
--- grass/trunk/lib/python/pygrass/modules/interface/module.py 2019-02-23 14:01:46 UTC (rev 74127)
+++ grass/trunk/lib/python/pygrass/modules/interface/module.py 2019-02-24 04:59:47 UTC (rev 74128)
@@ -61,7 +61,7 @@
>>> mapcalc = Module("r.mapcalc", overwrite=True, run_=False)
>>> queue = ParallelModuleQueue(nprocs=3)
- >>> for i in xrange(5):
+ >>> for i in range(5):
... new_mapcalc = copy.deepcopy(mapcalc)
... mapcalc_list.append(new_mapcalc)
... m = new_mapcalc(expression="test_pygrass_%i = %i"%(i, i))
@@ -84,7 +84,7 @@
>>> queue = ParallelModuleQueue(nprocs=8)
>>> mapcalc_list = []
- >>> for i in xrange(5):
+ >>> for i in range(5):
... new_mapcalc = copy.deepcopy(mapcalc)
... mapcalc_list.append(new_mapcalc)
... m = new_mapcalc(expression="test_pygrass_%i = %i"%(i, i))
@@ -108,7 +108,7 @@
>>> gregion = Module("g.region", flags="p", run_=False)
>>> queue = ParallelModuleQueue(nprocs=3)
>>> proc_list = []
- >>> for i in xrange(3):
+ >>> for i in range(3):
... new_gregion = copy.deepcopy(gregion)
... proc_list.append(new_gregion)
... new_mapcalc = copy.deepcopy(mapcalc)
Modified: grass/trunk/lib/python/pygrass/raster/__init__.py
===================================================================
--- grass/trunk/lib/python/pygrass/raster/__init__.py 2019-02-23 14:01:46 UTC (rev 74127)
+++ grass/trunk/lib/python/pygrass/raster/__init__.py 2019-02-24 04:59:47 UTC (rev 74128)
@@ -409,7 +409,7 @@
>>> map_b = RasterSegment(test_raster_name + "_segment")
>>> map_a.open('r')
>>> map_b.open('w', mtype="CELL", overwrite=True)
- >>> for row in xrange(map_a.info.rows):
+ >>> for row in range(map_a.info.rows):
... map_b[row] = map_a[row] + 1000
>>> map_a.close()
>>> map_b.close()
@@ -439,7 +439,7 @@
>>> elev = RasterSegment(test_raster_name)
>>> elev.open('r')
- >>> for i in xrange(4):
+ >>> for i in range(4):
... elev.get(i,i)
11
22
@@ -476,8 +476,8 @@
>>> map_b = RasterSegment(test_raster_name + "_segment")
>>> map_a.open('r')
>>> map_b.open('w', mtype="FCELL", overwrite=True)
- >>> for row in xrange(map_a.info.rows):
- ... for col in xrange(map_a.info.cols):
+ >>> for row in range(map_a.info.rows):
+ ... for col in range(map_a.info.cols):
... value = map_a.get(row,col)
... map_b.put(row,col,value + 100)
>>> map_a.close()
Modified: grass/trunk/lib/python/pygrass/vector/basic.py
===================================================================
--- grass/trunk/lib/python/pygrass/vector/basic.py 2019-02-23 14:01:46 UTC (rev 74127)
+++ grass/trunk/lib/python/pygrass/vector/basic.py 2019-02-24 04:59:47 UTC (rev 74128)
@@ -381,7 +381,7 @@
to the C line_cats struct.
>>> cats = Cats()
- >>> for cat in xrange(100, 110): cats.set(cat, layer=cat-50)
+ >>> for cat in range(100, 110): cats.set(cat, layer=cat-50)
>>> cats.n_cats
10
>>> cats.cat
Modified: grass/trunk/lib/python/temporal/abstract_space_time_dataset.py
===================================================================
--- grass/trunk/lib/python/temporal/abstract_space_time_dataset.py 2019-02-23 14:01:46 UTC (rev 74127)
+++ grass/trunk/lib/python/temporal/abstract_space_time_dataset.py 2019-02-24 04:59:47 UTC (rev 74128)
@@ -1143,7 +1143,7 @@
>>> import grass.temporal as tgis
>>> maps = []
- >>> for i in xrange(3):
+ >>> for i in range(3):
... map = tgis.RasterDataset("map%i at PERMANENT"%i)
... check = map.set_relative_time(i + 2, i + 3, "days")
... maps.append(map)
More information about the grass-commit
mailing list