Refactor protocol and transport modules to use type hints for improved clarity and consistency
- Updated Codec class to use abstract methods for encoding and decoding envelopes. - Changed Envelope class to use Dict and Optional for payload and error fields. - Refined error handling in RPCError class with Optional type hints for details. - Enhanced manifest validation logic with type hints for better type safety. - Improved plugin loading mechanism with consistent type annotations. - Updated RPCClient to utilize Optional for codec and connection attributes. - Refactored transport classes to use Optional for server attributes and socket paths.
This commit is contained in:
@@ -3,12 +3,14 @@
|
||||
根据运行平台自动选择最优传输实现。
|
||||
"""
|
||||
|
||||
from typing import Optional
|
||||
|
||||
import sys
|
||||
|
||||
from .base import TransportClient, TransportServer
|
||||
|
||||
|
||||
def create_transport_server(socket_path: str | None = None) -> TransportServer:
|
||||
def create_transport_server(socket_path: Optional[str] = None) -> TransportServer:
|
||||
"""创建传输服务端
|
||||
|
||||
Linux/macOS 使用 UDS,Windows 使用 TCP 回退。
|
||||
|
||||
Reference in New Issue
Block a user