Commit f87a693f authored by LE GAC Renaud's avatar LE GAC Renaud
Browse files

Update unicode by str in doc strings.

parent 37094a47
...@@ -12,10 +12,10 @@ def CLEAN_COLLABORATION(value): ...@@ -12,10 +12,10 @@ def CLEAN_COLLABORATION(value):
* Collaboration always start with a Capital letter. * Collaboration always start with a Capital letter.
Args: Args:
value (unicode): string where collaborations are separated by comma value (str): string where collaborations are separated by comma
Returns: Returns:
unicode: str:
""" """
li = [] li = []
...@@ -83,10 +83,10 @@ def CLEAN_THESIS_DEFENSE(value): ...@@ -83,10 +83,10 @@ def CLEAN_THESIS_DEFENSE(value):
* Remove prefix like *Presented*, *on*, *etc*. * Remove prefix like *Presented*, *on*, *etc*.
Args: Args:
value (unicode): string with the defence date value (str): string with the defence date
Returns: Returns:
unicode: str:
""" """
value = value.replace("Presented ", "") value = value.replace("Presented ", "")
......
...@@ -92,22 +92,22 @@ class Articles(Automaton): ...@@ -92,22 +92,22 @@ class Articles(Automaton):
found later by the harvester. found later by the harvester.
Args: Args:
oai_url (unicode): the oai_url, *e.g* oai_url (str): the oai_url, *e.g*
``http://cds.cern.ch/record/123456``. The origin field ``http://cds.cern.ch/record/123456``. The origin field
of the existing database record is update to **oai_url** of the existing database record is update to **oai_url**
when a match is found. when a match is found.
year (unicode): the year of the publication. It is used year (str): the year of the publication. It is used
by the search algorithm and by the logger. by the search algorithm and by the logger.
Keyword Args: Keyword Args:
id_publisher (int): identifier of the publisher in the database. id_publisher (int): identifier of the publisher in the database.
my_authors (unicode): authors of my institute separated by a comma. my_authors (str): authors of my institute separated by a comma.
pages (unicode): the page reference. pages (str): the page reference.
publication_url (unicode): the URL of the publications publication_url (str): the URL of the publications
preprint_number (unicode): the preprint number preprint_number (str): the preprint number
title (unicode): the title of the publication. title (str): the title of the publication.
volume (unicode): the volume reference. volume (str): the volume reference.
Returns: Returns:
tuple: ``(id, status)`` which contains the ``id`` of the record. tuple: ``(id, status)`` which contains the ``id`` of the record.
...@@ -194,20 +194,20 @@ class Articles(Automaton): ...@@ -194,20 +194,20 @@ class Articles(Automaton):
All the keyword arguments are needed by the transformation. All the keyword arguments are needed by the transformation.
Args: Args:
primary_oai_url (unicode): the *primary* OAI identifier of the primary_oai_url (str): the *primary* OAI identifier of the
record. It is used by the search algorithm. record. It is used by the search algorithm.
year (unicode): the year of publication which is used year (str): the year of publication which is used
by the logger. by the logger.
Keyword Args: Keyword Args:
id_publisher (int): identifier of the publisher in the database. id_publisher (int): identifier of the publisher in the database.
my_authors (unicode): authors of my institute separated by a comma. my_authors (str): authors of my institute separated by a comma.
oai_url (unicode): the full oai_url(s) of the article. oai_url (str): the full oai_url(s) of the article.
pages (unicode): the page reference. pages (str): the page reference.
publication_url (unicode): the URL of the publications publication_url (str): the URL of the publications
title (unicode): the title of the publication. title (str): the title of the publication.
volume (unicode): the volume reference. volume (str): the volume reference.
Returns: Returns:
tuple: ``(id, status)`` which contains the ``id`` of the record. tuple: ``(id, status)`` which contains the ``id`` of the record.
......
...@@ -76,7 +76,7 @@ class Automaton(object): ...@@ -76,7 +76,7 @@ class Automaton(object):
db (gluon.DAL): the database connection. db (gluon.DAL): the database connection.
id_team (int): the identifier of the team in the database. id_team (int): the identifier of the team in the database.
id_project (int): the identifier of the project in the database. id_project (int): the identifier of the project in the database.
automaton (unicode): the name of the automaton which automaton (str): the name of the automaton which
will be used to process the data. Possible values are: will be used to process the data. Possible values are:
``articles``, ``notes``, ``preprints``, ``proceedings``, ``articles``, ``notes``, ``preprints``, ``proceedings``,
``reports``, ``talks`` and ``theses``. ``reports``, ``talks`` and ``theses``.
...@@ -144,7 +144,7 @@ class Automaton(object): ...@@ -144,7 +144,7 @@ class Automaton(object):
"""Insert the record in the database, handling database exception. """Insert the record in the database, handling database exception.
Args: Args:
log_year (unicode): year of the record for the log log_year (str): year of the record for the log
Keyword Args: Keyword Args:
**fields: keyword arguments defining the record values to be **fields: keyword arguments defining the record values to be
...@@ -188,13 +188,13 @@ class Automaton(object): ...@@ -188,13 +188,13 @@ class Automaton(object):
A new log entry is created when a record is found. A new log entry is created when a record is found.
Args: Args:
title (unicode): the title of the publication. title (str): the title of the publication.
Keyword Args: Keyword Args:
host (unicode): the store. possible values are ``cds.cern.ch`` or host (str): the store. possible values are ``cds.cern.ch`` or
``inspirehep.net``. To be used with *rec_id*. ``inspirehep.net``. To be used with *rec_id*.
rec_id (int): the record identifier in the store rec_id (int): the record identifier in the store
oai_url (unicode): the URL of the record in the store. oai_url (str): the URL of the record in the store.
Note: Note:
Either use *host* and *rec_id* or *oai_url* Either use *host* and *rec_id* or *oai_url*
...@@ -270,7 +270,7 @@ class Automaton(object): ...@@ -270,7 +270,7 @@ class Automaton(object):
in the selector. in the selector.
Args: Args:
collection (unicode): string defining the collection in the collection (str): string defining the collection in the
store. The syntax depends on the invenio store: store. The syntax depends on the invenio store:
* ``"find cn d0 and tc p and not tc c"`` * ``"find cn d0 and tc p and not tc c"``
...@@ -386,7 +386,7 @@ class Automaton(object): ...@@ -386,7 +386,7 @@ class Automaton(object):
and found later by an harvester. and found later by an harvester.
Args: Args:
oai_url (unicode): the oai_url, *e.g* oai_url (str): the oai_url, *e.g*
``http://cds.cern.ch/record/123456``. The origin field ``http://cds.cern.ch/record/123456``. The origin field
of the existing database record is update to **oai_url** of the existing database record is update to **oai_url**
when a match is found. when a match is found.
...@@ -395,7 +395,7 @@ class Automaton(object): ...@@ -395,7 +395,7 @@ class Automaton(object):
by the search algorithm and by the logger. by the search algorithm and by the logger.
Keyword Args: Keyword Args:
kwargs (unicode): a series of key, value pair where the kwargs (str): a series of key, value pair where the
key is the name of a publications database field. key is the name of a publications database field.
Returns: Returns:
...@@ -457,7 +457,7 @@ class Automaton(object): ...@@ -457,7 +457,7 @@ class Automaton(object):
Args: Args:
xml (unicode): XML string encoding the publication records. xml (str): XML string encoding the publication records.
The format follows the MARC12 standard. The format follows the MARC12 standard.
Raises: Raises:
...@@ -586,7 +586,7 @@ class Automaton(object): ...@@ -586,7 +586,7 @@ class Automaton(object):
"""Decode the MARC XML string and insert records in the database. """Decode the MARC XML string and insert records in the database.
Args: Args:
xml (unicode): MARC XML string xml (str): MARC XML string
""" """
...@@ -658,7 +658,7 @@ class Automaton(object): ...@@ -658,7 +658,7 @@ class Automaton(object):
Returns: Returns:
dict: dict:
* ``collection_logs`` list of :class:MsgCollection * ``collection_logs`` list of :class:MsgCollection
* ``controller`` unicode * ``controller`` str
* ``logs`` list of :class:Msg * ``logs`` list of :class:Msg
* ``selector`` :py:class:plugin_dbui.Selector * ``selector`` :py:class:plugin_dbui.Selector
...@@ -672,7 +672,7 @@ class Automaton(object): ...@@ -672,7 +672,7 @@ class Automaton(object):
"""Get the database collaboration identifier using synonyms. """Get the database collaboration identifier using synonyms.
Args: Args:
value (unicode): the name of the collaboration. value (str): the name of the collaboration.
Returns: Returns:
int: int:
...@@ -691,7 +691,7 @@ class Automaton(object): ...@@ -691,7 +691,7 @@ class Automaton(object):
"""Get the database country identifier using synonyms. """Get the database country identifier using synonyms.
Args: Args:
value (unicode): the name of the country. value (str): the name of the country.
Returns: Returns:
int: int:
...@@ -709,7 +709,7 @@ class Automaton(object): ...@@ -709,7 +709,7 @@ class Automaton(object):
"""Get the database publisher identifier using synonyms. """Get the database publisher identifier using synonyms.
Args: Args:
value (unicode): the abbreviation of the publisher. value (str): the abbreviation of the publisher.
Returns: Returns:
int: int:
......
...@@ -19,11 +19,11 @@ def family_name_fr(full_name): ...@@ -19,11 +19,11 @@ def family_name_fr(full_name):
"""Extract the family name when the full name is encoded as ``J. Doe``. """Extract the family name when the full name is encoded as ``J. Doe``.
Args: Args:
full_name (unicode): author name encoded according to French full_name (str): author name encoded according to French
typographic rules. typographic rules.
Returns: Returns:
unicode: family name str: family name
""" """
return full_name[full_name.find(' ') + 1:] return full_name[full_name.find(' ') + 1:]
...@@ -98,9 +98,9 @@ def search_synonym(table, fieldname, value, create=False): ...@@ -98,9 +98,9 @@ def search_synonym(table, fieldname, value, create=False):
It contains a list of strings. It contains a list of strings.
Args: Args:
table (gluon.DAL.Table): database table. table (gluon.DAL.Table): database table.
fieldname (unicode): field of the database table fieldname (str): field of the database table
identified by its name. identified by its name.
value (unicode): value to be matched. value (str): value to be matched.
create(bool): create a new entry in the database table when create(bool): create a new entry in the database table when
it is ``True`` it is ``True``
......
...@@ -101,7 +101,7 @@ class CheckAndFix(object): ...@@ -101,7 +101,7 @@ class CheckAndFix(object):
They are replaced by ``\(`` *etc*. They are replaced by ``\(`` *etc*.
Returns: Returns:
unicode: str:
""" """
# alias # alias
...@@ -207,8 +207,8 @@ class CheckAndFix(object): ...@@ -207,8 +207,8 @@ class CheckAndFix(object):
"""Check that the synonym field contains *value*. """Check that the synonym field contains *value*.
Args: Args:
tablename (unicode): name of the database table tablename (str): name of the database table
value (unicode): value to be searched value (str): value to be searched
Returns: Returns:
bool: ``True`` if *one* row is found, ``False`` otherwise. bool: ``True`` if *one* row is found, ``False`` otherwise.
...@@ -615,14 +615,14 @@ class CheckAndFix(object): ...@@ -615,14 +615,14 @@ class CheckAndFix(object):
Args: Args:
record (RecordPubli): record describing a publication. record (RecordPubli): record describing a publication.
sep (unicode): sep (str):
string separating author names. The default is the comma. string separating author names. The default is the comma.
sort (bool): sort (bool):
sort authors by family name when true otherwise use the sort authors by family name when true otherwise use the
order of authors at the creation of the record order of authors at the creation of the record
Returns: Returns:
unicode: the list of authors separated by the ``sep`` argument. strcode: the list of authors separated by the ``sep`` argument.
Raises: Raises:
CheckException: when the list is empty CheckException: when the list is empty
...@@ -824,7 +824,7 @@ class CheckAndFix(object): ...@@ -824,7 +824,7 @@ class CheckAndFix(object):
Args: Args:
record (RecordPubli): record describing a publication. record (RecordPubli): record describing a publication.
host (unicode): possible values ares ``cds.cern.ch`` host (str): possible values ares ``cds.cern.ch``
or ``inspirehep.net`` or ``inspirehep.net``
""" """
......
...@@ -26,7 +26,7 @@ def build_harvester_tool(db, ...@@ -26,7 +26,7 @@ def build_harvester_tool(db,
db (gluon.dal.DAL): database connection. db (gluon.dal.DAL): database connection.
id_team (int): the identifier of the team in the database. id_team (int): the identifier of the team in the database.
id_project (int): the identifier of the project in the database. id_project (int): the identifier of the project in the database.
automaton (unicode): the name of the automaton which automaton (str): the name of the automaton which
will be used to process the data. Possible values are: will be used to process the data. Possible values are:
``articles``, ``notes``, ``preprints``, ``proceedings``, ``articles``, ``notes``, ``preprints``, ``proceedings``,
``reports``, ``talks`` and ``theses``. ``reports``, ``talks`` and ``theses``.
...@@ -75,7 +75,7 @@ def get_harvester_tool(automaton): ...@@ -75,7 +75,7 @@ def get_harvester_tool(automaton):
* theses * theses
Args: Args:
automaton (unicode): name of the automaton automaton (str): name of the automaton
Returns: Returns:
Automaton: class reference or ``None``. The latter happens Automaton: class reference or ``None``. The latter happens
......
...@@ -26,12 +26,12 @@ class Msg(Storage): ...@@ -26,12 +26,12 @@ class Msg(Storage):
* *reject* the record is rejected. * *reject* the record is rejected.
Args: Args:
collection (unicode): the harvester collection used to collection (str): the harvester collection used to
search the record. search the record.
harvester (gluon.dal.Row): the database harvester used to scan the harvester (gluon.dal.Row): the database harvester used to scan the
store. store.
record_id (int): the record identifier in the store. record_id (int): the record identifier in the store.
title (unicode): the title of the publication. title (str): the title of the publication.
""" """
def __init__(self, def __init__(self,
...@@ -59,8 +59,8 @@ class Msg(Storage): ...@@ -59,8 +59,8 @@ class Msg(Storage):
"""Set the action as *idle* and the explanation as ``txt``. """Set the action as *idle* and the explanation as ``txt``.
Args: Args:
txt (unicode): message associated to the action. txt (str): message associated to the action.
year (unicode): year of the publication year (str): year of the publication
translate (bool): translate the message according to the translate (bool): translate the message according to the
current language. current language.
...@@ -72,8 +72,8 @@ class Msg(Storage): ...@@ -72,8 +72,8 @@ class Msg(Storage):
"""Set the action as *load* and the explanation as ``txt``. """Set the action as *load* and the explanation as ``txt``.
Args: Args:
txt (unicode): message associated to the action. txt (str): message associated to the action.
year (unicode): year of the publication year (str): year of the publication
translate (bool): translate the message according to the translate (bool): translate the message according to the
current language. current language.
...@@ -85,8 +85,8 @@ class Msg(Storage): ...@@ -85,8 +85,8 @@ class Msg(Storage):
"""Set the action as *modify* and the explanation as ``txt``. """Set the action as *modify* and the explanation as ``txt``.
Args: Args:
txt (unicode): message associated to the action. txt (str): message associated to the action.
year (unicode): year of the publication year (str): year of the publication
translate (bool): translate the message according to the translate (bool): translate the message according to the
current language. current language.
...@@ -98,9 +98,9 @@ class Msg(Storage): ...@@ -98,9 +98,9 @@ class Msg(Storage):
"""Set the action as *reject* and the explanation as ``txt``. """Set the action as *reject* and the explanation as ``txt``.
Args: Args:
txt (unicode): message associated to the action. txt (str): message associated to the action.
year (unicode): year of the publication year (str): year of the publication
record (RecordPubli): the record on which the action is applied. record (RecordPubli): the record on which the action is applied.
It is used to determine the synonym value when the It is used to determine the synonym value when the
......
...@@ -8,10 +8,10 @@ class MsgCollection(Storage): ...@@ -8,10 +8,10 @@ class MsgCollection(Storage):
"""Messages for a collection. """Messages for a collection.
Args: Args:
error (unicode): error when scanning the collection. error (str): error when scanning the collection.
found (int): number of publication found in the harvester repository. found (int): number of publication found in the harvester repository.
url (unicode): URL used to scan the harvester repository. url (str): URL used to scan the harvester repository.
title (unicode): title of the collection. title (str): title of the collection.
""" """
def __init__(self, error="", found=0, title="", url=""): def __init__(self, error="", found=0, title="", url=""):
......
...@@ -40,7 +40,7 @@ def load_record(host, record_id): ...@@ -40,7 +40,7 @@ def load_record(host, record_id):
"""Helper function to load a single record from an invenio store. """Helper function to load a single record from an invenio store.
Args: Args:
host (unicode): host of the store. host (str): host of the store.
Possible values are ``cds.cern.ch`` or ``inspirehep.net``. Possible values are ``cds.cern.ch`` or ``inspirehep.net``.
record_id (int): the record identifier in the store record_id (int): the record identifier in the store
......
...@@ -64,7 +64,7 @@ class InvenioStore(object): ...@@ -64,7 +64,7 @@ class InvenioStore(object):
"""Interrogate the store using the *URL*. """Interrogate the store using the *URL*.
Args: Args:
url (unicode): URL string url (str): URL string
params (dict): parameters to be send with the URL params (dict): parameters to be send with the URL
Returns: Returns:
...@@ -195,7 +195,7 @@ class InvenioStore(object): ...@@ -195,7 +195,7 @@ class InvenioStore(object):
rec_id (int): record identifier in the store. rec_id (int): record identifier in the store.
Returns: Returns:
unicode: the XML string is compliant with str: the XML string is compliant with
the `MARC <http://www.loc.gov/marc/>`_ standard. the `MARC <http://www.loc.gov/marc/>`_ standard.
Use Marc12.__call__ to decode it. Use Marc12.__call__ to decode it.
...@@ -210,7 +210,7 @@ class InvenioStore(object): ...@@ -210,7 +210,7 @@ class InvenioStore(object):
def last_search_url(self): def last_search_url(self):
""" """
Returns: Returns:
unicode: the URL used in the last search. str: the URL used in the last search.
""" """
return self._url return self._url
...@@ -387,7 +387,7 @@ class InvenioStore(object): ...@@ -387,7 +387,7 @@ class InvenioStore(object):
http://invenio-demo.cern.ch/help/hacking/search-engine-api. http://invenio-demo.cern.ch/help/hacking/search-engine-api.
Returns: Returns:
unicode: the format of the string (HTML, XML) depend on the str: the format of the string (HTML, XML) depend on the
keyword **of**. For MARC12 format use **xm**. keyword **of**. For MARC12 format use **xm**.
Deprecated: the method get_ids coupled with get_record is Deprecated: the method get_ids coupled with get_record is
...@@ -424,7 +424,8 @@ class InvenioStore(object): ...@@ -424,7 +424,8 @@ class InvenioStore(object):
so (str): sort order ("a"=ascending, "d"=descending). so (str): sort order ("a"=ascending, "d"=descending).
Returns: Returns:
unicode): the format of the string HTML, XML depends on the str:
the format of the string HTML, XML depends on the
keyword **of**. Use **xm** for MARC XML. keyword **of**. Use **xm** for MARC XML.
""" """
......
...@@ -163,7 +163,7 @@ class IterRecord(object): ...@@ -163,7 +163,7 @@ class IterRecord(object):
"""Transform the XML node *<record>* into a Record. """Transform the XML node *<record>* into a Record.
Args: Args:
node (unicode): the *<record>* node has the following structure:: node (str): the *<record>* node has the following structure::
<record> <record>
<controlfield tag="001">1540265</controlfield> <controlfield tag="001">1540265</controlfield>
...@@ -221,7 +221,7 @@ class IterRecord(object): ...@@ -221,7 +221,7 @@ class IterRecord(object):
"""Transform the XML node *<datafiled>* into a dictionary. """Transform the XML node *<datafiled>* into a dictionary.
Args: Args:
node (unicode): the *<datafiled>* node has the following node (str): the *<datafiled>* node has the following
structure:: structure::
<datafield tag="024" ind1="8" ind2=" ">