ソースを参照

perf: Implemented short-circuit evaluation for logical conditions (#13674)

Co-authored-by: liusurong.lsr <liusurong.lsr@alibaba-inc.com>
tags/1.0.0
llinvokerl 8ヶ月前
コミット
33a565a719
コミッターのメールアドレスに関連付けられたアカウントが存在しません
1個のファイルの変更4行の追加0行の削除
  1. 4
    0
      api/core/workflow/utils/condition/processor.py

+ 4
- 0
api/core/workflow/utils/condition/processor.py ファイルの表示

expected=expected_value, expected=expected_value,
) )
group_results.append(result) group_results.append(result)
# Implemented short-circuit evaluation for logical conditions
if (operator == "and" and not result) or (operator == "or" and result):
final_result = result
return input_conditions, group_results, final_result


final_result = all(group_results) if operator == "and" else any(group_results) final_result = all(group_results) if operator == "and" else any(group_results)
return input_conditions, group_results, final_result return input_conditions, group_results, final_result

読み込み中…
キャンセル
保存