Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make usage of raw bookmarks easier #1065

Merged
merged 2 commits into from
Jun 26, 2024

Conversation

robsdedude
Copy link
Member

(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 python/typing#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.

(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 python/typing#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.
Copy link
Contributor

@StephenCathcart StephenCathcart left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚢

@robsdedude robsdedude merged commit 01d4fdc into neo4j:5.0 Jun 26, 2024
20 checks passed
@robsdedude robsdedude deleted the fix/bookmarks-from-raw-values branch June 26, 2024 07:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants