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
3fe0d5c1
Commit
3fe0d5c1
authored
Jan 29, 2020
by
LE GAC Renaud
Browse files
Remove the debug argument for Automaton and CheckAndFix.
parent
4aac44ff
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
10 additions
and
34 deletions
+10
-34
controllers/harvest.py
controllers/harvest.py
+4
-8
modules/harvest_tools/automaton.py
modules/harvest_tools/automaton.py
+2
-7
modules/harvest_tools/checkandfix.py
modules/harvest_tools/checkandfix.py
+1
-6
modules/harvest_tools/factory.py
modules/harvest_tools/factory.py
+2
-7
tests/basis/test_09_Automaton.py
tests/basis/test_09_Automaton.py
+1
-6
No files found.
controllers/harvest.py
View file @
3fe0d5c1
...
...
@@ -65,8 +65,7 @@ def free_run():
selector
.
id_categories
,
year_start
=
selector
.
year_start
,
year_end
=
selector
.
year_end
,
dry_run
=
(
selector
.
mode
==
MODE_DRY_RUN
),
debug
=
False
)
dry_run
=
(
selector
.
mode
==
MODE_DRY_RUN
))
if
not
tool
:
return
inline_alert
(
T
(
"Error"
),
T
(
"Select an harvester."
))
...
...
@@ -310,8 +309,7 @@ def insert_recjson():
selector
.
id_categories
,
year_start
=
selector
.
year_start
,
year_end
=
selector
.
year_end
,
dry_run
=
(
selector
.
mode
==
MODE_DRY_RUN
),
debug
=
False
)
dry_run
=
(
selector
.
mode
==
MODE_DRY_RUN
))
if
not
tool
:
return
inline_alert
(
T
(
"Error"
),
T
(
"Select an harvester."
))
...
...
@@ -381,8 +379,7 @@ def run():
row
.
harvesters
.
id_categories
,
year_start
=
selector
.
year_start
,
year_end
=
selector
.
year_end
,
dry_run
=
(
selector
.
mode
==
MODE_DRY_RUN
),
debug
=
False
)
dry_run
=
(
selector
.
mode
==
MODE_DRY_RUN
))
if
not
tool
:
return
inline_alert
(
T
(
"Error"
),
T
(
"Select an harvester."
))
...
...
@@ -447,8 +444,7 @@ def run_all():
harvester
.
id_categories
,
year_start
=
selector
.
year_start
,
year_end
=
selector
.
year_end
,
dry_run
=
(
selector
.
mode
==
MODE_DRY_RUN
),
debug
=
False
)
dry_run
=
(
selector
.
mode
==
MODE_DRY_RUN
))
if
not
tool
:
return
inline_alert
(
T
(
"Error"
),
T
(
"Select an harvester."
))
...
...
modules/harvest_tools/automaton.py
View file @
3fe0d5c1
...
...
@@ -104,9 +104,6 @@ class Automaton(object):
dry_run (bool):
new records are not inserted in the database when ``True``.
debug (bool):
activate the verbose mode when ``True``.
Raises:
ToolException:
* team or project or the publication category not defined
...
...
@@ -120,8 +117,7 @@ class Automaton(object):
id_category
,
year_start
=
None
,
year_end
=
None
,
dry_run
=
True
,
debug
=
False
):
dry_run
=
True
):
# protection team, project and/or category have to be defined
if
not
id_team
:
...
...
@@ -133,11 +129,10 @@ class Automaton(object):
if
not
id_category
:
raise
ToolException
(
MSG_NO_CAT
)
self
.
check
=
CheckAndFix
(
debug
)
self
.
check
=
CheckAndFix
()
self
.
collection_logs
=
[]
self
.
controller
=
automaton
self
.
db
=
db
self
.
dbg
=
debug
self
.
dry_run
=
dry_run
self
.
id_category
=
id_category
self
.
id_team
=
id_team
...
...
modules/harvest_tools/checkandfix.py
View file @
3fe0d5c1
...
...
@@ -78,15 +78,10 @@ UNIVERSITY = "University"
class
CheckAndFix
(
object
):
"""A collection of tools to check and repair the content of record.
Args:
debug (bool):
activate the debug mode.
"""
def
__init__
(
self
,
debug
=
False
):
def
__init__
(
self
):
self
.
db
=
current
.
db
self
.
dbg
=
debug
self
.
logger
=
logging
.
getLogger
(
"web2py.app.limbra"
)
self
.
reg_institute
=
self
.
_get_reg_institute
()
...
...
modules/harvest_tools/factory.py
View file @
3fe0d5c1
...
...
@@ -17,8 +17,7 @@ def build_harvester_tool(db,
id_category
,
year_start
=
None
,
year_end
=
None
,
dry_run
=
True
,
debug
=
False
):
dry_run
=
True
):
"""
Harvest tool factory function.
...
...
@@ -49,9 +48,6 @@ def build_harvester_tool(db,
dry_run (bool):
new records are not inserted in the database when ``True``.
debug (bool):
activate the verbose mode.
Returns:
Automaton:
* the appropriate harvester automaton.
...
...
@@ -69,8 +65,7 @@ def build_harvester_tool(db,
id_category
,
year_start
,
year_end
,
dry_run
,
debug
)
dry_run
)
def
get_harvester_tool
(
automaton
):
...
...
tests/basis/test_09_Automaton.py
View file @
3fe0d5c1
...
...
@@ -22,8 +22,7 @@ def svc():
"article"
,
get_id
(
db
.
categories
,
code
=
"ACL"
),
year_start
=
current
.
request
.
now
.
year
,
dry_run
=
True
,
debug
=
True
)
dry_run
=
True
)
def
test__is_record_in_db_09001
(
svc
):
...
...
@@ -85,7 +84,6 @@ def test_process_recid_09002(svc):
assert
len
(
recids
)
>
0
# try with the oldest one
svc
.
dbg
=
True
recid
=
recids
[
-
1
]
assert
svc
.
process_recid
(
recid
)
is
None
...
...
@@ -111,7 +109,6 @@ def test_process_collection_09003(svc):
svc
.
store
=
InvenioStore
()
# do it
svc
.
dbg
=
True
assert
svc
.
process_collection
(
"LHCb Papers"
)
is
None
# reset
...
...
@@ -123,11 +120,9 @@ def test_process_collection_09003(svc):
def
test_process_url_cds_09004
(
svc
):
svc
.
dbg
=
True
assert
svc
.
process_url
(
"cds.cern.ch"
,
"LHCb Papers"
)
is
None
def
test_process_url_ins_09005
(
svc
):
svc
.
dbg
=
True
assert
svc
.
process_url
(
"inspirehep.net"
,
"find cn lhcb and tc p and not tc c"
)
is
None
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