fix: monkey patch

- Moved the import of Queue and Empty from the top of the file to within the QueueTransportReadCloser class.
- This change improves encapsulation and ensures that the imports are only available where needed.
This commit is contained in:
Harry 2026-01-29 22:33:14 +08:00
parent f198540357
commit 4aea4071a8
1 changed files with 3 additions and 2 deletions

View File

@ -1,5 +1,3 @@
from queue import Empty, Queue
from core.virtual_environment.channel.exec import TransportEOFError
from core.virtual_environment.channel.transport import TransportReadCloser
@ -29,6 +27,8 @@ class QueueTransportReadCloser(TransportReadCloser):
A write handler that writes data to a queue.
"""
from queue import Queue
def __init__(self, queue: Queue[bytes | None]) -> None:
self.queue = queue
@ -70,6 +70,7 @@ class QueueTransportReadCloser(TransportReadCloser):
NEVER USE IT IN A MULTI-THREADED CONTEXT WITHOUT PROPER SYNCHRONIZATION.
"""
from queue import Empty
if n <= 0:
return b""