Did I find the right examples for you? yes no

All Samples(113107)  |  Call(113107)  |  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/z/c/zc.ajaxform-0.7.0/src/zc/ajaxform/calculator_subapplication_example.py   zc.ajaxform(Download)
    def value(self):
        return dict(value=getattr(self.context, 'calculator_value', 0))
 
    def do_add(self, value):
        value += getattr(self.context, 'calculator_value', 0)

src/p/y/pyke-HEAD/examples/web_framework/wsgi_app.py   pyke(Download)
    def __getattr__(self, attr):
        return getattr(self.cursor, attr)
 
def init(db_connection, trace_sql=False):
    global Engine, Db_connection, Db_cursor

src/b/o/Box2D-2.3b0/examples/settings.py   Box2D(Download)
 
for opt_name in list_options:
    value = getattr(fwSettings, opt_name)
    if isinstance(value, bool):
        if value:

src/n/u/Numberjack-HEAD/solvers/ExampleInterface/python/ExampleInterface.py   Numberjack(Download)
class ExampleInterface_IntVar(ExampleInterface_Expression):
    __swig_setmethods__ = {}
    for _s in [ExampleInterface_Expression]: __swig_setmethods__.update(getattr(_s,'__swig_setmethods__',{}))
    __setattr__ = lambda self, name, value: _swig_setattr(self, ExampleInterface_IntVar, name, value)
    __swig_getmethods__ = {}
    for _s in [ExampleInterface_Expression]: __swig_getmethods__.update(getattr(_s,'__swig_getmethods__',{}))
class ExampleInterface_Min(ExampleInterface_Expression):
    __swig_setmethods__ = {}
    for _s in [ExampleInterface_Expression]: __swig_setmethods__.update(getattr(_s,'__swig_setmethods__',{}))
    __setattr__ = lambda self, name, value: _swig_setattr(self, ExampleInterface_Min, name, value)
    __swig_getmethods__ = {}
    for _s in [ExampleInterface_Expression]: __swig_getmethods__.update(getattr(_s,'__swig_getmethods__',{}))
class ExampleInterface_Max(ExampleInterface_Expression):
    __swig_setmethods__ = {}
    for _s in [ExampleInterface_Expression]: __swig_setmethods__.update(getattr(_s,'__swig_setmethods__',{}))
    __setattr__ = lambda self, name, value: _swig_setattr(self, ExampleInterface_Max, name, value)
    __swig_getmethods__ = {}

src/r/e/remix-2.1.2/examples/capsule/capsule_support.py   remix(Download)
    """
    # Get the average marker duration.
    marker1 = average_duration(getattr(track1.analysis, track1.resampled['rate'])[track1.resampled['index']:track1.resampled['index']+rows(mat1)])
    marker2 = average_duration(getattr(track2.analysis, track2.resampled['rate'])[track2.resampled['index']:track2.resampled['index']+rows(mat2)])
 
def is_valid(track, inter, transition):
    markers = getattr(track.analysis, track.resampled['rate'])
    if len(markers) < 1:
        dur = track.duration
    else:
        return analysis.end_of_fade_in <= s.start and (s.start + s.duration) < analysis.start_of_fade_out
 
    members = getattr(analysis, member) # this is nicer than data.__dict__[member]
    ret = filter(central, members[:]) 
    index = members.index(ret[0]) if ret else 0
                C = min(dur / m.duration, 1)
 
                mat[i, 0:12] += C * np.array(getattr(segments[index], feature))
                index += 1
 

src/p/y/py2app-0.7.3/examples/PyObjC/pbplugin/PyTestPlugin.py   py2app(Download)
    def init(self):
        self = super(PyTestPlugin, self).init()
        print 'class load!!'
        print "Hello from py2app"
        print "frozen", repr(getattr(sys, "frozen", None))

src/d/i/diksel-HEAD/trunk/thirdparty/pyjamasdev/examples/libtest/ArgsTest.py   diksel(Download)
    def testKwArgsInherit(self):
 
        c = KwArgs(x=5, y=6)
        self.assertTrue(hasattr(c, 'kwargs'))
        kwa = getattr(c, 'kwargs', None)
            c = Kwargs2(x=5, y=6)
            self.assertTrue(hasattr(c, 'kwargs'))
            kwa = getattr(c, 'kwargs', None)
            if kwa:
                self.assertEquals(kwa.get('x'), 5)
        c.set_kwargs(x=5, y=6)
        self.assertTrue(hasattr(c, 'kwargs'))
        kwa = getattr(c, 'kwargs', None)
        if kwa:
            self.assertEquals(kwa.get('x'), 5)
        c.set_kwargs2(x=5, y=6)
        self.assertTrue(hasattr(c, 'kwargs'))
        kwa = getattr(c, 'kwargs', None)
        if kwa:
            self.assertEquals(kwa.get('x'), 5)
        c.set_kwargs3(x=5, y=6)
        self.assertTrue(hasattr(c, 'kwargs'))
        kwa = getattr(c, 'kwargs', None)
        if kwa:
            self.assertEquals(kwa.get('x'), 5)

src/q/u/quickfix-HEAD/trunk/quickfix/src/python/quickfix.py   quickfix(Download)
class DataDictionaryNotFound(Exception):
    __swig_setmethods__ = {}
    for _s in [Exception]: __swig_setmethods__.update(getattr(_s,'__swig_setmethods__',{}))
    __setattr__ = lambda self, name, value: _swig_setattr(self, DataDictionaryNotFound, name, value)
    __swig_getmethods__ = {}
    for _s in [Exception]: __swig_getmethods__.update(getattr(_s,'__swig_getmethods__',{}))
class FieldNotFound(Exception):
    __swig_setmethods__ = {}
    for _s in [Exception]: __swig_setmethods__.update(getattr(_s,'__swig_setmethods__',{}))
    __setattr__ = lambda self, name, value: _swig_setattr(self, FieldNotFound, name, value)
    __swig_getmethods__ = {}
    for _s in [Exception]: __swig_getmethods__.update(getattr(_s,'__swig_getmethods__',{}))
class FieldConvertError(Exception):
    __swig_setmethods__ = {}
    for _s in [Exception]: __swig_setmethods__.update(getattr(_s,'__swig_setmethods__',{}))
    __setattr__ = lambda self, name, value: _swig_setattr(self, FieldConvertError, name, value)
    __swig_getmethods__ = {}

src/t/w/Twisted-12.3.0/doc/core/examples/cred.py   Twisted(Download)
    def lineReceived(self, line):
        f = getattr(self, 'cmd_' + line.upper().split()[0])
        if f:
            try:
                f(*line.split()[1:])

src/b/a/badger-lib-HEAD/packages/python-openid/examples/djopenid/consumer/views.py   badger-lib(Download)
 
# List of (name, uri) for use in generating the request form.
POLICY_PAIRS = [(p, getattr(pape, p))
                for p in PAPE_POLICIES]
 
                policy_attr = k[len(policy_prefix):]
                if policy_attr in PAPE_POLICIES:
                    requested_policies.append(getattr(pape, policy_attr))
 
        if requested_policies:

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