def __init__(self, output_type="list", initial_len=1, interval=0, force_single_line=False, no_warning=False, sort_key=lambda x:x[0]):
self.sort_key = sort_key
self.no_warning = no_warning
no_warning and print("All reprint warning diabled.")
global is_atty
# reprint does not work in the IDLE terminal, and any other environment that can't get terminal_size
if is_atty and not all(get_terminal_size()):
if not no_warning:
r = input("Fail to get terminal size, we got {}, continue anyway? (y/N)".format(get_terminal_size()))
if not (r and isinstance(r, str) and r.lower()[0] in ['y','t','1']):
sys.exit(0)
is_atty = False
if output_type == "list":
self.warped_obj = output.SignalList(self, [''] * initial_len)
elif output_type == "dict":
self.warped_obj = output.SignalDict(self, {})
self.interval = interval
self.force_single_line = force_single_line
self._last_update = int(time.time()*1000)
评论列表
文章目录