@@ -143,18 +143,7 @@ def __init__(
143143 - term (str): Terminal name.
144144 - encoding (str): Encoding to use for I/O operations.
145145 """
146-
147- self .encoding = encoding or sys .getdefaultencoding ()
148-
149- if isinstance (f_in , int ):
150- self .input_fd = f_in
151- else :
152- self .input_fd = f_in .fileno ()
153-
154- if isinstance (f_out , int ):
155- self .output_fd = f_out
156- else :
157- self .output_fd = f_out .fileno ()
146+ super ().__init__ (f_in , f_out , term , encoding )
158147
159148 self .pollob = poll ()
160149 self .pollob .register (self .input_fd , select .POLLIN )
@@ -592,14 +581,19 @@ def __write_changed_line(self, y, oldline, newline, px_coord):
592581 px_pos = 0
593582 j = 0
594583 for c in oldline :
595- if j >= px_coord : break
584+ if j >= px_coord :
585+ break
596586 j += wlen (c )
597587 px_pos += 1
598588
599589 # reuse the oldline as much as possible, but stop as soon as we
600590 # encounter an ESCAPE, because it might be the start of an escape
601591 # sequene
602- while x_coord < minlen and oldline [x_pos ] == newline [x_pos ] and newline [x_pos ] != "\x1b " :
592+ while (
593+ x_coord < minlen
594+ and oldline [x_pos ] == newline [x_pos ]
595+ and newline [x_pos ] != "\x1b "
596+ ):
603597 x_coord += wlen (newline [x_pos ])
604598 x_pos += 1
605599
@@ -619,7 +613,11 @@ def __write_changed_line(self, y, oldline, newline, px_coord):
619613 self .__posxy = x_coord + character_width , y
620614
621615 # if it's a single character change in the middle of the line
622- elif x_coord < minlen and oldline [x_pos + 1 :] == newline [x_pos + 1 :] and wlen (oldline [x_pos ]) == wlen (newline [x_pos ]):
616+ elif (
617+ x_coord < minlen
618+ and oldline [x_pos + 1 :] == newline [x_pos + 1 :]
619+ and wlen (oldline [x_pos ]) == wlen (newline [x_pos ])
620+ ):
623621 character_width = wlen (newline [x_pos ])
624622 self .__move (x_coord , y )
625623 self .__write (newline [x_pos ])
0 commit comments