(self, section: dict, errors: List[str])
return new_section
Builds a new, unified, section by merging multiple
        :param section: The section to unify
        :param errors: The list where to add errors
Builds a new, unified, section by merging multiple
        :param section: The section to unify
        :param errors: The list where to add errors
Builds a new unified section by merging multiple : param section : The section to unify : param errors : The list where to add errors
def _merge_instances(self, section: dict, errors: List[str]) -> dict:
        """Builds a new, unified, section by merging multiple
        :param section: The section to unify
        :param errors: The list where to add errors
        """
        new_section = {
            'name': section['name'],
            'options': [],
        }
        # If one of these option is different for 2 options with the same name, an error is raised
        required_consistent_options = ['required', 'deprecation', 'metadata_tags']
        # Cache the option index to ease option checking before merging
        options_name_idx = {}

        for instance in section['options']:
            for opt in instance['options']:
                if options_name_idx.get(opt['name']) is not None:
                    cached_opt = new_section['options'][options_name_idx[opt['name']]]

                    for opt_name in required_consistent_options:
                        if cached_opt[opt_name] != opt[opt_name]:
                            errors.append(
                                f'Options {cached_opt} and {opt} have a different value for attribute `{opt_name}`'
                            )
                    if cached_opt['value']['type'] != opt['value']['type']:
                        errors.append(f'Options {cached_opt} and {opt} have a different value for attribute `type`')

                else:
                    new_section['options'].append(opt)
                    options_name_idx[opt['name']] = len(new_section['options']) - 1

        return new_section
def _merge_instances ( self , section : dict , errors : List [ str ] ) -> dict : new_section = { 'name' : section [ 'name' ] , 'options' : [ ] , } # If one of these option is different for 2 options with the same name, an error is raised required_consistent_options = [ 'required' , 'deprecation' , 'metadata_tags' ] # Cache the option index to ease option checking before merging options_name_idx = { } for instance in section [ 'options' ] : for opt in instance [ 'options' ] : if options_name_idx . get ( opt [ 'name' ] ) is not None : cached_opt = new_section [ 'options' ] [ options_name_idx [ opt [ 'name' ] ] ] for opt_name in required_consistent_options : if cached_opt [ opt_name ] != opt [ opt_name ] : errors . append ( f'Options {cached_opt} and {opt} have a different value for attribute `{opt_name}`' ) if cached_opt [ 'value' ] [ 'type' ] != opt [ 'value' ] [ 'type' ] : errors . append ( f'Options {cached_opt} and {opt} have a different value for attribute `type`' ) else : new_section [ 'options' ] . append ( opt ) options_name_idx [ opt [ 'name' ] ] = len ( new_section [ 'options' ] ) - 1 return new_section