All Samples(94736) | Call(92301) | Derive(2419) | Import(16)
type(object) -> the object's type type(name, bases, dict) -> a new type
src/p/y/pyCloudy-0.8.32/pyCloudy/utils/misc.py pyCloudy(Download)
"""
if np.size(text) == 1:
if type(par1) is int:
str1 = text[par1::]
elif type(par1) is str:
str1 = text
if type(par2) is int:
str2 = str1[0:par2]
elif type(par2) is str:
"""
if type(input_) != type(1):
raise TypeError, "expected integer, got {0}".format(type(input_))
if not 0 < input_ < 4000:
src/b/3/b3-1.9.0/b3/lib/statlib/stats.py b3(Download)
def __call__(self, arg1, *args, **kw):
if type(arg1) not in self._types:
raise TypeError, "don't know how to dispatch %s arguments" % type(arg1)
return apply(self._dispatch[type(arg1)], (arg1,) + args, kw)
"""
if (defaultreallimits <> None):
if type(defaultreallimits) not in [ListType,TupleType] or len(defaultreallimits)==1: # only one limit given, assumed to be lower one & upper is calc'd
lowerreallimit = defaultreallimits
upperreallimit = 1.000001 * max(inlist)
Returns: None
"""
if type(listoflists[0]) not in [ListType,TupleType]:
listoflists = [listoflists]
outfile = open(file,writetype)
src/r/e/reportlab-2.6/tools/pythonpoint/demos/examples.py reportlab(Download)
from string import strip
for (a,b) in g.items():
if a[:4]=="test" and type(b) is StringType:
#print 'for', a
#print b
src/a/t/Athena-Dependencies-Python-HEAD/Lib/xmlrpc/client.py Athena-Dependencies-Python(Download)
otype = (hasattr(other, "__class__")
and other.__class__.__name__
or type(other))
raise TypeError("Can't compare %s and %s" %
(self.__class__.__name__, otype))
def __dump(self, value, write):
try:
f = self.dispatch[type(value)]
except KeyError:
# check if this object can be marshalled as a structure
try:
value.__dict__
except:
raise TypeError("cannot marshal %s objects" % type(value))
for type_ in type(value).__mro__:
if type_ in self.dispatch.keys():
raise TypeError("cannot marshal %s objects" % type(value))
# XXX(twouters): using "_arbitrary_instance" as key as a quick-fix
# for the p3yk merge, this should probably be fixed more neatly.
raise TypeError("cannot marshal None unless allow_none is enabled")
write("<value><nil/></value>")
dispatch[type(None)] = dump_nil
def dump_int(self, value, write):
src/b/3/b3-1.9.0/b3/lib/statlib/io.py b3(Download)
"""
fnames = []
if type(namepatterns) in [ListType,TupleType]:
for item in namepatterns:
fnames = fnames + glob.glob(item)
Returns: None
"""
if type(outlist) in [N.ArrayType]:
aput(outlist,fname,writetype)
return
if type(outlist[0]) not in [ListType,TupleType]: # 1D list
def isstring(x):
if type(x)==StringType:
return 1
else:
return 0
header = imfile[0:-6]+'hdr'
vals = get(header,0) # '0' means no missing-file warning msg
if type(vals[0]) == ListType: # it's an extended header
xsize = int(vals[0][0])
ysize = int(vals[0][1])
src/b/o/boodler-HEAD/core/branch/rel_2_0_3/src/boodle/sample.py boodler(Download)
raise SampleError('file not readable: ' + sname.pathname)
(dummy, suffix) = os.path.splitext(sname.pathname)
elif (not (type(sname) in [str, unicode])):
raise SampleError('not a File or filename')
elif (os.path.isabs(sname)):
src/d/i/diksel-HEAD/trunk/thirdparty/pyjamasdev/examples/libtest/ClassTest.py diksel(Download)
def testMetaClass(self):
Klass = type('MyClass', (object,), {'method': method, 'x': 5})
instance = Klass()
self.assertEqual(instance.method(), 1)
self.assertEqual(instance.x, 5)
src/g/p/gpyconf-HEAD/examples/unittests/all_fields.py gpyconf(Download)
ignore_missing_widgets=True)
AllFieldsTest = type('AllFieldsTest', (Configuration,), _dict)
# generate the class
#from gpyconf.backends.configparser import ConfigParserBackend as BACKEND
test = AllFieldsTest(backend=BACKEND)
test.get_frontend().dialog.set_size_request(800, 600)
test.run_frontend()
src/p/y/pythia-0.8.1.11/pyre/units/unit.py pythia(Download)
def __mul__(self, other):
if type(other) == type(0) or type(other) == type(0.0):
return unit(other*self.value, self.derivation)
value = self.value * other.value
def __div__(self, other):
if type(other) == type(0) or type(other) == type(0.0):
return unit(self.value/other, self.derivation)
value = self.value / other.value
src/j/a/jasy-1.1.0-rc1/jasy/js/parse/Node.py jasy(Download)
relatedChildren.append(value)
elif type(value) in (bool, int, float, str, list, set, dict):
if type(value) == bool:
value = "true" if value else "false"
elif type(value) in (int, float):
value = str(value)
elif type(value) in (list, set, dict):
if type(value) == dict:
Previous 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 Next