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
Dataframe column names autocompletion #223
Conversation
Since this is a community submitted pull request, a Jenkins build has not been kicked off automatically. Can an Elastic organization member please verify the contents of this patch and then kick off a build manually? |
💚 CLA has been signed |
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.
Thanks for this change! Definitely will be appreciated by users :)
A couple of comments:
- The CLA service is reporting you haven't signed the CLA, if you have let me know cuz sometimes it's slow and needs a kick to register.
- You should run
nox -s blacken
to automatically format and lint your code - GitHub tip: if you write "Closes #" then that issue will be automatically closed once this PR is closed. I edited your comment above to do that.
eland/utils.py
Outdated
""" | ||
Ensure the given string can be used as attribute on an object instance. | ||
""" | ||
return isinstance(s, str) and re.search(string=s, pattern=r"^[a-zA-Z_]+[a-zA-Z0-9_]*$") and s.replace('_', '') |
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.
- Regex can be changed to
^[a-zA-Z_][a-zA-Z0-9_]*$
to remove the backtracking potential but have same meaning. - Even though it's technically "slower" can we change the last condition to be
s.replace("_", "") != ""
to read better?
Took me a few seconds to figure out what was being done there. :) Also what is it needed for?__
is a valid attr name (not a good one but eh)
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.
- you're right on regex, the
+
is actually useless - I didn't think
__
was a valid attribute name but it is indeed :) so I removed the last condition
eland/dataframe.py
Outdated
""" | ||
Provide autocompletion on field names in interactive environment. | ||
""" | ||
return super(NDFrame, self).__dir__() + [ |
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.
Is this intentionally super(NDFrame, self)
instead of super().__dir__()
?
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 was writing in p2/3 compatible, but indeed unnecessary here since eland is designed for python3
jenkins test this please |
jenkins test this please |
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.
This looks great! 🤩
Closes #222