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

All Samples(413)  |  Call(87)  |  Derive(0)  |  Import(326)
classobj(name, bases, dict)

Create a class object.  The name must be a string; the second argument
a tuple of classes, and the third a dictionary.

src/m/e/melt-HEAD/trunk/melt/tools/django/core/meta/__init__.py   melt(Download)
 
        # Create the module-level ObjectDoesNotExist exception.
        dne_exc_name = '%sDoesNotExist' % name
        does_not_exist_exception = types.ClassType(dne_exc_name, (ObjectDoesNotExist,), {})
        # Explicitly set its __module__ because it will initially (incorrectly)
        # be set to the module the code is being executed in.
        does_not_exist_exception.__module__ = MODEL_PREFIX + '.' + opts.module_name
        setattr(new_mod, dne_exc_name, does_not_exist_exception)
 
        # Create other exceptions.
        for exception_name in opts.exceptions:
            exc = types.ClassType(exception_name, (Exception,), {})
def get_manipulator(opts, klass, extra_methods, add=False, change=False):
    "Returns the custom Manipulator (either add or change) for the given opts."
    assert (add == False or change == False) and add != change, "get_manipulator() can be passed add=True or change=True, but not both"
    man = types.ClassType('%sManipulator%s' % (opts.object_name, add and 'Add' or 'Change'), (formfields.Manipulator,), {})
    man.__module__ = MODEL_PREFIX + '.' + opts.module_name # Set this explicitly, as above.
    man.__init__ = curry(manipulator_init, opts, add, change)
    man.save = curry(manipulator_save, opts, klass, add, change)

src/m/e/melt-HEAD/melt/tools/django/core/meta/__init__.py   melt(Download)
 
        # Create the module-level ObjectDoesNotExist exception.
        dne_exc_name = '%sDoesNotExist' % name
        does_not_exist_exception = types.ClassType(dne_exc_name, (ObjectDoesNotExist,), {})
        # Explicitly set its __module__ because it will initially (incorrectly)
        # be set to the module the code is being executed in.
        does_not_exist_exception.__module__ = MODEL_PREFIX + '.' + opts.module_name
        setattr(new_mod, dne_exc_name, does_not_exist_exception)
 
        # Create other exceptions.
        for exception_name in opts.exceptions:
            exc = types.ClassType(exception_name, (Exception,), {})
def get_manipulator(opts, klass, extra_methods, add=False, change=False):
    "Returns the custom Manipulator (either add or change) for the given opts."
    assert (add == False or change == False) and add != change, "get_manipulator() can be passed add=True or change=True, but not both"
    man = types.ClassType('%sManipulator%s' % (opts.object_name, add and 'Add' or 'Change'), (formfields.Manipulator,), {})
    man.__module__ = MODEL_PREFIX + '.' + opts.module_name # Set this explicitly, as above.
    man.__init__ = curry(manipulator_init, opts, add, change)
    man.save = curry(manipulator_save, opts, klass, add, change)

src/e/v/eventghost-HEAD/trunk/plugins/ZoomPlayer/__init__.py   eventghost(Download)
import socket
import asyncore
import threading
from types import ClassType
 
 
class Text:
        group = self.AddGroup('Navigational Commands')
        for className, descr, scancode in NV_ACTIONS:
            clsAttributes = dict(name=descr, value=scancode)
            cls = ClassType(className, (NvAction,), clsAttributes)
            group.AddAction(cls)
 
        group = self.AddGroup('Regular Functions')
        for className, descr in FN_ACTIONS:
            clsAttributes = dict(
                name=className[2:], 
                description=descr, 
                value=className
            )
            cls = ClassType(className, (FnAction,), clsAttributes)
                description=descr, 
                value=className
            )
            cls = ClassType(className, (ExAction,), clsAttributes)
            group.AddAction(cls)
 
        self.AddAction(self.MyCommand)

src/e/v/eventghost-HEAD/trunk/eg/Classes/ActionGroup.py   eventghost(Download)
# $LastChangedBy: bitmonster $
 
