>>> from redbaron import RedBaron
>>>
>>> with open('input_files/comment_after_statement_same_line.py') as f:
... fst = RedBaron(f.read())
... print fst.help(True)
...
...
0 -----------------------------------------------------
IfelseblockNode()
# identifiers: ifelseblock, ifelseblock_, ifelseblocknode
value ->
* IfNode()
# identifiers: if, if_, ifnode
test ->
NameNode()
# identifiers: name, name_, namenode
value='True'
value ->
* PassNode()
# identifiers: pass, pass_, passnode
None
In the above scenario, the commentNode is not shown by method, however when calling .dumps(), the code is correctly restructured, including the comment.
This gives the following output (using bpython):
In the above scenario, the commentNode is not shown by method, however when calling
.dumps()
, the code is correctly restructured, including the comment.