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 build_config["number_of_fields"]["value"] = field_value_int
return build_config return build_config
async def build_data( async def build_data(self) -> Data:
self,
number_of_fields: int = 0,
text_key: str = "text",
**kwargs,
) -> Data:
data = {} data = {}
for value_dict in kwargs.values(): for value_dict in self._attributes.values():
if isinstance(value_dict, dict): if isinstance(value_dict, dict):
# Check if the value of the value_dict is a Data # Check if the value of the value_dict is a Data
value_dict = { value_dict = {
key: value.get_text() if isinstance(value, Data) else value for key, value in value_dict.items() key: value.get_text() if isinstance(value, Data) else value for key, value in value_dict.items()
} }
data.update(value_dict) 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 self.status = return_data
return return_data return return_data