From e3ee146b122ac45c2c6564df5aa814f8c07a40a3 Mon Sep 17 00:00:00 2001 From: Gabriel Luiz Freitas Almeida Date: Thu, 22 Jun 2023 22:10:43 -0300 Subject: [PATCH] =?UTF-8?q?=F0=9F=94=A7=20refactor(documentloaders.py):=20?= =?UTF-8?q?use=20Optional=20type=20hint=20for=20name=20parameter=20in=20fo?= =?UTF-8?q?rmat=5Ffield=20method=20The=20`name`=20parameter=20in=20the=20`?= =?UTF-8?q?format=5Ffield`=20method=20of=20the=20`DocumentLoaderFrontNode`?= =?UTF-8?q?=20class=20now=20uses=20the=20`Optional`=20type=20hint=20to=20i?= =?UTF-8?q?ndicate=20that=20it=20can=20be=20None.=20This=20improves=20the?= =?UTF-8?q?=20code's=20readability=20and=20makes=20it=20easier=20to=20unde?= =?UTF-8?q?rstand=20the=20expected=20behavior=20of=20the=20method.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/backend/langflow/template/frontend_node/documentloaders.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/backend/langflow/template/frontend_node/documentloaders.py b/src/backend/langflow/template/frontend_node/documentloaders.py index 42ed0f601..8cfb9d229 100644 --- a/src/backend/langflow/template/frontend_node/documentloaders.py +++ b/src/backend/langflow/template/frontend_node/documentloaders.py @@ -1,3 +1,4 @@ +from typing import Optional from langflow.template.field.base import TemplateField from langflow.template.frontend_node.base import FrontendNode @@ -106,7 +107,7 @@ class DocumentLoaderFrontNode(FrontendNode): ) @staticmethod - def format_field(field: TemplateField, name: str | None = None) -> None: + def format_field(field: TemplateField, name: Optional[str] = None) -> None: FrontendNode.format_field(field, name) if field.name == "metadata": field.show = True