这按记录工作:
with driver.session() as session:
但我的 linter 对此抛出了一个错误:
session = driver.session()
> Assigning result of a function call, where the function has no returnpylint(assignment-from-no-return)
我认为这with
只是处理关闭句柄等的语法糖。
请注意,代码本身会运行,但 linter 错误确实会分散注意力。有没有办法修复原始代码
我正在尝试让会话对象用于多个事务(或我的应用程序的生命周期)
https://neo4j.com/docs/api/python-driver/current/driver.html#neo4j.Driver.session