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):
* Collaboration always start with a Capital letter.
Args:
value (unicode): string where collaborations are separated by comma
value (str): string where collaborations are separated by comma
Returns:
unicode:
str:
"""
li = []
......@@ -83,10 +83,10 @@ def CLEAN_THESIS_DEFENSE(value):
* Remove prefix like *Presented*, *on*, *etc*.
Args:
value (unicode): string with the defence date
value (str): string with the defence date
Returns:
unicode:
str:
"""
value = value.replace("Presented ", "")
......
......@@ -92,22 +92,22 @@ class Articles(Automaton):
found later by the harvester.
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
of the existing database record is update to **oai_url**
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.
Keyword Args:
id_publisher (int): identifier of the publisher in the database.
my_authors (unicode): authors of my institute separated by a comma.
pages (unicode): the page reference.
publication_url (unicode): the URL of the publications
preprint_number (unicode): the preprint number
title (unicode): the title of the publication.
volume (unicode): the volume reference.
my_authors (str): authors of my institute separated by a comma.
pages (str): the page reference.
publication_url (str): the URL of the publications
preprint_number (str): the preprint number
title (str): the title of the publication.
volume (str): the volume reference.
Returns:
tuple: ``(id, status)`` which contains the ``id`` of the record.
......@@ -194,20 +194,20 @@ class Articles(Automaton):
All the keyword arguments are needed by the transformation.
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.
year (unicode): the year of publication which is used
year (str): the year of publication which is used
by the logger.
Keyword Args:
id_publisher (int): identifier of the publisher in the database.
my_authors (unicode): authors of my institute separated by a comma.
oai_url (unicode): the full oai_url(s) of the article.
pages (unicode): the page reference.
publication_url (unicode): the URL of the publications
title (unicode): the title of the publication.
volume (unicode): the volume reference.
my_authors (str): authors of my institute separated by a comma.
oai_url (str): the full oai_url(s) of the article.
pages (str): the page reference.
publication_url (str): the URL of the publications
title (str): the title of the publication.
volume (str): the volume reference.
Returns:
tuple: ``(id, status)`` which contains the ``id`` of the record.
......
......@@ -76,7 +76,7 @@ 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.
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:
``articles``, ``notes``, ``preprints``, ``proceedings``,
``reports``, ``talks`` and ``theses``.
......@@ -144,7 +144,7 @@ class Automaton(object):
"""Insert the record in the database, handling database exception.
Args:
log_year (unicode): year of the record for the log
log_year (str): year of the record for the log
Keyword Args:
**fields: keyword arguments defining the record values to be
......@@ -188,13 +188,13 @@ class Automaton(object):
A new log entry is created when a record is found.
Args:
title (unicode): the title of the publication.
title (str): the title of the publication.
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*.
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:
Either use *host* and *rec_id* or *oai_url*
......@@ -270,7 +270,7 @@ class Automaton(object):
in the selector.
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:
* ``"find cn d0 and tc p and not tc c"``
......@@ -386,7 +386,7 @@ class Automaton(object):
and found later by an harvester.
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
of the existing database record is update to **oai_url**
when a match is found.
......@@ -395,7 +395,7 @@ class Automaton(object):
by the search algorithm and by the logger.
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.
Returns:
......@@ -457,7 +457,7 @@ class Automaton(object):
Args:
xml (unicode): XML string encoding the publication records.
xml (str): XML string encoding the publication records.
The format follows the MARC12 standard.
Raises:
......@@ -586,7 +586,7 @@ class Automaton(object):
"""Decode the MARC XML string and insert records in the database.
Args:
xml (unicode): MARC XML string
xml (str): MARC XML string
"""
......@@ -658,7 +658,7 @@ class Automaton(object):
Returns:
dict:
* ``collection_logs`` list of :class:MsgCollection
* ``controller`` unicode
* ``controller`` str
* ``logs`` list of :class:Msg
* ``selector`` :py:class:plugin_dbui.Selector
......@@ -672,7 +672,7 @@ class Automaton(object):
"""Get the database collaboration identifier using synonyms.
Args:
value (unicode): the name of the collaboration.
value (str): the name of the collaboration.
Returns:
int:
......@@ -691,7 +691,7 @@ class Automaton(object):
"""Get the database country identifier using synonyms.
Args:
value (unicode): the name of the country.
value (str): the name of the country.
Returns:
int:
......@@ -709,7 +709,7 @@ class Automaton(object):
"""Get the database publisher identifier using synonyms.
Args:
value (unicode): the abbreviation of the publisher.
value (str): the abbreviation of the publisher.
Returns:
int:
......
......@@ -19,11 +19,11 @@ def family_name_fr(full_name):
"""Extract the family name when the full name is encoded as ``J. Doe``.
Args:
full_name (unicode): author name encoded according to French
full_name (str): author name encoded according to French
typographic rules.
Returns:
unicode: family name
str: family name
"""
return full_name[full_name.find(' ') + 1:]
......@@ -98,9 +98,9 @@ def search_synonym(table, fieldname, value, create=False):
It contains a list of strings.
Args:
table (gluon.DAL.Table): database table.
fieldname (unicode): field of the database table
fieldname (str): field of the database table
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
it is ``True``
......
......@@ -101,7 +101,7 @@ class CheckAndFix(object):
They are replaced by ``\(`` *etc*.
Returns:
unicode:
str:
"""
# alias
......@@ -207,8 +207,8 @@ class CheckAndFix(object):
"""Check that the synonym field contains *value*.
Args:
tablename (unicode): name of the database table
value (unicode): value to be searched
tablename (str): name of the database table
value (str): value to be searched
Returns:
bool: ``True`` if *one* row is found, ``False`` otherwise.
......@@ -615,14 +615,14 @@ class CheckAndFix(object):
Args:
record (RecordPubli): record describing a publication.
sep (unicode):
sep (str):
string separating author names. The default is the comma.
sort (bool):
sort authors by family name when true otherwise use the
order of authors at the creation of the record
Returns:
unicode: the list of authors separated by the ``sep`` argument.
strcode: the list of authors separated by the ``sep`` argument.
Raises:
CheckException: when the list is empty
......@@ -824,7 +824,7 @@ class CheckAndFix(object):
Args:
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``
"""
......
......@@ -26,7 +26,7 @@ def build_harvester_tool(db,
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.
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:
``articles``, ``notes``, ``preprints``, ``proceedings``,
``reports``, ``talks`` and ``theses``.
......@@ -75,7 +75,7 @@ def get_harvester_tool(automaton):
* theses
Args:
automaton (unicode): name of the automaton
automaton (str): name of the automaton
Returns:
Automaton: class reference or ``None``. The latter happens
......
......@@ -26,12 +26,12 @@ class Msg(Storage):
* *reject* the record is rejected.
Args:
collection (unicode): the harvester collection used to
collection (str): the harvester collection used to
search the record.
harvester (gluon.dal.Row): the database harvester used to scan 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,
......@@ -59,8 +59,8 @@ class Msg(Storage):
"""Set the action as *idle* and the explanation as ``txt``.
Args:
txt (unicode): message associated to the action.
year (unicode): year of the publication
txt (str): message associated to the action.
year (str): year of the publication
translate (bool): translate the message according to the
current language.
......@@ -72,8 +72,8 @@ class Msg(Storage):
"""Set the action as *load* and the explanation as ``txt``.
Args:
txt (unicode): message associated to the action.
year (unicode): year of the publication
txt (str): message associated to the action.
year (str): year of the publication
translate (bool): translate the message according to the
current language.
......@@ -85,8 +85,8 @@ class Msg(Storage):
"""Set the action as *modify* and the explanation as ``txt``.
Args:
txt (unicode): message associated to the action.
year (unicode): year of the publication
txt (str): message associated to the action.
year (str): year of the publication
translate (bool): translate the message according to the
current language.
......@@ -98,9 +98,9 @@ class Msg(Storage):
"""Set the action as *reject* and the explanation as ``txt``.
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.
It is used to determine the synonym value when the
......
......@@ -8,10 +8,10 @@ class MsgCollection(Storage):
"""Messages for a collection.
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.
url (unicode): URL used to scan the harvester repository.
title (unicode): title of the collection.
url (str): URL used to scan the harvester repository.
title (str): title of the collection.
"""
def __init__(self, error="", found=0, title="", url=""):
......
......@@ -40,7 +40,7 @@ def load_record(host, record_id):
"""Helper function to load a single record from an invenio store.
Args:
host (unicode): host of the store.
host (str): host of the store.
Possible values are ``cds.cern.ch`` or ``inspirehep.net``.
record_id (int): the record identifier in the store
......
......@@ -64,7 +64,7 @@ class InvenioStore(object):
"""Interrogate the store using the *URL*.
Args:
url (unicode): URL string
url (str): URL string
params (dict): parameters to be send with the URL
Returns:
......@@ -195,7 +195,7 @@ class InvenioStore(object):
rec_id (int): record identifier in the store.
Returns:
unicode: the XML string is compliant with
str: the XML string is compliant with
the `MARC <http://www.loc.gov/marc/>`_ standard.
Use Marc12.__call__ to decode it.
......@@ -210,7 +210,7 @@ class InvenioStore(object):
def last_search_url(self):
"""
Returns:
unicode: the URL used in the last search.
str: the URL used in the last search.
"""
return self._url
......@@ -387,7 +387,7 @@ class InvenioStore(object):
http://invenio-demo.cern.ch/help/hacking/search-engine-api.
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**.
Deprecated: the method get_ids coupled with get_record is
......@@ -424,7 +424,8 @@ class InvenioStore(object):
so (str): sort order ("a"=ascending, "d"=descending).
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.
"""
......
......@@ -163,7 +163,7 @@ class IterRecord(object):
"""Transform the XML node *<record>* into a Record.
Args:
node (unicode): the *<record>* node has the following structure::
node (str): the *<record>* node has the following structure::
<record>
<controlfield tag="001">1540265</controlfield>
......@@ -221,7 +221,7 @@ class IterRecord(object):
"""Transform the XML node *<datafiled>* into a dictionary.
Args:
node (unicode): the *<datafiled>* node has the following
node (str): the *<datafiled>* node has the following
structure::
<datafield tag="024" ind1="8" ind2=" ">
......@@ -258,7 +258,7 @@ class IterRecord(object):
"""C{True} when the C{xml} string is not well formed.
Args:
xml (unicode):
xml (str):
Returns:
bool:
......
......@@ -83,7 +83,7 @@ class Marc12(object):
* Prefer the method :meth:`.records`.
Args:
xml (unicode): the XML string with the publication contents.
xml (str): the XML string with the publication contents.
Keyword Args:
filter_func (reference): a function to eliminate records
......@@ -105,10 +105,10 @@ class Marc12(object):
The conference is identified by its id or key.
Args:
host (unicode): possible values are ``cds.cern.ch`` or
host (str): possible values are ``cds.cern.ch`` or
``inspirehep.net``.
conf_id (unicode): the conference identifier in the store.
key (unicode): the conference key in the store.
conf_id (str): the conference identifier in the store.
key (str): the conference key in the store.
Returns:
Record: The conference record
......@@ -203,7 +203,7 @@ class Marc12(object):
"""Return an iterator on the embedded records.
Args:
xml (unicode): the XML string with the publication contents.
xml (str): the XML string with the publication contents.
Return:
IterRecord:
......@@ -215,7 +215,7 @@ class Marc12(object):
"""Transform the the XML string into a list of Record.
Args:
xml (unicode): the XML string with the publication contents.
xml (str): the XML string with the publication contents.
It has the following structure:
.. code-block:: xml
......
......@@ -20,7 +20,7 @@ class Record(dict):
In the `MARC <http://www.loc.gov/marc/>`_ standard, the ``field``
is a string containing at least three digit while the ``subfield`` is
a letter. The type of the ``field`` is unicode and ``subfield`` is string.
a letter. The type of the ``field`` is str and ``subfield`` is string.
The class comes with a collection of methods to extract the record
information masking the ``field`` and the ``subfield`` codification.
......@@ -52,7 +52,7 @@ class Record(dict):
"""Get the value associated to the key C{field} and C{subfield}.
Args:
field (unicode): typical values are ``"001"``, ``"700"``,
fiestrcode): typical values are ``"001"``, ``"700"``,
``"909CO"``, ....
subfield (str): typical values are ``"a"``, ``"b``", ....
......@@ -60,7 +60,7 @@ class Record(dict):
force_list (bool): always return a *list* when ``True``.
Returns:
unicode or list: empty string / list when not defined.
str or list: empty string / list when not defined.
"""
val = ""
......@@ -89,10 +89,10 @@ class Record(dict):
"""Build the Open Archive Initiative URL.
Args:
value (unicode): OAI identifier, *e*g* ``oai:host:id``
value (str): OAI identifier, *e*g* ``oai:host:id``
Returns:
unicode: the pattern of the string is ``http://host/record/id``.
str: the pattern of the string is ``http://host/record/id``.
The string is empty when it is not defined or when the value
is not well formed.
......@@ -113,7 +113,7 @@ class Record(dict):
"""The store housing the record.
Returns:
unicode: ``inspirehep.net`` or ``cds.cern.ch`` or an empty string
str: ``inspirehep.net`` or ``cds.cern.ch`` or an empty string
when not defined.
"""
......@@ -137,7 +137,7 @@ class Record(dict):
"""The id of the record in the store.
Returns:
unicode: the unique id of the record in the store
str: the unique id of the record in the store
"""
return self["001"]
......@@ -146,7 +146,7 @@ class Record(dict):
"""The Open Archive Initiative identifier(s).
Returns:
unicode: the primary and secondary OAI identifier are separated
str: the primary and secondary OAI identifier are separated
by a comma. The pattern of the identifier is ``oai:host:id`` or
an empty string when it is not defined.
......@@ -165,7 +165,7 @@ class Record(dict):
"""The Open Archive Initiative identifier URL(s).
Returns:
unicode: the primary and secondary URLs are separated by a comma.
str: the primary and secondary URLs are separated by a comma.
The pattern of the URL is ``http://host/record/id`` or
an empty string when it is not defined or when the OAI is
not well formed.
......@@ -188,7 +188,7 @@ class Record(dict):
It contains the value return by the method :meth:`.id`.
Returns:
unicode: the pattern of the string is ``oai:host:id``.
str: the pattern of the string is ``oai:host:id``.
It is an empty string when not defined
"""
......@@ -227,7 +227,7 @@ class Record(dict):
a new *id* and new *URL* which is return by this method.
Returns:
unicode: the pattern of the string is ``http://host/record/id``.
str: the pattern of the string is ``http://host/record/id``.
The string is empty when it is not defined or when the OAI
is not well formed.
......@@ -248,7 +248,7 @@ class Record(dict):
corresponds to the record in the other store, *inspirehep.net*.
Returns:
unicode: the pattern of the string is ``oai:host:id``.
str: the pattern of the string is ``oai:host:id``.
It is an empty string when not defined
"""
......@@ -283,7 +283,7 @@ class Record(dict):
"""The Open Archive Initiative URL for the secondary OAI.
Returns:
unicode: the pattern of the string is ``http://host/record/id``.
str: the pattern of the string is ``http://host/record/id``.
The string is empty when it is not defined or when the OAI
is not well formed.
......
......@@ -39,7 +39,7 @@ class RecordConf(RecordPubli):
"""The dates of the conference.
Returns:
unicode: the usual pattern is ``6-5 March 2012`` but it can varies
str: the usual pattern is ``6-5 March 2012`` but it can varies
between records and between stores since it is not
standardise.
......@@ -70,7 +70,7 @@ class RecordConf(RecordPubli):
"""The country where the conference took place.
Returns:
unicode: the filter *CLEAN_SPACES* is applied. The string is empty
str: the filter *CLEAN_SPACES* is applied. The string is empty
when the country is not defined.
"""
......@@ -83,7 +83,7 @@ class RecordConf(RecordPubli):
"""The conference key used in the store.
Returns:
unicode:
str:
"""
return self._get("111", "g")
......@@ -92,7 +92,7 @@ class RecordConf(RecordPubli):
"""The conference location.
Returns:
unicode: the pattern is ``town, country``
str: the pattern is ``town, country``
"""
location = self._get("111", "c")
......@@ -108,7 +108,7 @@ class RecordConf(RecordPubli):
"""The title of the conference.
Returns:
unicode:
str:
"""
return CLEAN_SPACES(self._get("111", "a"))
......@@ -117,7 +117,7 @@ class RecordConf(RecordPubli):
"""The town where the conference took place.
Returns:
unicode: empty string when it is not defined.
str: empty string when it is not defined.
"""
loc = self.conference_location()
......@@ -129,7 +129,7 @@ class RecordConf(RecordPubli):
"""The URL of the conference home page.
Returns:
unicode: select arbitrarily the first URL when severals
str: select arbitrarily the first URL when severals