Hi,

AFAIK, napoleon extension does not support type annotations.
I agree it is much useful!

Thanks,
Takeshi KOMIYA

2018年8月19日(日) 7:06 Clint Valentine <[email protected]>:

> I have the following property:
>
> ```
> def Something(object):
>
>     @property
>     def experimental_design(self) -> Any:
>         """Return a markdown summary of the samples on this sample sheet.
>
>         This property supports displaying rendered markdown only when
> running
>         within an IPython interpreter. If we are not running in an IPython
>         interpreter, then print out a nicely formatted ASCII table.
>
>         Returns:
>             markdown: A visual table of IDs and names for all samples.
>
>         """
>         if not self.samples:
>             raise ValueError('No samples in sample sheet')
>
>         markdown = tabulate(
>             [[getattr(s, h, '') for h in DESIGN_HEADER] for s in
> self.samples],
>             headers=DESIGN_HEADER,
>             tablefmt='pipe',
>         )
>
>         return maybe_render_markdown(markdown)
> ```
>
> When I set `napoleon_use_rtype` to `False` I get the following:
>
> [image: 1.png]
>
> When I set `napoleon_use_rtype` to `True` I get the following:
>
> [image: 2.png]
>
>
>
> What I *really* want is for Sphinx to recognize the return type of `Any`
> and list that as the type. This works well for functions:
>
>
> ```
>
>     def add_section(self, section_name: str) -> None:
>
>         """Add a section to the :class:`SampleSheet`."""
>
>         section_name = self._whitespace_re.sub('_', section_name)
>
>         self._sections.append(section_name)
>
>         setattr(self, section_name, Section())
>
> ```
>
>
> Rendering as:
>
>
> [image: 3.png]
>
>
> Anyone know a way to help? Are return types on properties from type
> annotations supported or am I required to just use plaintext in the
> docstring?
>
>
> If you want to explore my configuration I have the project here:
>
>
>     https://github.com/clintval/sample-sheet
>
>
> With docs here:
>
>
>     https://sample-sheet.readthedocs.io/
>
>
>
> Thanks!
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "sphinx-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at https://groups.google.com/group/sphinx-users.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"sphinx-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/sphinx-users.
For more options, visit https://groups.google.com/d/optout.

Reply via email to