Browse Source

Add async Eval method to PyRunner

pull/5/head
Ionite 2 years ago
parent
commit
b338ad82a5
No known key found for this signature in database
  1. 13
      StabilityMatrix/PyRunner.cs

13
StabilityMatrix/PyRunner.cs

@ -47,4 +47,17 @@ internal static class PyRunner
} }
}); });
} }
// Evaluate Python code
public static async Task<string> Eval(string code)
{
using (Py.GIL())
{
return await Task.Run(() =>
{
dynamic result = PythonEngine.Eval(code);
return result.ToString();
});
}
}
} }
Loading…
Cancel
Save