parameters: (comment, indent, translate_map = None, maxchars = 80)
return_statement: return result
docstring: Return the comments array as a formatted string.
docstring_summary: Return the comments array as a formatted string.
docstring_tokens: Return the comments array as a formatted string .
function: def format_comment(comment, indent, translate_map = None, maxchars = 80):
      """ Return the comments array as a formatted string. """
      result = ''
      wrapme = ''
      hasemptyline = False
      for line in comment:
          # if the line starts with a leading space, remove that space
          if not line is None and len(line) > 0 and line[0:1] == ' ':
              line = line[1:]
              didremovespace = True
          else:
              didremovespace = False
  
          if line is None or len(line) == 0 or line[0:1] == ' ' \
              or line[0:1] == '/':
              # the previous paragraph, if any, has ended
              if len(wrapme) > 0:
                  if not translate_map is None:
                      # apply the translation
                      for key in translate_map.keys():
                          wrapme = wrapme.replace(key, translate_map[key])
                  # output the previous paragraph
                  result += wrap_text(wrapme, indent+'// ', maxchars)
                  wrapme = ''
  
          if not line is None:
              if len(line) == 0 or line[0:1] == ' ' or line[0:1] == '/':
                  # blank lines or anything that's further indented should be
                  # output as-is
                  result += indent+'//'
                  if len(line) > 0:
                      if didremovespace:
                          result += ' '+line
                      else:
                          result += line
                  result += '\n'
              else:
                  # add to the current paragraph
                  wrapme += line+' '
          else:
              # output an empty line
              hasemptyline = True
              result += '\n'
  
      if len(wrapme) > 0:
          if not translate_map is None:
              # apply the translation
              for key in translate_map.keys():
                  wrapme = wrapme.replace(key, translate_map[key])
          # output the previous paragraph
          result += wrap_text(wrapme, indent+'// ', maxchars)
  
      if hasemptyline:
          # an empty line means a break between comments, so the comment is
          # probably a section heading and should have an extra line before it
          result = '\n' + result
      return result
function_tokens: def format_comment ( comment , indent , translate_map = None , maxchars = 80 ) : result = '' wrapme = '' hasemptyline = False for line in comment : # if the line starts with a leading space, remove that space if not line is None and len ( line ) > 0 and line [ 0 : 1 ] == ' ' : line = line [ 1 : ] didremovespace = True else : didremovespace = False if line is None or len ( line ) == 0 or line [ 0 : 1 ] == ' ' or line [ 0 : 1 ] == '/' : # the previous paragraph, if any, has ended if len ( wrapme ) > 0 : if not translate_map is None : # apply the translation for key in translate_map . keys ( ) : wrapme = wrapme . replace ( key , translate_map [ key ] ) # output the previous paragraph result += wrap_text ( wrapme , indent + '// ' , maxchars ) wrapme = '' if not line is None : if len ( line ) == 0 or line [ 0 : 1 ] == ' ' or line [ 0 : 1 ] == '/' : # blank lines or anything that's further indented should be # output as-is result += indent + '//' if len ( line ) > 0 : if didremovespace : result += ' ' + line else : result += line result += '\n' else : # add to the current paragraph wrapme += line + ' ' else : # output an empty line hasemptyline = True result += '\n' if len ( wrapme ) > 0 : if not translate_map is None : # apply the translation for key in translate_map . keys ( ) : wrapme = wrapme . replace ( key , translate_map [ key ] ) # output the previous paragraph result += wrap_text ( wrapme , indent + '// ' , maxchars ) if hasemptyline : # an empty line means a break between comments, so the comment is # probably a section heading and should have an extra line before it result = '\n' + result return result