In PyCharm, we can choose the default documentation style. The available options are NumPy, Google, plain, reStructuredText and epytext. See https://intellij-support.jetbrains.com/hc/en-us/community/posts/115000784410-how-to-change-pycharm-default-commenting-style-for-function-.

Suppose we already have a codebase with Google's documentation style, which looks as follows

  """Calculate the batched KL divergence KL(a || b) with a and b Normal.
    a: instance of a Normal distribution object.
    b: instance of a Normal distribution object.
    name: Name to use for created operations.
      Default value: `None` (i.e., `'kl_normal_normal'`).
    kl_div: Batchwise KL(a || b)

Is there any tool (e.g a command-line tool or any plugin for PyCharm) that would automatically convert the documentation above to any of other styles (and vice-versa)? Of course, I expect such a tool not to touch the actual code. Alternatively, feel free to come up with a piece of code that does it, but I suspect it won't be very short.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy