def parse_load_fk(cls, data: Dict[str, List[Dict[str, object]]]) -> Dict[str, List[Dict[str, object]]]:
        """
        :param data:{
            <column>: role,
            <column2>: role,
            <column>: {
                'role': role,
                'loadfk': { ... },
            },
        :return: {
            <column>: {
                'role': role,
            },
            ...
            <column3>: {
                'role': role,
                'loadfk': { ... },
            },
        }
        """
        default_value_dict = {'role': None, 'as': None, 'table': None, 'loadfk': None}

        def value_normalize_dict(value):
            def check(k, v):
                if k == 'role': return isinstance(v, str)
                if k == 'as': return isinstance(v, str)
                if k == 'table': return isinstance(v, str)
                if k == 'loadfk': return isinstance(v, dict)

            valid = {k: v for k, v in value.items() if check(k, v)}
            if not valid: return default_value_dict.copy()
            if 'loadfk' in valid and valid['loadfk']:
                valid['loadfk'] = cls.parse_load_fk(valid['loadfk'])
            for k, v in default_value_dict.items():
                valid.setdefault(k, v)
            return valid

        def value_normalize(value, no_list=True):
            if value is None:
                return default_value_dict.copy()
            elif not no_list and isinstance(value, List):
                # <column>: [value1, value2, ...]
                return list(map(value_normalize, value))
            elif isinstance(value, str):
                # <column>: role
                val = default_value_dict.copy()
                val['role'] = value
                return val
            elif isinstance(value, Dict):
                # {'role': <str>, 'as': <str>, ...}
                return value_normalize_dict(value)
            else:
                raise InvalidParams('Invalid syntax for "loadfk": %s' % value)

        # 对全部项进行检查
        new_data = {}
        if not isinstance(data, dict):
            raise InvalidParams('Invalid syntax for "loadfk": %s' % data)
        for k, v in data.items():
            nv = value_normalize(v, False)
            new_data[k] = nv if isinstance(nv, List) else [nv]
        return new_data
def parse_load_fk(cls, data: Dict[str, List[Dict[str, object]]]) -> Dict[str, List[Dict[str, object]]]:
        """
        :param data:{
            <column>: role,
            <column2>: role,
            <column>: {
                'role': role,
                'loadfk': { ... },
            },
        :return: {
            <column>: {
                'role': role,
            },
            ...
            <column3>: {
                'role': role,
                'loadfk': { ... },
            },
        }
        """
        default_value_dict = {'role': None, 'as': None, 'table': None, 'loadfk': None}

        def value_normalize_dict(value):
            def check(k, v):
                if k == 'role': return isinstance(v, str)
                if k == 'as': return isinstance(v, str)
                if k == 'table': return isinstance(v, str)
                if k == 'loadfk': return isinstance(v, dict)

            valid = {k: v for k, v in value.items() if check(k, v)}
            if not valid: return default_value_dict.copy()
            if 'loadfk' in valid and valid['loadfk']:
                valid['loadfk'] = cls.parse_load_fk(valid['loadfk'])
            for k, v in default_value_dict.items():
                valid.setdefault(k, v)
            return valid

        def value_normalize(value, no_list=True):
            if value is None:
                return default_value_dict.copy()
            elif not no_list and isinstance(value, List):
                # <column>: [value1, value2, ...]
                return list(map(value_normalize, value))
            elif isinstance(value, str):
                # <column>: role
                val = default_value_dict.copy()
                val['role'] = value
                return val
            elif isinstance(value, Dict):
                # {'role': <str>, 'as': <str>, ...}
                return value_normalize_dict(value)
            else:
                raise InvalidParams('Invalid syntax for "loadfk": %s' % value)

        # 对全部项进行检查
        new_data = {}
        if not isinstance(data, dict):
            raise InvalidParams('Invalid syntax for "loadfk": %s' % data)
        for k, v in data.items():
            nv = value_normalize(v, False)
            new_data[k] = nv if isinstance(nv, List) else [nv]
        return new_data
def parse_load_fk ( cls , data : Dict [ str , List [ Dict [ str , object ] ] ] ) -> Dict [ str , List [ Dict [ str , object ] ] ] : default_value_dict = { 'role' : None , 'as' : None , 'table' : None , 'loadfk' : None } def value_normalize_dict ( value ) : def check ( k , v ) : if k == 'role' : return isinstance ( v , str ) if k == 'as' : return isinstance ( v , str ) if k == 'table' : return isinstance ( v , str ) if k == 'loadfk' : return isinstance ( v , dict ) valid = { k : v for k , v in value . items ( ) if check ( k , v ) } if not valid : return default_value_dict . copy ( ) if 'loadfk' in valid and valid [ 'loadfk' ] : valid [ 'loadfk' ] = cls . parse_load_fk ( valid [ 'loadfk' ] ) for k , v in default_value_dict . items ( ) : valid . setdefault ( k , v ) return valid def value_normalize ( value , no_list = True ) : if value is None : return default_value_dict . copy ( ) elif not no_list and isinstance ( value , List ) : # <column>: [value1, value2, ...] return list ( map ( value_normalize , value ) ) elif isinstance ( value , str ) : # <column>: role val = default_value_dict . copy ( ) val [ 'role' ] = value return val elif isinstance ( value , Dict ) : # {'role': <str>, 'as': <str>, ...} return value_normalize_dict ( value ) else : raise InvalidParams ( 'Invalid syntax for "loadfk": %s' % value ) # 对全部项进行检查 new_data = { } if not isinstance ( data , dict ) : raise InvalidParams ( 'Invalid syntax for "loadfk": %s' % data ) for k , v in data . items ( ) : nv = value_normalize ( v , False ) new_data [ k ] = nv if isinstance ( nv , List ) else [ nv ] return new_data
:param data:{
            <column>: role,
            <column2>: role,
            <column>: {
                'role': role,
                'loadfk': { ... },
            },
        :return: {
            <column>: {
                'role': role,
            },
            ...
            <column3>: {
                'role': role,
                'loadfk': { ... },
            },
        }
: param data : { <column > : role <column2 > : role <column > : { role : role loadfk : { ... } } : return : { <column > : { role : role } ... <column3 > : { role : role loadfk : { ... } } }