How to use the omas.omas_utils._extra_structures.get function in omas

To help you get started, we’ve selected a few omas examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github gafusion / omas / omas / omas_imas.py View on Github external
if kid in request_check or (isinstance(kid, int) and ':' in request_check):
                propagate_requested_paths = [p[1:] for p in requested_paths if len(p) > 1 and (kid == p[0] or p[0] == ':')]
            else:
                continue

        # recursive call
        try:
            if isinstance(kid, str):
                subtree_paths = filled_paths_in_ids(getattr(ids, kid), ds[kid], propagate_path, [],
                                                    propagate_requested_paths, assume_uniform_array_structures)
            else:
                subtree_paths = filled_paths_in_ids(ids[kid], ds[':'], propagate_path, [],
                                                    propagate_requested_paths, assume_uniform_array_structures)
        except Exception:
            # check if the issue was that we were trying to load something that was added to the _extra_structures
            if o2i(l2u(propagate_path)) in _extra_structures.get(propagate_path[0], {}):
                # printe('`%s` does not exist in the IMAS data dictionary.
                # Consider opening a JIRA issue asking for its addition: https://jira.iter.org' % l2i(path + [kid]))
                continue
            printe('Error querying IMAS database for `%s` Possible IMAS version mismatch?' % l2i(path + [kid]))
            continue
        paths += subtree_paths

        # assume_uniform_array_structures
        if assume_uniform_array_structures and keys[0] == 0:
            zero_paths = subtree_paths
            for key in range(1, len(ids)):
                subtree_paths = copy.deepcopy(zero_paths)
                for p in subtree_paths:
                    p[len(path)] = key
                paths += subtree_paths