dadadel / pyment

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

It does not work with raw docstring #107

Closed ChaiByte closed 3 years ago

ChaiByte commented 3 years ago
def func(a, b):
    r"""test"""
    return a + b
pyment -o "google" -w test-before.py
def func(a, b):
    """r"""test

    Args:
      a:
      b:

    Returns:
    return a + b
dadadel commented 3 years ago

Hi @MegChai The current master version works fine with raw docstring. Generating a patch, I get with your example :

# Patch generated by Pyment v0.4.0dev

--- a/issue107.py
+++ b/issue107.py
@@ -1,4 +1,14 @@
 def func(a, b):
-    r"""test"""
+    r"""test
+
+    Args:
+      a: 
+      b: 
+
+    Returns:
+
+    Raises:
+
+    """
     return a + b

And if using like you -w the result is:

def func(a, b):
    r"""test

    Args:
      a: 
      b: 

    Returns:

    Raises:

    """
    return a + b

So I guess there is no problem. The only thing is that it is not yet released.

Feel free to reopen the ticket if you think there's still a problem with that.