Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
python-common
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
nomad-lab
python-common
Commits
1e9bbd1f
Commit
1e9bbd1f
authored
8 years ago
by
Henning Glawe
Browse files
Options
Downloads
Patches
Plain Diff
add special case in annotator for SimpleMatcher.does_nothing
parent
88a25996
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
common/python/nomadcore/annotator.py
+32
-9
32 additions, 9 deletions
common/python/nomadcore/annotator.py
with
32 additions
and
9 deletions
common/python/nomadcore/annotator.py
+
32
−
9
View file @
1e9bbd1f
...
...
@@ -42,20 +42,43 @@ class Annotator(object):
return
1
# classify match
full
=
match
and
match
.
start
()
==
0
and
match
.
end
()
==
len
(
line
)
ignore
=
not
match
and
(
RE_EMPTY
.
match
(
line
)
or
(
self
.
coverageIgnore
is
not
None
and
self
.
coverageIgnore
.
match
(
line
)))
ignore
=
False
matcher_does_nothing
=
False
if
match
:
if
matcher
.
does_nothing
:
matcher_does_nothing
=
True
else
:
m2
=
RE_EMPTY
.
match
(
line
)
if
m2
:
ignore
=
True
match
=
m2
elif
self
.
coverageIgnore
is
not
None
:
m2
=
self
.
coverageIgnore
.
match
(
line
)
if
m2
:
ignore
=
True
match
=
m2
# setup match label
if
match
:
matchlabel
=
(
''
if
full
else
'
p_
'
)
+
(
'
end
'
if
targetStartEnd
else
'
start
'
)
matchlabel
=
''
if
ignore
:
matchlabel
=
'
ign
'
elif
match
:
if
matcher_does_nothing
:
matchlabel
=
'
n_
'
if
not
full
:
matchlabel
+=
'
p_
'
matchlabel
+=
'
end
'
if
targetStartEnd
else
'
start
'
else
:
matchlabel
=
'
ign
'
if
ignore
else
'
no
'
matchlabel
=
'
no
'
# highlight line
if
match
:
if
ignore
:
highlighted
=
self
.
matchHighlighter
.
highlight
(
match
,
line
,
linecolor
=
ANSI
.
FG_BLUE
)
elif
matcher_does_nothing
:
highlighted
=
self
.
matchHighlighter
.
highlight
(
match
,
line
,
linecolor
=
ANSI
.
FG_MAGENTA
)
elif
match
:
highlighted
=
self
.
matchHighlighter
.
highlight
(
match
,
line
)
elif
ignore
:
highlighted
=
ANSI
.
FG_BLUE
+
self
.
matchHighlighter
.
with_ANSI_RESET
(
line
)
else
:
highlighted
=
line
# set matcher name
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment