From 98eca092707ed71dfcdd01f5057b7abc915a36ec Mon Sep 17 00:00:00 2001 From: Gabriel Luiz Freitas Almeida Date: Fri, 28 Jul 2023 11:22:40 -0300 Subject: [PATCH] =?UTF-8?q?=F0=9F=94=A7=20fix(custom=5Fcomponent.py):=20ad?= =?UTF-8?q?d=20type=20hints=20to=20improve=20code=20readability=20and=20ma?= =?UTF-8?q?intainability=20=F0=9F=94=A7=20fix(custom=5Fcomponent.py):=20ad?= =?UTF-8?q?d=20return=20type=20hint=20to=20'load=5Fflow'=20method=20for=20?= =?UTF-8?q?better=20code=20documentation=20=F0=9F=94=A7=20fix(custom=5Fcom?= =?UTF-8?q?ponent.py):=20add=20return=20type=20hint=20to=20'list=5Fflows'?= =?UTF-8?q?=20method=20for=20better=20code=20documentation?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/backend/langflow/interface/custom/custom_component.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/backend/langflow/interface/custom/custom_component.py b/src/backend/langflow/interface/custom/custom_component.py index d5f366d97..d71aa729c 100644 --- a/src/backend/langflow/interface/custom/custom_component.py +++ b/src/backend/langflow/interface/custom/custom_component.py @@ -1,4 +1,4 @@ -from typing import Callable, Optional +from typing import Any, Callable, List, Optional from fastapi import HTTPException from langflow.interface.custom.constants import CUSTOM_COMPONENT_SUPPORTED_TYPES from langflow.interface.custom.component import Component @@ -141,7 +141,7 @@ class CustomComponent(Component, extra=Extra.allow): def get_function(self): return validate.create_function(self.code, self.function_entrypoint_name) - def load_flow(self, flow_id: str, tweaks: Optional[dict] = None): + def load_flow(self, flow_id: str, tweaks: Optional[dict] = None) -> Any: from langflow.processing.process import build_sorted_vertices_with_caching from langflow.processing.process import process_tweaks @@ -153,7 +153,7 @@ class CustomComponent(Component, extra=Extra.allow): graph_data = process_tweaks(graph_data=graph_data, tweaks=tweaks) return build_sorted_vertices_with_caching(graph_data) - def list_flows(self): + def list_flows(self) -> List[Flow]: with session_getter() as session: flows = session.query(Flow).all() return flows