Commit c04b7556 authored by Alvin Noe Ladines's avatar Alvin Noe Ladines
Browse files

Fixed previous build failure

parent 1ad8d841
Pipeline #76029 passed with stages
in 24 minutes and 46 seconds
......@@ -1604,6 +1604,39 @@ class MSection(metaclass=MObjectMeta): # TODO find a way to make this a subclas
return {key: val for key, val in self.__dict__.items() if not key.startswith('m_')}.values()
def m_xpath(self, expression: str):
'''
Provides an interface to jmespath search functionality.
Arguments:
expression: A string compatible with the jmespath specs representing the
search. See https://jmespath.org/ for complete description.
.. code-block:: python
import jmespath
metainfo = {
"section_run": [
{
"code_name": "codeX",
"time": "2020-06-1-00:00:00",
"section_system": [
{
"atom_labels": ["H", "O"],
"atom_positions": [[0, 0, 0 ], [0, 0, 2]],
"lattice_vectors": [[0, 0, 1], [0, 1, 0], [0, 0, 1]]
}
],
"section_scc": [
{
"energy_total": 2.18122e-18
}
]
}
]
}
energy = jmespath.search('section_run[?code_name==`codeX`].section_scc[0].energy_total', meta)
'''
def to_dict(entries):
if not isinstance(entries, list):
try:
......
......@@ -20,6 +20,7 @@ aniso8601<=7
ase==3.19.0
python-keycloak
elasticsearch-dsl==6.4.0
jmespath
# [parsing]
pandas
......@@ -71,7 +72,6 @@ unidecode
python-json-logger
recommonmark
jinja2
jmespath
# [dev]
setuptools
......
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