我正在尝试让我的登录api在azure函数中运行,但是它一直在说import numpy as np
from scipy import integrate, LowLevelCallable
from numba import cfunc, carray, jit
from numba.types import intc, CPointer, float64
def jit_integrand_function(integrand_function):
jitted_function = jit(integrand_function, nopython=True)
@cfunc(float64(intc, CPointer(float64)))
def wrapped(n, xx):
ar = carray(xx, n)
return jitted_function(ar[0], ar[1], ar[2:])
return LowLevelCallable(wrapped.ctypes)
@jit_integrand_function
def circular(x, y, a):
if x**2 + y**2 < a[-1]**2 / 4:
return 1
else:
return 0
ar = np.array([1, 2, 3, 4])
a = ar[-1]
result = integrate.nquad(circular, [[-a/2, a/2],[-a/2, a/2]], args=ar)
。这是一个异步函数,所以我很困惑。
此行
await is only valid in async function
抛出错误。
const user = await db.collection('users').findOne({ email: userLoggingIn.email })
答案 0 :(得分:1)
MongoClient.connect(process.env.CosmosDBConnectionString, (err, client) => {
在这一行中,以err和client作为参数的匿名回调函数是需要异步的函数
MongoClient.connect(process.env.CosmosDBConnectionString, async (err, client) => {