A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/srossross/Meta below:

GitHub - srossross/Meta: Python Meta Programming

A Pure Python module containing a framework to manipulate and analyze python abstract syntax trees and bytecode.

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, '<nofile>', 'exec')
code = compile(mod, '<nofile>', '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
python -m unittest discover meta

test

From the version 1.0.0, Meta follows Semantic Versioning. The version X.Y.Z indicates:

Prior to version 1.0.0, custom versioning scheme was used.


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4