Skip to content

Commit

Permalink
Avoid parsing all files with NexusParser
Browse files Browse the repository at this point in the history
  • Loading branch information
domna committed Jul 8, 2024
1 parent 2a96e99 commit 48c94df
Showing 1 changed file with 3 additions and 16 deletions.
19 changes: 3 additions & 16 deletions src/pynxtools/nomad/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -473,12 +473,9 @@ def parse(
self._logger = logger if logger else get_logger(__name__)
self._clear_class_refs()

if mainfile.endswith("nxs"):
*_, self.nxs_fname = mainfile.rsplit("/", 1)
nexus_helper = HandleNexus(logger, mainfile)
nexus_helper.process_nexus_master_file(self.__nexus_populate)
else:
raise ValueError("No Nexus file is found to populate the nexus definition.")
*_, self.nxs_fname = mainfile.rsplit("/", 1)
nexus_helper = HandleNexus(logger, mainfile)
nexus_helper.process_nexus_master_file(self.__nexus_populate)

# TODO: domain experiment could also be registered
if archive.metadata is None:
Expand All @@ -503,13 +500,3 @@ def parse(

chemical_formulas = self._get_chemical_formulas()
self.normalize_chemical_formula(chemical_formulas)

def is_mainfile(
self,
filename: str,
mime: str,
buffer: bytes,
decoded_buffer: str,
compression: str = None,
):
return True

0 comments on commit 48c94df

Please sign in to comment.