fix: update CreateData.py (#2975)

* Update CreateData.py

Update to generate data correctly

* [autofix.ci] apply automated fixes

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
This commit is contained in:
YAMON.IO 2024-07-27 06:25:15 +09:00 committed by GitHub
commit 3cd0161c9a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -63,21 +63,16 @@ class CreateDataComponent(Component):
build_config["number_of_fields"]["value"] = field_value_int
return build_config
async def build_data(
self,
number_of_fields: int = 0,
text_key: str = "text",
**kwargs,
) -> Data:
async def build_data(self) -> Data:
data = {}
for value_dict in kwargs.values():
for value_dict in self._attributes.values():
if isinstance(value_dict, dict):
# Check if the value of the value_dict is a Data
value_dict = {
key: value.get_text() if isinstance(value, Data) else value for key, value in value_dict.items()
}
data.update(value_dict)
return_data = Data(data=data, text_key=text_key)
return_data = Data(data=data, text_key=self.text_key)
self.status = return_data
return return_data