All Samples(90637) | Call(88276) | Derive(2345) | Import(16)
type(object) -> the object's type type(name, bases, dict) -> a new type
src/c/a/casadi-HEAD/trunk/documentation/examples/SX/ssym.py casadi(Download)
x = ssym("x")
print type(x), x
#! Create a column matrix
#! This assigns three variables a, b and c: print type(a), a print type(b), b print type(c), c
src/a/t/Athena-Dependencies-Python-HEAD/Demo/parser/example.py Athena-Dependencies-Python(Download)
if vars is None:
vars = {}
if type(pattern) is ListType: # 'variables' are ['varname']
vars[pattern[0]] = data
return 1, vars
if type(pattern) is not TupleType:
src/l/a/Langtangen-HEAD/src/py/examples/q4w/example1/QAdata.py Langtangen(Download)
def usersAnswer(self, input):
if type(input) is type(''): # is input a string?
input = [input] # convert to list
self.user_input = input # list of strings
src/w/x/wxmap2-HEAD/trunk/app/src/python/pexpect-2.3/examples/rippy.py wxmap2(Download)
If it is a string then it is converted to a function reference.
"""
if type(func) is type(''):
if func in globals():
func = globals()[func]
# convert all flag options to 0 or 1
if '_flag' in k:
if type(d[k]) is types.StringType:
if d[k].strip().lower()[0] in 'yt1': #Yes, True, 1
d[k] = 1
src/b/y/byteplay-0.2/examples/make_constants_orig.py byteplay(Download)
return
for k, v in d.items():
if type(v) is FunctionType:
newv = _make_constants(v, builtin_only, stoplist, verbose)
setattr(mc, k, newv)
elif type(v) in (type, ClassType):
"""
if type(builtin_only) == type(make_constants):
raise ValueError("The bind_constants decorator must have arguments.")
return lambda f: _make_constants(f, builtin_only, stoplist, verbose)
def sample(population, k):
"Choose k unique random elements from a population sequence."
if not ininstance(population, (list, tuple, str)):
raise TypeError('Cannot handle type', type(population))
n = len(population)
src/b/y/byteplay-0.2/examples/make_constants.py byteplay(Download)
return
for k, v in d.items():
if type(v) is FunctionType:
newv = _make_constants(v, builtin_only, stoplist, verbose)
setattr(mc, k, newv)
elif type(v) in (type, ClassType):
"""
if type(builtin_only) == type(make_constants):
raise ValueError("The bind_constants decorator must have arguments.")
return lambda f: _make_constants(f, builtin_only, stoplist, verbose)
def sample(population, k):
"Choose k unique random elements from a population sequence."
if not ininstance(population, (list, tuple, str)):
raise TypeError('Cannot handle type', type(population))
n = len(population)
src/p/e/personis-0.933/personis/examples/aelog/httplib2/socks.py personis(Download)
"""
# Do a minimal input check first
if (not type(destpair) in (list,tuple)) or (len(destpair) < 2) or (not isinstance(destpair[0], basestring)) or (type(destpair[1]) != int):
raise GeneralProxyError((5, _generalerrors[5]))
if self.__proxy[0] == PROXY_TYPE_SOCKS5:
src/c/l/clearsilver-0.10.1/clearsilver/python/examples/trans/trans.py clearsilver(Download)
s = self.cleanHtmlString(s)
if self.containsWords(s, ishtml):
if type(ofs) == type(""): # HDF
if seen_hdf.has_key(ofs):
if seen_hdf[ofs][0] != s:
s_id = self.findString(s)
for (fname, ofs, l) in locs:
if type(ofs) == type(""): # ie, its HDF
location = "hdf:%s" % ofs
else:
src/c/a/casadi-HEAD/trunk/documentation/examples/SX/symbolicsubstitution.py casadi(Download)
z_= x*y z = z_+x print type(z), z #! We need SXFuncion to manipulate the SX graph
q = f.eval([vertcat([w,y])])[0] #! f.eval() returns a tuple with all outputs, we selected the first print type(q), q #! Note how q is now an SXMatrix #! We can take a shortcut via substitute: q = substitute(z,x,w) print type(q), q
src/b/i/bika.lims-3.0rc2.3/bika/lims/content/sampletype.py bika.lims(Download)
bsc = getToolByName(self, 'bika_setup_catalog')
## convert value to objects
if value and type(value) == str:
value = [bsc(UID=value)[0].getObject(),]
elif value and type(value) in (list, tuple) and type(value[0]) == str:
Previous 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 Next