def parse_docstring_info(text):
 q = '"""|\'\'\''
 p = '({})\\s+([^\\n]+)\\s+\\=+\\s+(.*?)(\\1)'.format(q)
 m = re.search(p, text, re.S)
 if m:
  comment = m.group(3).replace('\n', ' ')
  first_sentence = comment[:(comment.find('.') + 1)]
  return {'docstring': m.group(0), 'title': m.group(2), 'description': m.group(3), 'first_sentence': first_sentence}
 else:
  return {'error': 'Did not find docstring with title at top of file.'}

def parse_docstring_info ( text ) : q = '"""|\'\'\'' p = '({})\\s+([^\\n]+)\\s+\\=+\\s+(.*?)(\\1)' . format ( q ) m = re . search ( p , text , re . S ) if m : comment = m . group ( 3 ) . replace ( '\n' , ' ' ) first_sentence = comment [ : ( comment . find ( '.' ) + 1 ) ] return { 'docstring' : m . group ( 0 ) , 'title' : m . group ( 2 ) , 'description' : m . group ( 3 ) , 'first_sentence' : first_sentence } else : return { 'error' : 'Did not find docstring with title at top of file.' }
parse docstring from text and return an info dict .