0

This works as documented:

  with driver.session() as session:

but my linter throws an error on this:

  session = driver.session()

  > Assigning result of a function call, where the function has no returnpylint(assignment-from-no-return)

enter image description here

I thought that with was just a syntax sugar to handle closing handles etc.

Note that the code itself will run but the linter errors are really distracting. Is there a way to fix the original codes such that

I'm trying to get a session object to use for multiple transactions (or the lifetime of my app)

https://neo4j.com/docs/api/python-driver/current/driver.html#neo4j.Driver.session

source is here https://github.com/neo4j/neo4j-python-driver

dcsan
  • 11,333
  • 15
  • 77
  • 118
  • 1
    Have you actually checked if the linter is correct, here? I think it's just probably wrong. – juanpa.arrivillaga Jan 02 '20 at 07:23
  • the code works, so I assume the linter is wrong, but not sure how to dig deeper. I did get a hint about how to turn off linting for one line: `# noinspection INSPECTION_NAME` – dcsan Jan 02 '20 at 14:49
  • the JS version looks exactly like my desired python code https://neo4j.com/docs/driver-manual/1.7/sessions-transactions/ – dcsan Jan 02 '20 at 14:50

0 Answers0