Commit 42f21688 authored by Markus Scheidgen's avatar Markus Scheidgen
Browse files

Fix lazy cli importing after parsers refactor.

parent 6b80b7e6
Pipeline #78749 passed with stages
in 25 minutes and 33 seconds
......@@ -36,6 +36,7 @@ lazy_import.lazy_module('nomad.config')
lazy_import.lazy_module('nomad.infrastructure')
lazy_import.lazy_module('nomad.utils')
lazy_import.lazy_module('nomad.parsing')
lazy_import.lazy_module('nomad.parsing.parsers')
lazy_import.lazy_module('nomad.normalizing')
lazy_import.lazy_module('nomad.datamodel')
lazy_import.lazy_module('nomad.search')
......@@ -46,5 +47,5 @@ lazy_import.lazy_module('nomad.client')
lazy_import.lazy_module('nomadcore')
lazy_import.lazy_module('nomadcore.simple_parser')
from . import dev, parse, admin, client # noqa
from . import dev, admin, parse, client # noqa
from .cli import run_cli, cli # noqa
......@@ -45,6 +45,7 @@ lazy_import.lazy_module('nomad.files')
lazy_import.lazy_module('nomad.search')
lazy_import.lazy_module('nomad.datamodel')
lazy_import.lazy_module('nomad.parsing')
lazy_import.lazy_module('nomad.parsing.parsers')
lazy_import.lazy_module('nomad.infrastructure')
lazy_import.lazy_module('nomad.doi')
lazy_import.lazy_module('nomad.client')
......
......@@ -5,7 +5,6 @@ import click
import sys
from nomad import utils, parsing, normalizing, datamodel
from nomad.parsing.parsers import parser_dict, match_parser
import nomadcore
......@@ -21,15 +20,16 @@ def parse(
Run the given parser on the downloaded calculation. If no parser is given,
do parser matching and use the respective parser.
'''
from nomad.parsing import parsers
mainfile = os.path.basename(mainfile_path)
if logger is None:
logger = utils.get_logger(__name__)
if parser_name is not None:
parser = parser_dict.get(parser_name)
parser = parsers.parser_dict.get(parser_name)
assert parser is not None, 'the given parser must exist'
else:
parser = match_parser(mainfile_path, strict=strict)
parser = parsers.match_parser(mainfile_path, strict=strict)
if isinstance(parser, parsing.MatchingParser):
parser_name = parser.name
else:
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment