dadadel / pyment

Format and convert Python docstrings and generates patches
GNU General Public License v3.0
905 stars 62 forks source link

Google docs to reST difficulties with arg type + description #89

Open tristanlatr opened 4 years ago

tristanlatr commented 4 years ago

Hello,

I'm trying to convert automatically google docstrings to reST but not all infos seem to be parsed.

The description do not show up in the patch when the argument type is specified in the parenthesis. Only the type and the default value actually appears.

Any help would be appreciated!

Thanks :)

The following code

def qry_load_data(self, retry=1, wait_timeout_sec=120):
    """
    Internal

    Helper method to execute the query and load the data:
        - Submit the query
        - Wait the query to be executed
        - Get and parse the events

    Arguments:
        retry (int): number of time the query can be failed and retried
        wait_timeout_sec (int): wait timeout in seconds

    Returns: 
        tuple: (`msiempy.event.EventManager`, Query completed? `bool`)

    Raises:
        msiempy.core.session.NitroError if any unhandled errors.
        TimeoutError if wait_timeout_sec counter gets to 0.
    """
    pass

Generate the following patch

# Patch generated by Pyment v0.3.3

--- a/test.py
+++ b/test.py
@@ -1,21 +1,16 @@
 def qry_load_data(self, retry=1, wait_timeout_sec=120):
-    """
-    Internal
-
+    """Internal
+    
     Helper method to execute the query and load the data:
         - Submit the query
         - Wait the query to be executed
         - Get and parse the events

-    Arguments:
-        retry (int): number of time the query can be failed and retried
-        wait_timeout_sec (int): wait timeout in seconds
+    :param retry: int (Default value = 1)
+    :param wait_timeout_sec: int (Default value = 120)
+    :returns: tuple: (`msiempy.event.EventManager`, Query completed? `bool`)
+    :raises msiempy.core.session.NitroError: if any unhandled errors
+    :raises TimeoutError: if wait_timeout_sec counter gets to 0

-    Returns: 
-        tuple: (`msiempy.event.EventManager`, Query completed? `bool`)
-
-    Raises:
-        msiempy.core.session.NitroError if any unhandled errors.
-        TimeoutError if wait_timeout_sec counter gets to 0.
     """
     pass
Trezorro commented 3 years ago

+1 for related issue. The other way around doesn't generate docstrings with parentheses, which doesn't match google's style guide it seems.

dadadel commented 3 years ago

Hi! thanks for reporting, I'll get a look.

dadadel commented 3 years ago

This issue seems related to issue #48