Metadata-Version: 1.0
Name: codetree
Version: 2009.12.24.py3k.cpp
Summary: codetree - python code object, tree viewer
Home-page: http://pypi.python.org/pypi/codetree
Author: kai zhu
Author-email: kaizhu256@gmail.com
License: gpl
Description: codetree - python code object, tree viewer
        
        REQUIRES PYTHON3.1
        
        QUICK TEST: $ python3.1 setup.py build dev --quicktest
        
        DESCRIPTION: codetree - python code object, tree viewer
        
        SUMMARY:
        
        RECENT CHANGELOG:
        20091224 - modularized package - fix install issues - added sdist check
        20091205 - moved source code to c++
        20091116 - package integrated
        
        DEMO USAGE:
        
        >>> from codetree import *
        >>> ## source code
        >>> src = 'def foo():\n def bar(): print("hello")\n return bar()\nfoo()'; print( src )
        def foo():
        def bar(): print("hello")
        return bar()
        foo()
        
        >>> ## compile source code
        >>> codeobj = compile(src, '', 'exec')
        >>> exec( codeobj )
        hello
        
        >>> ## convert code object into editable codetree
        >>> tree = codetree(codeobj)
        
        >>> ## edit / compile / exec codetree
        >>> aa, depth, pos, subtree = tree.find('hello')
        >>> subtree[pos] = 'goodbye'
        >>> exec( tree.compile() )
        goodbye
        
        >>> ## codetree structure
        >>> print( tree )
        codetree(
        co_argcount       0
        co_kwonlyargcount 0
        co_nlocals        0
        co_stacksize      1
        co_flags          64
        co_code           b'd\x00\x00\x84\x00\x00Z\x00\x00e\x00\x00\x83\x00\x00\x01d\x01\x00S'
        co_consts
        codetree(
        co_argcount       0
        co_kwonlyargcount 0
        co_nlocals        1
        co_stacksize      1
        co_flags          67
        co_code           b'd\x01\x00\x84\x00\x00}\x00\x00|\x00\x00\x83\x00\x00S'
        co_consts
        None
        codetree(
        co_argcount       0
        co_kwonlyargcount 0
        co_nlocals        0
        co_stacksize      2
        co_flags          83
        co_code           b't\x00\x00d\x01\x00\x83\x01\x00\x01d\x00\x00S'
        co_consts
        None
        goodbye
        co_names          ['print']
        co_varnames       []
        co_filename       ''
        co_name           'bar'
        co_firstlineno    2
        co_lnotab         b''
        co_freevars       []
        co_cellvars       [])
        co_names          []
        co_varnames       ['bar']
        co_filename       ''
        co_name           'foo'
        co_firstlineno    1
        co_lnotab         b'\x00\x01\t\x01'
        co_freevars       []
        co_cellvars       [])
        None
        co_names          ['foo']
        co_varnames       []
        co_filename       ''
        co_name           '<module>'
        co_firstlineno    1
        co_lnotab         b'\t\x03'
        co_freevars       []
        co_cellvars       [])
        
        >>> ## disassemble codetree
        >>> print( tree.dis() )
        1           0 LOAD_CONST               0 (<code object foo at 0x8f40890, file "", line 1>)
        3 MAKE_FUNCTION            0
        6 STORE_NAME               0 (foo)
        
        4           9 LOAD_NAME                0 (foo)
        12 CALL_FUNCTION            0
        15 POP_TOP
        16 LOAD_CONST               1 (None)
        19 RETURN_VALUE
        
        2           0 LOAD_CONST               1 (<code object bar at 0x8f406e0, file "", line 2>)
        3 MAKE_FUNCTION            0
        6 STORE_FAST               0 (bar)
        
        3           9 LOAD_FAST                0 (bar)
        12 CALL_FUNCTION            0
        15 RETURN_VALUE
        
        2           0 LOAD_GLOBAL              0 (print)
        3 LOAD_CONST               1 ('goodbye')
        6 CALL_FUNCTION            1
        9 POP_TOP
        10 LOAD_CONST               0 (None)
        13 RETURN_VALUE
        
        
        
        
        
        
        
        
        
Platform: UNKNOWN
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: End Users/Desktop
Classifier: Intended Audience :: Science/Research
Classifier: License :: OSI Approved :: GNU General Public License (GPL)
Classifier: Natural Language :: English
Classifier: Operating System :: POSIX
Classifier: Operating System :: POSIX :: Linux
Classifier: Programming Language :: C
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.1
Classifier: Topic :: Multimedia
Classifier: Topic :: Multimedia :: Graphics
Classifier: Topic :: Scientific/Engineering
Classifier: Topic :: Scientific/Engineering :: Mathematics
Classifier: Topic :: Scientific/Engineering :: Visualization
Classifier: Topic :: Software Development
Classifier: Topic :: Software Development :: Code Generators
Classifier: Topic :: Software Development :: Libraries
Classifier: Topic :: Software Development :: Libraries :: Python Modules
