using System.Text;
using Elsa.Expressions.Helpers;
using Elsa.Expressions.Models;
using Elsa.Mediator.Contracts;
using Elsa.Expressions.Python.Contracts;
using Elsa.Expressions.Python.Models;
using Elsa.Expressions.Python.Notifications;
using Elsa.Expressions.Python.Options;
using Microsoft.Extensions.Options;
using Python.Runtime;
namespace Elsa.Expressions.Python.Services;
///
/// Evaluates Python expressions using IronPython.
///
public class PythonNetPythonEvaluator : IPythonEvaluator
{
private const string ReturnVarName = "elsa_python_result_variable_name";
private readonly INotificationSender _notificationSender;
private readonly IOptions _options;
///
/// Initializes a new instance of the class.
///
public PythonNetPythonEvaluator(INotificationSender notificationSender) : this(notificationSender, Microsoft.Extensions.Options.Options.Create(new PythonOptions()))
{
}
///
/// Initializes a new instance of the class.
///
public PythonNetPythonEvaluator(INotificationSender notificationSender, IOptions options)
{
_notificationSender = notificationSender;
_options = options;
}
///
public async Task