Add a dir attribute to a closed namespace by tonyfast · Pull Request #1134 · RDFLib/rdflib (original) (raw)
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 andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Conversation4 Commits2 Checks0 Files changed
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
[ Show hidden characters]({{ revealButtonHref }})
Proposed Changes
- This change is introduced for improved affordance when working with rdflib in interactive settings like IPython.
- The dir attribute gives attribute completion.
- Use the mangled attribute from the closed namespace object to give better interactive completion.
Closes #918
This change is introduced for improved affordance when working with rdflib in interactive settings like IPython.
Coverage increased (+0.1%) to 75.789% when pulling a5ccaee on tonyfast:patch-1 into e4fe0fd on RDFLib:master.
Hi @tonyfast, thanks for this PR. I don;t know much about iPython myself but fully support people using it.
Can you please just put a comment in about how this approach is better than this approach: PR #918? Code is very similar. If we merge your code, we will close #918 (or vice versa!).
Oh wow. yea that pr is basically the same thing. In #918, I personally can't get at the __uris
property the author is using there. Since the getattr
and getitem
work the same on the closed namespace the key completions (which returns getitem completion) should be equivalent to the getattr/__dir__
completion.
I made this PR on 5.0 so maybe it is up to date with the api.
@tonyfast we'll merge this one in and close the older #918. We'll leave it to Jupyter users to flag any issues (I've only just started making RDFlib Jupyter training material myself!).