• 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/d/gdata-2.0.17/samples/apps/marketplace_sample/gdata/gauth.py   gdata(Download)
  signed = private_key.hashAndSign(data)
  # Python2.3 and lower does not have the base64.b64encode function.
  if hasattr(base64, 'b64encode'):
    return base64.b64encode(signed)
  else:
    hashed = hmac.new(hash_key, base_string, sha)
  # Python2.3 does not have base64.b64encode.
  if hasattr(base64, 'b64encode'):
    return base64.b64encode(hashed.digest())
  else:
  signed = private_key.hashAndSign(base_string)
  # Python2.3 does not have base64.b64encode.
  if hasattr(base64, 'b64encode'):
    return base64.b64encode(signed)
  else:

src/g/o/google-data-api-HEAD/samples/oauth/oauth_on_appengine/appengine_utilities/sessions.py   google-data-api(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/m/d/mdn-lib-HEAD/packages/html5lib/examples/parse.py   mdn-lib(Download)
        sys.stdout.write(document.toxml("utf-8"))
    elif opts.tree:
        if not hasattr(document,'__getitem__'): document = [document]
        for fragment in document:
            print parser.tree.testSerializer(fragment).encode("utf-8")

src/n/e/neo-0.2.1/neo/test/iotest/test_exampleio.py   neo(Download)
        for ana in seg.analogsignals:
            self.assertEqual(ana.size, 0)
            assert hasattr(ana, 'lazy_shape')
        for st in seg.spiketrains:
            self.assertEqual(st.size, 0)
            assert hasattr(st, 'lazy_shape')

src/a/r/artie-HEAD/example/applications/scrape.py   artie(Download)
            '\r\n', '\nrequest: ').lstrip()
    file.write(request)
    if hasattr(file, 'flush'):
        file.flush()
    chunks = []
        print >>sys.stderr, 'fetch:', url
    import socket
    if scheme == 'http' or scheme == 'https' and hasattr(socket, 'ssl'):
        if query:
            path += '?' + query
def matchcontent(specimen, desired):
    """Match a string specimen to a desired string or compiled RE."""
    if hasattr(desired, 'match'):
        return desired.match(specimen)
    elif callable(desired):
        if end is None:
            end = len(self)
        if hasattr(start, 'end'):
            start = start.end
        elif start < 0:
            start += self.end
        else:
            start += self.start
        if hasattr(end, 'start'):

src/p/o/polinax-HEAD/libs/external_libs/Genshi-0.5.1/examples/tutorial/geddit/controller.py   polinax(Download)
        finally:
            fileobj.close()
    if hasattr(cherrypy.engine, 'subscribe'): # CherryPy >= 3.1
        cherrypy.engine.subscribe('stop', _save_data)
    else:

src/n/i/NiPy-OLD-HEAD/examples/neurospin/neurospy/GLMTools.py   NiPy-OLD(Download)
    image_data = []
 
    if hasattr(image_path, '__iter__'):
       if len(image_path)==1:
          image_path = image_path[0]
 
    if hasattr(image_path, '__iter__'):

src/s/q/sqlalchemy-HEAD/examples/beaker_caching/meta.py   sqlalchemy(Download)
    def __iter__(self):
        """override __iter__ to pull results from Beaker
           if particular attributes have been configured.
        """
        if hasattr(self, '_cache_parameters'):
 
    """
    if not hasattr(query, '_cache_parameters'):
        raise ValueError("This Query does not have caching parameters configured.")
 
def _set_cache_parameters(query, region, namespace, cache_key):
 
    if hasattr(query, '_cache_parameters'):
        region, namespace, cache_key = query._cache_parameters
        raise ValueError("This query is already configured "

src/s/q/SQLAlchemy-0.7.10/examples/beaker_caching/caching_query.py   SQLAlchemy(Download)
 
        """
        if hasattr(self, '_cache_parameters'):
            return self.get_value(createfunc=lambda: list(Query.__iter__(self)))
        else:
 
    """
    if not hasattr(query, '_cache_parameters'):
        raise ValueError("This Query does not have caching parameters configured.")
 
def _set_cache_parameters(query, region, namespace, cache_key):
 
    if hasattr(query, '_cache_parameters'):
        region, namespace, cache_key = query._cache_parameters
        raise ValueError("This query is already configured "

src/p/y/pyqtgraph-0.9.7/examples/multiplePlotSpeedTest.py   pyqtgraph(Download)
 
## Plot and clear 5 times, printing the time it took
if hasattr(pg, 'arrayToQPath'):
    for i in range(5):
        plt.clear()
if __name__ == '__main__':
    import sys
    if (sys.flags.interactive != 1) or not hasattr(QtCore, 'PYQT_VERSION'):
        QtGui.QApplication.instance().exec_()
 

Previous  3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11  Next