parameters: (self, desc)
docstring: Add a description.
docstring_summary: Add a description.
docstring_tokens: Add a description .
function: def add_desc(self, desc):
          """Add a description."""
          # TODO allow index to vary
          const_attrs = ["index", "error", "convert", "size_str"]
          if desc.name not in self.switches:
              self.switches[desc.name] = []
              self.switch_constants[desc.name] = {}
              for attr in const_attrs:
                  self.switch_constants[desc.name][attr] = None
  
          # some attributes, like error code, should be the same for all descs
          consts = self.switch_constants[desc.name]
          for attr in const_attrs:
              if getattr(desc, attr) is not None:
                  if (consts[attr] is not None and
                      consts[attr] != getattr(desc, attr)):
                      raise SpecError("mismatch %s for %s" % (attr, desc.name))
                  consts[attr] = getattr(desc, attr)
  
          self.switches[desc.name].append(desc)
function_tokens: def add_desc ( self , desc ) : # TODO allow index to vary const_attrs = [ "index" , "error" , "convert" , "size_str" ] if desc . name not in self . switches : self . switches [ desc . name ] = [ ] self . switch_constants [ desc . name ] = { } for attr in const_attrs : self . switch_constants [ desc . name ] [ attr ] = None # some attributes, like error code, should be the same for all descs consts = self . switch_constants [ desc . name ] for attr in const_attrs : if getattr ( desc , attr ) is not None : if ( consts [ attr ] is not None and consts [ attr ] != getattr ( desc , attr ) ) : raise SpecError ( "mismatch %s for %s" % ( attr , desc . name ) ) consts [ attr ] = getattr ( desc , attr ) self . switches [ desc . name ] . append ( desc )