📝 (component.py): update variable name from display_name to name for consistency and clarity
📝 (component.py): improve variable naming for better readability and maintainability 📝 (__init__.py): refactor function name _import_template_field to _import_input_class for better naming clarity 📝 (__init__.py): refactor function name _import_template_field to _import_input_class for better naming clarity 📝 (__init__.py): add function _import_output_class to import Output class from langflow.template.field.base
This commit is contained in:
parent
834570df8b
commit
52323eae4a
2 changed files with 12 additions and 4 deletions
|
|
@ -71,13 +71,13 @@ class Component(CustomComponent):
|
|||
for output in self.outputs:
|
||||
# Build the output if it's connected to some other vertex
|
||||
# or if it's not connected to any vertex
|
||||
if not vertex.outgoing_edges or output.display_name in vertex.edges_source_names:
|
||||
if not vertex.outgoing_edges or output.name in vertex.edges_source_names:
|
||||
method: Callable | Awaitable = getattr(self, output.method)
|
||||
result = method()
|
||||
# If the method is asynchronous, we need to await it
|
||||
if inspect.iscoroutinefunction(method):
|
||||
result = await result
|
||||
_results[output.display_name] = result
|
||||
_results[output.name] = result
|
||||
self._results = _results
|
||||
return _results
|
||||
|
||||
|
|
|
|||
|
|
@ -29,18 +29,26 @@ from .constants import (
|
|||
from .range_spec import RangeSpec
|
||||
|
||||
|
||||
def _import_template_field():
|
||||
def _import_input_class():
|
||||
from langflow.template.field.base import Input
|
||||
|
||||
return Input
|
||||
|
||||
|
||||
def _import_output_class():
|
||||
from langflow.template.field.base import Output
|
||||
|
||||
return Output
|
||||
|
||||
|
||||
def __getattr__(name: str) -> Any:
|
||||
# This is to avoid circular imports
|
||||
if name == "Input":
|
||||
return _import_template_field()
|
||||
return _import_input_class()
|
||||
elif name == "RangeSpec":
|
||||
return RangeSpec
|
||||
elif name == "Output":
|
||||
return _import_output_class()
|
||||
# The other names should work as if they were imported from constants
|
||||
# Import the constants module langflow.field_typing.constants
|
||||
from . import constants
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue