codegen
codegen copied to clipboard
Extension to ast that allow ast -> python code generation.
When parsing complex slicing expressions, like `classes[:, :-1]`, I get this error: ` File "/usr/local/lib/python3.4/dist-packages/mutpy/codegen.py", line 498, in visit_ExtSlice for idx, item in node.dims: TypeError: 'Slice' object is not iterable`...
Make it work for python 3.5+. Some relevant discussion at: https://github.com/alecthomas/importmagic/issues/25
_visit_Delete_ function (in the line 297 of codegen.py) throws a TypeError exception when I run my code. I am trying to fix the bug as below. If you have any...
``` $ python Python 2.7.1 (r271:86832, Jun 16 2011, 16:59:05) [GCC 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2335.15.00)] on darwin Type "help", "copyright", "credits" or "license" for...
In some cases, Line 70: _return ''.join(generator.result)_ throws TypeError exception. It should be corrected as _return ''.join(str(x) for x in generator.result)_
In codegen.py, the function name "visit_excepthandler" should be "visit_ExceptHandler".
Operator precedence is not being properly handled. A couple of examples: ``` >>> to_ast = lambda x:ast.parse(x, mode='eval') >>> codegen.to_source(to_ast( '(1+2)*3' )) '1 + 2 * 3' ``` `1+2*3` =...
- Added a space to some indentations - Created functions for visit_List and visit_Set, which call __sequence_visit - Created functions for visit_ListComp, visit_GeneratorExp and visit_SetComp, which call __generator_visit
While using codegen I noticed that the following code examples could not be parsed to an ast and then translated back again to source code with codegen: ``` python #...
In Python 3.4 `True`, `False` and `None` are not names, but named constants.