🔧 refactor(documentloaders.py): use Optional type hint for name parameter in format_field method

The `name` parameter in the `format_field` method of the `DocumentLoaderFrontNode` class now uses the `Optional` type hint to indicate that it can be None. This improves the code's readability and makes it easier to understand the expected behavior of the method.
This commit is contained in:
Gabriel Luiz Freitas Almeida 2023-06-22 22:10:43 -03:00
commit e3ee146b12

View file

@ -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