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 documentation and type hints for rdflib.query.Result and rdflib.graph.Graph #1211

Merged

Conversation

edmondchuc
Copy link
Contributor

@edmondchuc edmondchuc commented Dec 8, 2020

Add documentation and type hints for rdflib.query.Result. Update documentation and type hints for rdflib.graph.Graph.

I am keen to work on adding documentation and type hints to rdflib. rdflib.query.Result's serialize() is an example of this work.
Please leave any comments on styling and conventions.

Proposed Changes

  • Progressively update documentation and add type hints everywhere
  • Remove sphinx-style documentation such as parameter and return types and update with newer Python type hints.

For the second point, an example would be to remove

:returntype: rdflib.query.QueryResult
and replace it with using python type hints.

E.g.

def query(
        self,
        ...
        **kwargs
    ) -> query.Result:

Sphinx also understands this and adds hyperlinks automatically as well.

If this is acceptable, we should draft a guideline on adding/updating documentation and type hints to the rdflib codebase.

…mentation and type hints for rdflib.graph.Graph.
@coveralls
Copy link

Coverage Status

Coverage decreased (-0.04%) to 75.435% when pulling 2077524 on edmondchuc:feat/sparql-result-serializer-docs into c5ff127 on RDFLib:master.

@FlorianLudwig
Copy link
Contributor

Thanks for improving the docs, that is really welcome 👍

My opinion: the :returntype: in the doc string can be removed if there is a type declaration but parameter descriptions, like :param destination: Path of file output. cannot.

@nicholascar nicholascar merged commit 74943a0 into RDFLib:master Dec 27, 2020
@white-gecko white-gecko added this to the rdflib 6.0.0 milestone Mar 22, 2021
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.

None yet

5 participants