All Samples(106325) | Call(106325) | 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/r/e/reporter-lib-HEAD/packages/sqlalchemy/examples/elementtree/adjacency_list.py reporter-lib(Download)
def __get__(self, document, owner):
if document is None:
return self
if hasattr(document, '_element'):
return document._element
src/b/a/badger-lib-HEAD/packages/gdata/samples/webmastertools/SitesFeedSummary.py badger-lib(Download)
def safeElementText(element):
if hasattr(element, 'text'):
return element.text
return ''
# Format each site
src/b/a/badger-lib-HEAD/packages/gdata/samples/webmastertools/SitemapsFeedSummary.py badger-lib(Download)
def safeElementText(element):
if hasattr(element, 'text'):
return element.text
return ''
# Format each site
src/b/a/badger-lib-HEAD/packages/gdata/samples/webmastertools/AddDeleteExampleDotCom.py badger-lib(Download)
def safeElementText(element):
if hasattr(element, 'text'):
return element.text
return ''
print 'Logging in'
src/d/j/django-navbar-0.3.0/examples/dbgp/client.py django-navbar(Download)
types.TypeType,
types.ClassType,
types.ModuleType]
if hasattr('', '__add__'):
HiddenTypes.append(type(''.__add__))
# these are the names of the different contexts available from python, which show up
# Check if we are running a recent enough version of jython
# Currently we have problems with v<2.1
if not hasattr(sys, 'version_info') or int(''.join(map(str, sys.version_info[0:3]))) < 210:
print 'Jython debugging is not support for Jython versions below 2.1'
sys.exit(1)
if not file:
file = sys.stderr
if limit is None:
if hasattr(sys, 'tracebacklimit'):
limit = sys.tracebacklimit
n = 0
orig_tb = tb
def __init__(self, main_name='__main__'):
import __main__
self.name = main_name
self.module = imp.new_module(main_name)
if hasattr(__main__, '__builtins__'): # not Jython
self.module.__builtins__ = __main__.__builtins__
self.locals = self.globals = self.module.__dict__
def __init__(self, file, args, globals=None, locals=None, module=None, verbose = _verbose, tracer=None):
if module:
h_base.__init__(self, verbose)
d = self.modules_dict()
self.setSysInfo(d['sys'], file, args)
# add __file__, bug 43703
if module.name == '__main__' and not hasattr(module.module,'__file__'):
def set_trace(self):
"""Start debugging from here."""
frame = sys._getframe().f_back
self.reset()
while frame:
if not frame.f_globals.has_key('DBGPHide'):
if hasattr(self,'trace_dispatch'):
self._detach = 0
self.thread_id = thread.get_ident()
if not backend.appid:
if hasattr(os, 'getpid'):
backend.appid = os.getpid()
else:
# Jython doesn't provide getpid(), so we
# have to have _something_
backend.appid = 1
backend.parent_appid = getenv("DEBUGGER_APPID", '')
if hasattr(os, 'putenv'):
def do_feature_get(self, cmdargs, *args):
feature_value = ''
feature_success = 0
(tid, name, data,) = self._getopts(cmdargs, self._feature_get_optlist, "feature_get")
if hasattr(self, 'get_feature_'+name):
func = getattr(self, 'get_feature_'+name)
feature_value = func()
if feature_value:
feature_value = '<![CDATA[%s]]>' % feature_value
feature_success = 1
elif hasattr(self, name+'_enabled'):
feature_success = 1
elif hasattr(self, name+'_enabled'):
feature_success = getattr(self, name+'_enabled')
elif hasattr(self, 'do_'+name):
feature_success = 1
else:
feature_success = 0
types.DictType: ['hash',''],
types.InstanceType: ['object',''],
}
if hasattr(types,'BooleanType'):
commonTypes[types.BooleanType] = ['bool',' xsi:type="xsd:boolean"']
if hasattr(types,'UnicodeType'):
commonTypes[types.UnicodeType] = ['string',' xsi:type="xsd:string"']
def set_thread_support(debug_threads):
import thread, threading
if debug_threads:
if not hasattr(thread, '_thread_start_new_thread'):
thread._thread_start_new_thread = thread.start_new_thread
thread.start_new_thread = _thread_start_new_thread
threading._start_new_thread = _thread_start_new_thread
else:
if hasattr(thread, '_thread_start_new_thread'):
src/p/y/PyProp-HEAD/examples/tensor/helium_stabilization/plot_poster.py PyProp(Download)
def SandbjergSetAllFonts(parent): if hasattr(parent, "get_children"): for chld in parent.get_children(): if hasattr(chld, "set_fontproperties"): chld.set_fontproperties(SandbjergGetFont()) SandbjergSetAllFonts(chld)
src/p/y/PyProp-HEAD/examples/tensor/helium_stabilization/plot_movie.py PyProp(Download)
def MovieSetAllFonts(parent): if hasattr(parent, "get_children"): for chld in parent.get_children(): if hasattr(chld, "set_fontproperties"): chld.set_fontproperties(PaperGetFont()) PaperSetAllFonts(chld)
src/n/o/notmm-0.4.1/examples/lib/satchmo_admin/util.py notmm(Download)
if callable(name):
attr = name
value = attr(obj)
elif (model_admin is not None and hasattr(model_admin, name) and
not name == '__str__' and not name == '__unicode__'):
attr = getattr(model_admin, name)
value = attr(obj)
else:
if callable(name):
attr = name
elif model_admin is not None and hasattr(model_admin, name):
attr = getattr(model_admin, name)
elif hasattr(model, name):
attr = getattr(model, name)
else:
message = "Unable to lookup '%s' on %s" % (name, model._meta.object_name)
if model_admin:
message += " or %s" % (model_admin.__name__,)
raise AttributeError(message)
if hasattr(attr, "short_description"):
src/g/d/gdata-python-client-HEAD/samples/oauth/oauth_on_appengine/appengine_utilities/sessions.py gdata-python-client(Download)
def _delete_session(self):
"""
Delete the session and all session data.
"""
if hasattr(self, "session"):
self.session.delete()
self.cookie_vals = {}
return self.cache[keyname]
if keyname in self.cookie_vals:
return self.cookie_vals[keyname]
if hasattr(self, "session"):
data = self._get(keyname)
if data:
#UNPICKLING CACHE self.cache[keyname] = data.content
def __len__(self):
"""
Return size of session.
"""
# check memcache first
if hasattr(self, "session"):
results = self._get()
def __iter__(self):
"""
Iterate over the keys in the session data.
"""
# try memcache first
if hasattr(self, "session"):
for k in self._get():
src/m/a/Matplotlib--JJ-s-dev-HEAD/examples/user_interfaces/interactive2.py Matplotlib--JJ-s-dev(Download)
expr, attr = m.group(1, 3)
object = eval(expr, __main__.__dict__, self.locals)
words = dir(object)
if hasattr(object,'__class__'):
words.append('__class__')
words = words + get_class_members(object.__class__)
matches = []
def get_class_members(klass):
ret = dir(klass)
if hasattr(klass,'__bases__'):
for base in klass.__bases__:
ret = ret + get_class_members(base)
return ret
Previous 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 Next