INNER CODE UNIT · Python
_find_meta_info
nf-core/tools · nf_core/modules/lint/__init__.py:340
def _find_meta_info(meta_yml: dict, element_name: str, is_output=False) -> dict:
"""Find the information specified in the meta.yml file to update the corrected meta.yml content
Note: element_name may contain quotes (e.g., '"*.html"', "'bpipe'") from parsing main.nf,
but meta.yml keys don't include the quotes. We normalize both for comparison
by removing paired quotes (both single and double).
"""
# Remove paired quotes (single or double) from element name for comparison
normalized_element_name = unquote(element_name)
# Convert old meta.yml output structure (list) to dict
if is_output and isinstance(meta_yml, list):
meta_yml = {k: v for d in meta_yml for k, v in d.items()}
# Helper to check if a key matches and return its metadata
def check_match(element: dict) -> dict | None:
key = list(element.keys())[0]
return element[key] if normalized_element_name == unquote(key) else None