Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
nomad-lab
nomad-FAIR
Commits
a1c76ed1
Commit
a1c76ed1
authored
Oct 17, 2019
by
Alvin Noe Ladines
Browse files
Added xz compression
parent
5742383c
Pipeline
#62087
canceled with stages
in 1 minute and 27 seconds
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
vasp
@
7d850bd7
Compare
dc59aff1
...
7d850bd7
Subproject commit
dc59aff14e69a6818fbefeb7b1d504348438e26b
Subproject commit
7d850bd76e878b1429d6974f5daac456099f6e4f
nomad/parsing/__init__.py
View file @
a1c76ed1
...
...
@@ -75,6 +75,7 @@ from typing import Callable, IO, Union
import
magic
import
gzip
import
bz2
import
lzma
import
os.path
from
nomad
import
files
,
config
...
...
@@ -87,7 +88,8 @@ from nomad.parsing.artificial import TemplateParser, GenerateRandomParser, Chaos
_compressions
=
{
b
'
\x1f\x8b\x08
'
:
(
'gz'
,
gzip
.
open
),
b
'
\x42\x5a\x68
'
:
(
'bz2'
,
bz2
.
open
)
b
'
\x42\x5a\x68
'
:
(
'bz2'
,
bz2
.
open
),
b
'
\xfd\x37\x7a
'
:
(
'xz'
,
lzma
.
open
)
}
...
...
@@ -147,14 +149,14 @@ parsers = [
LegacyParser
(
name
=
'parsers/vasp'
,
code_name
=
'VASP'
,
parser_class_name
=
'vaspparser.VASPRunParserInterface'
,
mainfile_mime_re
=
r
'(application/
xml
)|(text/.*)'
,
mainfile_mime_re
=
r
'(application/
.*
)|(text/.*)'
,
mainfile_contents_re
=
(
r
'^\s*<\?xml version="1\.0" encoding="ISO-8859-1"\?>\s*'
r
'?\s*<modeling>'
r
'?\s*<generator>'
r
'?\s*<i name="program" type="string">\s*vasp\s*</i>'
r
'?'
),
supported_compressions
=
[
'gz'
,
'bz2'
]
supported_compressions
=
[
'gz'
,
'bz2'
,
'xz'
]
),
VaspOutcarParser
(
name
=
'parsers/vasp-outcar'
,
code_name
=
'VASP'
,
...
...
nomad/parsing/parser.py
View file @
a1c76ed1
...
...
@@ -139,7 +139,8 @@ class MatchingParser(Parser):
if
self
.
_mainfile_contents_re
is
not
None
:
try
:
# Try to open the file as a string for regex matching.
decoded_buffer
=
buffer
.
decode
(
'utf-8'
)
except
UnicodeDecodeError
:
print
(
'DECODED'
,
decoded_buffer
)
except
UnicodeDecodeError
as
e
:
return
False
# We're looking for a string match in a file that can't be converted to string.
if
self
.
_mainfile_contents_re
.
search
(
decoded_buffer
)
is
None
:
return
False
...
...
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