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
nomad-lab
normalizer-prototypes
Commits
4145ff7d
Commit
4145ff7d
authored
Jul 11, 2017
by
Daria M. Tomecka
Browse files
fixing scala wrapper
parent
38c49f7b
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/main/scala/eu/nomad_lab/normalizers/PrototypeNormalizer.scala
View file @
4145ff7d
...
...
@@ -7,17 +7,24 @@ import scala.collection.breakOut
import
eu.nomad_lab.normalize.ExternalNormalizerGenerator
import
eu.nomad_lab.meta
import
eu.nomad_lab.query
import
eu.nomad_lab.resolve._
import
eu.nomad_lab.h5.EmitJsonVisitor
import
eu.nomad_lab.h5.H5EagerScanner
import
eu.nomad_lab.h5.SectionH5
import
eu.nomad_lab.parsers.ExternalParserWrapper
import
eu.nomad_lab.JsonUtils
import
scala.collection.mutable.StringBuilder
object
PrototypeNormalizer
extends
ExternalNormalizerGenerator
(
name
=
"PrototypeNormalizer"
,
object
Prototype
s
Normalizer
extends
ExternalNormalizerGenerator
(
name
=
"Prototype
s
Normalizer"
,
info
=
jn
.
JObject
(
(
"name"
->
jn
.
JString
(
"PrototypeNormalizer"
))
::
(
"normalizerId"
->
jn
.
JString
(
"PrototypeNormalizer"
+
lab
.
PrototypeVersionInfo
.
version
))
::
(
"name"
->
jn
.
JString
(
"Prototype
s
Normalizer"
))
::
(
"normalizerId"
->
jn
.
JString
(
"Prototype
s
Normalizer"
+
lab
.
Prototype
s
VersionInfo
.
version
))
::
(
"versionInfo"
->
jn
.
JObject
(
(
"nomadCoreVersion"
->
jn
.
JObject
(
lab
.
NomadCoreVersionInfo
.
toMap
.
map
{
case
(
k
,
v
)
=>
k
->
jn
.
JString
(
v
.
toString
)
}(
breakOut
)
:
List
[(
String
,
jn.JString
)]))
::
(
lab
.
PrototypeVersionInfo
.
toMap
.
map
{
(
lab
.
Prototype
s
VersionInfo
.
toMap
.
map
{
case
(
key
,
value
)
=>
(
key
->
jn
.
JString
(
value
.
toString
))
}(
breakOut
)
:
List
[(
String
,
jn.JString
)])
...
...
@@ -42,7 +49,7 @@ object PrototypeNormalizer extends ExternalNormalizerGenerator(
)
++
DefaultPythonInterpreter
.
commonDirMapping
(),
metaInfoEnv
=
lab
.
meta
.
KnownMetaInfoEnvs
.
all
)
{
val
trace
:
Boolean
=
fals
e
val
trace
:
Boolean
=
tru
e
override
def
stdInHandler
(
context
:
ResolvedRef
)(
wrapper
:
ExternalParserWrapper
)(
pIn
:
java.io.OutputStream
)
:
Unit
=
{
val
out
:
java.io.Writer
=
if
(
trace
)
...
...
@@ -66,9 +73,9 @@ object PrototypeNormalizer extends ExternalNormalizerGenerator(
try
{
context
match
{
case
Calculation
(
archiveSet
,
c
)
=>
val
sysTable
=
c
.
sectionTable
(
Seq
(
"section_run"
,
"section_system"
))
def
outputSysSection
(
sysSection
:
SectionH5
)
:
Unit
=
{
val
sysTable
=
c
.
sectionTable
(
Seq
(
"section_run"
,
"section_system"
))
def
outputSysSection
(
sysSection
:
SectionH5
)
:
Unit
=
{
if
(!
isFirst
)
writeOut
(
","
)
else
...
...
@@ -83,14 +90,13 @@ object PrototypeNormalizer extends ExternalNormalizerGenerator(
scanner
.
scanResolvedRef
(
Section
(
archiveSet
,
sysSection
),
visitor
)
//writeOut("}")
flush
()
}
}
val
nSys
=
sysTable
.
lengthL
if
(
nSys
>
0
)
outputSysSection
(
sysTable
(
0
))
if
(
nSys
>
1
)
outputSysSection
(
sysTable
(
nSys
-
1
))
val
nSys
=
sysTable
.
lengthL
if
(
nSys
>
0
)
outputSysSection
(
sysTable
(
0
))
if
(
nSys
>
1
)
outputSysSection
(
sysTable
(
nSys
-
1
))
writeOut
(
"]"
)
flush
()
...
...
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