[GRASS-SVN] r60583 - in grass/trunk/lib/python/pygrass: docs modules/interface vector

svn_grass at osgeo.org svn_grass at osgeo.org
Thu May 29 03:48:13 PDT 2014


Author: lucadelu
Date: 2014-05-29 03:48:13 -0700 (Thu, 29 May 2014)
New Revision: 60583

Added:
   grass/trunk/lib/python/pygrass/docs/modules_grid.rst
   grass/trunk/lib/python/pygrass/docs/raster_elements.rst
   grass/trunk/lib/python/pygrass/docs/vector_attributes.rst
   grass/trunk/lib/python/pygrass/docs/vector_features.rst
   grass/trunk/lib/python/pygrass/docs/vector_utils.rst
Removed:
   grass/trunk/lib/python/pygrass/docs/attributes.rst
   grass/trunk/lib/python/pygrass/docs/gridmodules.rst
   grass/trunk/lib/python/pygrass/docs/vector_database.rst
Modified:
   grass/trunk/lib/python/pygrass/docs/index.rst
   grass/trunk/lib/python/pygrass/docs/modules.rst
   grass/trunk/lib/python/pygrass/docs/raster.rst
   grass/trunk/lib/python/pygrass/docs/vector.rst
   grass/trunk/lib/python/pygrass/modules/interface/flag.py
   grass/trunk/lib/python/pygrass/modules/interface/module.py
   grass/trunk/lib/python/pygrass/modules/interface/parameter.py
   grass/trunk/lib/python/pygrass/vector/basic.py
   grass/trunk/lib/python/pygrass/vector/geometry.py
   grass/trunk/lib/python/pygrass/vector/sql.py
Log:
pygrass doc: several improvements to sphinx documentation

Deleted: grass/trunk/lib/python/pygrass/docs/attributes.rst
===================================================================
--- grass/trunk/lib/python/pygrass/docs/attributes.rst	2014-05-29 10:33:59 UTC (rev 60582)
+++ grass/trunk/lib/python/pygrass/docs/attributes.rst	2014-05-29 10:48:13 UTC (rev 60583)
@@ -1,138 +0,0 @@
-Attributes
-===========
-
-It is possible to access the vector attributes with: ::
-
-    >>> from pygrass.vector import Vector
-    >>> municip = Vector('boundary_municp_sqlite')
-    >>> municip.open()
-    >>> municip.dblinks
-    DBlinks([[Link(1, boundary_municp, sqlite)]])
-
-The vector map have a ``table`` attributes that contain a Table object, that
-have some useful attributes like: layer, name, driver, etc.
-
-    >>> link = municip.dblinks[1]
-    >>> link.number
-    1
-    >>> link.name
-    'boundary_municp'
-    >>> link.table_name
-    'boundary_municp_sqlite'
-    >>> link.driver
-    'sqlite'
-    >>> link.database                                     # doctest: +ELLIPSIS
-    '.../sqlite.db'
-    >>> link.key
-    'cat'
-
-It is possible to change values, like: ::
-
-    >>> link.name = 'boundary'
-    >>> link.driver = 'pg'
-    >>> link.database = 'host=localhost,dbname=grassdb'
-    >>> link.key = 'gid'
-
-Now change again to old values: ::
-
-    >>> link.name = 'boundary_municp_sqlite'
-    >>> link.driver = 'sqlite'
-    >>> link.database = '$GISDBASE/$LOCATION_NAME/$MAPSET/sqlite.db'
-    >>> link.key = 'cat'
-
-Link object have methods that return a
-:ref:`Connection object <python:library:sqlite3:connection-objects>`, and to
-return a Table object: ::
-
-    >>> conn = link.connection()
-    >>> cur = conn.cursor()
-    >>> import sql
-    >>> cur.execute(sql.SELECT.format(cols=', '.join(['cat', 'AREA']),
-    ...                               tname=link.name))   # doctest: +ELLIPSIS
-    <sqlite3.Cursor object at ...>
-    >>> cur.fetchone()
-    (1, 0.0)
-    >>> cur.close()
-    >>> conn.close()
-
-From the Link object we can instantiate a Table object that allow user to
-make simple query with the Filters object: ::
-
-    >>> table = link.table()
-    >>> table.filters.select('cat', 'COUNTY',
-    ...                      'AREA','PERIMETER').order_by('AREA').limit(3)
-    Filters('SELECT cat, COUNTY, AREA, PERIMETER FROM boundary_municp_sqlite ORDER BY AREA LIMIT 3;')
-    >>> cur = table.execute()
-    >>> for row in cur.fetchall():
-    ...     print repr(row)
-    ...
-    (1, u'SURRY', 0.0, 1415.331)
-    (2, u'SURRY', 0.0, 48286.011)
-    (3, u'CASWELL', 0.0, 5750.087)
-
-
-Then we can get table information about table columns, from the columns
-attribute that is an instantiation of a Columns class.
-
-
-    >>> table.columns                                     # doctest: +ELLIPSIS
-    Columns([(u'cat', u'integer'), ..., (u'ACRES', u'double precision')])
-    >>> table.columns.names()                             # doctest: +ELLIPSIS
-    [u'cat', u'OBJECTID', u'AREA', u'PERIMETER', ..., u'ACRES']
-    >>> table.columns.types()                             # doctest: +ELLIPSIS
-    [u'integer', u'integer', u'double precision', ..., u'double precision']
-
-
-.. note ::
-    If the map use postgresql it is possible to: add/rename/cast/remove columns
-    the sqlite does not support these operations.
-
-
-For people that are used to the standardized Python SQL 2.0 interface:
-
-    * http://docs.python.org/library/sqlite3.html
-    * http://www.python.org/dev/peps/pep-0249/
-
-Therefore advanced user can just use, the connect attribute to build
-a new cursor object and interact with the database. ::
-
-    >>> cur = table.conn.cursor()
-    >>> cur.execute("SELECT * FROM %s" % table.name)     # doctest: +ELLIPSIS
-    <sqlite3.Cursor object at ...>
-    >>> cur.fetchone()[:5]                               # doctest: +ELLIPSIS
-    (1, 1, 0.0, 1415.331, 2.0)
-    >>> # Close communication with the database
-    >>> cur.close()
-    >>> conn.close()
-
-
-
-Link
--------
-
-.. autoclass:: pygrass.vector.table.Link
-    :members:
-
-DBlinks
--------
-
-.. autoclass:: pygrass.vector.table.DBlinks
-    :members:
-
-Filters
--------
-
-.. autoclass:: pygrass.vector.table.Filters
-    :members:
-
-Columns
--------
-
-.. autoclass:: pygrass.vector.table.Columns
-    :members:
-
-Table
------
-
-.. autoclass:: pygrass.vector.table.Table
-    :members:

Deleted: grass/trunk/lib/python/pygrass/docs/gridmodules.rst
===================================================================
--- grass/trunk/lib/python/pygrass/docs/gridmodules.rst	2014-05-29 10:33:59 UTC (rev 60582)
+++ grass/trunk/lib/python/pygrass/docs/gridmodules.rst	2014-05-29 10:48:13 UTC (rev 60583)
@@ -1,24 +0,0 @@
-GridModule
-============
-
-GridModule class permit to work with raster data and all the processors
-of your computer. It divides the input data into the number of choosen rows and
-columns and after it patches the results together to obtain only one output map.
-
-.. automodule:: pygrass.modules.grid.grid
-    :members:
-
-Functions
-------------
-
-Split
-^^^^^^^^
-
-.. automodule:: pygrass.modules.grid.split
-    :members:
-
-Patch
-^^^^^^^^
-
-.. automodule:: pygrass.modules.grid.patch
-    :members:

Modified: grass/trunk/lib/python/pygrass/docs/index.rst
===================================================================
--- grass/trunk/lib/python/pygrass/docs/index.rst	2014-05-29 10:33:59 UTC (rev 60582)
+++ grass/trunk/lib/python/pygrass/docs/index.rst	2014-05-29 10:48:13 UTC (rev 60583)
@@ -19,11 +19,13 @@
 
    gis
    raster
+   raster_elements
    vector
-   attributes
-   vector_database
+   vector_attributes
+   vector_features
+   vector_utils
    modules
-   gridmodules
+   modules_grid
    messages
 
 

Modified: grass/trunk/lib/python/pygrass/docs/modules.rst
===================================================================
--- grass/trunk/lib/python/pygrass/docs/modules.rst	2014-05-29 10:33:59 UTC (rev 60582)
+++ grass/trunk/lib/python/pygrass/docs/modules.rst	2014-05-29 10:48:13 UTC (rev 60583)
@@ -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. ::

Copied: grass/trunk/lib/python/pygrass/docs/modules_grid.rst (from rev 60581, grass/trunk/lib/python/pygrass/docs/gridmodules.rst)
===================================================================
--- grass/trunk/lib/python/pygrass/docs/modules_grid.rst	                        (rev 0)
+++ grass/trunk/lib/python/pygrass/docs/modules_grid.rst	2014-05-29 10:48:13 UTC (rev 60583)
@@ -0,0 +1,24 @@
+GridModule
+============
+
+GridModule class permit to work with raster data and all the processors
+of your computer. It divides the input data into the number of choosen rows and
+columns and after it patches the results together to obtain only one output map.
+
+.. automodule:: pygrass.modules.grid.grid
+    :members:
+
+Functions
+------------
+
+Split
+^^^^^^^^
+
+.. automodule:: pygrass.modules.grid.split
+    :members:
+
+Patch
+^^^^^^^^
+
+.. automodule:: pygrass.modules.grid.patch
+    :members:

Modified: grass/trunk/lib/python/pygrass/docs/raster.rst
===================================================================
--- grass/trunk/lib/python/pygrass/docs/raster.rst	2014-05-29 10:33:59 UTC (rev 60582)
+++ grass/trunk/lib/python/pygrass/docs/raster.rst	2014-05-29 10:48:13 UTC (rev 60583)
@@ -58,104 +58,6 @@
     >>> 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,46 +253,7 @@
 .. 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
 .. _Segmentation library: http://grass.osgeo.org/programming7/segmentlib.html

Added: grass/trunk/lib/python/pygrass/docs/raster_elements.rst
===================================================================
--- grass/trunk/lib/python/pygrass/docs/raster_elements.rst	                        (rev 0)
+++ grass/trunk/lib/python/pygrass/docs/raster_elements.rst	2014-05-29 10:48:13 UTC (rev 60583)
@@ -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:
\ No newline at end of file

Modified: grass/trunk/lib/python/pygrass/docs/vector.rst
===================================================================
--- grass/trunk/lib/python/pygrass/docs/vector.rst	2014-05-29 10:33:59 UTC (rev 60582)
+++ grass/trunk/lib/python/pygrass/docs/vector.rst	2014-05-29 10:48:13 UTC (rev 60583)
@@ -126,73 +126,3 @@
 
 .. 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:
\ No newline at end of file