import eg
from types import ClassType
from eg.Utils import SetDefault
 
 
        if identifier is not None:
            description = name if description is None else description
            defaultText = ClassType(
                identifier, 
                (), 
                {"name": name, "description": description}
            )
            translatedText = getattr(plugin.text, identifier, None)
            if translatedText is None:
                translatedText = ClassType(identifier, (), {})
            raise Exception("Actions must be subclasses of eg.ActionBase")
        if clsName is not None:
            actionCls = ClassType(
                clsName,
                (actionCls, ),
                dict(name=name, description=description, value=value),
            )
 
        text = self.Translate(plugin, actionCls, actionClsName)
        actionCls = ClassType(
            actionClsName,
            (actionCls, ), 
            dict(
                name=text.name,
    def Translate(self, plugin, actionCls, actionClsName):
        defaultText = actionCls.text
        if defaultText is None:
            defaultText = ClassType(actionClsName, (), {})
        translatedText = getattr(plugin.text, actionClsName, None)
        if translatedText is None:
            translatedText = ClassType(actionClsName, (), {})

src/e/v/eventghost-HEAD/plugins/ZoomPlayer/__init__.py   eventghost(Download)
import socket
import asyncore
import threading
from types import ClassType
 
 
class Text:
        group = self.AddGroup('Navigational Commands')
        for className, descr, scancode in NV_ACTIONS:
            clsAttributes = dict(name=descr, value=scancode)
            cls = ClassType(className, (NvAction,), clsAttributes)
            group.AddAction(cls)
 
        group = self.AddGroup('Regular Functions')
        for className, descr in FN_ACTIONS:
            clsAttributes = dict(
                name=className[2:], 
                description=descr, 
                value=className
            )
            cls = ClassType(className, (FnAction,), clsAttributes)
                description=descr, 
                value=className
            )
            cls = ClassType(className, (ExAction,), clsAttributes)
            group.AddAction(cls)
 
        self.AddAction(self.MyCommand)

src/e/v/eventghost-HEAD/eg/Classes/ActionGroup.py   eventghost(Download)
# $LastChangedBy: bitmonster $
 
import eg
from types import ClassType
from eg.Utils import SetDefault
 
 
        if identifier is not None:
            description = name if description is None else description
            defaultText = ClassType(
                identifier, 
                (), 
                {"name": name, "description": description}
            )
            translatedText = getattr(plugin.text, identifier, None)
            if translatedText is None:
                translatedText = ClassType(identifier, (), {})
            raise Exception("Actions must be subclasses of eg.ActionBase")
        if clsName is not None:
            actionCls = ClassType(
                clsName,
                (actionCls, ),
                dict(name=name, description=description, value=value),
            )
 
        text = self.Translate(plugin, actionCls, actionClsName)
        actionCls = ClassType(
            actionClsName,
            (actionCls, ), 
            dict(
                name=text.name,
    def Translate(self, plugin, actionCls, actionClsName):
        defaultText = actionCls.text
        if defaultText is None:
            defaultText = ClassType(actionClsName, (), {})
        translatedText = getattr(plugin.text, actionClsName, None)
        if translatedText is None:
            translatedText = ClassType(actionClsName, (), {})

src/r/e/reporter-lib-HEAD/packages/Django/django/db/models/base.py   reporter-lib(Download)
    def subclass_exception(name, parents, unused):
        return types.ClassType(name, parents, {})
else:
    def subclass_exception(name, parents, module):
        return type(name, parents, {'__module__': module})
 

src/l/o/Loopy-0.1.0-3/src/loopy/libevent/wrapper.py   Loopy(Download)
 
from ctypes import *
from ctypes.util import find_library
from types import ClassType as classobj
 
import socket
from decimal import Decimal, getcontext
def tailq_entry(eltype, name): #{{{
    anon = classobj(name, (Structure,), {})
    anon._fields_ = [("tqe_next", POINTER(eltype)),
                     ("tqe_prev", POINTER(POINTER(eltype)))]
    return anon
# End def #}}}
 
def rb_entry(eltype, name): #{{{
    anon = classobj(name, (Structure,), {})

src/z/a/zamboni-lib-HEAD/lib/python/celery/serialization.py   zamboni-lib(Download)
    def subclass_exception(name, parent, unused):
        return types.ClassType(name, (parent,), {})
else:
    def subclass_exception(name, parent, module):
        return type(name, (parent,), {'__module__': module})
 
 

src/r/p/rpyc-3.0.7/rpyc/core/vinegar.py   RPyC(Download)
import sys
import exceptions
import traceback
from types import InstanceType, ClassType
from rpyc.core import brine
from rpyc.core import consts
 
        if fullname not in _generic_exceptions_cache:
            fakemodule = {"__module__" : "%s.%s" % (__name__, modname)}
            if isinstance(GenericException, ClassType):
                _generic_exceptions_cache[fullname] = ClassType(fullname, (GenericException,), fakemodule)
            else:
                _generic_exceptions_cache[fullname] = type(fullname, (GenericException,), fakemodule)
        cls = _generic_exceptions_cache[fullname]

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