1919
2020from __future__ import annotations
2121
22+ import io
2223import os
2324import sys
2425
25- from _io import _WindowsConsoleIO
2626from abc import ABC , abstractmethod
2727from collections import deque
2828from dataclasses import dataclass , field
@@ -57,6 +57,7 @@ def __init__(self, err: int | None, descr: str | None = None) -> None:
5757 self .err = err
5858 self .descr = descr
5959
60+
6061TYPE_CHECKING = False
6162
6263if TYPE_CHECKING :
@@ -126,7 +127,7 @@ def __init__(
126127 self .height = 25
127128 self .__offset = 0
128129 self .event_queue : deque [Event ] = deque ()
129- self .out = _WindowsConsoleIO (self .output_fd , 'w' )
130+ self .out = io . _WindowsConsoleIO (self .output_fd , "w" ) # type: ignore[attr-defined]
130131
131132 def refresh (self , screen : list [str ], c_xy : tuple [int , int ]) -> None :
132133 """
@@ -279,7 +280,7 @@ def _disable_blinking(self):
279280 def __write (self , text : str ) -> None :
280281 self .out .write (text .encode (self .encoding , "replace" ))
281282 self .out .flush ()
282-
283+
283284 @property
284285 def screen_xy (self ) -> tuple [int , int ]:
285286 info = CONSOLE_SCREEN_BUFFER_INFO ()
@@ -302,14 +303,6 @@ def prepare(self) -> None:
302303 def restore (self ) -> None :
303304 pass
304305
305- def get_abs_position (self , x : int , y : int ) -> tuple [int , int ]:
306- cur_x , cur_y = self .screen_xy
307- dx = x - self .__posxy [0 ]
308- dy = y - self .__posxy [1 ]
309- cur_x += dx
310- cur_y += dy
311- return cur_x , cur_y
312-
313306 def _move_relative (self , x : int , y : int ) -> None :
314307 """Moves relative to the current __posxy"""
315308 dx = x - self .__posxy [0 ]
@@ -356,7 +349,7 @@ def _getscrollbacksize(self) -> int:
356349 if not GetConsoleScreenBufferInfo (OutHandle , info ):
357350 raise WinError (GetLastError ())
358351
359- return info .srWindow .Bottom # type: ignore[no-any-return]
352+ return info .srWindow .Bottom # type: ignore[no-any-return]
360353
361354 def _read_input (self ) -> INPUT_RECORD | None :
362355 rec = INPUT_RECORD ()
0 commit comments