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/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/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,
src/b/a/banyanims-HEAD/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,
src/p/r/Products.Archetypes-1.6.3/Products/Archetypes/ClassGen.py Products.Archetypes(Download)
import logging import re from types import FunctionType as function from App.class_init import InitializeClass from Products.Archetypes.log import log from Products.Archetypes.utils import capitalize
# 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,
src/p/r/Products.CompoundField-1.1/Products/CompoundField/ClassGen.py Products.CompoundField(Download)
#overloaded classgen version to handle schemas within fields from __future__ import nested_scopes import re from types import FunctionType as function from Products.Archetypes.utils import capitalize
# 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,
src/a/u/auto-07p-HEAD/auto/07p/python/AUTOclui.py auto-07p(Download)
from new import function
except ImportError:
import builtins as __builtin__ # Python 3
from types import FunctionType
class AUTOSimpleFunctions:
def __init__(self,outputRecorder=None,errorRecorder=None):
if 'FunctionType' in globals():
func_globals = f.__globals__.copy()
func_globals["withrunner"] = withrunner
return FunctionType(f.__code__, func_globals, key,
f.__defaults__, f.__closure__)
else:
func_globals = f.func_globals.copy()
1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 Next