How to use the astor.codegen.SourceGenerator function in astor

To help you get started, we’ve selected a few astor examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github pannous / angle / angle / pyc_emitter.py View on Github external
# >>> js2 = PyV8.JSContext(Global()) # create another context with the global object
# >>> js2.enter()
# >>> js2.eval("hello()")            # call the global object from javascript
# Hello World                          # the output from python script



# import __builtin__

# import codegen
import astor as codegen  # https://pypi.python.org/pypi/astor
from astor.codegen import SourceGenerator as sourcegen

sourcegen.visit_Function = sourcegen.visit_FunctionDef  # Love Python <3 !!
sourcegen.visit_function = sourcegen.visit_FunctionDef  # ???
sourcegen.visit_FunctionCall = sourcegen.visit_Call
sourcegen.visit_Variable = sourcegen.visit_Name
sourcegen.visit_Argument = sourcegen.visit_Name
sourcegen.visit_Condition = sourcegen.visit_Compare
# import english_parser
from kast.kast import Print, assign, name
from kast import kast
import nodes
import context as the

to_inject = []
to_provide = {}  # 'global' params for exec
provided={}

class Reflector(object):  # Implements list interface is
	def __getitem__(self, name):
		import english_parser
github pannous / angle / core / emitters / pyc_emitter.py View on Github external
# >>> js2 = PyV8.JSContext(Global()) # create another context with the global object
# >>> js2.enter()
# >>> js2.eval("hello()")            # call the global object from javascript
# Hello World                          # the output from python script



# import __builtin__

# import codegen
import astor as codegen  # https://pypi.python.org/pypi/astor
from astor.codegen import SourceGenerator as sourcegen

sourcegen.visit_Function = sourcegen.visit_FunctionDef  # Love Python <3 !!
sourcegen.visit_function = sourcegen.visit_FunctionDef  # ???
sourcegen.visit_FunctionCall = sourcegen.visit_Call
sourcegen.visit_Variable = sourcegen.visit_Name
sourcegen.visit_Argument = sourcegen.visit_Name
sourcegen.visit_Condition = sourcegen.visit_Compare
import angle
import english_parser
from kast.kast import Print, setter, name
from kast import kast
import nodes
import the

to_inject = []
to_provide= {} # 'global' params for exec

class Reflector(object):  # Implements list interface is
  def __getitem__(self, name):
    if name == "__tracebackhide__":