From df77ba81f7aac282c91f1acda65c69988884a451 Mon Sep 17 00:00:00 2001 From: Gabriel Luiz Freitas Almeida Date: Thu, 10 Aug 2023 09:24:10 -0300 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20fix(custom=5Fcomponent.py):=20fi?= =?UTF-8?q?x=20condition=20to=20check=20if=20Optional=20type=20hint=20is?= =?UTF-8?q?=20used=20but=20not=20imported=20in=20the=20code?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/backend/langflow/interface/custom/custom_component.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/backend/langflow/interface/custom/custom_component.py b/src/backend/langflow/interface/custom/custom_component.py index c1de48a98..74d06215f 100644 --- a/src/backend/langflow/interface/custom/custom_component.py +++ b/src/backend/langflow/interface/custom/custom_component.py @@ -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.",