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
75ff496f
Commit
75ff496f
authored
Jan 15, 2021
by
LE GAC Renaud
Browse files
Migrate check and fix method to preprints
parent
e98db28b
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
27 additions
and
13 deletions
+27
-13
modules/harvest_tools/preprints.py
modules/harvest_tools/preprints.py
+27
-13
No files found.
modules/harvest_tools/preprints.py
View file @
75ff496f
...
...
@@ -2,18 +2,20 @@
"""
from
.automaton
import
Automaton
from
.base
import
MSG_CRASH
,
MSG_LOAD
from
.base
import
MSG_CRASH
,
MSG_LOAD
,
T4
from
.checkandfix
import
CheckException
from
plugin_dbui
import
get_id
,
UNDEF_ID
from
store_tools
import
RecordCdsConfPaper
,
RecordCdsThesis
from
.recordcdsconfpaper
import
RecordCdsConfPaper
from
.recordhepconfpaper
import
RecordHepConfPaper
from
.recordcdsthesis
import
RecordCdsThesis
from
.recordhepthesis
import
RecordHepThesis
MSG_NOT_ARTICLE
=
"Reject publication is not a preprint"
MSG_PREPRINT_IS_PAPER
=
"Reject preprint is a published paper"
MSG_PREPRINT_IS_CONFERENCE
=
"Reject preprint is a conference"
MSG_PREPRINT_IS_THESIS
=
"Reject preprint is a thesis"
MSG_PREPRINT_NO_NUMBER
=
"Reject no preprint number"
T4
=
" "
*
4
class
Preprints
(
Automaton
):
"""Automaton for preprints.
...
...
@@ -23,6 +25,12 @@ class Preprints(Automaton):
def
check_record
(
self
,
record
):
"""Check the content of the preprint in order to fix non conformities.
* is with authors form my institute
* standardise name of collaboration
* format authors according to my format
* extract authors form my institute signing the publication
* is submitted date well formed
Args:
record (RecordPubli):
record describing a preprint.
...
...
@@ -33,20 +41,21 @@ class Preprints(Automaton):
corrected.
"""
if
not
Automaton
.
check_record
(
self
,
record
):
return
False
self
.
logger
.
debug
(
f
"
{
T4
}
check and fix record (preprint)"
)
self
.
logger
.
debug
(
f
"
{
T4
}
check record (preprint)"
)
if
record
.
subtype
()
==
"preprint"
:
self
.
logs
[
-
1
].
reject
(
MSG_NOT_ARTICLE
,
record
)
return
False
if
record
.
is_published
():
self
.
logs
[
-
1
].
reject
(
MSG_PREPRINT_IS_PAPER
,
record
=
record
)
return
False
if
isinstance
(
record
,
RecordCdsConfPaper
):
if
isinstance
(
record
,
(
RecordCdsConfPaper
,
RecordHepConfPaper
)
):
self
.
logs
[
-
1
].
reject
(
MSG_PREPRINT_IS_CONFERENCE
,
record
=
record
)
return
False
if
isinstance
(
record
,
RecordCdsThesis
):
if
isinstance
(
record
,
(
RecordCdsThesis
,
RecordHepThesis
)
):
self
.
logs
[
-
1
].
reject
(
MSG_PREPRINT_IS_THESIS
,
record
=
record
)
return
False
...
...
@@ -55,10 +64,15 @@ class Preprints(Automaton):
return
False
try
:
self
.
check
.
submitted
(
record
)
self
.
check
.
format_authors
(
record
,
fmt
=
"F. Last"
)
self
.
check
.
get_my_authors
(
record
,
sort
=
True
)
# is with authors form my institute
# standardise name of collaboration
# format authors according to my format
# extract authors form my institute signing the publication
# is submitted date well formed
record
.
check_and_fix
(
self
.
rex_institute
,
fmt_author
=
"F. Last"
,
sep_author
=
", "
,
sort_author
=
True
)
except
CheckException
as
e
:
self
.
logs
[
-
1
].
reject
(
e
,
record
=
record
)
...
...
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