Browse Source

pygrass doc: several improvements to sphinx documentation

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@60583 15284696-431f-4ddb-bdfa-cd5b030d7da7
Luca Delucchi 11 years ago
parent
commit
9f963cb76f

+ 5 - 3
lib/python/pygrass/docs/index.rst

@@ -19,11 +19,13 @@ Contents:
 
    gis
    raster
+   raster_elements
    vector
-   attributes
-   vector_database
+   vector_attributes
+   vector_features
+   vector_utils
    modules
-   gridmodules
+   modules_grid
    messages
 
 

+ 2 - 2
lib/python/pygrass/docs/modules.rst

@@ -1,5 +1,5 @@
-Modules
-=======
+Introduction on Modules
+=========================
 
 Grass modules are represented as objects. These objects are generated based
 on the XML module description that is used for GUI generation already. ::

lib/python/pygrass/docs/gridmodules.rst → lib/python/pygrass/docs/modules_grid.rst


+ 0 - 137
lib/python/pygrass/docs/raster.rst

@@ -58,104 +58,6 @@ We can rename the map: ::
     >>> print(new)
     new
 
-
-
-
-.. _RasterCategory-label:
-
-Categories
-----------
-
-All the raster classes support raster categories and share commons methods
-to modify the raster category.
-It is possible to check if the map has or not the categories with the
-``has_cats`` method. ::
-
-    >>> elev.has_cats()
-    False
-
-Opening a map that has category, for example the "landcove_1m" raster map
-from the North Carolina mapset. The ``has_cats`` method return True. ::
-
-    >>> land = raster.RasterRow('landcover_1m')
-    >>> land.has_cats()
-    True
-
-Get and set the categories title, with: ::
-
-    >>> land.cats_title
-    'Rural area: Landcover'
-    >>> land.cats_title = 'Rural area: Landcover2'
-    >>> land.cats_title
-    'Rural area: Landcover2'
-    >>> land.cats_title = 'Rural area: Landcover'
-
-Get the number of categories of the map with: ::
-
-    >>> land.num_cats()
-    11
-
-See all the categories with: ::
-
-    >>> land.cats
-    [('pond', 1, None),
-     ('forest', 2, None),
-     ('developed', 3, None),
-     ('bare', 4, None),
-     ('paved road', 5, None),
-     ('dirt road', 6, None),
-     ('vineyard', 7, None),
-     ('agriculture', 8, None),
-     ('wetland', 9, None),
-     ('bare ground path', 10, None),
-     ('grass', 11, None)]
-
-Access a single category, using Rast_get_ith_cat(), with: ::
-
-    >>> land.cats[0]
-    ('pond', 1, None)
-    >>> land.cats['pond']
-    ('pond', 1, None)
-    >>> land.get_cat(0)
-    ('pond', 1, None)
-    >>> land.get_cat('pond')
-    ('pond', 1, None)
-
-Add new or change existing categories: ::
-
-    >>> land.set_cat('label', 1)
-    >>> land.get_cat('label')
-    ('label', 1, None)
-    >>> land.set_cat('pond', 1, 1)
-
-
-Sort categories, with: ::
-
-    >>> land.sort_cats()
-
-
-Copy categories from another raster map with: ::
-
-    >>> land.copy_cats(elev)
-
-Read and Write: ::
-
-    >>> land.read_cats()
-    >>> #land.write_cats()
-
-Get a Category object or set from a Category object: ::
-
-    >>> cats = land.get_cats()
-    >>> land.set_cats(cats)
-
-Export and import from a file: ::
-
-    >>> land.write_cats_rules('land_rules.csv', ';')
-    >>> land.read_cats_rules('land_rules.csv', ';')
-
-.. autoclass:: pygrass.raster.category.Category
-    :members:
-
 .. _RasterRow-label:
 
 RastRow
@@ -351,45 +253,6 @@ to load all the map in memory. ::
 .. autoclass:: pygrass.raster.RasterNumpy
     :members:
 
-.. _Buffer-label:
-
-Buffer
-------
-
-The buffer class is used to interact with a memory buffer of a map like a
-raster row. The buffer class is based on the `numpy.ndarray`_ class. Therefore
-all the nice feature of the ndarray are allowed.
-
-.. autoclass:: pygrass.raster.buffer.Buffer
-    :members:
-
-.. _numpy.ndarray: http://docs.scipy.org/doc/numpy/reference/generated/numpy.ndarray.html
-
-
-.. _RowIO-label:
-
-RowIO
-------
-
-.. autoclass:: pygrass.raster.rowio.RowIO
-    :members:
-
-.. _Segment-label:
-
-Segment
--------
-
-.. autoclass:: pygrass.raster.segment.Segment
-    :members:
-
-.. _History-label:
-
-History
---------
-
-.. autoclass:: pygrass.raster.history.History
-    :members:
-
 
 .. _Raster library: http://grass.osgeo.org/programming7/rasterlib.html
 .. _RowIO library: http://grass.osgeo.org/programming7/rowiolib.html

+ 136 - 0
lib/python/pygrass/docs/raster_elements.rst

@@ -0,0 +1,136 @@
+Raster elements
+=================
+
+.. _RasterCategory-label:
+
+Categories
+----------
+
+All the raster classes support raster categories and share commons methods
+to modify the raster category.
+It is possible to check if the map has or not the categories with the
+``has_cats`` method. ::
+
+    >>> elev.has_cats()
+    False
+
+Opening a map that has category, for example the "landcove_1m" raster map
+from the North Carolina mapset. The ``has_cats`` method return True. ::
+
+    >>> land = raster.RasterRow('landcover_1m')
+    >>> land.has_cats()
+    True
+
+Get and set the categories title, with: ::
+
+    >>> land.cats_title
+    'Rural area: Landcover'
+    >>> land.cats_title = 'Rural area: Landcover2'
+    >>> land.cats_title
+    'Rural area: Landcover2'
+    >>> land.cats_title = 'Rural area: Landcover'
+
+Get the number of categories of the map with: ::
+
+    >>> land.num_cats()
+    11
+
+See all the categories with: ::
+
+    >>> land.cats
+    [('pond', 1, None),
+     ('forest', 2, None),
+     ('developed', 3, None),
+     ('bare', 4, None),
+     ('paved road', 5, None),
+     ('dirt road', 6, None),
+     ('vineyard', 7, None),
+     ('agriculture', 8, None),
+     ('wetland', 9, None),
+     ('bare ground path', 10, None),
+     ('grass', 11, None)]
+
+Access a single category, using Rast_get_ith_cat(), with: ::
+
+    >>> land.cats[0]
+    ('pond', 1, None)
+    >>> land.cats['pond']
+    ('pond', 1, None)
+    >>> land.get_cat(0)
+    ('pond', 1, None)
+    >>> land.get_cat('pond')
+    ('pond', 1, None)
+
+Add new or change existing categories: ::
+
+    >>> land.set_cat('label', 1)
+    >>> land.get_cat('label')
+    ('label', 1, None)
+    >>> land.set_cat('pond', 1, 1)
+
+
+Sort categories, with: ::
+
+    >>> land.sort_cats()
+
+
+Copy categories from another raster map with: ::
+
+    >>> land.copy_cats(elev)
+
+Read and Write: ::
+
+    >>> land.read_cats()
+    >>> #land.write_cats()
+
+Get a Category object or set from a Category object: ::
+
+    >>> cats = land.get_cats()
+    >>> land.set_cats(cats)
+
+Export and import from a file: ::
+
+    >>> land.write_cats_rules('land_rules.csv', ';')
+    >>> land.read_cats_rules('land_rules.csv', ';')
+
+.. autoclass:: pygrass.raster.category.Category
+    :members:
+
+.. _Buffer-label:
+
+Buffer
+------
+
+The buffer class is used to interact with a memory buffer of a map like a
+raster row. The buffer class is based on the `numpy.ndarray`_ class. Therefore
+all the nice feature of the ndarray are allowed.
+
+.. autoclass:: pygrass.raster.buffer.Buffer
+    :members:
+
+.. _numpy.ndarray: http://docs.scipy.org/doc/numpy/reference/generated/numpy.ndarray.html
+
+
+.. _RowIO-label:
+
+RowIO
+------
+
+.. autoclass:: pygrass.raster.rowio.RowIO
+    :members:
+
+.. _Segment-label:
+
+Segment
+-------
+
+.. autoclass:: pygrass.raster.segment.Segment
+    :members:
+
+.. _History-label:
+
+History
+--------
+
+.. autoclass:: pygrass.raster.history.History
+    :members:

+ 0 - 70
lib/python/pygrass/docs/vector.rst

@@ -126,73 +126,3 @@ VectorTopo
 
 .. autoclass:: pygrass.vector.VectorTopo
     :members:
-
-
-Vector Features
-===============
-
-Point
-------
-
-.. autoclass:: pygrass.vector.geometry.Point
-    :members:
-
-
-Line
------
-
-.. autoclass:: pygrass.vector.geometry.Line
-    :members:
-
-Boundary
---------
-
-.. autoclass:: pygrass.vector.geometry.Boundary
-    :members:
-
-Isle
------
-
-.. autoclass:: pygrass.vector.geometry.Isle
-    :members:
-
-
-Isles
------
-
-.. autoclass:: pygrass.vector.geometry.Isles
-    :members:
-
-Area
---------
-
-.. autoclass:: pygrass.vector.geometry.Area
-    :members:
-
-Utils
-=====
-
-Bbox
-----
-
-.. autoclass:: pygrass.vector.basic.Bbox
-    :members:
-
-
-BoxList
---------
-
-.. autoclass:: pygrass.vector.basic.BoxList
-    :members:
-
-Ilist
------
-
-.. autoclass:: pygrass.vector.basic.Ilist
-    :members:
-
-Cats
------
-
-.. autoclass:: pygrass.vector.basic.Cats
-    :members:

+ 21 - 15
lib/python/pygrass/docs/attributes.rst

@@ -1,5 +1,5 @@
-Attributes
-===========
+Vector Attributes
+===================
 
 It is possible to access the vector attributes with: ::
 
@@ -106,33 +106,39 @@ a new cursor object and interact with the database. ::
     >>> conn.close()
 
 
+DBlinks
+---------
+
+.. autoclass:: pygrass.vector.table.DBlinks
+    :members:
 
 Link
--------
+---------
 
 .. autoclass:: pygrass.vector.table.Link
     :members:
 
-DBlinks
--------
+Table
+---------
 
-.. autoclass:: pygrass.vector.table.DBlinks
+.. autoclass:: pygrass.vector.table.Table
     :members:
 
-Filters
--------
+Columns
+---------
 
-.. autoclass:: pygrass.vector.table.Filters
+.. autoclass:: pygrass.vector.table.Columns
     :members:
 
-Columns
--------
+Filters
+---------
 
-.. autoclass:: pygrass.vector.table.Columns
+.. autoclass:: pygrass.vector.table.Filters
     :members:
 
-Table
------
+SQL
+---------
 
-.. autoclass:: pygrass.vector.table.Table
+.. automodule:: pygrass.vector.sql
     :members:
+

+ 0 - 38
lib/python/pygrass/docs/vector_database.rst

@@ -1,38 +0,0 @@
-Vector Databases
-=================
-
-DBlinks
----------
-
-.. autoclass:: pygrass.vector.table.DBlinks
-    :members:
-
-Link
----------
-
-.. autoclass:: pygrass.vector.table.Link
-    :members:
-
-Table
----------
-
-.. autoclass:: pygrass.vector.table.Table
-    :members:
-
-Columns
----------
-
-.. autoclass:: pygrass.vector.table.Columns
-    :members:
-
-Filters
----------
-
-.. autoclass:: pygrass.vector.table.Filters
-    :members:
-
-SQL
----------
-
-.. automodule:: pygrass.vector.sql
-    :members:

+ 41 - 0
lib/python/pygrass/docs/vector_features.rst

@@ -0,0 +1,41 @@
+Vector Features
+===============
+
+Point
+------
+
+.. autoclass:: pygrass.vector.geometry.Point
+    :members:
+
+
+Line
+-----
+
+.. autoclass:: pygrass.vector.geometry.Line
+    :members:
+
+Boundary
+--------
+
+.. autoclass:: pygrass.vector.geometry.Boundary
+    :members:
+
+Isle
+-----
+
+.. autoclass:: pygrass.vector.geometry.Isle
+    :members:
+
+
+Isles
+-----
+
+.. autoclass:: pygrass.vector.geometry.Isles
+    :members:
+
+Area
+--------
+
+.. autoclass:: pygrass.vector.geometry.Area
+    :members:
+

