🐛 fix(custom.py): remove unused imports and unused code block to improve code cleanliness and performance
✨ feat(custom.py): add NotImplementedError to the build method to indicate that it needs to be implemented in subclasses 🚧 chore(test_custom_component.py): add test cases for various methods in the CustomComponent class to improve test coverage and ensure code correctness
This commit is contained in:
parent
352cb8bc85
commit
6122521783
2 changed files with 183 additions and 5 deletions
|
|
@ -1,4 +1,5 @@
|
|||
import ast
|
||||
import contextlib
|
||||
import traceback
|
||||
from typing import Callable, Optional
|
||||
from fastapi import HTTPException
|
||||
|
|
@ -89,12 +90,9 @@ class CustomComponent(BaseModel):
|
|||
else:
|
||||
split_item.append(None)
|
||||
for i in range(len(split_item)):
|
||||
try:
|
||||
with contextlib.suppress(ValueError):
|
||||
# Try to evaluate the item
|
||||
split_item[i] = ast.literal_eval(split_item[i])
|
||||
except ValueError:
|
||||
# If it fails, just pass
|
||||
pass
|
||||
|
||||
output_list.append(split_item)
|
||||
|
||||
|
|
@ -198,7 +196,7 @@ class CustomComponent(BaseModel):
|
|||
return validate.create_function(self.code, self.function_entrypoint_name)
|
||||
|
||||
def build(self):
|
||||
pass
|
||||
raise NotImplementedError
|
||||
|
||||
@property
|
||||
def data(self):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue