• 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/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__',{}))
    __getattr__ = lambda self, name: _swig_getattr(self, ExampleInterface_IntVar, name)
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__',{}))
    __getattr__ = lambda self, name: _swig_getattr(self, ExampleInterface_Min, name)
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__ = {}
    for _s in [ExampleInterface_Expression]: __swig_getmethods__.update(getattr(_s,'__swig_getmethods__',{}))
    __getattr__ = lambda self, name: _swig_getattr(self, ExampleInterface_Max, name)
class ExampleInterface_AllDiff(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_AllDiff, name, value)
    __swig_getmethods__ = {}
    for _s in [ExampleInterface_Expression]: __swig_getmethods__.update(getattr(_s,'__swig_getmethods__',{}))
    __getattr__ = lambda self, name: _swig_getattr(self, ExampleInterface_AllDiff, name)
class ExampleInterface_Gcc(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_Gcc, name, value)
    __swig_getmethods__ = {}
    for _s in [ExampleInterface_Expression]: __swig_getmethods__.update(getattr(_s,'__swig_getmethods__',{}))
    __getattr__ = lambda self, name: _swig_getattr(self, ExampleInterface_Gcc, name)
class ExampleInterface_Element(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_Element, name, value)
    __swig_getmethods__ = {}
    for _s in [ExampleInterface_Expression]: __swig_getmethods__.update(getattr(_s,'__swig_getmethods__',{}))
    __getattr__ = lambda self, name: _swig_getattr(self, ExampleInterface_Element, name)
class ExampleInterface_LeqLex(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_LeqLex, name, value)
    __swig_getmethods__ = {}
    for _s in [ExampleInterface_Expression]: __swig_getmethods__.update(getattr(_s,'__swig_getmethods__',{}))
    __getattr__ = lambda self, name: _swig_getattr(self, ExampleInterface_LeqLex, name)
class ExampleInterface_LessLex(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_LessLex, name, value)
    __swig_getmethods__ = {}
    for _s in [ExampleInterface_Expression]: __swig_getmethods__.update(getattr(_s,'__swig_getmethods__',{}))
    __getattr__ = lambda self, name: _swig_getattr(self, ExampleInterface_LessLex, name)
class ExampleInterface_Sum(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_Sum, name, value)
    __swig_getmethods__ = {}
    for _s in [ExampleInterface_Expression]: __swig_getmethods__.update(getattr(_s,'__swig_getmethods__',{}))
    __getattr__ = lambda self, name: _swig_getattr(self, ExampleInterface_Sum, name)
class ExampleInterface_binop(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_binop, name, value)
    __swig_getmethods__ = {}
    for _s in [ExampleInterface_Expression]: __swig_getmethods__.update(getattr(_s,'__swig_getmethods__',{}))
    __getattr__ = lambda self, name: _swig_getattr(self, ExampleInterface_binop, name)
class ExampleInterface_mul(ExampleInterface_binop):
    __swig_setmethods__ = {}
    for _s in [ExampleInterface_binop]: __swig_setmethods__.update(getattr(_s,'__swig_setmethods__',{}))
    __setattr__ = lambda self, name, value: _swig_setattr(self, ExampleInterface_mul, name, value)
    __swig_getmethods__ = {}
    for _s in [ExampleInterface_binop]: __swig_getmethods__.update(getattr(_s,'__swig_getmethods__',{}))
    __getattr__ = lambda self, name: _swig_getattr(self, ExampleInterface_mul, name)
class ExampleInterface_div(ExampleInterface_binop):
    __swig_setmethods__ = {}
    for _s in [ExampleInterface_binop]: __swig_setmethods__.update(getattr(_s,'__swig_setmethods__',{}))
    __setattr__ = lambda self, name, value: _swig_setattr(self, ExampleInterface_div, name, value)
    __swig_getmethods__ = {}
    for _s in [ExampleInterface_binop]: __swig_getmethods__.update(getattr(_s,'__swig_getmethods__',{}))
    __getattr__ = lambda self, name: _swig_getattr(self, ExampleInterface_div, name)
class ExampleInterface_mod(ExampleInterface_binop):
    __swig_setmethods__ = {}
    for _s in [ExampleInterface_binop]: __swig_setmethods__.update(getattr(_s,'__swig_setmethods__',{}))
    __setattr__ = lambda self, name, value: _swig_setattr(self, ExampleInterface_mod, name, value)
    __swig_getmethods__ = {}
    for _s in [ExampleInterface_binop]: __swig_getmethods__.update(getattr(_s,'__swig_getmethods__',{}))
    __getattr__ = lambda self, name: _swig_getattr(self, ExampleInterface_mod, name)
