Tagged Questions
43
votes
4answers
10k views
Python - Parse a .py file, read the AST, modify it, then write back the modified source code
I want to programmatically edit python source code. Basically I want to read a .py file, generate the AST, and then write back the modified python source code (i.e. another .py file).
There are ways ...
50
votes
10answers
28k views
What's the best way to generate a UML diagram from Python source code? [closed]
A colleague is looking to generate UML class diagrams from heaps of Python source code.
He's primarily interested in the inheritance relationships, and mildly interested in compositional ...
2
votes
1answer
806 views
How can I strip comments and doc strings from python source code?
Is there a program which I can run like this:
py2py.py < orig.py > smaller.py
Where orig.py contains python source code with comments and doc strings, and smaller.py contains identical, ...
1
vote
5answers
3k views
Script to remove python comments/docstrings
Is there a python script or tool available which can remove comments and docstrings from python source?
it should take care of cases like
"""
aas
"""
def f():
m = {
u'x':
...
2
votes
2answers
574 views
Is there a way to view the source code of a function, class, or module from the python interpreter?
Is there a way to view the source code of a function, class, or module from the python interpreter? (in addition to using help to view the docs and dir to view the attributes/methods)
-1
votes
6answers
1k views
I need a stand alone python interpreter/compiler! [closed]
Ok so i am in need of a python compiler (from .py or .pyw to .exe).
the only ones i have come across are:
- cx_freeze (doesnt work)
- py2exe (way too complicated)
EDIT:
both of the programs above ...