Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
sample-parser
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Analyze
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
sample-parser
Commits
5e8279e8
Commit
5e8279e8
authored
8 years ago
by
Mohamed, Fawzi Roberto (fawzi)
Browse files
Options
Downloads
Patches
Plain Diff
update sample parser
parent
1d1e7427
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
.gitignore
+54
-0
54 additions, 0 deletions
.gitignore
parser/sample-parser/sample_parser.py
+19
-1
19 additions, 1 deletion
parser/sample-parser/sample_parser.py
with
73 additions
and
1 deletion
.gitignore
0 → 100644
+
54
−
0
View file @
5e8279e8
# use glob syntax.
syntax: glob
*.ser
*.class
*~
*.bak
#*.off
*.old
*.pyc
*.bk
*.swp
.DS_Store
# logging files
detailed.log
# eclipse conf file
.settings
.classpath
.project
.manager
.scala_dependencies
# idea
.idea
*.iml
# building
target
build
null
tmp*
temp*
dist
test-output
build.log
# other scm
.svn
.CVS
.hg*
# switch to regexp syntax.
# syntax: regexp
# ^\.pc/
#SHITTY output not in target directory
build.log
#emacs TAGS
TAGS
lib/
env/
This diff is collapsed.
Click to expand it.
parser/sample-parser/sample_parser.py
+
19
−
1
View file @
5e8279e8
from
builtins
import
object
import
setup_paths
from
nomadcore.simple_parser
import
SimpleMatcher
,
mainFunction
from
nomadcore.local_meta_info
import
loadJsonFile
,
InfoKindEl
import
os
,
sys
,
json
class
SampleContext
(
object
):
"""
context for the sample parser
"""
def
__init__
(
self
):
self
.
parser
=
None
def
initialize_values
(
self
):
"""
allows to reset values if the same superContext is used to parse different files
"""
pass
def
startedParsing
(
self
,
path
,
parser
):
"""
called when parsing starts
"""
self
.
parser
=
parser
# allows to reset values if the same superContext is used to parse different files
self
.
initialize_values
()
# description of the input
mainFileDescription
=
SimpleMatcher
(
name
=
'
root
'
,
weak
=
True
,
...
...
@@ -31,4 +48,5 @@ metaInfoPath = os.path.normpath(os.path.join(os.path.dirname(os.path.abspath(__f
metaInfoEnv
,
warnings
=
loadJsonFile
(
filePath
=
metaInfoPath
,
dependencyLoader
=
None
,
extraArgsHandling
=
InfoKindEl
.
ADD_EXTRA_ARGS
,
uri
=
None
)
if
__name__
==
"
__main__
"
:
mainFunction
(
mainFileDescription
,
metaInfoEnv
,
parserInfo
)
superContext
=
SampleContext
()
mainFunction
(
mainFileDescription
,
metaInfoEnv
,
parserInfo
,
superContext
=
superContext
)
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