🔧 refactor(custom_component.py): refactor get_flow method signature to use Optional type hint for flow_name and flow_id parameters for better clarity and maintainability

This commit is contained in:
Gabriel Luiz Freitas Almeida 2023-07-31 15:02:13 -03:00
commit 95bf9ba233

View file

@ -158,7 +158,9 @@ class CustomComponent(Component, extra=Extra.allow):
flows = session.query(Flow).all()
return flows
def get_flow(self, *, flow_name: str = None, flow_id: str = None) -> Flow:
def get_flow(
self, *, flow_name: Optional[str] = None, flow_id: Optional[str] = None
) -> Flow:
with session_getter() as session:
if flow_id:
flow = session.query(Flow).get(flow_id)