Copied: grass/trunk/lib/python/pygrass/docs/vector_attributes.rst (from rev 60578, grass/trunk/lib/python/pygrass/docs/attributes.rst)
===================================================================
--- grass/trunk/lib/python/pygrass/docs/vector_attributes.rst	                        (rev 0)
+++ grass/trunk/lib/python/pygrass/docs/vector_attributes.rst	2014-05-29 10:48:13 UTC (rev 60583)
@@ -0,0 +1,144 @@
+Vector Attributes
+===================
+
+It is possible to access the vector attributes with: ::
+
+    >>> from pygrass.vector import Vector
+    >>> municip = Vector('boundary_municp_sqlite')
+    >>> municip.open()
+    >>> municip.dblinks
+    DBlinks([[Link(1, boundary_municp, sqlite)]])
+
+The vector map have a ``table`` attributes that contain a Table object, that
+have some useful attributes like: layer, name, driver, etc.
+
+    >>> link = municip.dblinks[1]
+    >>> link.number
+    1
+    >>> link.name
+    'boundary_municp'
+    >>> link.table_name
+    'boundary_municp_sqlite'
+    >>> link.driver
+    'sqlite'
+    >>> link.database                                     # doctest: +ELLIPSIS
+    '.../sqlite.db'
+    >>> link.key
+    'cat'
+
+It is possible to change values, like: ::
+
+    >>> link.name = 'boundary'
+    >>> link.driver = 'pg'
+    >>> link.database = 'host=localhost,dbname=grassdb'
+    >>> link.key = 'gid'
+
+Now change again to old values: ::
+
+    >>> link.name = 'boundary_municp_sqlite'
+    >>> link.driver = 'sqlite'
+    >>> link.database = '$GISDBASE/$LOCATION_NAME/$MAPSET/sqlite.db'
+    >>> link.key = 'cat'
+
+Link object have methods that return a
+:ref:`Connection object <python:library:sqlite3:connection-objects>`, and to
+return a Table object: ::
+
+    >>> conn = link.connection()
+    >>> cur = conn.cursor()
+    >>> import sql
+    >>> cur.execute(sql.SELECT.format(cols=', '.join(['cat', 'AREA']),
+    ...                               tname=link.name))   # doctest: +ELLIPSIS
+    <sqlite3.Cursor object at ...>
+    >>> cur.fetchone()
+    (1, 0.0)
+    >>> cur.close()
+    >>> conn.close()
+
+From the Link object we can instantiate a Table object that allow user to
+make simple query with the Filters object: ::
+
+    >>> table = link.table()
+    >>> table.filters.select('cat', 'COUNTY',
+    ...                      'AREA','PERIMETER').order_by('AREA').limit(3)
+    Filters('SELECT cat, COUNTY, AREA, PERIMETER FROM boundary_municp_sqlite ORDER BY AREA LIMIT 3;')
+    >>> cur = table.execute()
+    >>> for row in cur.fetchall():
+    ...     print repr(row)
+    ...
+    (1, u'SURRY', 0.0, 1415.331)
+    (2, u'SURRY', 0.0, 48286.011)
+    (3, u'CASWELL', 0.0, 5750.087)
+
+
+Then we can get table information about table columns, from the columns
+attribute that is an instantiation of a Columns class.
+
+
+    >>> table.columns                                     # doctest: +ELLIPSIS
+    Columns([(u'cat', u'integer'), ..., (u'ACRES', u'double precision')])
+    >>> table.columns.names()                             # doctest: +ELLIPSIS
+    [u'cat', u'OBJECTID', u'AREA', u'PERIMETER', ..., u'ACRES']
+    >>> table.columns.types()                             # doctest: +ELLIPSIS
+    [u'integer', u'integer', u'double precision', ..., u'double precision']
+
+
+.. note ::
+    If the map use postgresql it is possible to: add/rename/cast/remove columns
+    the sqlite does not support these operations.
+
+
+For people that are used to the standardized Python SQL 2.0 interface:
+
+    * http://docs.python.org/library/sqlite3.html
+    * http://www.python.org/dev/peps/pep-0249/
+
+Therefore advanced user can just use, the connect attribute to build
+a new cursor object and interact with the database. ::
+
+    >>> cur = table.conn.cursor()
+    >>> cur.execute("SELECT * FROM %s" % table.name)     # doctest: +ELLIPSIS
+    <sqlite3.Cursor object at ...>
+    >>> cur.fetchone()[:5]                               # doctest: +ELLIPSIS
+    (1, 1, 0.0, 1415.331, 2.0)
+    >>> # Close communication with the database
+    >>> cur.close()
+    >>> conn.close()
+
+
+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:
+

Deleted: grass/trunk/lib/python/pygrass/docs/vector_database.rst
===================================================================
--- grass/trunk/lib/python/pygrass/docs/vector_database.rst	2014-05-29 10:33:59 UTC (rev 60582)
+++ grass/trunk/lib/python/pygrass/docs/vector_database.rst	2014-05-29 10:48:13 UTC (rev 60583)
@@ -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:

Added: grass/trunk/lib/python/pygrass/docs/vector_features.rst
===================================================================
--- grass/trunk/lib/python/pygrass/docs/vector_features.rst	                        (rev 0)
+++ grass/trunk/lib/python/pygrass/docs/vector_features.rst	2014-05-29 10:48:13 UTC (rev 60583)
@@ -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:
+

Added: grass/trunk/lib/python/pygrass/docs/vector_utils.rst
===================================================================
--- grass/trunk/lib/python/pygrass/docs/vector_utils.rst	                        (rev 0)
+++ grass/trunk/lib/python/pygrass/docs/vector_utils.rst	2014-05-29 10:48:13 UTC (rev 60583)
@@ -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:
\ No newline at end of file

