pyment icon indicating copy to clipboard operation
pyment copied to clipboard

If already google format, will replace param description by its type and remove raise description

Open dadadel opened this issue 7 years ago • 0 comments

If a function a google docstring describing a parameter with a type, instead of letting it as is when producing google output format, Pyment will replace the param description by the type. Furthermore, if a raise section is present with an exception described, this description will be remove and the Raises keyword indented.

The following code (from tests/docs_already_google.py):

def func1(param1):
    """Function 1
    with 1 param

    Args:
      param1(type): 1st parameter

    Returns:
      None

    Raises:
      Exception: an exception

    """
    return None

Will produce the patch:

# Patch generated by Pyment v0.3.2-dev4

--- a/docs_already_google.py
+++ b/docs_already_google.py
@@ -3,13 +3,12 @@
     with 1 param

     Args:
-      param1(type): 1st parameter
+      param1: type

     Returns:
       None
-
-    Raises:
-      Exception: an exception
+      
+      Raises:

     """
     return None

This example is in the test suite test_pyment_cases.

dadadel avatar Oct 01 '17 21:10 dadadel