parameters: (self, set)
docstring: set a single parameter
docstring_summary: set a single parameter
docstring_tokens: set a single parameter
function: def set_one(self, set):
          '''set a single parameter'''
          v = set.split('=')
          if len(v) != 2:
              print("Error: set takes form NAME=VALUE")
              sys.exit(1)
          param_name = to_bytes(v[0].upper())
          param_value = to_bytes(v[1])
          
          contents = self.contents()
          lines = contents.strip().split(b'\n')
          changed = False
          for i in range(len(lines)):
              a = self.split_multi(lines[i], b", =\t")
              if len(a) != 2:
                  continue
              if a[0].upper() == param_name:
                  separator = to_bytes(lines[i][len(param_name)])
                  lines[i] = b'%s%s%s' % (param_name, separator, param_value)
                  changed = True
          if not changed:
              lines.append(to_bytes('%s=%s' % (to_ascii(param_name), to_ascii(param_value))))
          contents = b'\n'.join(lines)
          contents = contents.lstrip() + b'\n'
          self.set_contents(contents)
function_tokens: def set_one ( self , set ) : v = set . split ( '=' ) if len ( v ) != 2 : print ( "Error: set takes form NAME=VALUE" ) sys . exit ( 1 ) param_name = to_bytes ( v [ 0 ] . upper ( ) ) param_value = to_bytes ( v [ 1 ] ) contents = self . contents ( ) lines = contents . strip ( ) . split ( b'\n' ) changed = False for i in range ( len ( lines ) ) : a = self . split_multi ( lines [ i ] , b", =\t" ) if len ( a ) != 2 : continue if a [ 0 ] . upper ( ) == param_name : separator = to_bytes ( lines [ i ] [ len ( param_name ) ] ) lines [ i ] = b'%s%s%s' % ( param_name , separator , param_value ) changed = True if not changed : lines . append ( to_bytes ( '%s=%s' % ( to_ascii ( param_name ) , to_ascii ( param_value ) ) ) ) contents = b'\n' . join ( lines ) contents = contents . lstrip ( ) + b'\n' self . set_contents ( contents )