Repository: Avaiga/taipy
File: taipy/common/config/_serializer/_base_serializer.py (Python)

Code before:
        config = _Config()
        config._global_config = GlobalAppConfig._from_dict(as_dict.get(cls._GLOBAL_NODE_NAME, {}))
        for section_name, sect_as_dict in as_dict.items():
            if section_class := cls._section_class.get(section_name, None):
                if issubclass(section_class, UniqueSection):
                    config._unique_sections[section_name] = section_class._from_dict(  # type: ignore
                        sect_as_dict, None, None
                    )
                elif issubclass(section_class, Section):
                    config._sections[section_name] = cls.__extract_node(as_dict, section_class, section_name, config)
        return config

    @staticmethod
    def __extract_node(config_as_dict, cls_config, node, config: Optional[Any]) -> Dict[str, Section]:
        res = {}
        for key, value in config_as_dict.get(node, {}).items():  # my_task, {input=[], output=[my_data_node], ...}
            key = _validate_id(key)
            res[key] = cls_config._from_dict(value, key, config)
        return res

    @classmethod
    def _pythonify(cls, val):
        match = re.fullmatch(_TemplateHandler._PATTERN, str(val))
        if not match:
            if isinstance(val, str):
                TYPE_PATTERN = r"^(.+):(" + r"\b|\b".join(cls._SERIALIZABLE_TYPES) + r")?$"
                if match := re.fullmatch(TYPE_PATTERN, str(val)):
                    actual_val = match.group(1)
                    dynamic_type = match.group(2)
                    if dynamic_type == "SECTION":
                        return actual_val
                    if dynamic_type in cls._registered_types.keys():
                        return cls._registered_types[dynamic_type]._pythonify(actual_val)
                    if dynamic_type == "bool":
                        return _TemplateHandler._to_bool(actual_val)
                    elif dynamic_type == "int":
                        return _TemplateHandler._to_int(actual_val)
                    elif dynamic_type == "float":
                        return _TemplateHandler._to_float(actual_val)
                    elif dynamic_type == "datetime":
                        return _TemplateHandler._to_datetime(actual_val)
                    elif dynamic_type == "timedelta":
                        return _TemplateHandler._to_timedelta(actual_val)
                    elif dynamic_type == "function":
                        return _TemplateHandler._to_function(actual_val)
                    elif dynamic_type == "class":
                        return _TemplateHandler._to_class(actual_val)
                    elif dynamic_type == "str":
                        return actual_val
                    else:
                        error_msg = f"Error loading toml configuration at {val}. {dynamic_type} type is not supported."

Review comment (suggestion):
It does not look like it generates the same string:
What about:

```suggestion
                TYPE_PATTERN = r"^(.+):(\b" + r"\b|\b".join(cls._SERIALIZABLE_TYPES) + r"\b)?$"
```

Code after:
    def _from_dict(cls, as_dict) -> _Config:
        config = _Config()
        config._global_config = GlobalAppConfig._from_dict(as_dict.get(cls._GLOBAL_NODE_NAME, {}))
        for section_name, sect_as_dict in as_dict.items():
            if section_class := cls._section_class.get(section_name, None):
                if issubclass(section_class, UniqueSection):
                    config._unique_sections[section_name] = section_class._from_dict(  # type: ignore
                        sect_as_dict, None, None
                    )
                elif issubclass(section_class, Section):
                    config._sections[section_name] = cls.__extract_node(as_dict, section_class, section_name, config)
        return config

    @staticmethod
    def __extract_node(config_as_dict, cls_config, node, config: Optional[Any]) -> Dict[str, Section]:
        res = {}
        for key, value in config_as_dict.get(node, {}).items():  # my_task, {input=[], output=[my_data_node], ...}
            key = _validate_id(key)
            res[key] = cls_config._from_dict(value, key, config)
        return res

    @classmethod
    def _pythonify(cls, val):
        match = re.fullmatch(_TemplateHandler._PATTERN, str(val))
        if not match:
            if isinstance(val, str):
                TYPE_PATTERN = r"^(.+):(\b" + r"\b|\b".join(cls._SERIALIZABLE_TYPES) + r"\b)?$"
                if match := re.fullmatch(TYPE_PATTERN, str(val)):
                    actual_val = match.group(1)
                    dynamic_type = match.group(2)
                    if dynamic_type == "SECTION":
                        return actual_val
                    if dynamic_type in cls._registered_types.keys():
                        return cls._registered_types[dynamic_type]._pythonify(actual_val)
                    if dynamic_type == "bool":
                        return _TemplateHandler._to_bool(actual_val)
                    elif dynamic_type == "int":
                        return _TemplateHandler._to_int(actual_val)
                    elif dynamic_type == "float":
                        return _TemplateHandler._to_float(actual_val)
                    elif dynamic_type == "datetime":
                        return _TemplateHandler._to_datetime(actual_val)
                    elif dynamic_type == "timedelta":
                        return _TemplateHandler._to_timedelta(actual_val)
                    elif dynamic_type == "function":
                        return _TemplateHandler._to_function(actual_val)
                    elif dynamic_type == "class":
                        return _TemplateHandler._to_class(actual_val)
                    elif dynamic_type == "str":
                        return actual_val
                    else: