Did I find the right examples for you? yes no

All Samples(94736)  |  Call(92301)  |  Derive(2419)  |  Import(16)
type(object) -> the object's type
type(name, bases, dict) -> a new type

src/a/s/asciiporn-2009.05.01/asciiporn/weave/examples/functional.py   asciiporn(Download)
def c_list_map(func,seq):
    """ Uses CXX C code to implement a simple map-like function.
        It does not provide any error checking.
    """
    assert(type(func) in [FunctionType,MethodType,type(len)])
def c_list_map2(func,seq):
    """ Uses Python API more than CXX to implement a simple map-like function.
        It does not provide any error checking.
    """
    assert(type(func) in [FunctionType,MethodType,type(len)])

src/l/a/Langtangen-HEAD/src/py/examples/type.py   Langtangen(Download)
        raise TypeError, \
              'remove() argument 1 must be a string '\
              'or a list, not a %s' % type(files)
    for file in files:
        print 'removing',
def typecheck_types(i):
    for t in types_types:
        if type(i) == t:
            print t,
 
            print c,
 
type_types = (type(1), type([]), type(()), type({}), type(''),
              type(u''), type(1.0), type(MyClass('')))
 

src/p/y/py_examples-HEAD/phonon/kakawana-read-only/src/kakawana/feedparser.py   py_examples(Download)
            return [(tag['scheme'], tag['term']) for tag in UserDict.__getitem__(self, 'tags')]
        realkey = self.keymap.get(key, key)
        if type(realkey) == types.ListType:
            for k in realkey:
                if UserDict.has_key(self, k):
    def __setitem__(self, key, value):
        for k in self.keymap.keys():
            if key == k:
                key = self.keymap[k]
                if type(key) == types.ListType:
        attrsD = dict(attrs)
        baseuri = attrsD.get('xml:base', attrsD.get('base')) or self.baseuri
        if type(baseuri) != type(u''):
            try:
                baseuri = unicode(baseuri, self.encoding)
                output = _sanitizeHTML(output, self.encoding, self.contentparams.get('type', 'text/html'))
 
        if self.encoding and type(output) != type(u''):
            try:
                output = unicode(output, self.encoding)

src/t/o/Toolserver-0.4.1/samples/GreetingTool.py   Toolserver(Download)
		only called when the toolserver is started with the -c switch.
		"""
		assert type(self.instanceVar) == type(1), "instanceVar is an integer"
 
	def _shutdown(self):
	def greeting_pre_condition(self, name, delay):
		assert type(name) in (type(''), type(u'')), "Type of name must be string"
		assert type(delay) == type(1), "Type of delay must be integer"
 
	def greeting_post_condition(self, result):

src/m/u/mummy-1.0.1/python/oldmummy/schemas.py   mummy(Download)
            sub_schema = schema[key]
        else:
            sub_schema = schema[type(key)]
 
        matched, info = _validate(sub_schema, sub_message)
    dict: _validate_dict,
    UNION: _validate_union,
    type(ANY): _validate_any,
    RULE: _validate_rule,
}
    dict: _validate_dict_schema,
    UNION: _validate_union_schema,
    type(ANY): _validate_any_schema,
    RULE: _validate_rule_schema,
}
 
def _validate_schema(schema):
    schema_type = type(schema)
    for key in msgkeys:
        result.append(key)
        result.append(_transform(schema[type(message[key])], message[key]))
 
    return result

src/d/j/django_slumber-0.7.0/slumber_examples/tests/mock_client.py   django_slumber(Download)
        self.assertEquals(p2.pk, 2)
        self.assertEquals(len(p2.prices), 1)
        self.assertTrue(hasattr(p2.prices[0], 'pk'), type(p2.prices[0]))
        self.assertEquals(p2.prices[0].amount, Decimal("13"))
 

src/z/o/Zope2-2.13.19/src/Products/Five/viewlet/viewlet.py   Zope2(Download)
 
    # Generate a derived view class.
    class_ = type("SimpleViewletClass from %s" % template, bases, attrs)
 
    return class_
def JavaScriptViewlet(path):
    """Create a viewlet that can simply insert a javascript link."""
    src = os.path.join(os.path.dirname(__file__), 'javascript_viewlet.pt')
 
    klass = type('JavaScriptViewlet',
def CSSViewlet(path, media="all", rel="stylesheet"):
    """Create a viewlet that can simply insert a javascript link."""
    src = os.path.join(os.path.dirname(__file__), 'css_viewlet.pt')
 
    klass = type('CSSViewlet',

src/d/i/dionea-HEAD/dionea/trunk/sample/tg/depot-ajax/depot_ajax/tests/test_controllers.py   dionea(Download)
def test_method():
    "the index method should return a string called now"
    import types
    result = testutil.call(cherrypy.root.index)
    assert type(result["now"]) == types.StringType

src/p/e/personis-0.933/personis/examples/aelog/apiclient/model.py   personis(Download)
    astuples = []
    for key, value in params.iteritems():
      if type(value) == type([]):
        for x in value:
          x = x.encode('utf-8')
      patch[key] = None
    elif original_value != modified_value:
      if type(original_value) == type({}):
        # Recursively descend objects
        patch[key] = makepatch(original_value, modified_value)

src/d/o/domainmodel-0.15/src/dm/dom/meta.py   domainmodel(Download)
    def createClass(self, name, base, attrs):
        return type(name, (base,), attrs)
 
    def hasDeferredAttributes(self):
        return len(self.attributesDeferred) != 0
            className = "Temporal%s" % registerClass.__name__
            classBases = (TemporalRegisterMixin, registerClass)
            registerClass = type(className, classBases, {})
        register = registerClass(
            typeName=self.typeName,

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