+ 27 - 0
lib/python/pygrass/docs/vector_utils.rst

@@ -0,0 +1,27 @@
+Vector Utils
+===============
+
+Bbox
+----
+
+.. autoclass:: pygrass.vector.basic.Bbox
+    :members:
+
+
+BoxList
+--------
+
+.. autoclass:: pygrass.vector.basic.BoxList
+    :members:
+
+Ilist
+-----
+
+.. autoclass:: pygrass.vector.basic.Ilist
+    :members:
+
+Cats
+-----
+
+.. autoclass:: pygrass.vector.basic.Cats
+    :members:

+ 7 - 1
lib/python/pygrass/modules/interface/flag.py

@@ -8,8 +8,12 @@ from __future__ import (nested_scopes, generators, division, absolute_import,
                         with_statement, print_function, unicode_literals)
 from grass.pygrass.modules.interface import read
 
-
+# TODO add documentation
 class Flag(object):
+    """The Flag object store all information about a flag of module.
+
+    It is possible to set flags of command using this object.
+    """
     def __init__(self, xflag=None, diz=None):
         self.value = False
         diz = read.element2dict(xflag) if xflag is not None else diz
@@ -21,6 +25,7 @@ class Flag(object):
         self.guisection = diz.get('guisection', None)
 
     def get_bash(self):
+        """Prova"""
         if self.value:
             if self.special:
                 return '--%s' % self.name[0]
@@ -30,6 +35,7 @@ class Flag(object):
             return ''
 
     def get_python(self):
+        """Prova"""
         if self.value:
             if self.special:
                 return '%s=True' % self.name

+ 48 - 44
lib/python/pygrass/modules/interface/module.py

@@ -68,7 +68,7 @@ from grass.pygrass.modules.interface.read import GETFROMTAG, DOC
 
 
 class ParallelModuleQueue(object):
-    """!This class is designed to run an arbitrary number of pygrass Module
+    """This class is designed to run an arbitrary number of pygrass Module
        processes in parallel.
 
        Objects of type grass.pygrass.modules.Module can be put into the
@@ -82,8 +82,6 @@ class ParallelModuleQueue(object):
 
        Usage:
 
-       @code
-
        >>> import copy
        >>> import grass.pygrass.modules as pymod
        >>> mapcalc_list = []
@@ -106,27 +104,27 @@ class ParallelModuleQueue(object):
        0
        0
 
-       @endcode
-
     """
     def __init__(self, max_num_procs=1):
-        """!Constructor
+        """Constructor
 
-           @param max_num_procs The maximum number of Module processes that
-                                can be run in parallel
+        :param max_num_procs: The maximum number of Module processes that
+                              can be run in parallel
+        :type max_num_procs: int
         """
         self._num_procs = int(max_num_procs)
         self._list = int(max_num_procs) * [None]
         self._proc_count = 0
 
     def put(self, module):
-        """!Put the next Module object in the queue
+        """Put the next Module object in the queue
 
            To run the Module objects in parallel the run_ and finish_ options
            of the Module must be set to False.
 
-           @param module A preconfigured Module object with run_ and finish_
-                         set to False
+           :param module: a preconfigured Module object with run_ and finish_
+                          set to False
+           :type module: Module object
         """
         self._list[self._proc_count] = module
         self._list[self._proc_count].run()
@@ -136,38 +134,43 @@ class ParallelModuleQueue(object):
             self.wait()
 
     def get(self, num):
-        """!Get a Module object from the queue
+        """Get a Module object from the queue
 
-           @param num The number of the object in queue
-           @return The Module object or None if num is not in the queue
+           :param num: the number of the object in queue
+           :type num: int
+           :returns: the Module object or None if num is not in the queue
         """
         if num < self._num_procs:
             return self._list[num]
         return None
 
     def get_num_run_procs(self):
-        """!Get the number of Module processes that are in the queue running
+        """Get the number of Module processes that are in the queue running
            or finished
 
-           @return The maximum number fo Module processes running/finished in
-                   the queue
+           :returns: the maximum number fo Module processes running/finished in
+                     the queue
         """
         return len(self._list)
 
     def get_max_num_procs(self):
-        """!Return the maximum number of parallel Module processes
+        """Return the maximum number of parallel Module processes
         """
         return self._num_procs
 
     def set_max_num_procs(self, max_num_procs):