class ExampleInterface_and(ExampleInterface_binop):
    __swig_setmethods__ = {}
    for _s in [ExampleInterface_binop]: __swig_setmethods__.update(getattr(_s,'__swig_setmethods__',{}))
    __setattr__ = lambda self, name, value: _swig_setattr(self, ExampleInterface_and, name, value)
    __swig_getmethods__ = {}
    for _s in [ExampleInterface_binop]: __swig_getmethods__.update(getattr(_s,'__swig_getmethods__',{}))
    __getattr__ = lambda self, name: _swig_getattr(self, ExampleInterface_and, name)
class ExampleInterface_or(ExampleInterface_binop):
    __swig_setmethods__ = {}
    for _s in [ExampleInterface_binop]: __swig_setmethods__.update(getattr(_s,'__swig_setmethods__',{}))
    __setattr__ = lambda self, name, value: _swig_setattr(self, ExampleInterface_or, name, value)
    __swig_getmethods__ = {}
    for _s in [ExampleInterface_binop]: __swig_getmethods__.update(getattr(_s,'__swig_getmethods__',{}))
    __getattr__ = lambda self, name: _swig_getattr(self, ExampleInterface_or, name)
class ExampleInterface_eq(ExampleInterface_binop):
    __swig_setmethods__ = {}
    for _s in [ExampleInterface_binop]: __swig_setmethods__.update(getattr(_s,'__swig_setmethods__',{}))
    __setattr__ = lambda self, name, value: _swig_setattr(self, ExampleInterface_eq, name, value)
    __swig_getmethods__ = {}
    for _s in [ExampleInterface_binop]: __swig_getmethods__.update(getattr(_s,'__swig_getmethods__',{}))
    __getattr__ = lambda self, name: _swig_getattr(self, ExampleInterface_eq, name)
class ExampleInterface_ne(ExampleInterface_binop):
    __swig_setmethods__ = {}
    for _s in [ExampleInterface_binop]: __swig_setmethods__.update(getattr(_s,'__swig_setmethods__',{}))
    __setattr__ = lambda self, name, value: _swig_setattr(self, ExampleInterface_ne, name, value)
    __swig_getmethods__ = {}
    for _s in [ExampleInterface_binop]: __swig_getmethods__.update(getattr(_s,'__swig_getmethods__',{}))
    __getattr__ = lambda self, name: _swig_getattr(self, ExampleInterface_ne, name)
class ExampleInterface_le(ExampleInterface_binop):
    __swig_setmethods__ = {}
    for _s in [ExampleInterface_binop]: __swig_setmethods__.update(getattr(_s,'__swig_setmethods__',{}))
    __setattr__ = lambda self, name, value: _swig_setattr(self, ExampleInterface_le, name, value)
    __swig_getmethods__ = {}
    for _s in [ExampleInterface_binop]: __swig_getmethods__.update(getattr(_s,'__swig_getmethods__',{}))
    __getattr__ = lambda self, name: _swig_getattr(self, ExampleInterface_le, name)
class ExampleInterface_ge(ExampleInterface_binop):
    __swig_setmethods__ = {}
    for _s in [ExampleInterface_binop]: __swig_setmethods__.update(getattr(_s,'__swig_setmethods__',{}))
    __setattr__ = lambda self, name, value: _swig_setattr(self, ExampleInterface_ge, name, value)
    __swig_getmethods__ = {}
    for _s in [ExampleInterface_binop]: __swig_getmethods__.update(getattr(_s,'__swig_getmethods__',{}))
    __getattr__ = lambda self, name: _swig_getattr(self, ExampleInterface_ge, name)
class ExampleInterface_lt(ExampleInterface_binop):
    __swig_setmethods__ = {}
    for _s in [ExampleInterface_binop]: __swig_setmethods__.update(getattr(_s,'__swig_setmethods__',{}))
    __setattr__ = lambda self, name, value: _swig_setattr(self, ExampleInterface_lt, name, value)
    __swig_getmethods__ = {}
    for _s in [ExampleInterface_binop]: __swig_getmethods__.update(getattr(_s,'__swig_getmethods__',{}))
    __getattr__ = lambda self, name: _swig_getattr(self, ExampleInterface_lt, name)
class ExampleInterface_gt(ExampleInterface_binop):
    __swig_setmethods__ = {}
    for _s in [ExampleInterface_binop]: __swig_setmethods__.update(getattr(_s,'__swig_setmethods__',{}))
    __setattr__ = lambda self, name, value: _swig_setattr(self, ExampleInterface_gt, name, value)
    __swig_getmethods__ = {}
    for _s in [ExampleInterface_binop]: __swig_getmethods__.update(getattr(_s,'__swig_getmethods__',{}))
    __getattr__ = lambda self, name: _swig_getattr(self, ExampleInterface_gt, name)
class ExampleInterface_Minimise(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_Minimise, name, value)
    __swig_getmethods__ = {}
    for _s in [ExampleInterface_Expression]: __swig_getmethods__.update(getattr(_s,'__swig_getmethods__',{}))
    __getattr__ = lambda self, name: _swig_getattr(self, ExampleInterface_Minimise, name)
class ExampleInterface_Maximise(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_Maximise, name, value)
    __swig_getmethods__ = {}
    for _s in [ExampleInterface_Expression]: __swig_getmethods__.update(getattr(_s,'__swig_getmethods__',{}))
    __getattr__ = lambda self, name: _swig_getattr(self, ExampleInterface_Maximise, name)

src/c/l/clearversion-HEAD/trunk/clearVersion/etc/subversion/hooks/examples/mailer.py   clearversion(Download)
        if section not in self._predefined:
          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
        value = cp.get(section, option, raw=1)
    for part in string.split(option, '.'):
      if not hasattr(ob, part):
        return None
      ob = getattr(ob, part)
    return ob
 
  def get(self, option, group, params):
    "Get a config value with appropriate substitutions and value mapping."
 
    # find the right value
    value = None
    if group:
      sub = getattr(self, group)
      value = getattr(sub, option, None)
      sub = getattr(self, group)
      value = getattr(sub, option, None)
    if value is None:
      value = getattr(self.defaults, option, '')
 
    # parameterize it
    if params is not None:
      value = value % params
 
    # apply any mapper
    mapper = getattr(self.maps, option, None)
        # then just return the value unchanged.
        setattr(self.maps, optname,
                lambda value,
                       sect=getattr(self, sectname): getattr(sect,
                                                             value.lower(),
                                                             value))
        # mark for removal when all optnames are done
 
    # select the groups that apply to this repository
    for group in self._groups:
      sub = getattr(self, group)
      params = self._default_params
      if hasattr(sub, 'for_repos'):
        match = re.match(sub.for_repos, repos_dir)
 
      # if a matching rule hasn't been given, then use the empty string
      # as it will match all paths
      for_paths = getattr(sub, 'for_paths', '')
      exclude_paths = getattr(sub, 'exclude_paths', None)
      if exclude_paths:
        exclude_paths_re = re.compile(exclude_paths)

