(schema)
return {
        category: default_category_data(desc["type"], get_default_dict(desc["keys"]))
        for category, desc in schema.items()
    }
Return the minimal metadata that will pass the validator.
Return the minimal metadata that will pass the validator.
Return the minimal metadata that will pass the validator .
def get_default_metadata(schema):
    """Return the minimal metadata that will pass the validator."""
    def get_default_dict(keys_dict):
        " Return a dict with all default values from keys_dict "
        return {
            key: desc.get("default")
            for key, desc in keys_dict.items()
            if "default" in desc
        }

    def default_category_data(cat_type, defaults):
        " Return a valid data type for a category "
        return {
            'dict': lambda x: x,
            'dict_list': lambda x: [x] if x else [],
        }[cat_type](defaults)

    return {
        category: default_category_data(desc["type"], get_default_dict(desc["keys"]))
        for category, desc in schema.items()
    }
def get_default_metadata ( schema ) : def get_default_dict ( keys_dict ) : " Return a dict with all default values from keys_dict " return { key : desc . get ( "default" ) for key , desc in keys_dict . items ( ) if "default" in desc } def default_category_data ( cat_type , defaults ) : " Return a valid data type for a category " return { 'dict' : lambda x : x , 'dict_list' : lambda x : [ x ] if x else [ ] , } [ cat_type ] ( defaults ) return { category : default_category_data ( desc [ "type" ] , get_default_dict ( desc [ "keys" ] ) ) for category , desc in schema . items ( ) }