-        """!Set the maximum number of Module processes that should run
-           in parallel
+        """Set the maximum number of Module processes that should run
+        in parallel
+
+        :param max_num_procs: The maximum number of Module processes that
+                              can be run in parallel
+        :type max_num_procs: int   
         """
         self._num_procs = int(max_num_procs)
         self.wait()
 
     def wait(self):
-        """!Wait for all Module processes that are in the list to finish
+        """Wait for all Module processes that are in the list to finish
            and set the modules stdout and stderr output options
         """
         for proc in self._list:
@@ -185,24 +188,22 @@ class ParallelModuleQueue(object):
 
 class Module(object):
     """
-
     Python allow developers to not specify all the arguments and
     keyword arguments of a method or function.
 
-    ::
 
         def f(*args):
             for arg in args:
                 print arg
 
-    therefore if we call the function like: ::
+    therefore if we call the function like:
 
         >>> f('grass', 'gis', 'modules')
         grass
         gis
         modules
 
-    or we can define a new list: ::
+    or we can define a new list:
 
         >>> words = ['grass', 'gis', 'modules']
         >>> f(*words)
@@ -210,7 +211,7 @@ class Module(object):
         gis
         modules
 
-    we can do the same with keyword arguments, rewrite the above function: ::
+    we can do the same with keyword arguments, rewrite the above function:
 
         def f(*args, **kargs):
             for arg in args:
@@ -218,7 +219,7 @@ class Module(object):
             for key, value in kargs.items():
                 print "%s = %r" % (key, value)
 
-    now we can use the new function, with: ::
+    now we can use the new function, with:
 
         >>> f('grass', 'gis', 'modules', os = 'linux', language = 'python')
         grass
@@ -228,7 +229,7 @@ class Module(object):
         language = 'python'
 
     or, as before we can, define a dictionary and give the dictionary to
-    the function, like: ::
+    the function, like:
 
         >>> keywords = {'os' : 'linux', 'language' : 'python'}
         >>> f(*words, **keywords)
@@ -376,11 +377,12 @@ class Module(object):
                     raise ParameterError(msg % k)
             return self.run()
 
-
     def get_bash(self):
+        """Prova"""
         return ' '.join(self.make_cmd())
 
     def get_python(self):
+        """Prova"""
         prefix = self.name.split('.')[0]
         name = '_'.join(self.name.split('.')[1:])
         params = ', '.join([par.get_python() for par in self.params_list
@@ -403,7 +405,7 @@ class Module(object):
             return "%s.%s(%s)" % (prefix, name, params)
 
     def __str__(self):
-        """!Return the command string that can be executed in a shell
+        """Return the command string that can be executed in a shell
         """
         return ' '.join(self.make_cmd())
 
