All Samples(102020) | Call(102020) | Derive(0) | Import(0)
hasattr(object, name) -> bool Return whether the object has an attribute with the given name. (This is done by calling getattr(object, name) and catching exceptions.)
src/g/d/gdata-2.0.17/samples/oauth/oauth_on_appengine/appengine_utilities/sessions.py gdata(Download)
def _delete_session(self):
"""
Delete the session and all session data.
"""
if hasattr(self, "session"):
if keyname in self.cookie_vals:
return self.cookie_vals[keyname]
if hasattr(self, "session"):
data = self._get(keyname)
if data:
"""
# check memcache first
if hasattr(self, "session"):
results = self._get()
if results is not None:
"""
# try memcache first
if hasattr(self, "session"):
for k in self._get():
yield k.keyname
src/g/d/gdata-2.0.17/samples/apps/marketplace_sample/atom/http_core.py gdata(Download)
will retrieve a few using getheader.
"""
if hasattr(http_response, 'getheaders'):
return http_response.getheaders()
else:
self.reason = reason
if body is not None:
if hasattr(body, 'read'):
self._body = body
else:
# 'Token invalid - AuthSub token has wrong scope' in the HTTP response.
if (uri.scheme == 'https' and int(uri.port or 443) == 443 and
hasattr(connection, '_buffer') and
isinstance(connection._buffer, list)):
header_line = 'Host: %s:443' % uri.host
return
# Check to see if data is a file-like object that has a read method.
elif hasattr(data, 'read'):
# Read the file and send it a chunk at a time.
while 1:
src/d/j/django-navbar-0.3.0/examples/dbgp/_logging/__init__.py django-navbar(Download)
# caller stack frame.
#
if hasattr(sys, 'frozen'): #support for py2exe
_srcfile = "logging%s__init__%s" % (os.sep, __file__[-4:])
elif string.lower(__file__[-4:]) in ['.pyc', '.pyo']:
return sys.exc_traceback.tb_frame.f_back
if hasattr(sys, '_getframe'): currentframe = sys._getframe
# done filching
self.thread = None
self.threadName = None
if hasattr(os, 'getpid'):
self.process = os.getpid()
else:
arguments with the message.
"""
if not hasattr(types, "UnicodeType"): #if no unicode support...
msg = str(self.msg)
else:
msg = self.format(record)
fs = "%s\n"
if not hasattr(types, "UnicodeType"): #if no unicode support...
self.stream.write(fs % msg)
else:
src/m/a/matplotlib-HEAD/examples/user_interfaces/interactive2.py matplotlib(Download)
object = eval(expr, __main__.__dict__, self.locals)
words = dir(object)
if hasattr(object,'__class__'):
words.append('__class__')
words = words + get_class_members(object.__class__)
def get_class_members(klass):
ret = dir(klass)
if hasattr(klass,'__bases__'):
for base in klass.__bases__:
ret = ret + get_class_members(base)
src/m/a/matplotlib-HEAD/examples/pylab_examples/findobj_demo.py matplotlib(Download)
def myfunc(x):
return hasattr(x, 'set_color') and not hasattr(x, 'set_facecolor')
for o in fig.findobj(myfunc):
o.set_color('blue')
src/t/e/Telemeta-1.4.4/example/sandbox_sqlite/modelviz.py Telemeta(Download)
abstract_models = []
for appmodel in appmodels:
abstract_models = abstract_models + [abstract_model for abstract_model in appmodel.__bases__ if hasattr(abstract_model, '_meta') and abstract_model._meta.abstract]
abstract_models = list(set(abstract_models)) # remove duplicates
appmodels = abstract_models + appmodels
for appmodel in appmodels:
appmodel_abstracts = [abstract_model.__name__ for abstract_model in appmodel.__bases__ if hasattr(abstract_model, '_meta') and abstract_model._meta.abstract]
def getBasesAbstractFields(c):
_abstract_fields = []
for e in c.__bases__:
if hasattr(e, '_meta') and e._meta.abstract:
_abstract_fields.extend(e._meta.fields)
# show related field name
if hasattr(field, 'related_query_name'):
label += ' (%s)' % field.related_query_name()
if isinstance(field, ManyToManyField):
if (getattr(field, 'creates_table', False) or # django 1.1.
(hasattr(field.rel.through, '_meta') and field.rel.through._meta.auto_created)): # django 1.2
add_relation(field, '[arrowhead=dot arrowtail=dot, dir=both]')
elif isinstance(field, GenericRelation):
src/s/c/scikits.statsmodels-0.3.1/scikits/statsmodels/examples/example_wls.py scikits.statsmodels(Download)
explained sum of squares (for centered)
'''
if hasattr(fitresult, 'resid') and hasattr(fitresult, 'model'):
resid = fitresult.resid
endog = fitresult.model.endog
src/m/y/Myghty-1.2/examples/shoppingcart/lib/form.py Myghty(Download)
def reflect_to(self, object):
if hasattr(object, self.name):
setattr(object, self.name, self.displayvalue)
def reflect_from(self, object):
if hasattr(object, self.name):
def reflect_to(self, object):
if hasattr(object, self.name):
setattr(object, self.name, self.currentvalue)
def reflect_from(self, object):
if hasattr(object, self.name):
src/m/a/Matplotlib--JJ-s-dev-HEAD/examples/user_interfaces/interactive2.py Matplotlib--JJ-s-dev(Download)
object = eval(expr, __main__.__dict__, self.locals)
words = dir(object)
if hasattr(object,'__class__'):
words.append('__class__')
words = words + get_class_members(object.__class__)
def get_class_members(klass):
ret = dir(klass)
if hasattr(klass,'__bases__'):
for base in klass.__bases__:
ret = ret + get_class_members(base)
src/m/a/Matplotlib--JJ-s-dev-HEAD/examples/pylab_examples/findobj_demo.py Matplotlib--JJ-s-dev(Download)
def myfunc(x):
return hasattr(x, 'set_color') and not hasattr(x, 'set_facecolor')
for o in fig.findobj(myfunc):
o.set_color('blue')
Previous 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 Next