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-octopus
Commits
ab9ce80c
Commit
ab9ce80c
authored
Mar 01, 2018
by
Ask Hjorth Larsen
Browse files
remove other unused module
parent
f1ee8be9
Changes
2
Hide whitespace changes
Inline
Side-by-side
parser/parser-octopus/util.py
deleted
100644 → 0
View file @
f1ee8be9
from
nomadcore.simple_parser
import
mainFunction
,
runParser
OCT_ENERGY_UNIT_NAME
=
'usrOctEnergyUnit'
f_num
=
r
'[-+]?(\d*\.\d+|\d+\.\d*)'
# e.g.: 0.7 1. -.1
e_num
=
r
'[-+]?\d*\.\d+[EeDd][-+]\d*'
# e.g.: -7.642e-300
i_num
=
r
'[-+\d]*'
def
numpattern
(
id
,
unit
=
None
,
pattern
=
f_num
):
if
unit
is
None
:
pat
=
r
'(?P<%(id)s>%(pattern)s)'
else
:
pat
=
r
'(?P<%(id)s__%(unit)s>%(pattern)s)'
return
pat
%
dict
(
id
=
id
,
unit
=
unit
,
pattern
=
pattern
)
def
pat
(
meta
,
regex
):
return
'(?P<%s>%s)'
%
(
meta
,
regex
)
def
word
(
meta
):
return
pat
(
meta
,
regex
=
r
'\S*'
)
def
integer
(
meta
):
return
pat
(
meta
,
regex
=
i_num
)
def
floating
(
meta
):
return
pat
(
meta
,
regex
=
'%s|%s'
%
(
f_num
,
e_num
))
def
parse_file_without_decorations
(
pew
,
meta_info_env
,
matchers
,
parser_info
,
supercontext
,
fname
):
"""Run SimpleMatcher on a file printing only sequence of json."""
# If we set outF, it only redirects some of the stuff.
# It writes "[" followed by json followed by "]", to
# different streams. By redirecting one of them we can get only
# the json. Strange but true!
class
DevNull
:
def
write
(
self
,
txt
):
pass
# This is to prevent another header (nomad_parse_events_1_0 etc.)
def
parsefile
(
parser_builder
,
uri
,
path
,
backend
,
super_context
):
with
open
(
path
)
as
fd
:
runParser
(
parser_builder
,
backend
,
super_context
,
fd
)
mainFunction
(
matchers
,
meta_info_env
,
parser_info
,
outF
=
DevNull
(),
# Eats surrounding []
parseFile
=
parsefile
,
cachingLevelForMetaName
=
{},
superBackend
=
pew
,
superContext
=
supercontext
,
mainFile
=
fname
)
src/main/scala/eu/nomad_lab/parsers/OctopusParser.scala
View file @
ab9ce80c
/*
/*
Copyright 2016-201
7
The NOMAD Developers Group
Copyright 2016-201
8
The NOMAD Developers Group
Licensed under the Apache License, Version 2.0 (the "License");
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
you may not use this file except in compliance with the License.
...
@@ -49,7 +49,6 @@ Simulation Box:
...
@@ -49,7 +49,6 @@ Simulation Box:
"parser-octopus/parser_octopus.py"
,
"parser-octopus/parser_octopus.py"
,
"parser-octopus/aseoct.py"
,
"parser-octopus/aseoct.py"
,
"parser-octopus/generate-octopus-json.py"
,
"parser-octopus/generate-octopus-json.py"
,
"parser-octopus/util.py"
,
"parser-octopus/setup_paths.py"
,
"parser-octopus/setup_paths.py"
,
"nomad_meta_info/public.nomadmetainfo.json"
,
"nomad_meta_info/public.nomadmetainfo.json"
,
"nomad_meta_info/common.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