Can Sphinx napoleon document function returning multiple arguments?

前端 未结 3 784
不思量自难忘°
不思量自难忘° 2020-12-14 07:55

I am trying to use the Google code style to document a function that I then use sphinx with the napoleon extension to create documentation for. The function is unusual in th

3条回答
  •  难免孤独
    2020-12-14 08:06

    Google style does not support multiple return values. As a workaround you can use:

    Returns:
            2-element tuple containing
    
            - **rates** (*array*): the unnormalized rates (just the sum of the
              exponential kernels). To obtain rates in Hz divide the
              array by `2*tau` (or other conventional `x*tau` duration).
            - **nph** (*array*): number of photons in -5*tau..5*tau window
              for each timestamp. Proportional to the rate computed
              with KDE and rectangular kernel.
    

    This results in a nice output even with multi-line description for each returned item.

提交回复
热议问题