chore: enforce ruff lint and format standards across backend
This commit is contained in:
parent
a8e312a4f8
commit
a6cc585dd0
39 changed files with 459 additions and 559 deletions
|
|
@ -68,7 +68,8 @@ def builtin_node(
|
|||
return node_dict
|
||||
|
||||
|
||||
def custom_node( code: str,
|
||||
def custom_node(
|
||||
code: str,
|
||||
node_id: str,
|
||||
values: dict | None = None,
|
||||
position: tuple[int, int] = (0, 0),
|
||||
|
|
@ -109,9 +110,7 @@ def kirche_node(
|
|||
|
||||
comp_name = getattr(CustomInputForm, "name", None) or "CustomInputForm"
|
||||
inst = CustomInputForm()
|
||||
frontend_node = ComponentFrontendNode.from_inputs(
|
||||
**inst.get_template_config(inst)
|
||||
)
|
||||
frontend_node = ComponentFrontendNode.from_inputs(**inst.get_template_config(inst))
|
||||
inst._map_parameters_on_frontend_node(frontend_node)
|
||||
node = frontend_node.to_dict(keep_name=False)
|
||||
node = inst._update_template(node)
|
||||
|
|
@ -207,9 +206,7 @@ def edge(src: dict, src_output: str, dst: dict, dst_input: str) -> dict:
|
|||
# --------------------------------------------------------------------------
|
||||
# flow document
|
||||
# --------------------------------------------------------------------------
|
||||
def flow_doc(
|
||||
name: str, description: str, nodes: list[dict], edges: list[dict]
|
||||
) -> dict:
|
||||
def flow_doc(name: str, description: str, nodes: list[dict], edges: list[dict]) -> dict:
|
||||
return {
|
||||
"data": {
|
||||
"nodes": nodes,
|
||||
|
|
@ -233,7 +230,7 @@ def flow_doc(
|
|||
# --------------------------------------------------------------------------
|
||||
# custom component code
|
||||
# --------------------------------------------------------------------------
|
||||
RULE_CHECK_CODE = '''from lfx.custom import Component
|
||||
RULE_CHECK_CODE = """from lfx.custom import Component
|
||||
from lfx.io import MessageTextInput, Output
|
||||
from lfx.schema.message import Message
|
||||
import json
|
||||
|
|
@ -277,9 +274,9 @@ class RuleCheckComponent(Component):
|
|||
except (TypeError, ValueError):
|
||||
schwelle = 200000.0
|
||||
return Message(text="PRUEFUNG" if betrag > schwelle else "OK")
|
||||
'''
|
||||
"""
|
||||
|
||||
ENVELOPE_CODE = '''from lfx.custom import Component
|
||||
ENVELOPE_CODE = """from lfx.custom import Component
|
||||
from lfx.io import MessageTextInput, Output
|
||||
from lfx.schema.message import Message
|
||||
import json
|
||||
|
|
@ -336,9 +333,9 @@ class EnvelopeComponent(Component):
|
|||
def get_continuation(self) -> Message:
|
||||
value = self._env().get("continuation_flow_id")
|
||||
return Message(text=str(value) if value else "")
|
||||
'''
|
||||
"""
|
||||
|
||||
APPROVAL_CALLBACK_CODE = '''from lfx.custom import Component
|
||||
APPROVAL_CALLBACK_CODE = """from lfx.custom import Component
|
||||
from lfx.io import MessageTextInput, Output
|
||||
from lfx.schema.message import Message
|
||||
|
||||
|
|
@ -393,7 +390,7 @@ class ApprovalCallbackComponent(Component):
|
|||
except Exception as exc:
|
||||
return Message(text=f"CALLBACK_FAILED: {exc}")
|
||||
return Message(text="PENDING_HUMAN_APPROVAL")
|
||||
'''
|
||||
"""
|
||||
|
||||
|
||||
# --------------------------------------------------------------------------
|
||||
|
|
@ -456,9 +453,7 @@ def build_approval_handoff() -> dict:
|
|||
"ChatInput-entry",
|
||||
position=(0, 300),
|
||||
)
|
||||
envelope = custom_node(
|
||||
ENVELOPE_CODE, "CustomComponent-envelope", position=(400, 300)
|
||||
)
|
||||
envelope = custom_node(ENVELOPE_CODE, "CustomComponent-envelope", position=(400, 300))
|
||||
rule = custom_node(RULE_CHECK_CODE, "CustomComponent-rule", position=(800, 300))
|
||||
router = builtin_node(
|
||||
"lfx.components.flow_controls.conditional_router",
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue