parameters: (self, option)
return_statement: return "".join(result)
docstring: A copy of the normal optparse.IndentedHelpFormatter.format_option()
          method.  This has been snarfed so we can modify text wrapping to
          out liking:
  
          --  add our own regular expression that doesn't break on hyphens
              (so things like --no-print-directory don't get broken);
  
          --  wrap the list of options themselves when it's too long
              (the wrapper.fill(opts) call below);
  
          --  set the subsequent_indent when wrapping the help_text.
docstring_summary: A copy of the normal optparse.IndentedHelpFormatter.format_option()
          method.  This has been snarfed so we can modify text wrapping to
          out liking:
docstring_tokens: A copy of the normal optparse . IndentedHelpFormatter . format_option () method . This has been snarfed so we can modify text wrapping to out liking :
function: def format_option(self, option):
          """
          A copy of the normal optparse.IndentedHelpFormatter.format_option()
          method.  This has been snarfed so we can modify text wrapping to
          out liking:
  
          --  add our own regular expression that doesn't break on hyphens
              (so things like --no-print-directory don't get broken);
  
          --  wrap the list of options themselves when it's too long
              (the wrapper.fill(opts) call below);
  
          --  set the subsequent_indent when wrapping the help_text.
          """
          # The help for each option consists of two parts:
          #   * the opt strings and metavars
          #     eg. ("-x", or "-fFILENAME, --file=FILENAME")
          #   * the user-supplied help string
          #     eg. ("turn on expert mode", "read data from FILENAME")
          #
          # If possible, we write both of these on the same line:
          #   -x      turn on expert mode
          #
          # But if the opt string list is too long, we put the help
          # string on a second line, indented to the same column it would
          # start in if it fit on the first line.
          #   -fFILENAME, --file=FILENAME
          #           read data from FILENAME
          result = []
  
          opts = self.option_strings[option]
          opt_width = self.help_position - self.current_indent - 2
          if len(opts) > opt_width:
              wrapper = textwrap.TextWrapper(width=self.width,
                                             initial_indent = '  ',
                                             subsequent_indent = '  ')
              wrapper.wordsep_re = no_hyphen_re
              opts = wrapper.fill(opts) + '\n'
              indent_first = self.help_position
          else:                       # start help on same line as opts
              opts = "%*s%-*s  " % (self.current_indent, "", opt_width, opts)
              indent_first = 0
          result.append(opts)
          if option.help:
  
              help_text = self.expand_default(option)
  
              # SCons:  indent every line of the help text but the first.
              wrapper = textwrap.TextWrapper(width=self.help_width,
                                             subsequent_indent = '  ')
              wrapper.wordsep_re = no_hyphen_re
              help_lines = wrapper.wrap(help_text)
              result.append("%*s%s\n" % (indent_first, "", help_lines[0]))
              for line in help_lines[1:]:
                  result.append("%*s%s\n" % (self.help_position, "", line))
          elif opts[-1] != "\n":
              result.append("\n")
          return "".join(result)
function_tokens: def format_option ( self , option ) : # The help for each option consists of two parts: #   * the opt strings and metavars #     eg. ("-x", or "-fFILENAME, --file=FILENAME") #   * the user-supplied help string #     eg. ("turn on expert mode", "read data from FILENAME") # # If possible, we write both of these on the same line: #   -x      turn on expert mode # # But if the opt string list is too long, we put the help # string on a second line, indented to the same column it would # start in if it fit on the first line. #   -fFILENAME, --file=FILENAME #           read data from FILENAME result = [ ] opts = self . option_strings [ option ] opt_width = self . help_position - self . current_indent - 2 if len ( opts ) > opt_width : wrapper = textwrap . TextWrapper ( width = self . width , initial_indent = '  ' , subsequent_indent = '  ' ) wrapper . wordsep_re = no_hyphen_re opts = wrapper . fill ( opts ) + '\n' indent_first = self . help_position else : # start help on same line as opts opts = "%*s%-*s  " % ( self . current_indent , "" , opt_width , opts ) indent_first = 0 result . append ( opts ) if option . help : help_text = self . expand_default ( option ) # SCons:  indent every line of the help text but the first. wrapper = textwrap . TextWrapper ( width = self . help_width , subsequent_indent = '  ' ) wrapper . wordsep_re = no_hyphen_re help_lines = wrapper . wrap ( help_text ) result . append ( "%*s%s\n" % ( indent_first , "" , help_lines [ 0 ] ) ) for line in help_lines [ 1 : ] : result . append ( "%*s%s\n" % ( self . help_position , "" , line ) ) elif opts [ - 1 ] != "\n" : result . append ( "\n" ) return "" . join ( result )