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

Add a __dir__ attribute to a closed namespace #1134

Merged
merged 2 commits into from
Aug 27, 2020

Conversation

tonyfast
Copy link
Contributor

@tonyfast tonyfast commented Jul 27, 2020

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.
@coveralls
Copy link

coveralls commented Jul 27, 2020

Coverage Status

Coverage increased (+0.1%) to 75.789% when pulling a5ccaee on tonyfast:patch-1 into e4fe0fd on RDFLib:master.

Use the IPython _ipython_key_completions_ to provide completion with the __getitem__ attribute
https://ipython.readthedocs.io/en/stable/config/integrating.html#tab-completion
@nicholascar
Copy link
Member

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!).

@tonyfast
Copy link
Contributor Author

tonyfast commented Jul 30, 2020

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.

@nicholascar
Copy link
Member

nicholascar commented Aug 27, 2020

@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!).

@nicholascar nicholascar merged commit b5a9278 into RDFLib:master Aug 27, 2020
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.

3 participants