Skip to content

add pipe_duplex for socket <-> websocket - #65

Merged
codeskyblue merged 7 commits into
masterfrom
add_pipe_duplex
Nov 22, 2025
Merged

add pipe_duplex for socket <-> websocket#65
codeskyblue merged 7 commits into
masterfrom
add_pipe_duplex

Conversation

@codeskyblue

Copy link
Copy Markdown
Owner

No description provided.

Copilot AI review requested due to automatic review settings November 19, 2025 01:37

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 and AsyncDuplex Protocol for async bidirectional I/O
  • Implemented SocketDuplex and WebSocketDuplex wrapper classes for unified async interfaces
  • Updated type annotations in android.py to 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.

Comment thread uiautodev/remote/pipe.py Outdated
Comment thread uiautodev/remote/pipe.py
Comment on lines +139 to +140
except Exception:
pass No newline at end of file

Copilot AI Nov 19, 2025

Copy link

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.

Copilot uses AI. Check for mistakes.
Comment thread uiautodev/remote/pipe.py
Comment thread uiautodev/remote/pipe.py
Comment thread uiautodev/remote/pipe.py
Comment thread uiautodev/remote/pipe.py Outdated

import logging
from typing import Dict, Optional
from typing import Dict, Optional, Union

Copilot AI Nov 19, 2025

Copy link

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.

Suggested change
from typing import Dict, Optional, Union
from typing import Union

Copilot uses AI. Check for mistakes.
Comment thread uiautodev/remote/pipe.py
Comment thread uiautodev/remote/pipe.py Outdated
Comment on lines +79 to +84
except:
pass
if not self._same:
try:
self.wsock.close()
except:

Copilot AI Nov 19, 2025

Copy link

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.

Suggested change
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)

Copilot uses AI. Check for mistakes.
Comment thread uiautodev/remote/pipe.py Outdated
Comment on lines +79 to +84
except:
pass
if not self._same:
try:
self.wsock.close()
except:

Copilot AI Nov 19, 2025

Copy link

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.

Suggested change
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.

Copilot uses AI. Check for mistakes.
Comment thread uiautodev/remote/scrcpy3.py Outdated

def _start_scrcpy3(self):
device = self._device
version = self.VERSION

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

version = self.VERSION,这个version没用上

codeskyblue and others added 4 commits November 20, 2025 14:07
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@codeskyblue
codeskyblue merged commit 54bf3b9 into master Nov 22, 2025
6 checks passed

@8vsmgwttft-del 8vsmgwttft-del left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants