MCPcopy Create free account
hub / github.com/apache/impala / write

Method write

shell/impala_shell/shell_output.py:209–221  ·  view source on GitHub ↗

This method will erase the previously printed text on screen by going up as many new lines as the old text had and overwriting it with whitespace. Afterwards, the new text will be printed.

(self, data)

Source from the content-addressed store, hash-verified

207 sys.stderr.write(self.last_clean_text)
208
209 def write(self, data):
210 """This method will erase the previously printed text on screen by going
211 up as many new lines as the old text had and overwriting it with whitespace.
212 Afterwards, the new text will be printed."""
213 self._clean_before()
214 new_line_count = data.count("\n")
215 sys.stderr.write(self.UP * min(new_line_count, self.last_line_count))
216 sys.stderr.write(data)
217
218 # Cache the line count and the old text where all text was replaced by
219 # whitespace.
220 self.last_line_count = new_line_count
221 self.last_clean_text = re.sub(r"[^\s]", " ", data)
222
223 def clear(self):
224 sys.stderr.write(self.UP * self.last_line_count)

Callers

nothing calls this directly

Calls 4

_clean_beforeMethod · 0.95
minFunction · 0.85
countMethod · 0.45
writeMethod · 0.45

Tested by

no test coverage detected