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

All Samples(106874)  |  Call(106874)  |  Derive(0)  |  Import(0)
getattr(object, name[, default]) -> value

Get a named attribute from an object; getattr(x, 'y') is equivalent to x.y.
When a default argument is given, it is returned when the attribute doesn't
exist; without it, an exception is raised in that case.

src/n/o/notmm-0.4.1/examples/lib/satchmo_store/shop/utils.py   notmm(Download)
def is_multihost_enabled():
    return getattr(SiteManager, 'MULTIHOST', False)
 

src/p/y/py2exe-HEAD/trunk/py2exe/py2exe/samples/simple/hello.py   py2exe(Download)
import sys
 
print "Hello from py2exe"
 
print "frozen", repr(getattr(sys, "frozen", None))
 
print "sys.path", sys.path

src/r/e/REST-Client-HEAD/sample/webapi/rest.py   REST-Client(Download)
    def __addParams(self,name,key,value,add):
        """
        辞書形式のパラメーターを追加
 
        """
        if self.cursor == -1:
            target=getattr(self,name,None)
          mod = __import__(name,{},())
          components=name.split(".")
          for comp in components[1:]:
              mod = getattr(mod, comp)
 
          return mod
 

src/d/i/diksel-HEAD/thirdparty/pyjamasdev/examples/libtest/ClassTest.py   diksel(Download)
        self.assertEquals(obj1.z, expected_result3, "Did not inherit property from grandparent")
        self.assertEquals(obj2.z, expected_result3, "Did not inherit property from grandparent")
 
        res = getattr(obj1, "r", None)
        self.assertNotEqual(res, expected_result4, "ExampleGrandParentConstructor.__init__() was called (%s)" % res)
        self.assertNotEqual(getattr(obj2, "r", None), expected_result4, "ExampleGrandParentConstructor.__init__() was called")
 

src/p/y/pygtkmvc-HEAD/trunk/gtkmvco/examples/custom_widget/htmltextview.py   pygtkmvc(Download)
    def __motion_notify_event(self, widget, event):
        x, y, _ = widget.window.get_pointer()
        x, y = widget.window_to_buffer_coords(gtk.TEXT_WINDOW_TEXT, x, y)
        tags = widget.get_iter_at_location(x, y).get_tags()
        for tag in tags:
            if getattr(tag, 'is_anchor', False):
                is_over_anchor = True

src/i/r/ironruby-HEAD/Languages/IronPython/Samples/IronTunes/IronTunesWindow.py   ironruby(Download)
    def enliven(self, w):
        self.w = w
        controls = [n for n in Walk(w) if isinstance(n, Button) or isinstance(n, TextBox) or isinstance(n, ListView)]
        for i in controls:
            if (isinstance(i,Button)):
                if (hasattr(self, "on_" + i.Name)):
                    i.Click += getattr(self, "on_" + i.Name)
            elif (isinstance(i,ListView)):
                if (i.Name == "LibraryView"):
                    i.MouseDown += getattr(self, "on_LibraryViewMouseDown")
 
        #set up a timer to refresh the position indicator
        dt = System.Windows.Threading.DispatcherTimer()
        dt.Tick += getattr(self,"on_tick")
        dt.Interval = System.TimeSpan.FromMilliseconds(100)
        dt.Start()
 

src/p/y/python-xmpp-server-HEAD/examples/chat-server.py   python-xmpp-server(Download)
    def roster(self, iq):
        """A roster is this account's list of contacts; it may be
        fetched or updated."""
 
        roster = self.rosters.get(self)
        method = getattr(self, '%s_roster' % iq.get('type'))
        return method and method(iq, roster)
    def send(self, conn, to, elem):
        """Send a subscription request or response."""
 
        method = getattr(self, 'send_%s' % elem.get('type'), None)
        return method and method(conn, xml.jid(to).bare, elem)
 
    def send_subscribe(self, conn, contact, pres):
    def recv(self, conn, elem):
        """Handle subscription requests or responses to this account.
        Reply to probes without involving the client."""
 
        method = getattr(self, 'recv_%s' % elem.get('type'), None)
        return method and method(conn, elem)
 

src/c/b/cbflib-HEAD/trunk/CBFlib_bleeding_edge/ply-3.2/example/yply/ylex.py   cbflib(Download)
def t_SECTION(t):
    r'%%'
    if getattr(t.lexer,"lastsection",0):
         t.value = t.lexer.lexdata[t.lexpos+2:]
         t.lexer.lexpos = len(t.lexer.lexdata)
    else:
         t.lexer.lastsection = 0

src/m/o/modu-1.0.2/examples/modusite/modusite/editable/itemdefs/release_itemdef.py   modu(Download)
def release_prewrite_callback(req, frm, storable):
	filename = getattr(storable, 'filename', '')
	if(filename.endswith('.tar.gz')):
		storable.load_tarball_info(req, filename)
	return True
 
__itemdef__ = define.itemdef(

src/m/o/modu-1.0.2/examples/modusite/modusite/editable/itemdefs/faq_itemdef.py   modu(Download)
def update_answered_by(req, form, storable):
	if not(getattr(storable, 'answered_by', None)):
		storable.answered_by = req.user.get_id()
		output = req.user.first + ' ' + req.user.last
		form['answered_by'](value=storable.answered_by)
	return True
 

Previous  5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13  Next