[GRASS-SVN] r62384 - in grass/trunk/lib/python/pygrass: raster vector vector/testsuite
svn_grass at osgeo.org
svn_grass at osgeo.org
Sun Oct 26 10:18:06 PDT 2014
Author: zarch
Date: 2014-10-26 10:18:06 -0700 (Sun, 26 Oct 2014)
New Revision: 62384
Modified:
grass/trunk/lib/python/pygrass/raster/__init__.py
grass/trunk/lib/python/pygrass/raster/abstract.py
grass/trunk/lib/python/pygrass/vector/__init__.py
grass/trunk/lib/python/pygrass/vector/abstract.py
grass/trunk/lib/python/pygrass/vector/geometry.py
grass/trunk/lib/python/pygrass/vector/table.py
grass/trunk/lib/python/pygrass/vector/testsuite/test_vector3d.py
Log:
pygrass: fix other import after functions has been renamed
Modified: grass/trunk/lib/python/pygrass/raster/__init__.py
===================================================================
--- grass/trunk/lib/python/pygrass/raster/__init__.py 2014-10-26 17:00:51 UTC (rev 62383)
+++ grass/trunk/lib/python/pygrass/raster/__init__.py 2014-10-26 17:18:06 UTC (rev 62384)
@@ -22,7 +22,7 @@
#
from grass.pygrass.errors import OpenError, must_be_open
from grass.pygrass.gis.region import Region
-from grass.pygrass import functions
+from grass.pygrass import utils
#
# import raster classes
@@ -664,7 +664,7 @@
"""
if not region:
region = Region()
- x, y = functions.coor2pixel(point.coords(), region)
+ x, y = utils.coor2pixel(point.coords(), region)
return self[x][y]
Modified: grass/trunk/lib/python/pygrass/raster/abstract.py
===================================================================
--- grass/trunk/lib/python/pygrass/raster/abstract.py 2014-10-26 17:00:51 UTC (rev 62383)
+++ grass/trunk/lib/python/pygrass/raster/abstract.py 2014-10-26 17:18:06 UTC (rev 62384)
@@ -18,7 +18,7 @@
#
# import pygrass modules
#
-from grass.pygrass import functions
+from grass.pygrass import utils
from grass.pygrass.gis.region import Region
from grass.pygrass.errors import must_be_open
from grass.pygrass.shell.conversion import dict2html
@@ -294,7 +294,7 @@
def _set_name(self, newname):
"""Private method to change the Raster name"""
- if not functions.is_clean_name(newname):
+ if not utils.is_clean_name(newname):
str_err = _("Map name {0} not valid")
raise ValueError(str_err.format(newname))
if self.exist():
@@ -347,7 +347,7 @@
return (self.__getitem__(irow) for irow in range(self._rows))
def _repr_png_(self):
- return raw_figure(functions.r_export(self))
+ return raw_figure(utils.r_export(self))
def exist(self):
"""Return True if the map already exist, and
@@ -361,10 +361,10 @@
"""
if self.name:
if self.mapset == '':
- mapset = functions.get_mapset_raster(self.name, self.mapset)
+ mapset = utils.get_mapset_raster(self.name, self.mapset)
self.mapset = mapset if mapset else ''
return True if mapset else False
- return bool(functions.get_mapset_raster(self.name, self.mapset))
+ return bool(utils.get_mapset_raster(self.name, self.mapset))
else:
return False
@@ -391,7 +391,7 @@
"""Remove the map"""
if self.is_open():
self.close()
- functions.remove(self.name, 'rast')
+ utils.remove(self.name, 'rast')
def fullname(self):
"""Return the full name of a raster map: name at mapset"""
@@ -421,7 +421,7 @@
def rename(self, newname):
"""Rename the map"""
if self.exist():
- functions.rename(self.name, newname, 'rast')
+ utils.rename(self.name, newname, 'rast')
self._name = newname
def set_from_rast(self, rastname='', mapset=''):
@@ -452,7 +452,7 @@
"""
if not region:
region = Region()
- row, col = functions.coor2pixel(point.coords(), region)
+ row, col = utils.coor2pixel(point.coords(), region)
if col < 0 or col > region.cols or row < 0 or row > region.rows:
return None
line = self.get_row(int(row))
Modified: grass/trunk/lib/python/pygrass/vector/__init__.py
===================================================================
--- grass/trunk/lib/python/pygrass/vector/__init__.py 2014-10-26 17:00:51 UTC (rev 62383)
+++ grass/trunk/lib/python/pygrass/vector/__init__.py 2014-10-26 17:18:06 UTC (rev 62384)
@@ -212,7 +212,7 @@
False
>>> cens.close()
- >>> from grass.pygrass.functions import copy, remove
+ >>> from grass.pygrass.utils import copy, remove
>>> copy('census','mycensus','vect')
>>> from grass.pygrass.modules.shortcuts import vector as v
>>> v.colors(map='mycensus', color='population', column='TOTAL_POP')
Modified: grass/trunk/lib/python/pygrass/vector/abstract.py
===================================================================
--- grass/trunk/lib/python/pygrass/vector/abstract.py 2014-10-26 17:00:51 UTC (rev 62383)
+++ grass/trunk/lib/python/pygrass/vector/abstract.py 2014-10-26 17:18:06 UTC (rev 62384)
@@ -9,7 +9,7 @@
import grass.lib.vector as libvect
from grass.pygrass.vector.vector_type import MAPTYPE
-from grass.pygrass import functions
+from grass.pygrass import utils
from grass.pygrass.errors import GrassError, OpenError, must_be_open
from grass.pygrass.vector.table import DBlinks, Link
from grass.pygrass.vector.find import PointFinder, BboxFinder, PolygonFinder
@@ -104,7 +104,7 @@
def _set_name(self, newname):
"""Private method to change the Vector name"""
- if not functions.is_clean_name(newname):
+ if not utils.is_clean_name(newname):
str_err = _("Map name {0} not valid")
raise ValueError(str_err.format(newname))
if self.exist():
@@ -268,7 +268,7 @@
"""
if self.exist():
if not self.is_open():
- functions.rename(self.name, newname, 'vect')
+ utils.rename(self.name, newname, 'vect')
else:
raise GrassError("The map is open, not able to renamed it.")
self._name = newname
@@ -281,10 +281,10 @@
"""Return if the Vector exists or not"""
if self.name:
if self.mapset == '':
- mapset = functions.get_mapset_vector(self.name, self.mapset)
+ mapset = utils.get_mapset_vector(self.name, self.mapset)
self.mapset = mapset if mapset else ''
return True if mapset else False
- return bool(functions.get_mapset_vector(self.name, self.mapset))
+ return bool(utils.get_mapset_vector(self.name, self.mapset))
else:
return False
@@ -388,7 +388,7 @@
self.layer = self.dblinks.by_layer(layer).layer
self.table = self.dblinks.by_layer(layer).table()
self.n_lines = self.table.n_rows()
- self.writable = self.mapset == functions.getenv("MAPSET")
+ self.writable = self.mapset == utils.getenv("MAPSET")
self.find = {'by_point': PointFinder(self.c_mapinfo, self.table,
self.writable),
'by_box': BboxFinder(self.c_mapinfo, self.table,
@@ -417,7 +417,7 @@
"""Remove vector map"""
if self.is_open():
self.close()
- functions.remove(self.name, 'vect')
+ utils.remove(self.name, 'vect')
def build(self):
"""Close the vector map and build vector Topology"""
Modified: grass/trunk/lib/python/pygrass/vector/geometry.py
===================================================================
--- grass/trunk/lib/python/pygrass/vector/geometry.py 2014-10-26 17:00:51 UTC (rev 62383)
+++ grass/trunk/lib/python/pygrass/vector/geometry.py 2014-10-26 17:18:06 UTC (rev 62384)
@@ -176,7 +176,7 @@
"""Set value of a given column of a table attribute.
>>> from grass.pygrass.vector import VectorTopo
- >>> from grass.pygrass.functions import copy, remove
+ >>> from grass.pygrass.utils import copy, remove
>>> copy('schools', 'myschools', 'vect')
>>> schools = VectorTopo('myschools')
>>> schools.open('r')
Modified: grass/trunk/lib/python/pygrass/vector/table.py
===================================================================
--- grass/trunk/lib/python/pygrass/vector/table.py 2014-10-26 17:00:51 UTC (rev 62383)
+++ grass/trunk/lib/python/pygrass/vector/table.py 2014-10-26 17:18:06 UTC (rev 62384)
@@ -25,7 +25,7 @@
import grass.lib.vector as libvect
from grass.pygrass.gis import Mapset
from grass.pygrass.errors import DBError
-from grass.pygrass.functions import table_exist
+from grass.pygrass.utils import table_exist
from grass.script.db import db_table_in_vector
from grass.script.core import warning
@@ -382,7 +382,7 @@
>>> import sqlite3
>>> path = '$GISDBASE/$LOCATION_NAME/$MAPSET/sqlite/sqlite.db'
- >>> from grass.pygrass.functions import copy, remove
+ >>> from grass.pygrass.utils import copy, remove
>>> copy('census','mycensus','vect')
>>> cols_sqlite = Columns('mycensus',
... sqlite3.connect(get_path(path)))
@@ -441,7 +441,7 @@
>>> import sqlite3
>>> path = '$GISDBASE/$LOCATION_NAME/$MAPSET/sqlite/sqlite.db'
- >>> from grass.pygrass.functions import copy, remove
+ >>> from grass.pygrass.utils import copy, remove
>>> copy('census','mycensus','vect')
>>> cols_sqlite = Columns('mycensus',
... sqlite3.connect(get_path(path)))
@@ -495,7 +495,7 @@
>>> import sqlite3
>>> path = '$GISDBASE/$LOCATION_NAME/$MAPSET/sqlite/sqlite.db'
- >>> from grass.pygrass.functions import copy, remove
+ >>> from grass.pygrass.utils import copy, remove
>>> copy('census','mycensus','vect')
>>> cols_sqlite = Columns('mycensus',
... sqlite3.connect(get_path(path)))
@@ -536,7 +536,7 @@
>>> import sqlite3
>>> path = '$GISDBASE/$LOCATION_NAME/$MAPSET/sqlite/sqlite.db'
- >>> from grass.pygrass.functions import copy, remove
+ >>> from grass.pygrass.utils import copy, remove
>>> copy('census','mycensus','vect')
>>> cols_sqlite = Columns('mycensus',
... sqlite3.connect(get_path(path)))
Modified: grass/trunk/lib/python/pygrass/vector/testsuite/test_vector3d.py
===================================================================
--- grass/trunk/lib/python/pygrass/vector/testsuite/test_vector3d.py 2014-10-26 17:00:51 UTC (rev 62383)
+++ grass/trunk/lib/python/pygrass/vector/testsuite/test_vector3d.py 2014-10-26 17:18:06 UTC (rev 62384)
@@ -13,7 +13,7 @@
from grass.pygrass.vector import VectorTopo
from grass.pygrass.vector.geometry import Point
from grass.pygrass.gis.region import Region
-from grass.pygrass.functions import get_mapset_vector
+from grass.pygrass.utils import get_mapset_vector
def generate_coordinates(number, bbox=None, with_z=False):
More information about the grass-commit
mailing list