resolved RESOLVED PASS · 25 tool calls · 74 s · Textualize/rich
proxy isatty Fixes https://github.com/Textualize/rich/issues/4041
| # | Tool | Arguments | Result |
|---|---|---|---|
| 1 | run_command | {
"command": "grep -rn \"isatty\" . | head -20"
} | {"status": "ok", "stdout": "./tests/test_null_file.py:9: assert not file.isatty()\n./tests/test_console.py:875: def _mock_isatty():\n./tests/test_console.py:878full{"status": "ok", "stdout": "./tests/test_null_file.py:9: assert not file.isatty()\n./tests/test_console.py:875: def _mock_isatty():\n./tests/test_console.py:878: console.file.isatty = _mock_isatty\n./tests/test_console.py:1079: self.called_isatty = False\n./tests/test_console.py:1081: def isatty(self) -> bool:\n./tests/test_console.py:1082: self.called_isatty = True\n./tests/test_console.py:1086: \"\"\"A file object that reports False for isatty\"\"\"\n./tests/test_console.py:1089: self.called_isatty = False\n./tests/test_console.py:1091: def isatty(self) -> bool:\n./tests/test_console.py:1092: self.called_isatty = True\n./tests/test_console.py:1099: # Should have called isatty to auto-detect tty support\n./tests/test_console.py:1100: assert console.file.called_isatty\n./tests/test_console.py:1107: assert not console.file.called_isatty\n./tests/test_console.py:1114: assert console.file.called_isatty\n./tests/test_console.py:1121: assert console.file.called_isatty\n./tests/test_console.py:1128: assert console.file.called_isatty\n./tests/test_console.py:1135: assert not console.file.called_isatty\n./rich/console.py:969: isatty: Optional[Callable[[], bool]] = getattr(self.file, \"isatty\", None)\n./rich/console.py:971: return False if isatty is None else isatty()\n./rich/console.py:973: # in some situation (at the end of a pytest run for example) isatty() can raise\n", "exit_code": 0} |
| 2 | read_file | {
"filepath": "rich/console.py",
"start_line": 960,
"end_line": 980
} | {"status": "ok", "filepath": "rich/console.py", "content": " if tty_compatible == \"1\":\n return True\n\n # https://force-color.org/\n force_color = environ.gefull{"status": "ok", "filepath": "rich/console.py", "content": " if tty_compatible == \"1\":\n return True\n\n # https://force-color.org/\n force_color = environ.get(\"FORCE_COLOR\")\n if force_color is not None:\n return force_color != \"\"\n\n # Any other value defaults to auto detect\n isatty: Optional[Callable[[], bool]] = getattr(self.file, \"isatty\", None)\n try:\n return False if isatty is None else isatty()\n except ValueError:\n # in some situation (at the end of a pytest run for example) isatty() can raise\n # ValueError: I/O operation on closed file\n # return False because we aren't in a terminal anymore\n return False\n\n @property\n def is_dumb_terminal(self) -> bool:\n \"\"\"Detect dumb terminal.\n", "start_line": 960, "end_line": 980, "total_lines": 2698, "is_truncated": false} |
| 3 | run_command | {
"command": "grep -rn \"FileProxy\" ."
} | {"status": "ok", "stdout": "./CHANGELOG.md:373:- Fixed missing `fileno` on FileProxy\n./CHANGELOG.md:1188:- FileProxy now raises TypeError for empty non-str argfull{"status": "ok", "stdout": "./CHANGELOG.md:373:- Fixed missing `fileno` on FileProxy\n./CHANGELOG.md:1188:- FileProxy now raises TypeError for empty non-str arguments https://github.com/textualize/rich/issues/828\n./tests/test_file_proxy.py:7:from rich.file_proxy import FileProxy\n./tests/test_file_proxy.py:12: file_proxy = FileProxy(console, sys.stdout)\n./tests/test_file_proxy.py:23: file_proxy = FileProxy(console, file)\n./tests/test_file_proxy.py:33: file_proxy = FileProxy(console, file)\n./rich/file_proxy.py:11:class FileProxy(io.TextIOBase):\n./rich/live.py:11:from .file_proxy import FileProxy\n./rich/live.py:198: if self._redirect_stdout and not isinstance(sys.stdout, FileProxy):\n./rich/live.py:200: sys.stdout = cast(\"TextIO\", FileProxy(self.console, sys.stdout))\n./rich/live.py:201: if self._redirect_stderr and not isinstance(sys.stderr, FileProxy):\n./rich/live.py:203: sys.stderr = cast(\"TextIO\", FileProxy(self.console, sys.stderr))\n", "exit_code": 0} |
| 4 | read_file | {
"filepath": "rich/file_proxy.py"
} | {"status": "ok", "filepath": "rich/file_proxy.py", "content": "import io\nfrom typing import IO, TYPE_CHECKING, Any, List\n\nfrom .ansi import AnsiDecoder\nfromfull{"status": "ok", "filepath": "rich/file_proxy.py", "content": "import io\nfrom typing import IO, TYPE_CHECKING, Any, List\n\nfrom .ansi import AnsiDecoder\nfrom .text import Text\n\nif TYPE_CHECKING:\n from .console import Console\n\n\nclass FileProxy(io.TextIOBase):\n \"\"\"Wraps a file (e.g. sys.stdout) and redirects writes to a console.\"\"\"\n\n def __init__(self, console: \"Console\", file: IO[str]) -> None:\n self.__console = console\n self.__file = file\n self.__buffer: List[str] = []\n self.__ansi_decoder = AnsiDecoder()\n\n @property\n def rich_proxied_file(self) -> IO[str]:\n \"\"\"Get proxied file.\"\"\"\n return self.__file\n\n def __getattr__(self, name: str) -> Any:\n return getattr(self.__file, name)\n\n def write(self, text: str) -> int:\n if not isinstance(text, str):\n raise TypeError(f\"write() argument must be str, not {type(text).__name__}\")\n buffer = self.__buffer\n lines: List[str] = []\n while text:\n line, new_line, text = text.partition(\"\\n\")\n if new_line:\n lines.append(\"\".join(buffer) + line)\n buffer.clear()\n else:\n buffer.append(line)\n break\n if lines:\n console = self.__console\n with console:\n output = Text(\"\\n\").join(\n self.__ansi_decoder.decode_line(line) for line in lines\n )\n console.print(output)\n return len(text)\n\n def flush(self) -> None:\n output = \"\".join(self.__buffer)\n if output:\n self.__console.print(output)\n del self.__buffer[:]\n\n def fileno(self) -> int:\n return self.__file.fileno()\n", "start_line": 1, "end_line": 57, "total_lines": 57, "is_truncated": false} |
| 5 | run_command | {
"command": "python3 -c \"import sys; from rich.file_proxy import FileProxy; from rich.console import Console; console = Console(); proxy = FileProxy(console, sys.stdout); print(f'isatty exists: {hasattr(proxy, \\\"isatty\\\")}'); print(f'isatty value: {getattr(proxy, \\\"isatty\\\", \\\"N/A\\\")}')\""
} | {"status": "ok", "stdout": "isatty exists: True\nisatty value: <built-in method isatty of FileProxy object at 0x7a8b07a3cd60>\n", "exit_code": 0}full{"status": "ok", "stdout": "isatty exists: True\nisatty value: <built-in method isatty of FileProxy object at 0x7a8b07a3cd60>\n", "exit_code": 0} |
| 6 | run_command | {
"command": "python3 -c \"import sys; from rich.file_proxy import FileProxy; from rich.console import Console; console = Console(); proxy = FileProxy(console, sys.stdout); print(f'proxy.isatty(): {proxy.isatty()}')\""
} | {"status": "ok", "stdout": "proxy.isatty(): False\n", "exit_code": 0}full{"status": "ok", "stdout": "proxy.isatty(): False\n", "exit_code": 0} |
| 7 | run_command | {
"command": "python3 -c \"import sys; print(f'sys.stdout.isatty(): {sys.stdout.isatty()}')\""
} | {"status": "ok", "stdout": "sys.stdout.isatty(): False\n", "exit_code": 0}full{"status": "ok", "stdout": "sys.stdout.isatty(): False\n", "exit_code": 0} |
| 8 | run_command | {
"command": "python3 -c \"import os; import sys; from rich.file_proxy import FileProxy; from rich.console import Console; console = Console(); proxy = FileProxy(console, sys.stdout); print(f'sys.stdout.isatty(): {sys.stdout.isatty()}'); print(f'proxy.isatty(): {proxy.isatty()}')\""
} | {"status": "ok", "stdout": "sys.stdout.isatty(): False\nproxy.isatty(): False\n", "exit_code": 0}full{"status": "ok", "stdout": "sys.stdout.isatty(): False\nproxy.isatty(): False\n", "exit_code": 0} |
| 9 | run_command | {
"command": "python3 -c \"import os; import sys; from rich.file_proxy import FileProxy; from rich.console import Console; console = Console(); proxy = FileProxy(console, sys.stdout); print(f'proxy.isatty(): {proxy.isatty()}'); print(f'sys.stdout.isatty(): {sys.stdout.isatty()}')\""
} | {"status": "ok", "stdout": "proxy.isatty(): False\nsys.stdout.isatty(): False\n", "exit_code": 0}full{"status": "ok", "stdout": "proxy.isatty(): False\nsys.stdout.isatty(): False\n", "exit_code": 0} |
| 10 | run_command | {
"command": "python3 -c \"import io; from rich.file_proxy import FileProxy; from rich.console import Console; console = Console(); class MockFile(io.TextIOBase): def isatty(self): return True; mock_file = MockFile(); proxy = FileProxy(console, mock_file); print(f'mock_file.isatty(): {mock_file.isatty()}'); print(f'proxy.isatty(): {proxy.isatty()}')\""
} | {"status": "error", "error_type": "CommandError", "error_message": "Command failed with exit code 1", "details": {"stdout": "", "stderr": " File \"<string>\", lfull{"status": "error", "error_type": "CommandError", "error_message": "Command failed with exit code 1", "details": {"stdout": "", "stderr": " File \"<string>\", line 1\n import io; from rich.file_proxy import FileProxy; from rich.console import Console; console = Console(); class MockFile(io.TextIOBase): def isatty(self): return True; mock_file = MockFile(); proxy = FileProxy(console, mock_file); print(f'mock_file.isatty(): {mock_file.isatty()}'); print(f'proxy.isatty(): {proxy.isatty()}')\n ^^^^^\nSyntaxError: invalid syntax\n", "exit_code": 1}} |
| 11 | write_file | {
"content": "import io\nfrom rich.file_proxy import FileProxy\nfrom rich.console import Console\n\nclass MockFile(io.TextIOBase):\n def isatty(self):\n return True\n\nconsole = Console()\nmock_file = MockFile()\nproxy = FileProxy(console, mock_file)\nprint(f\"mock_file.isatty(): {mock_file.isatty()}\")\ntry:\n print(f\"proxy.isatty(): {proxy.isatty()}\")\nexcept Exception as e:\n print(f\"proxy.isatty() raised: {e}\")\n",
"filepath": "/tmp/test_proxy_isatty.py"
} | {"status": "ok", "filepath": "/tmp/test_proxy_isatty.py", "size": 404}full{"status": "ok", "filepath": "/tmp/test_proxy_isatty.py", "size": 404} |
| 12 | run_command | {
"command": "python3 /tmp/test_proxy_isatty.py"
} | {"status": "error", "error_type": "CommandError", "error_message": "Command failed with exit code 2", "details": {"stdout": "", "stderr": "python3: can't open ffull{"status": "error", "error_type": "CommandError", "error_message": "Command failed with exit code 2", "details": {"stdout": "", "stderr": "python3: can't open file '/tmp/swe_work/eval4_submission/rich_4077/a/tmp/test_proxy_isatty.py': [Errno 2] No such file or directory\n", "exit_code": 2}} |
| 13 | run_command | {
"command": "python3 /workspace/tmp/test_proxy_isatty.py"
} | {"status": "error", "error_type": "CommandError", "error_message": "Command failed with exit code 2", "details": {"stdout": "", "stderr": "python3: can't open ffull{"status": "error", "error_type": "CommandError", "error_message": "Command failed with exit code 2", "details": {"stdout": "", "stderr": "python3: can't open file '/tmp/swe_work/eval4_submission/rich_4077/a/workspace/tmp/test_proxy_isatty.py': [Errno 2] No such file or directory\n", "exit_code": 2}} |
| 14 | run_command | {
"command": "mkdir -p /tmp && python3 /tmp/test_proxy_isatty.py"
} | {"status": "error", "error_type": "CommandError", "error_message": "Command failed with exit code 2", "details": {"stdout": "", "stderr": "python3: can't open ffull{"status": "error", "error_type": "CommandError", "error_message": "Command failed with exit code 2", "details": {"stdout": "", "stderr": "python3: can't open file '/tmp/swe_work/eval4_submission/rich_4077/a/tmp/test_proxy_isatty.py': [Errno 2] No such file or directory\n", "exit_code": 2}} |
| 15 | write_file | {
"content": "import io\nfrom rich.file_proxy import FileProxy\nfrom rich.console import Console\n\nclass MockFile(io.TextIOBase):\n def isatty(self):\n return True\n\nconsole = Console()\nmock_file = MockFile()\nproxy = FileProxy(console, mock_file)\nprint(f\"mock_file.isatty(): {mock_file.isatty()}\")\ntry:\n print(f\"proxy.isatty(): {proxy.isatty()}\")\nexcept Exception as e:\n print(f\"proxy.isatty() raised: {e}\")\n",
"filepath": "test_proxy_isatty.py"
} | {"status": "ok", "filepath": "test_proxy_isatty.py", "size": 404}full{"status": "ok", "filepath": "test_proxy_isatty.py", "size": 404} |
| 16 | run_command | {
"command": "python3 test_proxy_isatty.py"
} | {"status": "ok", "stdout": "mock_file.isatty(): True\nproxy.isatty(): False\n", "exit_code": 0}full{"status": "ok", "stdout": "mock_file.isatty(): True\nproxy.isatty(): False\n", "exit_code": 0} |
| 17 | read_file | {
"filepath": "rich/file_proxy.py"
} | {"status": "ok", "filepath": "rich/file_proxy.py", "content": "import io\nfrom typing import IO, TYPE_CHECKING, Any, List\n\nfrom .ansi import AnsiDecoder\nfromfull{"status": "ok", "filepath": "rich/file_proxy.py", "content": "import io\nfrom typing import IO, TYPE_CHECKING, Any, List\n\nfrom .ansi import AnsiDecoder\nfrom .text import Text\n\nif TYPE_CHECKING:\n from .console import Console\n\n\nclass FileProxy(io.TextIOBase):\n \"\"\"Wraps a file (e.g. sys.stdout) and redirects writes to a console.\"\"\"\n\n def __init__(self, console: \"Console\", file: IO[str]) -> None:\n self.__console = console\n self.__file = file\n self.__buffer: List[str] = []\n self.__ansi_decoder = AnsiDecoder()\n\n @property\n def rich_proxied_file(self) -> IO[str]:\n \"\"\"Get proxied file.\"\"\"\n return self.__file\n\n def __getattr__(self, name: str) -> Any:\n return getattr(self.__file, name)\n\n def write(self, text: str) -> int:\n if not isinstance(text, str):\n raise TypeError(f\"write() argument must be str, not {type(text).__name__}\")\n buffer = self.__buffer\n lines: List[str] = []\n while text:\n line, new_line, text = text.partition(\"\\n\")\n if new_line:\n lines.append(\"\".join(buffer) + line)\n buffer.clear()\n else:\n buffer.append(line)\n break\n if lines:\n console = self.__console\n with console:\n output = Text(\"\\n\").join(\n self.__ansi_decoder.decode_line(line) for line in lines\n )\n console.print(output)\n return len(text)\n\n def flush(self) -> None:\n output = \"\".join(self.__buffer)\n if output:\n self.__console.print(output)\n del self.__buffer[:]\n\n def fileno(self) -> int:\n return self.__file.fileno()\n", "start_line": 1, "end_line": 57, "total_lines": 57, "is_truncated": false} |
| 18 | run_command | {
"command": "python3 -c \"import io; from rich.file_proxy import FileProxy; from rich.console import Console; class MockFile(io.TextIOBase): def isatty(self): return True; console = Console(); mock_file = MockFile(); proxy = FileProxy(console, mock_file); print(f'proxy.isatty: {proxy.isatty}')\""
} | {"status": "error", "error_type": "CommandError", "error_message": "Command failed with exit code 1", "details": {"stdout": "", "stderr": " File \"<string>\", lfull{"status": "error", "error_type": "CommandError", "error_message": "Command failed with exit code 1", "details": {"stdout": "", "stderr": " File \"<string>\", line 1\n import io; from rich.file_proxy import FileProxy; from rich.console import Console; class MockFile(io.TextIOBase): def isatty(self): return True; console = Console(); mock_file = MockFile(); proxy = FileProxy(console, mock_file); print(f'proxy.isatty: {proxy.isatty}')\n ^^^^^\nSyntaxError: invalid syntax\n", "exit_code": 1}} |
| 19 | run_command | {
"command": "python3 -c \"import io; from rich.file_proxy import FileProxy; from rich.console import Console; \nclass MockFile(io.TextIOBase): \n def isatty(self): return True\nconsole = Console()\nmock_file = MockFile()\nproxy = FileProxy(console, mock_file)\nprint(f'proxy.isatty: {proxy.isatty}')\""
} | {"status": "ok", "stdout": "proxy.isatty: <built-in method isatty of FileProxy object at 0x7ba14a132d10>\n", "exit_code": 0}full{"status": "ok", "stdout": "proxy.isatty: <built-in method isatty of FileProxy object at 0x7ba14a132d10>\n", "exit_code": 0} |
| 20 | run_command | {
"command": "python3 -c \"import io; from rich.file_proxy import FileProxy; from rich.console import Console; \nclass MockFile(io.TextIOBase): \n def isatty(self): return True\nconsole = Console()\nmock_file = MockFile()\nproxy = FileProxy(console, mock_file)\nprint(f'proxy.isatty(): {proxy.isatty()}')\""
} | {"status": "ok", "stdout": "proxy.isatty(): False\n", "exit_code": 0}full{"status": "ok", "stdout": "proxy.isatty(): False\n", "exit_code": 0} |
| 21 | run_command | {
"command": "python3 -c \"import io; help(io.TextIOBase)\""
} | {"status": "ok", "stdout": "Help on class TextIOBase in module io:\n\nclass TextIOBase(_io._TextIOBase, IOBase)\n | Base class for text I/O.\n |\n | This class full{"status": "ok", "stdout": "Help on class TextIOBase in module io:\n\nclass TextIOBase(_io._TextIOBase, IOBase)\n | Base class for text I/O.\n |\n | This class provides a character and line based interface to stream\n | I/O. There is no readinto method because Python's character strings\n | are immutable.\n |\n | Method resolution order:\n | TextIOBase\n | _io._TextIOBase\n | IOBase\n | _io._IOBase\n | builtins.object\n |\n | Data and other attributes defined here:\n |\n | __abstractmethods__ = frozenset()\n |\n | ----------------------------------------------------------------------\n | Methods inherited from _io._TextIOBase:\n |\n | detach(self, /)\n | Separate the underlying buffer from the TextIOBase and return it.\n |\n | After the underlying buffer has been detached, the TextIO is in\n | an unusable state.\n |\n | read(self, size=-1, /)\n | Read at most size characters from stream.\n |\n | Read from underlying buffer until we have size characters or we hit\n | EOF. If size is negative or omitted, read until EOF.\n |\n | readline(self, size=-1, /)\n | Read until newline or EOF.\n |\n | Return an empty string if EOF is hit immediately.\n | If size is specified, at most size characters will be read.\n |\n | write(self, s, /)\n | Write string s to stream.\n |\n | Return the number of characters written\n | (which is always equal to the length of the string).\n |\n | ----------------------------------------------------------------------\n | Data descriptors inherited from _io._TextIOBase:\n |\n | encoding\n | Encoding of the text stream.\n |\n | Subclasses should override.\n |\n | errors\n | The error setting of the decoder or encoder.\n |\n | Subclasses should override.\n |\n | newlines\n | Line endings translated so far.\n |\n | Only line endings translated during reading are considered.\n |\n | Subclasses should override.\n | |
| 22 | edit_file | {
"filepath": "rich/file_proxy.py",
"new_string": " def fileno(self) -> int:\\n return self.__file.fileno()\\n\\n def isatty(self) -> bool:\\n return self.__file.isatty()",
"old_string": " def fileno(self) -> int:\\n return self.__file.fileno()"
} | {"status": "error", "error_type": "FileEditError", "error_message": "old_string not found in file (tried exact, flexible and regex matching)"}full{"status": "error", "error_type": "FileEditError", "error_message": "old_string not found in file (tried exact, flexible and regex matching)"} |
| 23 | read_file | {
"filepath": "rich/file_proxy.py"
} | {"status": "ok", "filepath": "rich/file_proxy.py", "content": "import io\nfrom typing import IO, TYPE_CHECKING, Any, List\n\nfrom .ansi import AnsiDecoder\nfromfull{"status": "ok", "filepath": "rich/file_proxy.py", "content": "import io\nfrom typing import IO, TYPE_CHECKING, Any, List\n\nfrom .ansi import AnsiDecoder\nfrom .text import Text\n\nif TYPE_CHECKING:\n from .console import Console\n\n\nclass FileProxy(io.TextIOBase):\n \"\"\"Wraps a file (e.g. sys.stdout) and redirects writes to a console.\"\"\"\n\n def __init__(self, console: \"Console\", file: IO[str]) -> None:\n self.__console = console\n self.__file = file\n self.__buffer: List[str] = []\n self.__ansi_decoder = AnsiDecoder()\n\n @property\n def rich_proxied_file(self) -> IO[str]:\n \"\"\"Get proxied file.\"\"\"\n return self.__file\n\n def __getattr__(self, name: str) -> Any:\n return getattr(self.__file, name)\n\n def write(self, text: str) -> int:\n if not isinstance(text, str):\n raise TypeError(f\"write() argument must be str, not {type(text).__name__}\")\n buffer = self.__buffer\n lines: List[str] = []\n while text:\n line, new_line, text = text.partition(\"\\n\")\n if new_line:\n lines.append(\"\".join(buffer) + line)\n buffer.clear()\n else:\n buffer.append(line)\n break\n if lines:\n console = self.__console\n with console:\n output = Text(\"\\n\").join(\n self.__ansi_decoder.decode_line(line) for line in lines\n )\n console.print(output)\n return len(text)\n\n def flush(self) -> None:\n output = \"\".join(self.__buffer)\n if output:\n self.__console.print(output)\n del self.__buffer[:]\n\n def fileno(self) -> int:\n return self.__file.fileno()\n", "start_line": 1, "end_line": 57, "total_lines": 57, "is_truncated": false} |
| 24 | edit_file | {
"filepath": "rich/file_proxy.py",
"new_string": " def fileno(self) -> int:\n return self.__file.fileno()\n\n def isatty(self) -> bool:\n return self.__file.isatty()",
"old_string": " def fileno(self) -> int:\n return self.__file.fileno()"
} | {"status": "ok", "filepath": "rich/file_proxy.py", "occurrences": 1, "strategy": "exact", "diff": "--- a/rich/file_proxy.py\n+++ b/rich/file_proxy.py\n@@ -55,3 full{"status": "ok", "filepath": "rich/file_proxy.py", "occurrences": 1, "strategy": "exact", "diff": "--- a/rich/file_proxy.py\n+++ b/rich/file_proxy.py\n@@ -55,3 +55,6 @@\n \n def fileno(self) -> int:\n return self.__file.fileno()\n+\n+ def isatty(self) -> bool:\n+ return self.__file.isatty()\n", "is_truncated": false} |
| 25 | run_command | {
"command": "python3 test_proxy_isatty.py"
} | {"status": "ok", "stdout": "mock_file.isatty(): True\nproxy.isatty(): True\n", "exit_code": 0}full{"status": "ok", "stdout": "mock_file.isatty(): True\nproxy.isatty(): True\n", "exit_code": 0} |
| 26 | submit_patch | [] | {"status": "ok", "patch_size": 1498, "files_changed": 3}full{"status": "ok", "patch_size": 1498, "files_changed": 3} |
diff --git a/rich/file_proxy.py b/rich/file_proxy.py
index 4b0b0da6..e32523bd 100644
--- a/rich/file_proxy.py
+++ b/rich/file_proxy.py
@@ -55,3 +55,6 @@ class FileProxy(io.TextIOBase):
def fileno(self) -> int:
return self.__file.fileno()
+
+ def isatty(self) -> bool:
+ return self.__file.isatty()
diff --git a/test_proxy_isatty.py b/test_proxy_isatty.py
new file mode 100644
index 00000000..4ef4448b
--- /dev/null
+++ b/test_proxy_isatty.py
@@ -0,0 +1,16 @@
+import io
+from rich.file_proxy import FileProxy
+from rich.console import Console
+
+class MockFile(io.TextIOBase):
+ def isatty(self):
+ return True
+
+console = Console()
+mock_file = MockFile()
+proxy = FileProxy(console, mock_file)
+print(f"mock_file.isatty(): {mock_file.isatty()}")
+try:
+ print(f"proxy.isatty(): {proxy.isatty()}")
+except Exception as e:
+ print(f"proxy.isatty() raised: {e}")
diff --git a/tmp/test_proxy_isatty.py b/tmp/test_proxy_isatty.py
new file mode 100644
index 00000000..4ef4448b
--- /dev/null
+++ b/tmp/test_proxy_isatty.py
@@ -0,0 +1,16 @@
+import io
+from rich.file_proxy import FileProxy
+from rich.console import Console
+
+class MockFile(io.TextIOBase):
+ def isatty(self):
+ return True
+
+console = Console()
+mock_file = MockFile()
+proxy = FileProxy(console, mock_file)
+print(f"mock_file.isatty(): {mock_file.isatty()}")
+try:
+ print(f"proxy.isatty(): {proxy.isatty()}")
+except Exception as e:
+ print(f"proxy.isatty() raised: {e}")
.... [100%] 4 passed in 0.10s