@@ -415,7 +417,7 @@ class Module(object):
         """{cmd_name}({cmd_params})
         """
         head = DOC['head'].format(cmd_name=self.name,
-             cmd_params=('\n' +  # go to a new line
+            cmd_params=('\n' +  # go to a new line
              # give space under the function name
              (' ' * (len(self.name) + 1))).join([', '.join(
              # transform each parameter in string
@@ -427,8 +429,8 @@ class Module(object):
         return '\n'.join([head, params, DOC['flag_head'], flags, DOC['foot']])
 
     def get_dict(self):
-        """!Return a dictionary that includes the name, all valid
-            inputs, outputs and flags
+        """Return a dictionary that includes the name, all valid
+        inputs, outputs and flags
         """
         dic = {}
         dic['name'] = self.name
@@ -440,9 +442,9 @@ class Module(object):
         return dic
 
     def make_cmd(self):
-        """!Create the command string that can be executed in a shell
+        """Create the command string that can be executed in a shell
 
-           @return The command string
+        :returns: the command string
         """
         skip = ['stdin', 'stdout', 'stderr']
         args = [self.name, ]
@@ -458,15 +460,17 @@ class Module(object):
         return args
 
     def run(self, node=None):
-        """!Run the module
-
-           This function will wait for the process to terminate
-           in case finish_==True and sets up stdout and stderr.
-           If finish_==False this function will return after starting
-           the process. Use self.popen.communicate() of self.popen.wait()
-           to wait for the process termination. The handling
-           of stdout and stderr must then be done outside of this
-           function.
+        """Run the module
+
+        :param node:
+        :type node:
+
+        This function will wait for the process to terminate in case
+        finish_==True and sets up stdout and stderr. If finish_==False this
+        function will return after starting the process. Use 
+        self.popen.communicate() of self.popen.wait() to wait for the process
+        termination. The handling of stdout and stderr must then be done
+        outside of this function.
         """
         if self.inputs['stdin'].value:
             self.stdin = self.inputs['stdin'].value

+ 9 - 2
lib/python/pygrass/modules/interface/parameter.py

@@ -12,8 +12,12 @@ import re
 from grass.pygrass.modules.interface.read import GETTYPE, element2dict, DOC
 
 
+# TODO add documentation
 class Parameter(object):
-
+    """The Parameter object store all information about a parameter of module.
+    
+    It is possible to set parameter of command using this object.
+    """
     def __init__(self, xparameter=None, diz=None):
         self._value = None
         diz = element2dict(xparameter) if xparameter is not None else diz
@@ -138,9 +142,11 @@ class Parameter(object):
 
     # here the property function is used to transform value in an attribute
     # in this case we define which function must be use to get/set the value
-    value = property(fget=_get_value, fset=_set_value)
+    value = property(fget=_get_value, fset=_set_value,
+                     doc="Set or obtain value")
 
     def get_bash(self):
+        """Prova"""
         if isinstance(self._value, list) or isinstance(self._value, tuple):
             value = ','.join([str(v) for v in self._value])
         else:
@@ -148,6 +154,7 @@ class Parameter(object):
         return """%s=%s""" % (self.name, value)
 
     def get_python(self):
+        """Prova"""
         if not self.value:
             return ''
         return """%s=%r""" % (self.name, self._value)

+ 41 - 39
lib/python/pygrass/vector/basic.py

@@ -125,15 +125,16 @@ class Bbox(object):
         return ['north', 'south', 'west', 'east', 'top', 'bottom']
 
     def contains(self, point):
-        """Return True if the object is contained by the BoundingBox.
+        """Return True if the object is contained by the BoundingBox
 
-        :param point:the point to analyze 
+        :param point: the point to analyze
         :type point: a Point object or a tuple with the coordinates
-            >>> from grass.pygrass.vector.geometry import Point
-            >>> poi = Point(5,5)
-            >>> bbox = Bbox(north=10, south=0, west=0, east=10)
-            >>> bbox.contains(poi)
-            True
+
+        >>> from grass.pygrass.vector.geometry import Point
+        >>> poi = Point(5,5)
+        >>> bbox = Bbox(north=10, south=0, west=0, east=10)
+        >>> bbox.contains(poi)
+        True
 
         """
         return bool(libvect.Vect_point_in_box(point.x, point.y,
@@ -149,6 +150,7 @@ class Bbox(object):
         :param tb: if tb parameter is False return only: north, south, east,
                    west and not top and bottom
         :type tb: bool
+
         """
         if tb:
             return (self.north, self.south, self.east, self.west,
@@ -201,22 +203,22 @@ class BoxList(object):
 
     def append(self, box):
         """Append a Bbox object to a Boxlist object, using the
-        ``Vect_boxlist_append`` C fuction. 
-        
+        ``Vect_boxlist_append`` C fuction.
+
         :param bbox: the bounding box to add to the list
         :param bbox: a Bbox object
-        
-            >>> box0 = Bbox()
-            >>> box1 = Bbox(1,2,3,4)
-            >>> box2 = Bbox(5,6,7,8)
-            >>> boxlist = BoxList([box0, box1])
-            >>> boxlist
-            Boxlist([Bbox(0.0, 0.0, 0.0, 0.0), Bbox(1.0, 2.0, 3.0, 4.0)])
-            >>> len(boxlist)
-            2
-            >>> boxlist.append(box2)
-            >>> len(boxlist)
-            3
+
+        >>> box0 = Bbox()
+        >>> box1 = Bbox(1,2,3,4)
+        >>> box2 = Bbox(5,6,7,8)
+        >>> boxlist = BoxList([box0, box1])
+        >>> boxlist
+        Boxlist([Bbox(0.0, 0.0, 0.0, 0.0), Bbox(1.0, 2.0, 3.0, 4.0)])
+        >>> len(boxlist)
+        2
+        >>> boxlist.append(box2)
+        >>> len(boxlist)
+        3
 
         """
         indx = self.__len__()
@@ -261,12 +263,13 @@ class BoxList(object):
 
         :param indx: the index value of the Bbox to remove
         :param indx: int
-            >>> boxlist = BoxList([Bbox(),
-            ...                    Bbox(1, 0, 0, 1),
-            ...                    Bbox(1, -1, -1, 1)])
-            >>> boxlist.remove(0)
-            >>> boxlist
-            Boxlist([Bbox(1.0, 0.0, 0.0, 1.0), Bbox(1.0, -1.0, -1.0, 1.0)])
+
+        >>> boxlist = BoxList([Bbox(),
+        ...                    Bbox(1, 0, 0, 1),
+        ...                    Bbox(1, -1, -1, 1)])
+        >>> boxlist.remove(0)
+        >>> boxlist
+        Boxlist([Bbox(1.0, 0.0, 0.0, 1.0), Bbox(1.0, -1.0, -1.0, 1.0)])
 
         """
         if hasattr(indx, 'c_boxlist'):
@@ -279,18 +282,17 @@ class BoxList(object):
 
     def reset(self):
         """Reset the c_boxlist C struct, using the ``Vect_reset_boxlist`` C
-        function. ::
-
-            >>> boxlist = BoxList([Bbox(),
-            ...                    Bbox(1, 0, 0, 1),
-            ...                    Bbox(1, -1, -1, 1)])
-            >>> len(boxlist)
-            3
-            >>> boxlist.reset()
-            >>> len(boxlist)
-            0
-
-        ..
+        function.
+
+        >>> boxlist = BoxList([Bbox(),
+        ...                    Bbox(1, 0, 0, 1),
+        ...                    Bbox(1, -1, -1, 1)])
+        >>> len(boxlist)
+        3
+        >>> boxlist.reset()
+        >>> len(boxlist)
+        0
+
         """
         libvect.Vect_reset_boxlist(self.c_boxlist)
 

+ 16 - 16
lib/python/pygrass/vector/geometry.py

@@ -476,14 +476,14 @@ class Point(Geo):
         :type tol: float
         :returns: the buffer as Area object
 
-            >>> pnt = Point(0, 0)
-            >>> area = pnt.buffer(10)
-            >>> area.boundary                              #doctest: +ELLIPSIS
-            Line([Point(10.000000, 0.000000),...Point(10.000000, 0.000000)])
-            >>> area.centroid
-            Point(0.000000, 0.000000)
-            >>> area.isles
-            []
+        >>> pnt = Point(0, 0)
+        >>> area = pnt.buffer(10)
+        >>> area.boundary                              #doctest: +ELLIPSIS
+        Line([Point(10.000000, 0.000000),...Point(10.000000, 0.000000)])
+        >>> area.centroid
+        Point(0.000000, 0.000000)
+        >>> area.isles
+        []
 
         """
         if dist is not None:
@@ -997,14 +997,14 @@ class Line(Geo):
         :type tol: float
         :returns: the buffer as Area object
 
-            >>> line = Line([(0, 0), (0, 2)])
-            >>> area = line.buffer(10)
-            >>> area.boundary                              #doctest: +ELLIPSIS
-            Line([Point(-10.000000, 0.000000),...Point(-10.000000, 0.000000)])
-            >>> area.centroid
-            Point(0.000000, 0.000000)
-            >>> area.isles
-            []
+        >>> line = Line([(0, 0), (0, 2)])
+        >>> area = line.buffer(10)
+        >>> area.boundary                              #doctest: +ELLIPSIS
+        Line([Point(-10.000000, 0.000000),...Point(-10.000000, 0.000000)])
+        >>> area.centroid
+        Point(0.000000, 0.000000)
+        >>> area.isles
+        []
 
         ..
         """

+ 0 - 3
lib/python/pygrass/vector/sql.py

@@ -1,8 +1,5 @@
 # -*- coding: utf-8 -*-
 """
-SQL
-===
-
 It is a collection of strings to avoid to repeat the code.
 
     >>> SELECT.format(cols=', '.join(['cat', 'area']), tname='table')