Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
limbra
limbra
Commits
bcab4702
Commit
bcab4702
authored
Jan 13, 2021
by
LE GAC Renaud
Browse files
Rename PluginAuthors and PluginPublicationInfo as AuthorsMixin and PublicationInfoMixin
parent
c02e9993
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
26 additions
and
31 deletions
+26
-31
modules/harvest_tools/checkandfix.py
modules/harvest_tools/checkandfix.py
+1
-1
modules/store_tools/__init__.py
modules/store_tools/__init__.py
+2
-0
modules/store_tools/authorsmixin.py
modules/store_tools/authorsmixin.py
+7
-11
modules/store_tools/publicationinfomixin.py
modules/store_tools/publicationinfomixin.py
+5
-11
modules/store_tools/recordheppubli.py
modules/store_tools/recordheppubli.py
+3
-3
modules/store_tools/recordpubli.py
modules/store_tools/recordpubli.py
+7
-4
tests/basis/test_02_factory_tools.py
tests/basis/test_02_factory_tools.py
+1
-1
No files found.
modules/harvest_tools/checkandfix.py
View file @
bcab4702
...
...
@@ -22,7 +22,7 @@ from store_tools import (MSG_NO_CONF,
REG_OAI
,
REG_YEAR
)
from
store_tools.
plugin
publicationinfo
import
PAPER_REFERENCE_KEYS
from
store_tools.publicationinfo
mixin
import
PAPER_REFERENCE_KEYS
from
plugin_dbui
import
CLEAN_SPACES
,
get_id
,
UNDEF_ID
...
...
modules/store_tools/__init__.py
View file @
bcab4702
...
...
@@ -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
...
...
modules/store_tools/
plugin
authors.py
→
modules/store_tools/authors
mixin
.py
View file @
bcab4702
"""
record
author
plug
in.py
"""author
smix
in.py
"""
import
re
...
...
@@ -49,14 +49,11 @@ def to_initial(name):
return
(
""
.
join
(
li
)
if
"-"
in
li
else
" "
.
join
(
li
))
class
Plugin
Authors
(
object
):
"""
Plug
in to handle authors
in RecordPubli and RecordHepPubli
class
Authors
Mixin
(
object
):
"""
Mix
in 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 |
+---------------+--------------------------------+
"""
...
...
modules/store_tools/
plugin
publicationinfo.py
→
modules/store_tools/publicationinfo
mixin
.py
View file @
bcab4702
"""
plugin
publicationinfo.py
"""publicationinfo
mixin
.py
"""
import
numpy
as
np
...
...
@@ -7,14 +7,11 @@ import re
PAPER_REFERENCE_KEYS
=
{
"pagination"
,
"title"
,
"volume"
,
"year"
}
class
Plugin
PublicationInfo
(
object
):
"""
Plug
in to handle publication_info
in RecordPubli and RecordHepPubli
class
PublicationInfo
Mixin
(
object
):
"""
Mix
in 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
):
...
...
modules/store_tools/recordheppubli.py
View file @
bcab4702
...
...
@@ -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
,
Plugin
Authors
,
Plugin
PublicationInfo
):
class
RecordHepPubli
(
RecordHep
,
Authors
Mixin
,
PublicationInfo
Mixin
):
"""Article, preprint and proceeding from inspirehep.net version 2.
Schema for publication is documented here:
...
...
modules/store_tools/recordpubli.py
View file @
bcab4702
""" 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
,
Plugin
Authors
,
Plugin
PublicationInfo
):
class
RecordPubli
(
Record
,
Authors
Mixin
,
PublicationInfo
Mixin
):
"""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
()
...
...
tests/basis/test_02_factory_tools.py
View file @
bcab4702
...
...
@@ -14,7 +14,7 @@ from store_tools.factory import (add_conference_data,
build_store
,
get_conference_data
)
from
store_tools.
plugin
authors
import
to_initial
from
store_tools.authors
mixin
import
to_initial
from
store_tools.recordconf
import
RecordConf
from
store_tools.recordhepconf
import
RecordHepConf
from
store_tools.recordhepinst
import
RecordHepInst
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment