def _parseLocalVariables(line):
 paren = '-*-'
 start = (line.find(paren) + len(paren))
 end = line.rfind(paren)
 if ((start == (-1)) or (end == (-1))):
  raise ValueError(('%r not a valid local variable declaration' % (line,)))
 items = line[start:end].split(';')
 localVars = {}
 for item in items:
  if (len(item.strip()) == 0):
   continue
  split = item.split(':')
  if (len(split) != 2):
   raise ValueError(('%r contains invalid declaration %r' % (line, item)))
  localVars[split[0].strip()] = split[1].strip()
 return localVars

def _parseLocalVariables ( line ) : paren = '-*-' start = ( line . find ( paren ) + len ( paren ) ) end = line . rfind ( paren ) if ( ( start == ( - 1 ) ) or ( end == ( - 1 ) ) ) : raise ValueError ( ( '%r not a valid local variable declaration' % ( line , ) ) ) items = line [ start : end ] . split ( ';' ) localVars = { } for item in items : if ( len ( item . strip ( ) ) == 0 ) : continue split = item . split ( ':' ) if ( len ( split ) != 2 ) : raise ValueError ( ( '%r contains invalid declaration %r' % ( line , item ) ) ) localVars [ split [ 0 ] . strip ( ) ] = split [ 1 ] . strip ( ) return localVars
accepts a single line in emacs local variable declaration format and returns a dict of all the variables {name: value} .