original_docstring:  Format the return value of a query for humans 
docstring: Format the return value of a query for humans
docstring_tokens: Format the return value of a query for humans
code: def _pretty_format(self, statement, result):
          """ Format the return value of a query for humans """
          if result is None:
              return "Success"
          ret = result
          if statement.action in ("SELECT", "SCAN"):
              if statement.save_file:
                  filename = statement.save_file[0]
                  if filename[0] in ['"', "'"]:
                      filename = unwrap(filename)
                  ret = "Saved %d record%s to %s" % (result, plural(result), filename)
              elif isinstance(result, Count):
                  if result.count == result.scanned_count:
                      ret = "%d" % result
                  else:
                      ret = "%d (scanned count: %d)" % (result, result.scanned_count)
          elif statement.action == "UPDATE":
              if isinstance(result, int):
                  ret = "Updated %d item%s" % (result, plural(result))
          elif statement.action == "DELETE":
              ret = "Deleted %d item%s" % (result, plural(result))
          elif statement.action == "CREATE":
              if result:
                  ret = "Created table %r" % statement.table
              else:
                  ret = "Table %r already exists" % statement.table
          elif statement.action == "INSERT":
              ret = "Inserted %d item%s" % (result, plural(result))
          elif statement.action == "DROP":
              if result:
                  ret = "Dropped table %r" % statement.table
              else:
                  ret = "Table %r does not exist" % statement.table
          elif statement.action == "ANALYZE":
              ret = self._pretty_format(statement[1], result)
          elif statement.action == "LOAD":
              ret = "Loaded %d item%s" % (result, plural(result))
          return ret
code_tokens: def _pretty_format ( self , statement , result ) : if result is None : return "Success" ret = result if statement . action in ( "SELECT" , "SCAN" ) : if statement . save_file : filename = statement . save_file [ 0 ] if filename [ 0 ] in [ '"' , "'" ] : filename = unwrap ( filename ) ret = "Saved %d record%s to %s" % ( result , plural ( result ) , filename ) elif isinstance ( result , Count ) : if result . count == result . scanned_count : ret = "%d" % result else : ret = "%d (scanned count: %d)" % ( result , result . scanned_count ) elif statement . action == "UPDATE" : if isinstance ( result , int ) : ret = "Updated %d item%s" % ( result , plural ( result ) ) elif statement . action == "DELETE" : ret = "Deleted %d item%s" % ( result , plural ( result ) ) elif statement . action == "CREATE" : if result : ret = "Created table %r" % statement . table else : ret = "Table %r already exists" % statement . table elif statement . action == "INSERT" : ret = "Inserted %d item%s" % ( result , plural ( result ) ) elif statement . action == "DROP" : if result : ret = "Dropped table %r" % statement . table else : ret = "Table %r does not exist" % statement . table elif statement . action == "ANALYZE" : ret = self . _pretty_format ( statement [ 1 ] , result ) elif statement . action == "LOAD" : ret = "Loaded %d item%s" % ( result , plural ( result ) ) return ret
short_docstring: Format the return value of a query for humans
short_docstring_tokens: Format the return value of a query for humans
comment: """ Format the return value of a query for humans """