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

Rename PluginAuthors and PluginPublicationInfo as AuthorsMixin and PublicationInfoMixin

parent c02e9993
......@@ -22,7 +22,7 @@ from store_tools import (MSG_NO_CONF,
REG_OAI,
REG_YEAR)
from store_tools.pluginpublicationinfo import PAPER_REFERENCE_KEYS
from store_tools.publicationinfomixin import PAPER_REFERENCE_KEYS
from plugin_dbui import CLEAN_SPACES, get_id, UNDEF_ID
......
......@@ -4,6 +4,7 @@ Note:
details on the invenio API at http://invenio-software.org/
"""
from .authorsmixin import AuthorsMixin
from .base import (ARXIV,
ARXIV_PDF,
is_conference,
......@@ -26,6 +27,7 @@ from .exception import (StoreException,
from .factory import build_record, build_store
from .inspirehepstore import InspirehepStore
from .publicationinfomixin import PublicationInfoMixin
from store_tools.cdsstore import CdsStore
from .record import Record
from .recordconf import RecordConf
......
"""recordauthorplugin.py
"""authorsmixin.py
"""
import re
......@@ -49,14 +49,11 @@ def to_initial(name):
return ("".join(li) if "-" in li else " ".join(li))
class PluginAuthors(object):
"""Plugin to handle authors in RecordPubli and RecordHepPubli
class AuthorsMixin(object):
"""Mixin to handle authors.
Attributes:
df_authors (pandas.DataFrame):
Authors and their affiliations are stored in DataFrame with the
following structure:
The parent class must have the attribute ``df_authors``:
It is a pandas.DataFrame containing authors and their affiliations:
+---------------+--------------------------------+
| column | |
......@@ -71,9 +68,8 @@ class PluginAuthors(object):
+---------------+--------------------------------+
| last_name | family name |
+---------------+--------------------------------+
The DataFrame has to be build in the parent
It is retrieved via self.df_authors
| role | equal to dir. for phd director |
+---------------+--------------------------------+
"""
......
"""pluginpublicationinfo.py
"""publicationinfomixin.py
"""
import numpy as np
......@@ -7,14 +7,11 @@ import re
PAPER_REFERENCE_KEYS = {"pagination", "title", "volume", "year"}
class PluginPublicationInfo(object):
"""Plugin to handle publication_info in RecordPubli and RecordHepPubli
class PublicationInfoMixin(object):
"""Mixin to handle publication_info.
Attributes:
df_info (pandas.DataFrame):
publication information are stored in DataFrame with the
following structure:
The parent class must have the attribute ``df_info``:
It is a pandas.DataFrame containing publication information:
+------------+--------------------------------+
| column | |
......@@ -28,9 +25,6 @@ class PluginPublicationInfo(object):
| pagination | page number or ranges |
+------------+--------------------------------+
The DataFrame has to be build in the parent
It is retrieved via self.df_info
"""
def is_published(self):
......
......@@ -3,11 +3,11 @@
"""
import logging
from .authorsmixin import AuthorsMixin
from filters import CLEAN_COLLABORATION
from pandas import DataFrame
from .publicationinfomixin import PublicationInfoMixin
from .recordhep import RecordHep
from store_tools.pluginauthors import PluginAuthors
from store_tools.pluginpublicationinfo import PluginPublicationInfo
def pages(row):
......@@ -41,7 +41,7 @@ def pages(row):
return f"{pstart}-{pend}"
class RecordHepPubli(RecordHep, PluginAuthors, PluginPublicationInfo):
class RecordHepPubli(RecordHep, AuthorsMixin, PublicationInfoMixin):
"""Article, preprint and proceeding from inspirehep.net version 2.
Schema for publication is documented here:
......
""" store_tools.recordpubli
"""
import logging
from .authorsmixin import AuthorsMixin
from .base import ARXIV
from filters import CLEAN_COLLABORATION
from pandas import concat, DataFrame
from plugin_dbui import CLEAN_SPACES
from .publicationinfomixin import PublicationInfoMixin
from .record import Record
from store_tools import ARXIV
from store_tools.pluginauthors import PluginAuthors
from store_tools.pluginpublicationinfo import PluginPublicationInfo
def to_str(x):
return ("|".join(x) if isinstance(x, list) else x)
class RecordPubli(Record, PluginAuthors, PluginPublicationInfo):
class RecordPubli(Record, AuthorsMixin, PublicationInfoMixin):
"""Article, preprint, proceeding, report and talk from cds.cern.ch or
old.inspirehep.net.
......@@ -122,6 +124,7 @@ class RecordPubli(Record, PluginAuthors, PluginPublicationInfo):
def __init__(self, *args):
self._last_fmt_author = "Last, First"
self.logger = logging.getLogger("web2py.app.limbra")
Record.__init__(self, *args)
self._process_authors()
......
......@@ -14,7 +14,7 @@ from store_tools.factory import (add_conference_data,
build_store,
get_conference_data)
from store_tools.pluginauthors import to_initial
from store_tools.authorsmixin import to_initial
from store_tools.recordconf import RecordConf
from store_tools.recordhepconf import RecordHepConf
from store_tools.recordhepinst import RecordHepInst
......
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