https://github.com/enthought/meta
Default Repo description from terraform module
https://github.com/enthought/meta
Last synced: 8 months ago
JSON representation
Default Repo description from terraform module
- Host: GitHub
- URL: https://github.com/enthought/meta
- Owner: enthought
- License: other
- Created: 2013-07-04T22:10:44.000Z (almost 13 years ago)
- Default Branch: develop
- Last Pushed: 2013-07-04T22:13:39.000Z (almost 13 years ago)
- Last Synced: 2024-12-27T02:42:47.902Z (over 1 year ago)
- Language: Python
- Homepage:
- Size: 396 KB
- Stars: 0
- Watchers: 4
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.rst
- License: license.rst
Awesome Lists containing this project
README
Meta
====
.. image:: https://secure.travis-ci.org/srossross/Meta.png?branch=develop
A Pure Python module containing a framework to manipulate and analyze
python ast's and bytecode.
Example
========
This shows how to take python source to a code object and back again from within python::
import meta, ast
source = '''
a = 1
b = 2
c = (a ** b)
'''
mod = ast.parse(source, '', 'exec')
code = compile(mod, '', 'exec')
mod2 = meta.decompile(code)
source2 = meta.dump_python_source(mod2)
assert source == source2
This shows the depyc script. The script compiles itself, and then the compiled script extracts itself::
DEPYC_FILE=`python -c"import meta.scripts.depyc; print meta.scripts.depyc.__file__"`
depyc $DEPYC_FILE --pyc > depycX.pyc
python -m depycX depycX.pyc --python > depycX.py
echo depycX.py
Notes
======
* Meta is python3 compliant (mostly)
Bugs
=====
* The decompliler does not yet support complex list/set/dict - comprehensions
Testing
=======
`python -m unittest discover meta`