Skip to content

Commit

Permalink
Improve docstrings and prevent napoleon to use rtype in sphinx docs
Browse files Browse the repository at this point in the history
  • Loading branch information
althonos committed Jul 22, 2019
1 parent a9fee11 commit fdf4293
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 0 deletions.
2 changes: 2 additions & 0 deletions docs/api/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ Functions

.. autofunction:: fastobo.loads

.. autofunction:: fastobo.load_graph


Data structures
^^^^^^^^^^^^^^^
Expand Down
1 change: 1 addition & 0 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,7 @@ def inspector(app, what, name, obj, options, signature, return_annotation):
napoleon_use_admonition_for_examples = True
napoleon_use_admonition_for_notes = True
napoleon_use_admonition_for_references = True
napoleon_use_rtype = False

# -- Options for autodoc extension -------------------------------------------

Expand Down
14 changes: 14 additions & 0 deletions src/py/doc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,11 @@ impl OboDoc {
/// xref: MassBank:EA281701
/// <BLANKLINE>
///
/// See Also:
/// The `Translation of Identifiers
/// <http://owlcollab.github.io/oboformat/doc/obo-syntax.html#5.9>`_
/// section of the OBO format version 1.4 specification.
///
fn compact_ids(&self) -> PyResult<Self> {
let py = unsafe { Python::assume_gil_acquired() };
let mut doc = obo::OboDoc::from_py(self.clone_py(py), py);
Expand All @@ -182,6 +187,10 @@ impl OboDoc {
///
/// Create a semantically equivalent OBO document with IRI identifiers.
///
/// The OBO specification describes how to perform an URI decompaction
/// using either ID spaces declared in the document header, builtin ID
/// spaces, or a default rule using the `purl.obolibrary.org` domain.
///
/// Example:
/// >>> doc = fastobo.loads(textwrap.dedent(
/// ... """
Expand All @@ -199,6 +208,11 @@ impl OboDoc {
/// xref: http://www.massbank.jp/jsp/FwdRecord.jsp?id=EA281701
/// <BLANKLINE>
///
/// See Also:
/// The `Translation of Identifiers
/// <http://owlcollab.github.io/oboformat/doc/obo-syntax.html#5.9>`_
/// section of the OBO format version 1.4 specification.
///
fn decompact_ids(&self) -> PyResult<Self> {
let py = unsafe { Python::assume_gil_acquired() };
let mut doc = obo::OboDoc::from_py(self.clone_py(py), py);
Expand Down

0 comments on commit fdf4293

Please sign in to comment.