[GRASS-SVN] r74505 - in grass/trunk/lib/python/pygrass: raster vector

svn_grass at osgeo.org svn_grass at osgeo.org
Thu May 16 14:11:05 PDT 2019


Author: annakrat
Date: 2019-05-16 14:11:05 -0700 (Thu, 16 May 2019)
New Revision: 74505

Modified:
   grass/trunk/lib/python/pygrass/raster/segment.py
   grass/trunk/lib/python/pygrass/vector/abstract.py
Log:
pygrass: fixes for Python 3

Modified: grass/trunk/lib/python/pygrass/raster/segment.py
===================================================================
--- grass/trunk/lib/python/pygrass/raster/segment.py	2019-05-16 20:54:26 UTC (rev 74504)
+++ grass/trunk/lib/python/pygrass/raster/segment.py	2019-05-16 21:11:05 UTC (rev 74505)
@@ -27,8 +27,8 @@
     def nseg(self):
         rows = self.rows()
         cols = self.cols()
-        return ((rows + self.srows - 1) / self.srows) * \
-               ((cols + self.scols - 1) / self.scols)
+        return int(((rows + self.srows - 1) / self.srows) *
+                   ((cols + self.scols - 1) / self.scols))
 
     def segments_in_mem(self):
         if self.maxmem > 0 and self.maxmem < 100:

Modified: grass/trunk/lib/python/pygrass/vector/abstract.py
===================================================================
--- grass/trunk/lib/python/pygrass/vector/abstract.py	2019-05-16 20:54:26 UTC (rev 74504)
+++ grass/trunk/lib/python/pygrass/vector/abstract.py	2019-05-16 21:11:05 UTC (rev 74505)
@@ -127,7 +127,7 @@
 
     def _get_organization(self):
         """Private method to obtain the Vector organization"""
-        return libvect.Vect_get_organization(self.c_mapinfo)
+        return utils.decode(libvect.Vect_get_organization(self.c_mapinfo))
 
     def _set_organization(self, org):
         """Private method to change the Vector organization"""
@@ -138,7 +138,7 @@
 
     def _get_date(self):
         """Private method to obtain the Vector date"""
-        return libvect.Vect_get_date(self.c_mapinfo)
+        return utils.decode(libvect.Vect_get_date(self.c_mapinfo))
 
     def _set_date(self, date):
         """Private method to change the Vector date"""
@@ -149,7 +149,7 @@
 
     def _get_person(self):
         """Private method to obtain the Vector person"""
-        return libvect.Vect_get_person(self.c_mapinfo)
+        return utils.decode(libvect.Vect_get_person(self.c_mapinfo))
 
     def _set_person(self, person):
         """Private method to change the Vector person"""
@@ -160,7 +160,7 @@
 
     def _get_title(self):
         """Private method to obtain the Vector title"""
-        return libvect.Vect_get_map_name(self.c_mapinfo)
+        return utils.decode(libvect.Vect_get_map_name(self.c_mapinfo))
 
     def _set_title(self, title):
         """Private method to change the Vector title"""
@@ -171,7 +171,7 @@
 
     def _get_map_date(self):
         """Private method to obtain the Vector map date"""
-        date_str = libvect.Vect_get_map_date(self.c_mapinfo)
+        date_str = utils.decode(libvect.Vect_get_map_date(self.c_mapinfo))
         try:
             return datetime.datetime.strptime(date_str, self.date_fmt)
         except:
@@ -198,7 +198,7 @@
 
     def _get_comment(self):
         """Private method to obtain the Vector comment"""
-        return libvect.Vect_get_comment(self.c_mapinfo)
+        return utils.decode(libvect.Vect_get_comment(self.c_mapinfo))
 
     def _set_comment(self, comm):
         """Private method to set the Vector comment"""



More information about the grass-commit mailing list