Commit 75fdf47c authored by LE GAC Renaud's avatar LE GAC Renaud
Browse files

Sphinx documentation for the harvest_tools.base mdoule.

parent 7871f569
harvest_tools.base.family_name_fr
=================================
.. currentmodule:: harvest_tools.base
.. autofunction:: family_name_fr
\ No newline at end of file
harvest_tools.base.format_author_fr
===================================
.. currentmodule:: harvest_tools.base
.. autofunction:: format_author_fr
\ No newline at end of file
harvest_tools.base.learn_my_authors
===================================
.. currentmodule:: harvest_tools.base
.. autofunction:: learn_my_authors
\ No newline at end of file
......@@ -2,6 +2,18 @@
Harvesters
----------
Constants
^^^^^^^^^
DRY_RUN
MSG_CRASH
MSG_FIX_ORIGIN
MSG_IN_DB
MSG_LOAD
Factory
^^^^^^^
.. currentmodule:: harvest_tools.factory
......@@ -12,6 +24,19 @@ Factory
build_harvester_tool
get_harvester_tool
Helper functions
^^^^^^^^^^^^^^^^
.. currentmodule:: harvest_tools.base
.. autosummary::
:toctree: generated/
family_name_fr
format_author_fr
learn_my_authors
Classes
^^^^^^^
.. currentmodule:: harvest_tools.automaton
......
......@@ -13,25 +13,38 @@ MSG_LOAD = "Load in the database"
def family_name_fr(full_name):
"""Extract the family name when the full name is encoded as C{J. Doe}.
"""Extract the family name when the full name is encoded as ``J. Doe``.
@type full_name: unicode
Args:
full_name (unicode): author name encoded according to French
typographic rules.
@rtype: unicode
Returns:
unicode: family name
"""
return full_name[full_name.find(' ') + 1:]
def format_author_fr(name):
"""Format the author name according to French typographic rules,
I{i.e.} C{J.-P. Doe}.
The name stays unchanged when the formatting failed.
"""Format the author name according to French typographic rules.
@type name: unicode
@param name:
Note:
The name stays unchanged when the formatting failed.
@rtype: unicode
Args:
name (unicode): full name. Possible patterns are:
* ``Family, L``
* ``Family, P L``
* ``Family, M -H``
* ``Family Name, J``
* ``Family-Name, J``
* ``Family, F Name``
* ``Family, First``
Returns:
unicode: the author name encode as ``J.-P. Doe``.
"""
# protection
......@@ -77,25 +90,20 @@ def learn_my_authors(db,
id_project=None,
id_team=None,
year=None):
"""Train the rescue list of the authors of my institute,
stored in the database, using the list C{authors} provided in argument.
@note: all keyword arguments have to be defined.
@type db: gluon.dal.DAL
@param db:
@type authors: list
@param authors: authors names
@type id_project: int
@param id_project: project identifier
@type id_team: int
@param id_team: team identifier
@type year: int
@param year:
"""Train the rescue list of the authors of my institute.
Authors which are not in the rescue list, are added.
The rescue list is defined by the project, the team identifier and
by the year.
Warning:
all keyword arguments have to be defined.
Args:
db (gluon.dal.DAL): database connection.
authors (list): authors names
id_project (int): the identifier of the project in the database.
id_team (int): the identifier of the team in the database.
year (int): the year
"""
# get the list of authors store in the database
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment