Commit 172102fc authored by LE GAC Renaud's avatar LE GAC Renaud
Browse files

Fix pylint warnings / errors in invenio_tools.

parent 7936b2a3
......@@ -376,8 +376,8 @@ class CheckAndFix(object):
# check country information (all valid countries have been enter once)
db = self.db
id = get_id(db.countries, country=record.conference_country())
if not id:
id_country = get_id(db.countries, country=record.conference_country())
if not id_country:
raise CheckException(MSG_NO_COUNTRY)
def conference_date(self, record):
......
......@@ -195,11 +195,11 @@ class InvenioStore(object):
return ids
def get_record(self, id):
"""Retrieve a record defined by its C{id} in the invenio store.
def get_record(self, rec_id):
"""Retrieve a record defined by its C{rec_id} in the invenio store.
@type id: int
@param id:
@type rec_id: int
@param rec_id:
@rtype: unicode
@return: the XML string is compliant with
......@@ -210,7 +210,7 @@ class InvenioStore(object):
"""
self._try = 0
url = 'http://%s/record/%s/export/xm' % (self._host, id)
url = 'http://%s/record/%s/export/xm' % (self._host, rec_id)
return self.interogate(url)
def last_search_url(self):
......
......@@ -49,8 +49,8 @@ class Marc12(object):
raise Marc12Exception(MSG_NO_CONF)
# get conference information
id = record.reference_conference_id()
conference = self._get_conference(host, id, key)
id_conf = record.reference_conference_id()
conference = self._get_conference(host, id_conf, key)
# protection id can be a reference to other object like book
if u"111" not in conference:
......@@ -110,7 +110,7 @@ class Marc12(object):
raise Marc12Exception(MSG_NO_CONF)
def __call__(self, xml, filter=None, func=None):
def __call__(self, xml, filter_func=None, func=None):
"""Transform the the XML string into a list of L{Record}.
@type xml: unicode
......@@ -134,8 +134,8 @@ class Marc12(object):
</record>
</collection>
@type filter: reference to a function
@param filter: A function to eliminate records which don't satisfy
@type filter_func: reference to a function
@param filter_func: A function to eliminate records which don't satisfy
functions criteria. The argument of the function is a Record while
the return value is a boolean.
......@@ -166,7 +166,7 @@ class Marc12(object):
else:
upcast_record = RecordPubli(record)
if filter and not filter(upcast_record):
if filter_func and not filter_func(upcast_record):
continue
if func:
......
......@@ -6,7 +6,6 @@ import pprint
from base import OAI_URL, REG_OAI
from exception import RecordException
class Record(dict):
......
......@@ -2,9 +2,6 @@
""" invenio_tools.recordconf
"""
import re
from base import REG_YEAR
from plugin_dbui import CLEAN_SPACES
from recordpubli import RecordPubli
......
......@@ -39,7 +39,7 @@ class RecordInst(Record):
raise RecordException(MSG_INVALID_RECORD)
if record.host() != 'inspirehep.net':
raise RecordException(MSG_INVALID_INSTITUTE)
raise RecordException(MSG_INVALID_HOST)
Record.__init__(self, record)
......
......@@ -9,8 +9,7 @@ from base import (ARXIV,
ARXIV_PDF,
REG_ARXIV_NUMBER,
REG_AUTHOR,
REG_YEAR,
THESIS_DIR)
REG_YEAR)
from filters import CLEAN_COLLABORATION
from plugin_dbui import CLEAN_SPACES
from record import Record
......@@ -376,10 +375,10 @@ class RecordPubli(Record):
for di in dictionaries:
if isinstance(di, dict):
if "u" in di:
continue
else:
return False
if "u" in di:
continue
else:
return False
else:
return False
......
......@@ -2,7 +2,7 @@
""" invenio_tools.recordthesis
"""
from base import THESIS_DIR
from base import REG_AUTHOR, THESIS_DIR
from filters import CLEAN_THESIS_DEFENSE
from recordpubli import RecordPubli
......
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