Repository: Avaiga/taipy
File: taipy/gui/_renderers/builder.py (Python)

Code before:
                _to_camel_case(var_name),
                _get_client_var_name(hash_name),
            )
            if with_update:
                self.__set_update_var_name(hash_name)
            if with_default:
                if native_type:
                    val = self.__attributes.get(var_name)
                    if native_type and isinstance(val, str):
                        with contextlib.suppress(Exception):
                            val = float(val)
                    self.__set_default_value(var_name, val, native_type=native_type)
                else:
                    self.__set_default_value(var_name, var_type=var_type)
        else:
            if var_type == PropertyType.data and (self.__control_type != "chart" or "figure" not in self.__attributes):
                _warn(f"{self.__control_type}.{var_name} property should be bound.")
            value = self.__attributes.get(var_name)
            if value is not None:
                if native_type:
                    if isinstance(value, str):
                        with contextlib.suppress(Exception):
                            value = float(value)
                    if isinstance(value, (int, float)):
                        return self.__set_react_attribute(_to_camel_case(var_name), value)
                if isinstance(value, (datetime, date, time)):
                    return self.set_attribute(_to_camel_case(var_name), _date_to_string(value))
                else:
                    self.set_attribute(_to_camel_case(var_name), value)
        return self

    def _set_labels(self, var_name: str = "labels"):
        if value := self.__attributes.get(var_name):
            if _is_true(value):
                return self.__set_react_attribute(_to_camel_case(var_name), True)
            elif isinstance(value, (dict, _MapDict)):
                return self.set_dict_attribute(var_name)
        return self

    def _set_partial(self):
        if self.__control_type not in _Builder.__BLOCK_CONTROLS:
            return self
        if partial := self.__attributes.get("partial"):
            if self.__attributes.get("page"):
                _warn(f"{self.__element_name} control: page and partial should not be both defined.")
            if isinstance(partial, Partial):
                self.__attributes["page"] = partial._route
                self.__set_react_attribute("partial", partial._route)
                self.__set_react_attribute("defaultPartial", True)
        return self


Review comment (suggestion):
I would have wriitten this:
```suggestion
                if isinstance(value, (datetime, date, time)):
                    value = _date_to_string(value)
                self.set_attribute(_to_camel_case(var_name), value)
```
That to me is more readable.

Code after:
                _to_camel_case(var_name),
                _get_client_var_name(hash_name),
            )
            if with_update:
                self.__set_update_var_name(hash_name)
            if with_default:
                if native_type:
                    val = self.__attributes.get(var_name)
                    if native_type and isinstance(val, str):
                        with contextlib.suppress(Exception):
                            val = float(val)
                    self.__set_default_value(var_name, val, native_type=native_type)
                else:
                    self.__set_default_value(var_name, var_type=var_type)
        else:
            if var_type == PropertyType.data and (self.__control_type != "chart" or "figure" not in self.__attributes):
                _warn(f"{self.__control_type}.{var_name} property should be bound.")
            value = self.__attributes.get(var_name)
            if value is not None:
                if native_type:
                    if isinstance(value, str):
                        with contextlib.suppress(Exception):
                            value = float(value)
                    if isinstance(value, (int, float)):
                        return self.__set_react_attribute(_to_camel_case(var_name), value)
                if isinstance(value, (datetime, date, time)):
                    value = _date_to_string(value)
                self.set_attribute(_to_camel_case(var_name), value)
        return self

    def _set_labels(self, var_name: str = "labels"):
        if value := self.__attributes.get(var_name):
            if _is_true(value):
                return self.__set_react_attribute(_to_camel_case(var_name), True)
            elif isinstance(value, (dict, _MapDict)):
                return self.set_dict_attribute(var_name)
        return self

    def _set_partial(self):
        if self.__control_type not in _Builder.__BLOCK_CONTROLS:
            return self
        if partial := self.__attributes.get("partial"):
            if self.__attributes.get("page"):
                _warn(f"{self.__element_name} control: page and partial should not be both defined.")
            if isinstance(partial, Partial):
                self.__attributes["page"] = partial._route
                self.__set_react_attribute("partial", partial._route)
                self.__set_react_attribute("defaultPartial", True)
        return self

    def _set_propagate(self):