Skip to content

Commit 81d0230

Browse files
committed
Don't expose the internal method
1 parent 8f866bf commit 81d0230

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

halo/halo.py

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -323,12 +323,12 @@ def _pop_stream_content_until_self(self, clear_self=False):
323323

324324
if lines_to_erase > 0:
325325
# Move cursor up n lines
326-
self._write("\033[{}A".format(lines_to_erase))
326+
self._write_stream("\033[{}A".format(lines_to_erase))
327327
# Erase rest content
328-
self._write(self.CLEAR_REST)
328+
self._write_stream(self.CLEAR_REST)
329329
return "".join(reversed(erased_content))
330330

331-
def _write(self, s):
331+
def _write_stream(self, s):
332332
"""Write to the stream, if writable
333333
Parameters
334334
----------
@@ -338,7 +338,7 @@ def _write(self, s):
338338
if self._check_stream():
339339
self._stream.write(s)
340340

341-
def write(self, s, overwrite=False):
341+
def _write(self, s, overwrite=False):
342342
"""Write to the stream and keep following lines unchanged.
343343
Parameters
344344
----------
@@ -349,9 +349,9 @@ def write(self, s, overwrite=False):
349349
"""
350350
with Halo._lock:
351351
erased_content = self._pop_stream_content_until_self(overwrite)
352-
self._write(s)
352+
self._write_stream(s)
353353
# Write back following lines
354-
self._write(erased_content)
354+
self._write_stream(erased_content)
355355
self._content = s if overwrite else self._content + s
356356

357357
def _hide_cursor(self):
@@ -441,7 +441,7 @@ def clear(self):
441441
with Halo._lock:
442442
erased_content = self._pop_stream_content_until_self(True)
443443
self._content = ""
444-
self._write(erased_content)
444+
self._write_stream(erased_content)
445445
return self
446446

447447
def _render_frame(self):
@@ -455,9 +455,9 @@ def _render_frame(self):
455455
frame = self.frame()
456456
output = "\r{}\n".format(frame)
457457
try:
458-
self.write(output, True)
458+
self._write(output, True)
459459
except UnicodeEncodeError:
460-
self.write(encode_utf_8_text(output), True)
460+
self._write(encode_utf_8_text(output), True)
461461

462462
def render(self):
463463
"""Runs the render until thread flag is set.
@@ -663,8 +663,8 @@ def stop_and_persist(self, symbol=" ", text=None):
663663
)
664664

665665
try:
666-
self.write(output)
666+
self._write(output)
667667
except UnicodeEncodeError:
668-
self.write(encode_utf_8_text(output))
668+
self._write(encode_utf_8_text(output))
669669

670670
return self

0 commit comments

Comments
 (0)