Show_doc() not highlighting "return" value for functions that don't have parameters

I have a couple of simple functions that don’t take any arguments, but just return an object.

 #| export  
def sod_now() -> float:
  """ 
  Returns the seconds of the day for right now.

  Returns
  -------
  float
    Seconds of the day
  """
  return np.fmod(soe_now(), 86400.0)

When I run show_doc( sod_now ) I get:


sod_now

 sod_now ()

Returns the seconds of the day for right now.


Which doesn’t highlight the return like it does when there are parameters for some reason.

1 Like

@Lidar532 welcome to fast.ai community. I think if you are not type annotating any argument, it returns like you showed.

While if you are passing a a function argument and annotating like this ways:

def sod_now(x: int  # hello
            ) -> float: # Seconds of day
  """ 
  Returns the seconds of the day for right now.
  """
  return 1

You will get your expected output format when using show_doc in nbdev.

1 Like