Repository navigation
fix: 修复非 Linux 平台下 libc 未定义 NameError 及规范类型注解 - #82
Open
reginaldalfret wants to merge 1 commit into
Open
reginaldalfret wants to merge 1 commit into
reginaldalfret wants to merge 1 commit into
Conversation
…typing annotations In py_vhome/vhome.py, return None for libc when the host platform is not Linux, avoiding NameError on macOS and other platforms. In config_flow.py and device_manager.py, replace invalid type annotations with dict[str, Any]. In __init__.py, simplify chained DeviceManager.instance() calls. Signed-off-by: reginaldalfret <reginaldalfret@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
概述
本 PR 修复了在非 Linux 环境(如 macOS)下
detect_platform抛出NameError: name 'libc' is not defined的问题,并规范了配置流程中的类型注解。改动说明
修复
detect_platform中未定义变量问题 (py_vhome/vhome.py)else分支直接返回(sysplat, arch, libc),但在非 Linux/非 Windows 环境下libc未被定义,导致直接触发NameError。(sysplat, arch, None),保持与类型签名Tuple[str, str, Optional[str]]一致。修复类型注解语法 (
config_flow.py&device_manager.py)description_placeholders: {} = {}为description_placeholders: dict[str, Any] = {}。优化
async_unload_entry调用结构 (__init__.py)dm = DeviceManager.instance(),避免冗余连续链式调用.instance().instance()。