Compile the expression to a list of Python AST expressions, a
        set of variable names used, and a set of function names.
518058
def translate(self):
        
        expressions = []
        varnames = set()
        funcnames = set()
        for part in self.parts:
            if isinstance(part, str):
                expressions.append(ex_literal(part))
            else:
                e, v, f = part.translate()
                expressions.extend(e)
                varnames.update(v)
                funcnames.update(f)
        return expressions, varnames, funcnames
215020
def _compile(self, expression):
        

        x = self.RE_PYTHON_VAR.sub('(?:\\1,)', expression)
        x = self.RE_SPACES.sub('', x)
        return re.compile(x)
749040
def map_expression(expr):
    
    if callable(expr):
        return expr

    # first, split the string on commas to get key/value bits
    # XXX: should we allow people to escape commas here?
    # XXX: what's a good test case for commas in an expression?
    bits = expr.split(',')
    # then, split each bit on '=' to get the key and expression strings
    exprs = [
        (bit[0].strip(), len(bit) > 1 and bit[1].strip() or '')
        for bit in [bit.split('=') for bit in bits]
    ]
    # then, convert those into a dict where each key indicates an expression()
    keys = [
        (k[0], k[1] and expression(k[1]) or None)
        for k in exprs
    ]
    key_dict = dict(keys)
    def _expr(data, **kwargs):
        vals = {}
        for key, expr in key_dict.items():
            # the SQL * selects all keys
            if key == '*':
                vals.update(data)
                continue
            # and if there's no expression, just grab the named key
            elif not expr:
                vals[key] = data.get(key)
                continue
            # otherwise, execute the expression
            # XXX: this will throw an exception if the named key doesn't exist
            # in the data dict!
            else:
                vals[key] = expr(data, **kwargs)
        return vals
    _expr.__doc__ = expr
    _expr.keys = map(lambda k: k[0], keys)
    return _expr
1176416
def get_variables(expression, variables=None):
    """"""
    if variables is None:
        variables = set()
    if hasattr(expression, 'variable_name') and expression.variable_name is not None:
        variables.add(expression.variable_name)
    if isinstance(expression, Operation):
        for operand in op_iter(expression):
            get_variables(operand, variables)
    return variables
608964
def _ctypes_ex_variables(executable):
    
    result = []
    for p in executable.ordered_parameters:
        _ctypes_code_parameter(result, p, "indices")
        _ctypes_code_parameter(result, p, "variable")
        _ctypes_code_parameter(result, p, "out")

    if type(executable).__name__ == "Function":
        #For functions, we still create a subroutine-type interface and then just add an extra
        #output-type parameter for the function's return type.
        _ctypes_code_parameter(result, executable, "indices")
        _ctypes_code_parameter(result, executable, "variable")
        _ctypes_code_parameter(result, executable, "out")
        
    return result
993905
def CPP_to_Python(s):
    
    s = CPP_to_Python_Ops_Expression.sub(CPP_to_Python_Ops_Sub, s)
    for expr, repl in CPP_to_Python_Eval_List:
        s = expr.sub(repl, s)
    return s
1335326
def _construct_regex(cls, fmt):
        """"""
        return re.compile(fmt.format(**vars(cls)), flags=re.U)
1280588
def eval_to_ast(self, e, n, extra_constraints=(), exact=None):
        
        return [ ast.bv.BVV(v, e.size()) for v in self.eval(e, n, extra_constraints=extra_constraints, exact=exact) ]
335133
def compile(expr, params=None):
    
    from ibis.clickhouse.compiler import to_sql

    return to_sql(expr, dialect.make_context(params=params))
930951
def compile_to_python(exp, env, done=None): 
  ''''''
  original_exp = exp
  compiler = Compiler()
  if done is None:
    done = il.Done(compiler.new_var(il.ConstLocalVar('v')))
  compiler.exit_block_cont_map = {}
  compiler.continue_block_cont_map = {}
  compiler.protect_cont = done
  if env is None: env = Environment()
  exp = element(exp)
  exp = exp.alpha(env, compiler)
  exp = exp.cps(compiler, done)
  exp.analyse(compiler)
  env = Environment()
  exp = exp.optimize(env, compiler)
  #exp = exp.tail_recursive_convert()
  function = compiler.new_var(il.ConstLocalVar('compiled_dao_function'))
  exp = il.Function(function, (), exp)
  exp = il.begin(*exp.pythonize(env, compiler)[0])
  if isinstance(exp, il.Begin):
    exp = exp.statements[0]
  exp.body = exp.body.replace_return_with_yield()
  compiler = Compiler()
  result = exp.to_code(compiler)
  return prelude + result
1023256
def _compilecode(function, name, impl, args, varargs, kwargs):
    

    newcodestr, generatedname, impl_name = _generatecode(
        function=function, name=name, impl=impl,
        args=args, varargs=varargs, kwargs=kwargs
    )

    try:
        __file__ = getfile(function)
    except TypeError:
        __file__ = '<string>'

    # compile newcodestr
    code = compile(newcodestr, __file__, 'single')

    # define the code with the new function
    _globals = {}
    exec_(code, _globals)

    # get new code
    _var = _globals[generatedname]
    newco = get_function_code(_var)

    # get new consts list
    newconsts = list(newco.co_consts)

    if PY3:
        newcode = list(newco.co_code)
    else:
        newcode = [ord(co) for co in newco.co_code]

    consts_values = {impl_name: impl}

    # change LOAD_GLOBAL to LOAD_CONST
    index = 0
    newcodelen = len(newcode)
    while index < newcodelen:
        if newcode[index] == LOAD_GLOBAL:
            oparg = newcode[index + 1] + (newcode[index + 2] << 8)
            name = newco.co_names[oparg]
            if name in consts_values:
                const_value = consts_values[name]
                if const_value in newconsts:
                    pos = newconsts.index(const_value)
                else:
                    pos = len(newconsts)
                    newconsts.append(consts_values[name])
                newcode[index] = LOAD_CONST
                newcode[index + 1] = pos & 0xFF
                newcode[index + 2] = pos >> 8
        index += 1

    codeobj = getcodeobj(newconsts, newcode, newco, get_function_code(function))
    # instanciate a new function
    if function is None or isbuiltin(function):
        result = FunctionType(codeobj, {})

    else:
        result = type(function)(
            codeobj,
            get_function_globals(function),
            function.__name__,
            get_function_defaults(function),
            get_function_closure(function)
        )

    return result
1107506
def et(name, parallel, inputs, outputs, expression):
    
    ExpressionTool = collections.namedtuple("ExpressionTool", "name inputs outputs expression parallel")
    return ExpressionTool(name, inputs, outputs, expression, parallel)
421559
def compile(self, ast):
        

        documents = {}

        imports = util.StringBuilder()
        for imp in ast.imports:
            if imp.static or imp.wildcard:
                continue

            package_parts = []
            cls_parts = []

            for part in imp.path.split('.'):
                if cls_parts or part[0].isupper():
                    cls_parts.append(part)
                else:
                    package_parts.append(part)


            # If the import's final part wasn't capitalized,
            # append it to the class parts anyway so sphinx doesn't complain.
            if cls_parts == []:
                cls_parts.append(package_parts.pop())

            package = '.'.join(package_parts)
            cls = '.'.join(cls_parts)

            imports.append(util.Directive('java:import', package + ' ' + cls).build())
        import_block = imports.build()

        if not ast.package:
            raise ValueError('File must have package declaration')

        package = ast.package.name
        type_declarations = []
        for path, node in ast.filter(javalang.tree.TypeDeclaration):
            if not self.filter(node):
                continue

            classes = [n.name for n in path if isinstance(n, javalang.tree.TypeDeclaration)]
            classes.append(node.name)

            name = '.'.join(classes)
            type_declarations.append((package, name, node))

        for package, name, declaration in type_declarations:
            full_name = package + '.' + name
            document = self.compile_type_document(import_block, package, name, declaration)
            documents[full_name] = (package, name, document.build())
        return documents
1155658
def p_expression_invar(self, p):
        '''  
        '''
        _LOGGER.debug("expresion -> expresion IN VAR")
    
        if p[3] not in self._VAR_VALUES:
            if self._autodefine_vars:
                self._VAR_VALUES[p[3]] = TypedList([])
            else:
                raise TypeError("list expected for IN operator")
            
        l = self._VAR_VALUES[p[3]]
        if l.type != TypedList.LIST: raise TypeError("list expected for IN operator")
        p[3] = l
        
        self.p_expression_inlist(p)
67054
def _write_expressiontool(step_dir, name, inputs, outputs, expression, parallel):
    
    out_file = os.path.join(step_dir, "%s.cwl" % name)
    out = {"class": "ExpressionTool",
           "cwlVersion": "v1.0",
           "requirements": [{"class": "InlineJavascriptRequirement"}],
           "inputs": [],
           "outputs": [],
           "expression": expression}
    out = _add_inputs_to_tool(inputs, out, parallel)
    out = _add_outputs_to_tool(outputs, out)
    _tool_to_file(out, out_file)
    return os.path.join("steps", os.path.basename(out_file))
1240031
def compile_func(arg_names, statements, name='_the_func', debug=False):
    
    func_def = ast.FunctionDef(
        name=name,
        args=ast.arguments(
            args=[ast.arg(arg=n, annotation=None) for n in arg_names],
            kwonlyargs=[],
            kw_defaults=[],
            defaults=[ex_literal(None) for _ in arg_names],
        ),
        body=statements,
        decorator_list=[],
    )

    mod = ast.Module([func_def])
    ast.fix_missing_locations(mod)

    prog = compile(mod, '<generated>', 'exec')

    # Debug: show bytecode.
    if debug:
        dis.dis(prog)
        for const in prog.co_consts:
            if isinstance(const, types.CodeType):
                dis.dis(const)

    the_locals = {}
    exec(prog, {}, the_locals)
    return the_locals[name]
1066493
function compile(ast, opts) {
  opts = assign({}, config.defaultOpts, opts)
  debug('compile', opts, ast)
  var worker = makeWorker(opts)
  for (var i = 0, text = ast.value, len = text.length; i < len; i++) {
    compileLine(text[i], worker)
  }
  return worker.buf.join('')
}