• Facebook
  • Twitter
  • Reddit
  • StumbleUpon
  • Digg
  • email

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/a/gaesdk-python-HEAD/lib/PyAMF/doc/tutorials/examples/actionscript/simple/python/client.py   gaesdk-python(Download)
    # the User class attributes are not present at this point
    logging.debug("not hasattr(lenards, 'username'): %s" %
                  (not hasattr(lenards, 'username')))
    logging.debug("not hasattr(lenards, 'email'): %s" %
                  (not hasattr(lenards, 'email')))
    logging.debug("not hasattr(lenards, 'password'): %s" %
                  (not hasattr(lenards, 'password')))

src/p/y/py_examples-HEAD/phonon/kakawana-read-only/src/kakawana/feedparser.py   py_examples(Download)
    def has_key(self, key):
        try:
            return hasattr(self, key) or UserDict.has_key(self, key)
        except AttributeError:
            return False
        else:
            infourl = urllib.addinfourl(fp, headers, req.get_full_url())
        if not hasattr(infourl, 'status'):
            infourl.status = code
        return infourl
        else:
            infourl = urllib.addinfourl(fp, headers, req.get_full_url())
        if not hasattr(infourl, 'status'):
            infourl.status = code
        return infourl
    """
 
    if hasattr(url_file_stream_or_string, 'read'):
        return url_file_stream_or_string
 
 
    # if feed is gzip-compressed, decompress it
    if f and data and hasattr(f, 'headers'):
        if gzip and f.headers.get('content-encoding', '') == 'gzip':
            try:

src/d/j/django_slumber-0.7.0/slumber_examples/tests/mock_client.py   django_slumber(Download)
    def test_basic_app_data(self):
        """Ensure that the basic meta data part of the mock works as it should.
        """
        self.assertTrue(hasattr(client, 'app'))
        self.assertTrue(hasattr(client.app, 'contrib'))
        self.assertTrue(hasattr(client.app.contrib, 'auth'))
        self.assertTrue(hasattr(client.app.contrib.auth, 'Model'))
        self.assertTrue(hasattr(client.app, 'Pizza'))

src/p/y/Pyro-3.16/examples/pickle/pickletest.py   Pyro(Download)
	print "PyroAdapter bound to URI:",
	a=createPyroAdapter(Pyro.protocol.PYROAdapter)
	assert not hasattr(a,"URI")
	assert not hasattr(a,"conn")
	a.bindToURI(ns.URI)
		s=pickle.dumps(a,protocol=protocol)
		a2=pickle.loads(s)
		assert not hasattr(a,"conn"), "original cannot have conn because of release"
		assert not hasattr(a2,"conn"), "pickled obj cannot have conn"
		if compareObjects(a,a2):
	print "DynamicProxy bound to URI:",
	p=Pyro.core.getProxyForURI(ns.URI)
	assert not hasattr(p.adapter,"conn")
	p.ping()
	assert isinstance(p.adapter.conn, Pyro.protocol.TCPConnection)

src/d/j/django_slumber-0.7.0/slumber_examples/tests/authentication.py   django_slumber(Download)
    def test_remote_user(self):
        user = client.auth.django.contrib.auth.User.get(username='user')
        for attr in ['is_active', 'is_staff', 'date_joined', 'is_superuser',
                'first_name', 'last_name', 'email', 'username']:
            self.assertTrue(hasattr(user, attr), user.__dict__.keys())
        self.assertTrue(user.is_staff)
        self.assertFalse(user.is_superuser)
        self.assertTrue(hasattr(user, 'remote_user'))
        self.assertEqual(user.username, user.remote_user.username)
        self.assertEqual(user.is_active, user.remote_user.is_active)
    def test_group_permissions(self):
        user = self.backend.get_user(self.user.username)
        self.assertTrue(hasattr(user, 'remote_user'))
        perms = self.backend.get_group_permissions(user)
        self.assertEqual(perms, self.user.get_group_permissions())
 
    def test_all_permissions(self):
        user = self.backend.get_user(self.user.username)
        self.assertTrue(hasattr(user, 'remote_user'))
    def test_module_perms(self):
        user = self.backend.get_user(self.user.username)
        self.assertTrue(hasattr(user, 'remote_user'))
        self.assertFalse(self.backend.has_module_perms(user, 'slumber_examples'))
 

src/m/a/matplotlib-HEAD/examples/units/basic_units.py   matplotlib(Download)
    def __call__(self, *args):
        converted_args = []
        arg_units = [self.unit]
        for a in args:
            if hasattr(a, 'get_unit') and not hasattr(a, 'convert_to'):
                # if this arg has a unit type but no conversion ability,
                # this operation is prohibited
                return NotImplemented
 
            if hasattr(a, 'convert_to'):
            else:
                converted_args.append(a)
                if hasattr(a, 'get_unit'):
                    arg_units.append(a.get_unit())
                else:
    def  __getattribute__(self, name):
        if (name.startswith('__')):
            return object.__getattribute__(self, name)
        variable = object.__getattribute__(self, 'value')
        if (hasattr(variable, name) and name not in self.__class__.__dict__):

src/g/a/gaesdk-python-HEAD/lib/PyAMF/doc/tutorials/examples/actionscript/recordset/python/gateway.py   gaesdk-python(Download)
def as_recordset(result):
    keys = None
 
    if hasattr(result, 'keys'):
        keys = result.keys
    elif hasattr(result, '_ResultProxy__keys'):

src/p/y/pyobjc-framework-Cocoa-2.5.1/Examples/AppKit/PythonBrowser/PythonBrowserModel.py   pyobjc-framework-Cocoa(Download)
def getInstanceVarNames(obj):
    """Return a list the names of all (potential) instance variables."""
    # Recipe from Guido
    slots = {}
    if hasattr(obj, "__dict__"):
        slots.update(obj.__dict__)
    if hasattr(obj, "__class__"):
        slots["__class__"] = 1
    cls = getattr(obj, "__class__", type(obj))
    if hasattr(cls, "__mro__"):
                # XXX using callable() is a heuristic which isn't 100%
                # foolproof.
                if hasattr(value, "__get__") and not callable(value) and \
                        hasattr(obj, name):
                    slots[name] = 1

src/p/y/PyProp-HEAD/examples/tensor/helium_stabilization/AnasaziSolver.py   PyProp(Download)
 
		useInverseIterations = False
		if hasattr(configSection, "inverse_iterations"):
			useInverseIterations = configSection.inverse_iterations
 
 
		self.Debug = False
		if hasattr(configSection, "krylov_debug"):
			if configSection.krylov_debug == True:	
				self.Debug = True
 
		self.CounterOn = False
		if hasattr(configSection, "counter_on"):
		if preconditioner:
			self.Preconditioner = preconditioner
		elif hasattr(configSection, "preconditioner"):
			config = configSection.Config
			preconditionerName = configSection.preconditioner
		if generalizedEigenvalueProblem and not configSection.krylov_method == "KrylovSchur":
			self.ApplyMatrix = self.BaseProblem.Propagator.BasePropagator.MultiplyHamiltonianNoOverlap
		if hasattr(configSection, "matrix_vector_func"):
			if configSection.matrix_vector_func:
				self.ApplyMatrix = configSection.matrix_vector_func

src/m/a/Matplotlib--JJ-s-dev-HEAD/examples/units/basic_units.py   Matplotlib--JJ-s-dev(Download)
    def __call__(self, *args):
        converted_args = []
        arg_units = [self.unit]
        for a in args:
            if hasattr(a, 'get_unit') and not hasattr(a, 'convert_to'):
                # if this arg has a unit type but no conversion ability,
                # this operation is prohibited
                return NotImplemented
 
            if hasattr(a, 'convert_to'):
            else:
                converted_args.append(a)
                if hasattr(a, 'get_unit'):
                    arg_units.append(a.get_unit())
                else:
  def  __getattribute__(self, name):
    if (name.startswith('__')):
       return object.__getattribute__(self, name)
    variable = object.__getattribute__(self, 'value')
    if (hasattr(variable, name) and name not in self.__class__.__dict__):

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