def add_initializer(
        self, fields: list[PydanticModelField], config: ModelConfigData, is_settings: bool, is_root_model: bool
    ) -> None:
        """Adds a fields-aware `__init__` method to the class.

        The added `__init__` will be annotated with types vs. all `Any` depending on the plugin settings.
        """
        if '__init__' in self._cls.info.names and not self._cls.info.names['__init__'].plugin_generated:
            return  # Don't generate an __init__ if one already exists

        typed = self.plugin_config.init_typed
        model_strict = bool(config.strict)
        use_alias = not (config.validate_by_name or config.populate_by_name) and config.validate_by_alias is not False
        requires_dynamic_aliases = bool(config.has_alias_generator and not config.validate_by_name)
        args = self.get_field_arguments(
            fields,
            typed=typed,
            model_strict=model_strict,
            requires_dynamic_aliases=requires_dynamic_aliases,
            use_alias=use_alias,
            is_settings=is_settings,
            is_root_model=is_root_model,
            force_typevars_invariant=True,
        )

        if is_settings:
            base_settings_node = self._api.lookup_fully_qualified(BASESETTINGS_FULLNAME).node
            assert isinstance(base_settings_node, TypeInfo)
            if '__init__' in base_settings_node.names:
                base_settings_init_node = base_settings_node.names['__init__'].node
                assert isinstance(base_settings_init_node, FuncDef)
                if base_settings_init_node is not None and base_settings_init_node.type is not None:
                    func_type = base_settings_init_node.type
                    assert isinstance(func_type, CallableType)
                    for arg_idx, arg_name in enumerate(func_type.arg_names):
                        if arg_name is None or arg_name.startswith('__') or not arg_name.startswith('_'):
                            continue
                        analyzed_variable_type = self._api.anal_type(func_type.arg_types[arg_idx])
                        if analyzed_variable_type is not None and arg_name == '_cli_settings_source':
                            # _cli_settings_source is defined as CliSettingsSource[Any], and as such
                            # the Any causes issues with --disallow-any-explicit. As a workaround, change
                            # the Any type (as if CliSettingsSource was left unparameterized):
                            analyzed_variable_type = analyzed_variable_type.accept(
                                ChangeExplicitTypeOfAny(TypeOfAny.from_omitted_generics)
                            )
                        variable = Var(arg_name, analyzed_variable_type)
                        args.append(Argument(variable, analyzed_variable_type, None, ARG_OPT))

        if not self.should_init_forbid_extra(fields, config):
            var = Var('kwargs')
            args.append(Argument(var, AnyType(TypeOfAny.explicit), None, ARG_STAR2))

        add_method(self._api, self._cls, '__init__', args=args, return_type=NoneType())
Adds a fields-aware `__init__` method to the class.

        The added `__init__` will be annotated with types vs. all `Any` depending on the plugin settings.
        
pydantic/mypy.py