def sanitize_help(parser):
 wrapper = textwrap.TextWrapper(width=79)
 parser.description = wrapper.fill(parser.description)
 if (not parser.epilog):
  return parser
 cleanlog = parser.epilog.replace(u':option:', u'').replace(u':program:', u'').replace(u'::', u':').replace(u'``', u'"')
 newlog = prev_section = u''
 for section in cleanlog.split(u'\n\n'):
  if section.startswith(u'    '):
   newlog += (section + u'\n')
  else:
   if prev_section.startswith(u'    '):
    newlog += u'\n'
   newlog += (wrapper.fill(section) + u'\n\n')
  prev_section = section
 parser.epilog = newlog
 return parser

def sanitize_help ( parser ) : wrapper = textwrap . TextWrapper ( width = 79 ) parser . description = wrapper . fill ( parser . description ) if ( not parser . epilog ) : return parser cleanlog = parser . epilog . replace ( u':option:' , u'' ) . replace ( u':program:' , u'' ) . replace ( u'::' , u':' ) . replace ( u'``' , u'"' ) newlog = prev_section = u'' for section in cleanlog . split ( u'\n\n' ) : if section . startswith ( u'    ' ) : newlog += ( section + u'\n' ) else : if prev_section . startswith ( u'    ' ) : newlog += u'\n' newlog += ( wrapper . fill ( section ) + u'\n\n' ) prev_section = section parser . epilog = newlog return parser
remove sphinx directives & reflow text to width of 79 characters .