-
Notifications
You must be signed in to change notification settings - Fork 63
add pipe_duplex for socket <-> websocket #65
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR introduces bidirectional pipe functionality for async socket and WebSocket communication, enabling data transfer between different connection types. The implementation adds a new pipe.py module with protocol definitions and wrapper classes.
Key Changes:
- Added
pipe_duplex()function andAsyncDuplexProtocol for async bidirectional I/O - Implemented
SocketDuplexandWebSocketDuplexwrapper classes for unified async interfaces - Updated type annotations in
android.pyto accurately reflect return types
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 16 comments.
| File | Description |
|---|---|
| uiautodev/remote/pipe.py | New module implementing async duplex piping with Protocol definition and socket/WebSocket wrapper classes |
| uiautodev/router/android.py | Added Union type import and updated shell function return type annotation |
| uiautodev/remote/scrcpy.py | Minor formatting improvement (added blank line) |
| uiautodev/command_proxy.py | Added redundant int() casts for additional type safety in tap coordinates |
Comments suppressed due to low confidence (3)
uiautodev/remote/pipe.py:79
- Except block directly handles BaseException.
except:
uiautodev/remote/pipe.py:84
- Except block directly handles BaseException.
except:
uiautodev/remote/pipe.py:139
- 'except' clause does nothing but pass and there is no explanatory comment.
except Exception:
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| except Exception: | ||
| pass No newline at end of file |
Copilot
AI
Nov 19, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bare except Exception: without logging or handling the specific exception makes debugging difficult. Consider logging the exception or handling specific exception types (e.g., ConnectionError, RuntimeError) for better error visibility.
|
|
||
| import logging | ||
| from typing import Dict, Optional | ||
| from typing import Dict, Optional, Union |
Copilot
AI
Nov 19, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Import of 'Dict' is not used.
Import of 'Optional' is not used.
| from typing import Dict, Optional, Union | |
| from typing import Union |
uiautodev/remote/pipe.py
Outdated
| except: | ||
| pass | ||
| if not self._same: | ||
| try: | ||
| self.wsock.close() | ||
| except: |
Copilot
AI
Nov 19, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
'except' clause does nothing but pass and there is no explanatory comment.
| except: | |
| pass | |
| if not self._same: | |
| try: | |
| self.wsock.close() | |
| except: | |
| except: | |
| # Ignore exceptions during socket close (e.g., already closed) | |
| pass | |
| if not self._same: | |
| try: | |
| self.wsock.close() | |
| except: | |
| # Ignore exceptions during socket close (e.g., already closed) |
uiautodev/remote/pipe.py
Outdated
| except: | ||
| pass | ||
| if not self._same: | ||
| try: | ||
| self.wsock.close() | ||
| except: |
Copilot
AI
Nov 19, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
'except' clause does nothing but pass and there is no explanatory comment.
| except: | |
| pass | |
| if not self._same: | |
| try: | |
| self.wsock.close() | |
| except: | |
| except: | |
| # Ignore errors during rsock close; socket may already be closed or invalid. | |
| pass | |
| if not self._same: | |
| try: | |
| self.wsock.close() | |
| except: | |
| # Ignore errors during wsock close; socket may already be closed or invalid. |
uiautodev/remote/scrcpy3.py
Outdated
|
|
||
| def _start_scrcpy3(self): | ||
| device = self._device | ||
| version = self.VERSION |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
version = self.VERSION,这个version没用上
Co-authored-by: Copilot <[email protected]>
Co-authored-by: Copilot <[email protected]>
Co-authored-by: Copilot <[email protected]>
No description provided.