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
8ecc9cac
Commit
8ecc9cac
authored
8 years ago
by
Berk Onat
Browse files
Options
Downloads
Plain Diff
Merge branch 'SM-peekline-branch' into 'master'
Added peekline feature to SimpleMatcher. See merge request
!5
parents
6492edbb
3e2cfeb7
Branches
Branches containing commit
Tags
3.2
Tags containing commit
1 merge request
!5
Added peekline feature to SimpleMatcher.
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
common/python/nomadcore/simple_parser.py
+9
-0
9 additions, 0 deletions
common/python/nomadcore/simple_parser.py
with
9 additions
and
0 deletions
common/python/nomadcore/simple_parser.py
+
9
−
0
View file @
8ecc9cac
...
@@ -29,6 +29,7 @@ class PushbackLineFile(object):
...
@@ -29,6 +29,7 @@ class PushbackLineFile(object):
def
__init__
(
self
,
fIn
,
lines
=
tuple
()):
def
__init__
(
self
,
fIn
,
lines
=
tuple
()):
self
.
fIn
=
fIn
self
.
fIn
=
fIn
self
.
fInLine
=
None
self
.
lines
=
list
(
lines
)
self
.
lines
=
list
(
lines
)
self
.
lineNr
=
0
self
.
lineNr
=
0
self
.
name
=
fIn
.
name
self
.
name
=
fIn
.
name
...
@@ -40,10 +41,18 @@ class PushbackLineFile(object):
...
@@ -40,10 +41,18 @@ class PushbackLineFile(object):
else
:
else
:
res
=
self
.
fIn
.
readline
()
res
=
self
.
fIn
.
readline
()
if
res
:
if
res
:
self
.
fInLine
=
res
self
.
lineNr
+=
1
self
.
lineNr
+=
1
return
res
return
res
def
peekline
(
self
):
pos
=
self
.
fIn
.
tell
()
line
=
self
.
fIn
.
readline
()
self
.
fIn
.
seek
(
pos
)
return
line
def
pushbackLine
(
self
,
line
):
def
pushbackLine
(
self
,
line
):
self
.
fInLine
=
line
self
.
lines
.
append
(
line
)
self
.
lines
.
append
(
line
)
self
.
lineNr
-=
1
self
.
lineNr
-=
1
...
...
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