Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
nomad-lab
parser-orca
Commits
b641bf93
Commit
b641bf93
authored
Jun 22, 2016
by
Mohamed, Fawzi Roberto (fawzi)
Browse files
added python sample files
parent
677a04df
Changes
3
Hide whitespace changes
Inline
Side-by-side
parser/parser-orca/orca_parser.py
0 → 100644
View file @
b641bf93
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
OrcaContext
(
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
,
startReStr
=
""
,
subMatchers
=
[
SimpleMatcher
(
name
=
'newRun'
,
startReStr
=
r
"\s*# SampleParser #\s*"
,
repeats
=
True
,
required
=
True
,
forwardMatch
=
True
,
sections
=
[
'section_run'
],
subMatchers
=
[
SimpleMatcher
(
name
=
'header'
,
startReStr
=
r
"\s*# SampleParser #\s*"
)
])
])
# loading metadata from nomad-meta-info/meta_info/nomad_meta_info/fhi_aims.nomadmetainfo.json
parserInfo
=
{
"name"
:
"sample_parser"
,
"version"
:
"1.0"
}
metaInfoPath
=
os
.
path
.
normpath
(
os
.
path
.
join
(
os
.
path
.
dirname
(
os
.
path
.
abspath
(
__file__
)),
"../../../../nomad-meta-info/meta_info/nomad_meta_info/orca.nomadmetainfo.json"
))
metaInfoEnv
,
warnings
=
loadJsonFile
(
filePath
=
metaInfoPath
,
dependencyLoader
=
None
,
extraArgsHandling
=
InfoKindEl
.
ADD_EXTRA_ARGS
,
uri
=
None
)
if
__name__
==
"__main__"
:
mainFunction
(
mainFileDescription
,
metaInfoEnv
,
parserInfo
,
superContext
=
OrcaContext
())
parser/parser-orca/setup_paths.py
0 → 100644
View file @
b641bf93
import
sys
,
os
,
os
.
path
baseDir
=
os
.
path
.
dirname
(
os
.
path
.
abspath
(
__file__
))
commonDir
=
os
.
path
.
normpath
(
os
.
path
.
join
(
baseDir
,
"../../../../python-common/common/python"
))
if
not
commonDir
in
sys
.
path
:
sys
.
path
.
insert
(
0
,
commonDir
)
src/main/scala/eu/nomad_lab/parsers/OrcaParser.scala
View file @
b641bf93
...
...
@@ -26,7 +26,7 @@ object OrcaParser extends SimpleExternalParserGenerator(
cmd
=
Seq
(
DefaultPythonInterpreter
.
python2Exe
(),
"${envDir}/parsers/orca/parser/parser-orca/OrcaParser.py"
,
"--uri"
,
"${mainFileUri}"
,
"${mainFilePath}"
),
resList
=
Seq
(
"parser-orca/
O
rca
P
arser.py"
,
"parser-orca/
o
rca
_p
arser.py"
,
"parser-orca/setup_paths.py"
,
"nomad_meta_info/public.nomadmetainfo.json"
,
"nomad_meta_info/common.nomadmetainfo.json"
,
...
...
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