Modified: grass/trunk/lib/python/pygrass/modules/interface/flag.py
===================================================================
--- grass/trunk/lib/python/pygrass/modules/interface/flag.py	2014-05-29 10:33:59 UTC (rev 60582)
+++ grass/trunk/lib/python/pygrass/modules/interface/flag.py	2014-05-29 10:48:13 UTC (rev 60583)
@@ -8,8 +8,12 @@
                         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.
 
-class Flag(object):
+    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 @@
         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 @@
             return ''
 
     def get_python(self):
+        """Prova"""
         if self.value:
             if self.special:
                 return '%s=True' % self.name

Modified: grass/trunk/lib/python/pygrass/modules/interface/module.py
===================================================================
--- grass/trunk/lib/python/pygrass/modules/interface/module.py	2014-05-29 10:33:59 UTC (rev 60582)
+++ grass/trunk/lib/python/pygrass/modules/interface/module.py	2014-05-29 10:48:13 UTC (rev 60583)
@@ -68,7 +68,7 @@
 
 
 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 @@
 
        Usage:
 
-       @code
-
        >>> import copy
        >>> import grass.pygrass.modules as pymod
        >>> mapcalc_list = []
@@ -106,27 +104,27 @@
        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 @@
             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 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 @@
         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 @@
             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 @@
         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 @@
                     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 @@
             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 @@
         """{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 @@
         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 @@
         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 @@
         return args
 
     def run(self, node=None):
-        """!Run the module
+        """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.
+        :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

Modified: grass/trunk/lib/python/pygrass/modules/interface/parameter.py
===================================================================
--- grass/trunk/lib/python/pygrass/modules/interface/parameter.py	2014-05-29 10:33:59 UTC (rev 60582)
+++ grass/trunk/lib/python/pygrass/modules/interface/parameter.py	2014-05-29 10:48:13 UTC (rev 60583)
@@ -12,8 +12,12 @@
 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 @@
 
     # 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 @@
         return """%s=%s""" % (self.name, value)
 
     def get_python(self):
+        """Prova"""
         if not self.value:
             return ''
         return """%s=%r""" % (self.name, self._value)

Modified: grass/trunk/lib/python/pygrass/vector/basic.py
===================================================================
--- grass/trunk/lib/python/pygrass/vector/basic.py	2014-05-29 10:33:59 UTC (rev 60582)
+++ grass/trunk/lib/python/pygrass/vector/basic.py	2014-05-29 10:48:13 UTC (rev 60583)
@@ -125,16 +125,17 @@
         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,
                                               point.z if point.z else 0,
@@ -149,6 +150,7 @@
         :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,23 +203,23 @@
 
     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__()
         libvect.Vect_boxlist_append(self.c_boxlist, indx, box.c_bbox)
@@ -261,13 +263,14 @@
 
         :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'):
             libvect.Vect_boxlist_delete_boxlist(self.c_boxlist, indx.c_boxlist)
@@ -279,18 +282,17 @@
 
     def reset(self):
         """Reset the c_boxlist C struct, using the ``Vect_reset_boxlist`` C
-        function. ::
+        function.
 
-            >>> boxlist = BoxList([Bbox(),
-            ...                    Bbox(1, 0, 0, 1),
-            ...                    Bbox(1, -1, -1, 1)])
-            >>> len(boxlist)
-            3
-            >>> boxlist.reset()
-            >>> len(boxlist)
-            0
+        >>> 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)
 

Modified: grass/trunk/lib/python/pygrass/vector/geometry.py
===================================================================
--- grass/trunk/lib/python/pygrass/vector/geometry.py	2014-05-29 10:33:59 UTC (rev 60582)
+++ grass/trunk/lib/python/pygrass/vector/geometry.py	2014-05-29 10:48:13 UTC (rev 60583)
@@ -476,14 +476,14 @@
         :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 @@
         :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
+        []
 
         ..
         """

Modified: grass/trunk/lib/python/pygrass/vector/sql.py
===================================================================
--- grass/trunk/lib/python/pygrass/vector/sql.py	2014-05-29 10:33:59 UTC (rev 60582)
+++ grass/trunk/lib/python/pygrass/vector/sql.py	2014-05-29 10:48:13 UTC (rev 60583)
@@ -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')



More information about the grass-commit mailing list