neo4j / neo4j-python-driver

Neo4j Bolt driver for Python
https://neo4j.com/docs/api/python-driver/current/
Other
882 stars 187 forks source link

Make usage of raw bookmarks easier #1065

Closed robsdedude closed 1 month ago

robsdedude commented 1 month ago

(Async)Neo4jBookmarkManager's initial_bookmarks parameter, as well as Bookmarks.from_raw_values values parameter accept anything of type Iterable[str]. Unfortunately, str itself implements that type and yields the characters of the string. That most certainly not what the user intended.

In an ideal world, we could tell the type checker to only accept Iterable[str] when not of type str. See also https://github.com/python/typing/issues/256.

To help users out, we now explicitly check for isinstance(input, str) and turn such inputs into an iterable with the input string as the only element.