All Samples(108166) | Call(108166) | 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/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/g/a/gaesdk-python-HEAD/lib/PyAMF/doc/tutorials/examples/gateways/appengine/demo/simplejson/decoder.py gaesdk-python(Download)
def JSONConstant(match, context, c=_CONSTANTS):
s = match.group(0)
fn = getattr(context, 'parse_constant', None)
if fn is None:
rval = c[s]
def JSONNumber(match, context):
match = JSONNumber.regex.match(match.string, *match.span())
integer, frac, exp = match.groups()
if frac or exp:
fn = getattr(context, 'parse_float', None) or float
res = fn(integer + (frac or '') + (exp or ''))
else:
fn = getattr(context, 'parse_int', None) or int
def JSONString(match, context):
encoding = getattr(context, 'encoding', None)
return scanstring(match.string, match.end(), encoding)
pattern(r'"')(JSONString)
raise ValueError(errmsg("Expecting property name", s, end))
end += 1
encoding = getattr(context, 'encoding', None)
iterscan = JSONScanner.iterscan
while True:
src/w/e/web2py-HEAD/applications/examples/controllers/global.py web2py(Download)
def get(args):
try:
obj = globals(),get(args[0])
for k in range(1,len(args)):
obj = getattr(obj,args[k])
obj = get(request.args)
if obj:
doc = getattr(obj,'__doc__','no documentation')
keys = dir(obj)
t = type(obj)
c = getattr(obj,'__class__',None)
d = getattr(obj,'__bases__',None)
for key in keys:
a = getattr(obj,key,None)
src/d/j/django-datagrid-1.1/example/datagrid/grids.py django-datagrid(Download)
if len(field_names) > 1:
field_name = field_names.pop(0)
value = getattr(obj, field_name)
if callable(value):
value = value()
while field_names:
field_name = field_names.pop(0)
value = getattr(value, field_name)
if callable(value):
value = value()
else:
# value = getattr(obj, self.field_name)
value = getattr(obj, self.db_field)
if self.data_func:
value = self.data_func(value)
def render_data(self, obj):
# return date(getattr(obj, self.field_name), self.format)
return date(getattr(obj, self.db_field), self.format)
class DateTimeSinceColumn(Column):
def render_data(self, obj):
# return _("%s ago") % timesince(getattr(obj, self.field_name))
return _("%s ago") % timesince(getattr(obj, self.db_field))
src/d/j/django-geoportail-0.4.6/examples/geoportal/templatetags/geoportal_tags.py django-geoportail(Download)
# Default options
if not 'width' in self.options:
self.options['width'] = getattr(settings,
'GEOPORTAL_DEFAULT_WIDTH',
utils.DEFAULT_WIDTH)
if not 'height' in self.options:
self.options['height'] = getattr(settings,
if not 'color' in self.options:
self.options['color'] = getattr(settings,
'GEOPORTAL_DEFAULT_COLOR',
utils.DEFAULT_COLOR)
if not 'opacity' in self.options:
self.options['opacity'] = getattr(settings,
'collection_type': collection_type,
'layers': utils.get_layers((('maps', 1),)),
'default_lon': getattr(settings, 'GEOPORTAL_DEFAULT_LON',
utils.DEFAULT_LON),
'default_lat': getattr(settings, 'GEOPORTAL_DEFAULT_LAT',
src/p/y/PyAMF-0.6.1/doc/tutorials/examples/gateways/appengine/demo/simplejson/decoder.py PyAMF(Download)
def JSONConstant(match, context, c=_CONSTANTS):
s = match.group(0)
fn = getattr(context, 'parse_constant', None)
if fn is None:
rval = c[s]
def JSONNumber(match, context):
match = JSONNumber.regex.match(match.string, *match.span())
integer, frac, exp = match.groups()
if frac or exp:
fn = getattr(context, 'parse_float', None) or float
res = fn(integer + (frac or '') + (exp or ''))
else:
fn = getattr(context, 'parse_int', None) or int
def JSONString(match, context):
encoding = getattr(context, 'encoding', None)
return scanstring(match.string, match.end(), encoding)
pattern(r'"')(JSONString)
raise ValueError(errmsg("Expecting property name", s, end))
end += 1
encoding = getattr(context, 'encoding', None)
iterscan = JSONScanner.iterscan
while True:
src/p/y/PyAMF-HEAD/doc/tutorials/examples/actionscript/google_appengine/simplejson/decoder.py PyAMF(Download)
def JSONConstant(match, context, c=_CONSTANTS):
s = match.group(0)
fn = getattr(context, 'parse_constant', None)
if fn is None:
rval = c[s]
def JSONNumber(match, context):
match = JSONNumber.regex.match(match.string, *match.span())
integer, frac, exp = match.groups()
if frac or exp:
fn = getattr(context, 'parse_float', None) or float
res = fn(integer + (frac or '') + (exp or ''))
else:
fn = getattr(context, 'parse_int', None) or int
def JSONString(match, context):
encoding = getattr(context, 'encoding', None)
return scanstring(match.string, match.end(), encoding)
pattern(r'"')(JSONString)
raise ValueError(errmsg("Expecting property name", s, end))
end += 1
encoding = getattr(context, 'encoding', None)
iterscan = JSONScanner.iterscan
while True:
src/n/e/neo-0.2.1/neo/core/irregularlysampledsignal.py neo(Download)
def __array_finalize__(self, obj):
super(IrregularlySampledSignal, self).__array_finalize__(obj)
self.times = getattr(obj, 'times', None)
# The additional arguments
self.annotations = getattr(obj, 'annotations', None)
# Globally recommended attributes
self.name = getattr(obj, 'name', None)
self.file_origin = getattr(obj, 'file_origin', None)
self.name = getattr(obj, 'name', None)
self.file_origin = getattr(obj, 'file_origin', None)
self.description = getattr(obj, 'description', None)
def __repr__(self):
src/c/l/clearversion-HEAD/trunk/clearVersion/etc/subversion/hooks/examples/mailer.py clearversion(Download)
self._groups.append(section)
else:
section_ob = getattr(self, section)
for option in cp.options(section):
# get the raw value -- we use the same format for *our* interpolation
if not hasattr(ob, part):
return None
ob = getattr(ob, part)
return ob
value = None
if group:
sub = getattr(self, group)
value = getattr(sub, option, None)
if value is None:
value = getattr(self.defaults, option, '')
src/p/s/PSI-0.3b2/examples/process_details.py PSI(Download)
print fmt %('Process ID', p.pid)
print fmt %('Parent Process ID', p.ppid)
print fmt %('Executable', getattr(p, 'exe', 'N/A'))
print fmt %('Command', p.command)
% (grp.getgrgid(p.rgid).gr_name, p.rgid))
print fmt %('Process group', p.pgrp)
print fmt %('Number of threads', getattr(p, 'nthreads', 'N/A'))
print fmt %('Started', str(p.start_time.datetime()))
value = str(e)
else:
all_status = [(s, getattr(psi.process, s)) for s in dir(psi.process)
if s.startswith('PROC_STATUS_')]
proc_status = [s[0] for s in all_status if status == s[1]]
value = ', '.join(proc_status)
print fmt %('Status', value)
print fmt %('Terminal device', getattr(p, 'terminal', 'N/A'))
print fmt %('Environment', getattr(p, 'env', 'N/A'))
1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 Next