Skip to content

Adjust docstring of python code to align top and bottom #861

@yongtang

Description

@yongtang

After we use black to format python code, it looks like the doctsring of python is not aligned as black indent the top one but does not indent the whole string. As an example, below is the docstring after black:

def resample(
    input, rate_in, rate_out, quality, name=None
):  # pylint: disable=redefined-builtin
    """Resample audio.
  Args:
    input: A 2-D `Tensor` of type `int16` or `float`. Audio input.
    rate_in: The rate of the audio input.
    rate_out: The rate of the audio output.
    quality: The quality of the resample, 1-10.
    name: A name for the operation (optional).
  Returns:
    output: Resampled audio.
  """

But instead we should have the following:

def resample(
    input, rate_in, rate_out, quality, name=None
):  # pylint: disable=redefined-builtin
    """Resample audio.
    Args:
      input: A 2-D `Tensor` of type `int16` or `float`. Audio input.
      rate_in: The rate of the audio input.
      rate_out: The rate of the audio output.
      quality: The quality of the resample, 1-10.
      name: A name for the operation (optional).
    Returns:
      output: Resampled audio.
    """

Otherwise docs team may have trouble generating the website. (and the non-aligned one does not look good aesthetically).

This is an issue we need fix before v0.13.0.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions