• Facebook
  • Twitter
  • Reddit
  • StumbleUpon
  • Digg
  • email

All Samples(415)  |  Call(79)  |  Derive(0)  |  Import(336)
function(code, globals[, name[, argdefs[, closure]]])

Create a function object from a code object and a dictionary.
The optional name string overrides the name from the code object.
The optional argdefs tuple specifies the default argument values.
The optional closure tuple supplies the bindings for free variables.

src/m/e/melt-HEAD/trunk/melt/tools/django/core/meta/__init__.py   melt(Download)
        # given namespace's globals, too.
        new_globals = {'__builtins__': __builtins__, 'db': db.db, 'datetime': datetime}
        new_globals.update(extra_globals.__dict__)
        func = types.FunctionType(code, globals=new_globals, name=k, argdefs=v.func_defaults)
        func.__dict__.update(v.__dict__)
        setattr(namespace, k, func)
        # For all of the custom functions that have been added so far, give

src/m/e/melt-HEAD/melt/tools/django/core/meta/__init__.py   melt(Download)
        # given namespace's globals, too.
        new_globals = {'__builtins__': __builtins__, 'db': db.db, 'datetime': datetime}
        new_globals.update(extra_globals.__dict__)
        func = types.FunctionType(code, globals=new_globals, name=k, argdefs=v.func_defaults)
        func.__dict__.update(v.__dict__)
        setattr(namespace, k, func)
        # For all of the custom functions that have been added so far, give

src/p/y/python-big-HEAD/examples/bcmd.py   python-big(Download)
#!/usr/bin/env python
 
import sys, getopt, traceback
from types import FunctionType, BuiltinFunctionType
from nws.sleigh import Sleigh, sshcmd
 
if __name__ == '__main__':

src/w/e/weightless-HEAD/weightless/examples/testautodecorate.py   weightless(Download)
from types import GeneratorType, FunctionType
 
def decorator(generatorOrFunction):
    if type(generatorOrFunction) == GeneratorType:
        print "composing"
        return generatorOrFunction
    elif type(generatorOrFunction) == FunctionType:

src/n/w/nwsclient-1.6.3/examples/bcmd.py   nwsclient(Download)
#!/usr/bin/env python
 
import sys, getopt, traceback
from types import FunctionType, BuiltinFunctionType
from nws.sleigh import Sleigh, sshcmd
 
if __name__ == '__main__':

src/p/y/pylibs-HEAD/optimise.py   pylibs(Download)
import sys
 
from opcode import opmap, HAVE_ARGUMENT, EXTENDED_ARG
from types import FunctionType, ClassType, CodeType
 
# ------------------------------------------------------------------------------
# some konstants
        )
 
    return FunctionType(
        codeobj, function.func_globals, function.func_name,
        function.func_defaults, function.func_closure
        )
 

src/d/e/Dejavu-1.5.0/dejavu/codewalk.py   Dejavu(Download)
 
import operator
import sets
from types import CodeType, FunctionType, MethodType
 
from compiler.consts import *
CO_NOFREE = 0x0040
            if newname is None:
                newname = ''
            co = self.code_object()
            return FunctionType(co, {}, newname)
        else:
            if newname is None:
                newname = f.func_name
            co = self.code_object()
            return FunctionType(co, f.func_globals, newname,
            if newname is None:
                newname = ''
            co = self.code_object()
            return FunctionType(co, {}, newname)
        else:
            if newname is None:
                newname = f.func_name
            co = self.code_object()
            # All cells should be dereferenced, so force func_closure to None.
            return FunctionType(co, f.func_globals, newname, f.func_defaults)

src/f/l/flioops-HEAD/py/trunk/utils/func.py   flioops(Download)
 
	src = "lambda %(_argspec_)s: _caller_(%(_params_)s)" % dict(_argspec_=fcall, _params_=fcall)
	new_func = eval(src, dict(_caller_=wrapper))
	new_func = types.FunctionType(new_func.func_code, new_func.func_globals, new_func.func_name, \
			defs, new_func.func_closure)
 
	# for (name, value) in getmembers(f, lambda x: type(x) in FUNCVAL_TYPES):
	func= eval(src, globalns and globalns or wrapped.func_globals, {})
	if closures is not None:
		func= func(**closures)
	return types.FunctionType(func.func_code, func.func_globals, func.func_name, \
			wrapped.func_defaults, func.func_closure)
 
def code_src(co):
def execInGlobals(globalns):
	"""
	Function decorator that redirects the execution of
	the target function to be performed with 'globalns'
	as the global namespace.
	"""
	return lambda f: types.FunctionType(f.func_code, globalns, \

src/p/y/pypy-HEAD/pypy/objspace/std/smallintobject.py   pypy(Download)
            new_name = name.replace("Int", "SmallInt")
            # Copy the function, so the annotator specializes it for
            # W_SmallIntObject.
            ns[new_name] = types.FunctionType(func.func_code, ns, new_name,
                                              func.func_defaults,
                                              func.func_closure)
    ns["get_integer"] = ns["pos__SmallInt"] = ns["int__SmallInt"]

src/b/a/banyanims-HEAD/trunk/dependencies/zope-instance-2.7.4-0/Products/Archetypes/ClassGen.py   banyanims(Download)
from __future__ import nested_scopes
import re
from types import FunctionType as function
 
from Products.Archetypes.utils import capitalize
from Products.Archetypes.utils import _getSecurity
from Products.Archetypes.debug import warn
        # to access the method.
        # This code is renaming the internal name from e.g. generatedAccessor to
        # methodName.
        method = function(method.func_code,
                          method.func_globals,
                          methodName,
                          method.func_defaults,

  1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9  Next