see doc in Term class
        
        According to http://support.microsoft.com/kb/99261 the best way
        to clear the console is to write out empty spaces
974305
def clear(self, scope = 'screen'):
        
        #TODO: clear attributes too
        if scope == 'screen':
            bos = (0, self._get_console_info()['window']['top'])
            cols, lines = self.get_size()
            length = cols * lines
            self._clear_console(length, bos)
            self.move('beginning of screen')
        elif scope == ' beginning of line':
            pass
        elif scope == 'end of line':
            curx, cury = self._get_position()
            cols, lines = self.get_size()
            coord = (curx, cury)
            length = cols - curx
            self._clear_console(length, coord)
        elif scope == 'end of screen':
            curx, cury = self._get_position()
            coord = (curx, cury)
            cols, lines = self.get_size()
            length = (lines - cury) * cols - curx
            self._clear_console(length, coord)
        elif scope == 'line':
            curx, cury = self._get_position()
            coord = (0, cury)
            cols, lines = self.get_size()
            self._clear_console(cols, coord)
            self._set_position((curx, cury))
        elif scope == 'left':
            self.move('left')
            self.write(' ')
        elif scope == 'right':
            self.write(' ')
            self.move('left')
        else:
            raise ValueError("invalid scope to clear")
160511
void repaintScreen() {
        int repaintLine = 1;
        console.out().print(ansi().eraseScreen(Erase.ALL));
        console.out().print(ansi().cursor(1, 1));
        console.out().print("\33[" + (getHeaderSize() + 1) + ";" + (terminal.getHeight() - getFooterSize()) + ";r");
        redrawHeader();
        redrawFooter();
        LinkedList<String> linesToDisplay = new LinkedList<String>();
        int l = 1;
        while (linesToDisplay.size() < terminal.getHeight() - getFooterSize()) {
            String currentLine = getContent(l++);
            linesToDisplay.addAll(toDisplayLines(currentLine));
        }

        for (int i = 0; i < terminal.getHeight() - getHeaderSize() - getFooterSize(); i++) {
            console.out().print(ansi().cursor(repaintLine + getHeaderSize(), 1));
            displayText(linesToDisplay.get(i));
            repaintLine++;
        }
        console.out().print(ansi().cursor(2, 1));
    }
337463
def backspace(self):
        
        if self._cx + self._cw >= 0:
            self.erase()
            self._cx -= self._cw

        self.flush()
390939
def clear(self):
        
        # Clear the actual terminal
        self.reset()
        self._change_colours(Screen.COLOUR_WHITE, 0, 0)
        self._clear()
726561
def clear_highlight(self, src_id, line_start=0, line_end=-1, async_=None,
                        **kwargs):
        """"""
        async_ = check_async(async_, kwargs, True)
        self.request('nvim_buf_clear_highlight', src_id,
                     line_start, line_end, async_=async_)
755229
def clean_whitespace(self, tree):
        

        pointer = 0
        end = len(tree)

        while pointer < end:
            piece = tree[pointer]
            if piece[0] == 'block':
                child_tree = piece[3]

                # Look at open tag, if the only other thing on the line is whitespace
                # then delete it so we don't introduce extra newlines to the output
                open_pre_whitespace = False
                open_pre_content = True
                if pointer > 1 and tree[pointer - 1][0] == 'whitespace' and (tree[pointer - 2][0] == 'newline' or tree[pointer - 2] == 'template'):
                    open_pre_whitespace = True
                    open_pre_content = False
                elif pointer > 0 and (tree[pointer - 1][0] == 'newline' or tree[pointer - 1] == 'template'):
                    open_pre_content = False

                open_post_whitespace = False
                open_post_content = True
                child_len = len(child_tree)
                if child_len > 2 and child_tree[1][0] == 'whitespace' and child_tree[2][0] == 'newline':
                    open_post_whitespace = True
                    open_post_content = False
                elif child_len > 1 and child_tree[1][0] == 'newline':
                    open_post_content = False

                if not open_pre_content and not open_post_content:
                    if open_pre_whitespace:
                        tree.pop(pointer - 1)
                        pointer -= 1
                        end -= 1
                    if open_post_whitespace:
                        child_tree.pop(1)
                    child_tree.pop(1)  # trailing newline

                # Do the same thing, but for the close tag
                close_pre_whitespace = False
                close_pre_content = True
                child_len = len(child_tree)
                if child_len > 2 and child_tree[child_len - 1][0] == 'whitespace' and child_tree[child_len - 2][0] == 'newline':
                    close_pre_whitespace = True
                    close_pre_content = False
                elif child_len > 1 and child_tree[child_len - 1][0] == 'newline':
                    close_pre_content = False

                close_post_whitespace = False
                close_post_content = True
                tree_len = len(tree)
                if tree_len > pointer + 2 and tree[pointer + 1][0] == 'whitespace' and tree[pointer + 2][0] == 'newline':
                    close_post_whitespace = True
                    close_post_content = False
                elif tree_len == pointer + 2 and tree[pointer + 1][0] == 'whitespace':
                    close_post_whitespace = True
                    close_post_content = False
                elif tree_len > pointer + 1 and tree[pointer + 1][0] == 'newline':
                    close_post_content = False
                elif tree_len == pointer + 1:
                    close_post_content = False

                if not close_pre_content and not close_post_content:
                    if close_pre_whitespace:
                        child_tree.pop()
                    child_tree.pop()  # preceeding newline
                    if close_post_whitespace:
                        tree.pop(pointer + 1)
                        end -= 1

                self.clean_whitespace(child_tree)

            pointer += 1
190878
def clear_buffer(self):
        """"""
        command_url = self.hub_url + '/1?XB=M=1'
        response = self.post_direct_command(command_url)
        self.logger.info("clear_buffer: %s", response)
        return response
898339
public void clearLast(int N) {
        if (N < 1) {
            throw new IllegalArgumentException("Unable to clear " + N + " lines");
        }
        if (N > count()) {
            throw new IllegalArgumentException("Count: " + N + ", Size: " + count());
        }
        if (N == count()) {
            clear();
            return;
        }

        terminal.format("\r%s", CURSOR_ERASE);
        buffer.remove(buffer.size() - 1);
        for (int i = 1; i < N; ++i) {
            terminal.format("%s%s", UP, CURSOR_ERASE);
            buffer.remove(buffer.size() - 1);
        }

        terminal.format("%s\r%s",
                        UP,
                        cursorRight(printableWidth(lastLine())));
    }
311949
def empty(cls: Type[BoardT], *, chess960: bool = False) -> BoardT:
        """"""
        return cls(None, chess960=chess960)
93926
def clear():
    
    if not isatty(sys.stdout):
        return
    # If we're on Windows and we don't have colorama available, then we
    # clear the screen by shelling out.  Otherwise we can use an escape
    # sequence.
    if WIN:
        os.system('cls')
    else:
        sys.stdout.write('\033[2J\033[1;1H')
1049330
function clearScreen(reset) {
    if (reset === void 0) { reset = true; }
    var out = '\x1B[2J';
    var newline = '\n';
    if (chek_1.isWindows()) { // hack cause windows sucks!
        newline = '\r\n';
        out = '';
        var lines = process.stdout['getWindowSize']()[1] || [];
        lines.forEach(function (line) {
            out += '\r\n';
        });
    }
    out += '\x1B[0f';
    process.stdout.write(out);
}
786902
def stop(self, hide_progress=False, new_status=None):
    

    self._status = ProgressBarStatus.stopped
    if hide_progress:
      sep = " - "
      if new_status is None:
        new_status = sep = ""

      kwargs = {
        "begin_line": self._begin_line_character,
        "text": self._text,
        "new_status": new_status,
        "sep": sep,
        "fill_space": " " * (self._console_width - len(self._text) - len(sep) - len(new_status) - len(os.linesep))
      }
      self.stdout.write("{begin_line}{text}{sep}{new_status}{fill_space}".format(**kwargs))
    else:
      self.progress(int(self._max), new_status=new_status)

    self.stdout.write(os.linesep)
838119
void clear() {
		count = 0;
		m0 = 0.0;
		clusters.space.setToOrigin(m1);
		clusters.space.setToOrigin(m2);
		var = 0.0;
		key = null;
	}
584556
def leaveWhitespace( self ):
        """"""
        self.skipWhitespace = False
        self.exprs = [ e.copy() for e in self.exprs ]
        for e in self.exprs:
            e.leaveWhitespace()
        return self
629395
int clear() {
        vb.clear();
        vd.clear();
        os.clear();

        if (vi != null && links != 0) {
            for (int i = 0; i < links; i++) {
                vi[i].clear();
                vc[i].clear();
            }
            vi = null;
            vc = null;
        }
        if (dataoffsets != null) {
            dataoffsets = null;
        }
        if (pcmlengths != null) {
            pcmlengths = null;
        }
        if (serialnos != null) {
            serialnos = null;
        }
        if (offsets != null) {
            offsets = null;
        }
        oy.clear();

        return (0);
    }
1034962
def clear_data(self):
        '''
         '''
        if self.forest.verbose > 1:
            print('clearing up stuff')
        self.S = None
        self.Uy = None
        self.U = None
693869
def clear(self):
        
        if hasattr(self.stdout, 'isatty') and self.stdout.isatty() or self.term_type == 'mintty':
            cmd, shell = {
                'posix': ('clear', False),
                'nt': ('cls', True),
                'cygwin': (['echo', '-en', r'\ec'], False),
                'mintty': (r'echo -en "\ec', False),
            }[self.term_type]
            subprocess.call(cmd, shell=shell, stdin=self.stdin, stdout=self.stdout, stderr=self.stderr)