File tree Expand file tree Collapse file tree 1 file changed +4
-6
lines changed
Expand file tree Collapse file tree 1 file changed +4
-6
lines changed Original file line number Diff line number Diff line change @@ -769,12 +769,9 @@ def _parse_references_section(self, section: str) -> List[str]:
769769 def _parse_returns_section (self , section : str ) -> List [str ]:
770770 fields = self ._consume_returns_section ()
771771 multi = len (fields ) > 1
772- if multi :
773- use_rtype = False
774- else :
775- use_rtype = self ._config .napoleon_use_rtype
776-
772+ use_rtype = False if multi else self ._config .napoleon_use_rtype
777773 lines : List [str ] = []
774+
778775 for _name , _type , _desc in fields :
779776 if use_rtype :
780777 field = self ._format_field (_name , '' , _desc )
@@ -787,7 +784,8 @@ def _parse_returns_section(self, section: str) -> List[str]:
787784 else :
788785 lines .extend (self ._format_block (':returns: * ' , field ))
789786 else :
790- lines .extend (self ._format_block (':returns: ' , field ))
787+ if any (field ): # only add :returns: if there's something to say
788+ lines .extend (self ._format_block (':returns: ' , field ))
791789 if _type and use_rtype :
792790 lines .extend ([':rtype: %s' % _type , '' ])
793791 if lines and lines [- 1 ]:
You can’t perform that action at this time.
0 commit comments