(data_value, ref_dict, section, key)
return True
Validates a key/value pair entry in a chunk.

    Parameters
    ----------
    data_value
        Valid or invaid entry in metadata for validation.
    ref_dict: dict
        A dictionary containing reference information.
    section: str
        The section in which this key/value pair is stored ("global", etc.).
        This is for better error reporting only.
    key: str
        The key of this key/value pair ("core:Version", etc.). This is for better error reporting only.

    Returns
    -------
    True or ValidationResult
Validates a key/value pair entry in a chunk.
Validates a key / value pair entry in a chunk .
def validate_key(data_value, ref_dict, section, key):
    '''
    Validates a key/value pair entry in a chunk.

    Parameters
    ----------
    data_value
        Valid or invaid entry in metadata for validation.
    ref_dict: dict
        A dictionary containing reference information.
    section: str
        The section in which this key/value pair is stored ("global", etc.).
        This is for better error reporting only.
    key: str
        The key of this key/value pair ("core:Version", etc.). This is for better error reporting only.

    Returns
    -------
    True or ValidationResult
    '''
    if ref_dict.get('required') and data_value is None:
        return ValidationResult(
            False,
            f'In Section `{section}`, an entry is missing required key `{key}`'
            )
    if 'type' in ref_dict and not match_type(data_value, ref_dict["type"]):
        return ValidationResult(
            False,
            f'In Section `{section}`, entry `{key}={data_value}` is not of type `{ref_dict["type"]}`'
            )
    # if "py_re" in ref_dict and not re.match(ref_dict["py_re"], data_value):
        # return ValidationResult(False, "regex fail")
    return True
def validate_key ( data_value , ref_dict , section , key ) : if ref_dict . get ( 'required' ) and data_value is None : return ValidationResult ( False , f'In Section `{section}`, an entry is missing required key `{key}`' ) if 'type' in ref_dict and not match_type ( data_value , ref_dict [ "type" ] ) : return ValidationResult ( False , f'In Section `{section}`, entry `{key}={data_value}` is not of type `{ref_dict["type"]}`' ) # if "py_re" in ref_dict and not re.match(ref_dict["py_re"], data_value): # return ValidationResult(False, "regex fail") return True