Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
bob
bob.bio.base
Commits
d99ffd97
Commit
d99ffd97
authored
Apr 05, 2018
by
Amir MOHAMMADI
Browse files
Load annotators as resources in FailSafe annotator
parent
9e1b68db
Pipeline
#18414
passed with stage
in 46 minutes and 56 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
bob/bio/base/annotator/FailSafe.py
View file @
d99ffd97
import
logging
import
six
from
.
import
Annotator
from
..
import
load_resource
logger
=
logging
.
getLogger
(
__name__
)
...
...
@@ -21,7 +23,11 @@ class FailSafe(Annotator):
def
__init__
(
self
,
annotators
,
required_keys
,
**
kwargs
):
super
(
FailSafe
,
self
).
__init__
(
**
kwargs
)
self
.
annotators
=
list
(
annotators
)
self
.
annotators
=
[]
for
annotator
in
annotators
:
if
isinstance
(
annotator
,
six
.
string_types
):
annotator
=
load_resource
(
annotator
,
'annotator'
)
self
.
annotators
.
append
(
annotator
)
self
.
required_keys
=
list
(
required_keys
)
def
annotate
(
self
,
sample
,
**
kwargs
):
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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