🐛 fix(custom_component.py): fix condition to check if Optional type hint is used but not imported in the code
This commit is contained in:
parent
564634d36c
commit
df77ba81f7
1 changed files with 3 additions and 1 deletions
|
|
@ -49,7 +49,9 @@ class CustomComponent(Component, extra=Extra.allow):
|
|||
reader = DirectoryReader("", False)
|
||||
|
||||
for type_hint in TYPE_HINT_LIST:
|
||||
if reader.is_type_hint_used_but_not_imported(type_hint, code):
|
||||
if reader._is_type_hint_used_in_args(
|
||||
"Optional", code
|
||||
) and not reader._is_type_hint_imported("Optional", code):
|
||||
error_detail = {
|
||||
"error": "Type hint Error",
|
||||
"traceback": f"Type hint '{type_hint}' is used but not imported in the code.",
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue