Commit 7871f569 authored by LE GAC Renaud's avatar LE GAC Renaud
Browse files

Sphinx documentation for the harvester factory.

parent 6c68b927
harvest_tools.factory.build_harvester_tool
==========================================
.. currentmodule:: harvest_tools.factory
.. autofunction:: build_harvester_tool
\ No newline at end of file
harvest_tools.factory.get_harvester_tool
========================================
.. currentmodule:: harvest_tools.factory
.. autofunction:: get_harvester_tool
\ No newline at end of file
......@@ -2,6 +2,18 @@
Harvesters
----------
Factory
^^^^^^^
.. currentmodule:: harvest_tools.factory
.. autosummary::
:toctree: generated/
build_harvester_tool
get_harvester_tool
Classes
^^^^^^^
.. currentmodule:: harvest_tools.automaton
.. autosummary::
......
......@@ -70,8 +70,10 @@ class Automaton(object):
db (gluon.DAL): the database connection.
id_team (int): the identifier of the team in the database.
id_project (int): the identifier of the project in the database.
controller (unicode): type of the publication (``article``,
``proceeding``, *etc*).
controller (unicode): the name of the automaton which
will be used to process the data. Possible values are:
``articles``, ``notes``, ``preprints``, ``proceedings``,
``reports``, ``talks`` and ``theses``.
id_category (int): the identifier of the category of publication
year_start (int): starting year for the scan
year_end (int): ending year of the scan
......
......@@ -21,36 +21,27 @@ def build_harvester_tool(db,
dry_run=True,
debug=False):
"""
Harvest tool factory function, returns the appropriate harverster tool or
None if no factory exist for the specified controller.
@type db: gluon.dal.DAL
@param db:
@type id_team: int
@param id_team: Identifier of the team in the db
@type id_project: int
@param id_project: Identifier of the project in the db
@type controller: unicode
@param controller: Type of publication (i.e. 'article', 'proceedings', ...)
@type id_category: int
@param id_category: Identifier of the category of publication
(i.e. ACL, ACTI, ...)
@type year_start: int
@keyword year_start: Start year of search (i.e. '2014')
@type year_end: int
@keyword year_end: End year of search (i.e. '2015')
@type dry_run: boolean
@keyword dry_run: True if no record is to be written to the db
@type debug: bool
@param debug: activate the debug mode
Harvest tool factory function.
Args:
db (gluon.dal.DAL): database connection.
id_team (int): the identifier of the team in the database.
id_project (int): the identifier of the project in the database.
controller (unicode): the controller defined the automaton which
will be used to process the data. Possible values are:
``articles``, ``notes``, ``preprints``, ``proceedings``,
``reports``, ``talks`` and ``theses``.
id_category (int): the identifier of the publication category,
*e.g.* ACL, ACTI, ...
year_start (int): starting year for the scan.
year_end (int): ending year for the scan.
dry_run (bool): new records are not inserted in the database
when ``True``.
debug (bool): activate the verbose mode.
Returns:
Automaton: returns the appropriate harvester automaton or
``None`` if no factory exist for the specified controller.
"""
tool_class = get_harvester_tool(controller)
......@@ -70,22 +61,26 @@ def build_harvester_tool(db,
def get_harvester_tool(controller):
"""Get the harvester tool associated to the controller
or None if .
@note: valid names for the controller are:
- articles
- notes
- preprints
- proceedings
- reports
- talks
- theses
@type controller: unicode
@param controller: name of the controller
@rtype: class reference or None
@return: None when the controller corresponds to nothing.
or None if it does not exist.
Note:
The controller defined the automaton which will be used to process
the data. Possible values are:
* articles
* notes
* preprints
* proceedings
* reports
* talks
* theses
Args:
controller (unicode): name of the controller
Returns:
Automaton: class reference or ``None``. The latter happens
when the controller corresponds to nothing.
"""
if controller == 'articles':
......
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