Closed theilen closed 7 years ago
Thank you @theilen for reporting this issue. Can you please provide the whole command that you run? What about the version number of Pyment and of Python? And can you confirm that the code above can as is produce the bug?
I updated my above report accordingly. Let me know if you need anything else.
Hi @theilen! I'm sorry to be long to answer but I am quite busy. What is your input format? It seems to be a kind of Google/Numpydoc style format. And what is your expected output format? Anyway, if I run Pyment on your file and ask for reST, google or numpydoc format, it generates valid patches (but the return type is missing for the two last formats). Note that I tried it under Linux. Unfortunately I haven't Windows. I coded Pyment in order to be OS independent but I didn't try it under Windows. My apologies. I will try it as soon as I have access to a computer under Windows.
Hi @dadadel! My input format does not follow any predifined format. I wanted to use pyment to achieve a consistent doc-format. My impression was that pyment should be able to handle all input, I did not realize it expects already formatted code. I'm sorry if i misread your description!
As described above, I used pyment without any additional keywords, so I would expect it to create reStructured text.
I do not believe, that the problem is with me using windows. Since windows does not have a native way of dealing with patch-files, I used a ported version of unix's patch
to test it. It should work just the same. Maybe the failure was just me and my unstructured input.
Hi @theilen, Do you still have the problem ? I wasn't able to reproduce with your example.
As there is nothing new and the test for the issue is ok, I close this issue.
When trying to convert my handwritten docstrings to something more consisting I ran into a corrupted patch-file. I attached a shortened patch-file and the corresponding original file that reproduce the bug. I was using pyment v0.3.0 with Python 2.7.6 (in a WinPython distribution).
1) As you can see, the whole docstring is supposed to be changed to convert
'''
to"""
. But only the first line of the new docstring is marked with+
, the other 3 lines are not marked, ergo they are treated as context that should be equal in both files. Therefore the line count of the hunk does not fit anymore and the patching fails. 2) Also note that the last 3 lines got an extra whitespace in the beginning of the line. This is not present in the original file. 3) As a side-note: pyment creates ana/
and anb/
in the beginning of the paths of source and target of the patch. Note that these are not the actual folders of the files. I executed pyment in the folder of the file. Comparing with patches created fromdiff
, I would guess that you could just omit this behavior.I do not think it is of importance here, but note that I am using pyment on Windows 7.
patchfile (created running
pyment __init__short.py
in the same folder as__init__short.py
)original file:
edit: files now reproduce the bug.