src/k/m/kmkey-HEAD/bundles/kmkey-08.03.01/FCKeditor/_zope_help/CPS_examples/connectorCPS.py   kmkey(Download)
    props=getToolByName(context,'portal_properties')
    if hasattr(props,'navtree_properties'):
        props=props.navtree_properties
    rolesSeeUnpublishedContent=getattr(props,'rolesSeeUnpublishedContent',  ['Manager','Reviewer','Owner'])
  except:
    rolesSeeUnpublishedContent = ['Manager','Reviewer','Owner']
 
        if object.meta_type in CPS_FOLDER_TYPE and object.meta_type in all_portal_types  :
 
          #review_state=container.portal_workflow.getInfoFor(object, 'review_state', '')
          start_pub=getattr(object,'effective_date',None)
          end_pub=getattr(object,'expiration_date',None)
          if not ((start_pub and start_pub > DateTime()) or (end_pub and DateTime() > end_pub)):
            results.append(object)
 
 
        titre_data=''
        filename=getattr(data,'filename', '')
        titre_data=filename[max(string.rfind(filename, '/'),
                        string.rfind(filename, '\\'),
                        string.rfind(filename, ':'),

src/k/m/kmkey-HEAD/bundles/kmkey-08.02.02/FCKeditor/_zope_help/CPS_examples/connectorCPS.py   kmkey(Download)
    props=getToolByName(context,'portal_properties')
    if hasattr(props,'navtree_properties'):
        props=props.navtree_properties
    rolesSeeUnpublishedContent=getattr(props,'rolesSeeUnpublishedContent',  ['Manager','Reviewer','Owner'])
  except:
    rolesSeeUnpublishedContent = ['Manager','Reviewer','Owner']
 
        if object.meta_type in CPS_FOLDER_TYPE and object.meta_type in all_portal_types  :
 
          #review_state=container.portal_workflow.getInfoFor(object, 'review_state', '')
          start_pub=getattr(object,'effective_date',None)
          end_pub=getattr(object,'expiration_date',None)
          if not ((start_pub and start_pub > DateTime()) or (end_pub and DateTime() > end_pub)):
            results.append(object)
 
 
        titre_data=''
        filename=getattr(data,'filename', '')
        titre_data=filename[max(string.rfind(filename, '/'),
                        string.rfind(filename, '\\'),
                        string.rfind(filename, ':'),

src/k/m/kmkey-HEAD/bundles/kmkey-08.01.02/FCKeditor/_zope_help/CPS_examples/connectorCPS.py   kmkey(Download)
    props=getToolByName(context,'portal_properties')
    if hasattr(props,'navtree_properties'):
        props=props.navtree_properties
    rolesSeeUnpublishedContent=getattr(props,'rolesSeeUnpublishedContent',  ['Manager','Reviewer','Owner'])
  except:
    rolesSeeUnpublishedContent = ['Manager','Reviewer','Owner']
 
        if object.meta_type in CPS_FOLDER_TYPE and object.meta_type in all_portal_types  :
 
          #review_state=container.portal_workflow.getInfoFor(object, 'review_state', '')
          start_pub=getattr(object,'effective_date',None)
          end_pub=getattr(object,'expiration_date',None)
          if not ((start_pub and start_pub > DateTime()) or (end_pub and DateTime() > end_pub)):
            results.append(object)
 
 
        titre_data=''
        filename=getattr(data,'filename', '')
        titre_data=filename[max(string.rfind(filename, '/'),
                        string.rfind(filename, '\\'),
                        string.rfind(filename, ':'),

src/k/m/kmkey-HEAD/bundles/ajterrassa_participacio/FCKeditor/_zope_help/CPS_examples/connectorCPS.py   kmkey(Download)
    props=getToolByName(context,'portal_properties')
    if hasattr(props,'navtree_properties'):
        props=props.navtree_properties
    rolesSeeUnpublishedContent=getattr(props,'rolesSeeUnpublishedContent',  ['Manager','Reviewer','Owner'])
  except:
    rolesSeeUnpublishedContent = ['Manager','Reviewer','Owner']
 
        if object.meta_type in CPS_FOLDER_TYPE and object.meta_type in all_portal_types  :
 
          #review_state=container.portal_workflow.getInfoFor(object, 'review_state', '')
          start_pub=getattr(object,'effective_date',None)
          end_pub=getattr(object,'expiration_date',None)
          if not ((start_pub and start_pub > DateTime()) or (end_pub and DateTime() > end_pub)):
            results.append(object)
 
 
        titre_data=''
        filename=getattr(data,'filename', '')
        titre_data=filename[max(string.rfind(filename, '/'),
                        string.rfind(filename, '\\'),
                        string.rfind(filename, ':'),

src/d/j/django-datagrid-1.1/example/datagrid/grids.py   django-datagrid(Download)
        field_names = self.field_name.split('.')
        if len(field_names) > 1:
            field_name = field_names.pop(0)
            value = getattr(obj, field_name)
            if callable(value):
                value = value()
            if value is None:
                #NO further processing is possible, so bailout early.
                return value
            while field_names:
                field_name = field_names.pop(0)
                value = getattr(value, field_name)
                    return value
        else:
            # value = getattr(obj, self.field_name)
            value = getattr(obj, self.db_field)
        if self.data_func:
            value = self.data_func(value)
        if callable(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):
    """
    A column that renders a date or time relative to now.
    """
    def __init__(self, label, sortable=True, *args, **kwargs):
        Column.__init__(self, label, sortable=sortable, *args, **kwargs)
 
    def render_data(self, obj):
        # return _("%s ago") % timesince(getattr(obj, self.field_name))
        return _("%s ago") % timesince(getattr(obj, self.db_field))
 
 
        for attr in dir(self):
            column = getattr(self, attr)
            if isinstance(column, Column):
                self.all_columns.append(column)
                column.datagrid = self
        self.default_sort = self.all_columns[0].id
 
        #Get the meta fields
        meta = getattr(self, 'Meta', None)
        page_size = request.GET.get('page_size', None)
        if page_size:
            try:
                pass
 
        #Handle controls
        self.pagination_control_widget = getattr(meta, 'pagination_control_widget', False)
        self.get_pdf_link = getattr(meta, 'get_pdf_link', False)
        self.get_csv_link = getattr(meta, 'get_csv_link', False)
        self.filter_fields = getattr(meta, 'filter_fields', [])
        self.search_fields = getattr(meta, 'search_fields', [])
        self.filtering_options = {}
        if self.filter_fields:
            filtering_options = {}
            #TODO: This is very costly for large querysets so we may want to cache this, or do this in SQL
            for field in self.filter_fields:
                filtering_options[field] = set([getattr(el, field) for el in queryset])
 
                if self.profile_sort_field:
                    profile_sort_list = \
                        getattr(profile, self.profile_sort_field, None)
 
                if self.profile_columns_field:
                    profile_columns_list = \
                        getattr(profile, self.profile_columns_field, None)
 
        for colname in colnames:
            try:
                column = getattr(self, colname.id)
            except AttributeError:
                # The user specified a column that doesn't exist. Skip it.
                continue

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]
    else:
        rval = fn(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)
 
WHITESPACE = re.compile(r'\s*', FLAGS)
 
    if nextchar != '"':
        raise ValueError(errmsg("Expecting property name", s, end))
    end += 1
    encoding = getattr(context, 'encoding', None)
    iterscan = JSONScanner.iterscan
    while True:
        key, end = scanstring(s, end, encoding)
        end += 1
        if nextchar != '"':
            raise ValueError(errmsg("Expecting property name", s, end - 1))
    object_hook = getattr(context, 'object_hook', None)
    if object_hook is not None:
        pairs = object_hook(pairs)
    return pairs, end

src/c/l/clearversion-HEAD/clearVersion/etc/subversion/hooks/examples/mailer.py   clearversion(Download)
        if section not in self._predefined:
          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
        value = cp.get(section, option, raw=1)
    for part in string.split(option, '.'):
      if not hasattr(ob, part):
        return None
      ob = getattr(ob, part)
    return ob
 
  def get(self, option, group, params):
    "Get a config value with appropriate substitutions and value mapping."
 
    # find the right value
    value = None
    if group:
      sub = getattr(self, group)
      value = getattr(sub, option, None)
      sub = getattr(self, group)
      value = getattr(sub, option, None)
    if value is None:
      value = getattr(self.defaults, option, '')
 
    # parameterize it
    if params is not None:
      value = value % params
 
    # apply any mapper
    mapper = getattr(self.maps, option, None)
        # then just return the value unchanged.
        setattr(self.maps, optname,
                lambda value,
                       sect=getattr(self, sectname): getattr(sect,
                                                             value.lower(),
                                                             value))
        # mark for removal when all optnames are done
 
    # select the groups that apply to this repository
    for group in self._groups:
      sub = getattr(self, group)
      params = self._default_params
      if hasattr(sub, 'for_repos'):
        match = re.match(sub.for_repos, repos_dir)
 
      # if a matching rule hasn't been given, then use the empty string
      # as it will match all paths
      for_paths = getattr(sub, 'for_paths', '')
      exclude_paths = getattr(sub, 'exclude_paths', None)
      if exclude_paths:
        exclude_paths_re = re.compile(exclude_paths)

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)
        if kwa:
            self.assertEquals(kwa.get('x'), 5)
            self.assertEquals(kwa.get('y'), 6)
            self.assertEquals(kwa.get('z'), 7)
 
        try:
            c = Kwargs2(x=5, y=6)
            self.assertTrue(hasattr(c, 'kwargs'))
            kwa = getattr(c, 'kwargs', None)
 
        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)
            self.assertEquals(kwa.get('y'), 6)
            self.assertEquals(kwa.get('z'), 8)
 
 
        c.set_kwargs2(x=5, y=6)
        self.assertTrue(hasattr(c, 'kwargs'))
        kwa = getattr(c, 'kwargs', None)
 
        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)
            self.assertEquals(kwa.get('y'), 6)
    def set_kwargs3(self, **kwargs):
        skw = getattr(self, "set_kwargs")
        skw(**kwargs)
 
def kw_args(**kwargs):
    return kwargs
 

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