mirror of
				https://github.com/python/cpython.git
				synced 2025-10-31 13:41:24 +00:00 
			
		
		
		
	gh-111201: Support pyrepl on Windows (#119559)
Co-authored-by: Anthony Shaw <anthony.p.shaw@gmail.com> Co-authored-by: Łukasz Langa <lukasz@langa.pl>
This commit is contained in:
		
							parent
							
								
									13a5fdc72f
								
							
						
					
					
						commit
						0d07182821
					
				
					 15 changed files with 1020 additions and 49 deletions
				
			
		|  | @ -19,10 +19,18 @@ | |||
| 
 | ||||
| from __future__ import annotations | ||||
| 
 | ||||
| import sys | ||||
| 
 | ||||
| from abc import ABC, abstractmethod | ||||
| from dataclasses import dataclass, field | ||||
| 
 | ||||
| 
 | ||||
| TYPE_CHECKING = False | ||||
| 
 | ||||
| if TYPE_CHECKING: | ||||
|     from typing import IO | ||||
| 
 | ||||
| 
 | ||||
| @dataclass | ||||
| class Event: | ||||
|     evt: str | ||||
|  | @ -36,6 +44,25 @@ class Console(ABC): | |||
|     height: int = 25 | ||||
|     width: int = 80 | ||||
| 
 | ||||
|     def __init__( | ||||
|         self, | ||||
|         f_in: IO[bytes] | int = 0, | ||||
|         f_out: IO[bytes] | int = 1, | ||||
|         term: str = "", | ||||
|         encoding: str = "", | ||||
|     ): | ||||
|         self.encoding = encoding or sys.getdefaultencoding() | ||||
| 
 | ||||
|         if isinstance(f_in, int): | ||||
|             self.input_fd = f_in | ||||
|         else: | ||||
|             self.input_fd = f_in.fileno() | ||||
| 
 | ||||
|         if isinstance(f_out, int): | ||||
|             self.output_fd = f_out | ||||
|         else: | ||||
|             self.output_fd = f_out.fileno() | ||||
| 
 | ||||
|     @abstractmethod | ||||
|     def refresh(self, screen: list[str], xy: tuple[int, int]) -> None: ... | ||||
| 
 | ||||
|  | @ -108,5 +135,4 @@ def wait(self) -> None: | |||
|         ... | ||||
| 
 | ||||
|     @abstractmethod | ||||
|     def repaint(self) -> None: | ||||
|         ... | ||||
|     def repaint(self) -> None: ... | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Dino Viehland
						Dino Viehland