-
Notifications
You must be signed in to change notification settings - Fork 803
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
Allow tuples and other iterables in source() method #1895
Conversation
elasticsearch_dsl/search_base.py
Outdated
elif not isinstance(fields, (str, InstrumentedField)): | ||
return [str(f) for f in fields] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Have you considered a more explicit check, like explicitly allowing lists and tuples or looking for for collections.abc.Iterable
? If not, maybe this warrants a comment?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll add a comment for now. Basically the way I'm thinking about this is that in this case the typing change broke how the library works at runtime. My goal was to address the runtime problem. As I mentioned back when we did the typing changes, I think we could replace specific types such as List and Dict with more generic ones in a lot of places, but when I look at that I'll do it for the whole library.
* Allow tuples and other iterables in source() method Fixes elastic#1893 * review feedback
Fixes #1893