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
896fd76d
Commit
896fd76d
authored
Jan 12, 2021
by
LE GAC Renaud
Browse files
Update RecordHepPubli and CheckAnFix to fix collaboration handling
parent
fbddce74
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
27 additions
and
19 deletions
+27
-19
modules/harvest_tools/checkandfix.py
modules/harvest_tools/checkandfix.py
+18
-10
modules/store_tools/recordheppubli.py
modules/store_tools/recordheppubli.py
+1
-8
tests/basis/test_05_RecordHepPubli.py
tests/basis/test_05_RecordHepPubli.py
+1
-1
tests/basis/test_13_CheckAndFix_article.py
tests/basis/test_13_CheckAndFix_article.py
+7
-0
No files found.
modules/harvest_tools/checkandfix.py
View file @
896fd76d
...
...
@@ -372,7 +372,8 @@ class CheckAndFix(object):
Raises:
CheckException:
* the collaboration is unknown (neither collaborationnor synonym)
* the collaboration is unknown (neither collaboration
or synonym)
* more than one synonym found.
"""
self
.
logger
.
debug
(
f
"
{
T6
}
check collaboration"
)
...
...
@@ -391,15 +392,22 @@ class CheckAndFix(object):
collaboration
=
db
.
collaborations
[
dbid
].
collaboration
if
collaboration
!=
val
:
# one collaboration
if
isinstance
(
record
[
"corporate_name"
],
dict
):
record
[
"corporate_name"
][
"collaboration"
]
=
collaboration
# several collaboration
# replace the list of dictionary by a single one
else
:
record
[
"corporate_name"
]
=
\
{
"collaboration"
:
collaboration
}
# cds.cern.ch
if
"corporate_name"
in
record
:
# one collaboration
if
isinstance
(
record
[
"corporate_name"
],
dict
):
record
[
"corporate_name"
][
"collaboration"
]
=
\
collaboration
# several collaboration
# replace the list of dictionary by a single one
else
:
record
[
"corporate_name"
]
=
\
{
"collaboration"
:
collaboration
}
# inspirehep.net
elif
"collaborations"
in
record
:
record
[
"collaborations"
]
=
[{
"value"
:
collaboration
}]
except
ToolException
as
e
:
raise
CheckException
(
*
e
.
args
)
...
...
modules/store_tools/recordheppubli.py
View file @
896fd76d
...
...
@@ -209,14 +209,7 @@ class RecordHepPubli(RecordHep, PluginAuthors, PluginPublicationInfo):
if
collaborations
is
None
:
return
""
lst
=
[]
for
elt
in
collaborations
:
val
=
elt
[
"value"
]
val
=
(
val
if
val
.
endswith
(
"ollaboration"
)
else
f
"
{
val
}
Collaboration"
)
lst
.
append
(
val
)
lst
=
[
elt
[
"value"
]
for
elt
in
collaborations
]
return
CLEAN_COLLABORATION
(
", "
.
join
(
lst
))
def
paper_url
(
self
):
...
...
tests/basis/test_05_RecordHepPubli.py
View file @
896fd76d
...
...
@@ -155,7 +155,7 @@ def test_find_authors_by_affiliation_ins_05031(record):
# Other methods
#
def
test_collaboration_ins_05040
(
record
):
assert
record
.
collaboration
()
==
"LHCb
Collaboration
"
assert
record
.
collaboration
()
==
"LHCb"
def
test_is_published_ins_05041
(
record
):
...
...
tests/basis/test_13_CheckAndFix_article.py
View file @
896fd76d
...
...
@@ -124,3 +124,10 @@ def test_get_my_authors_cds_13008(svc, reccds):
"K. De Bruyn|R. Le Gac|O. Leroy|"
\
"G. Mancinelli|M. Martin|A. Mordà|"
\
"J. Serrano|A. Tayduganov|A. Tsaregorodtsev"
def
test_collaboration_ins_13009
(
svc
):
# require the CPPM database (test_limbra)
record
=
load_record
(
"inspirehep.net"
,
1826290
,
shelf
=
"literature"
)
svc
.
collaboration
(
record
)
assert
record
.
collaboration
()
==
"HESS Collaboration"
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