| 文件 | 最后提交记录 | 最后更新时间 |
|---|---|---|
fix: pre-commit code Co-authored-by: wangrui<wangrui124@huawei.com> # message auto-generated for no-merge-commit merge: !199 merge br_geir into master fix: pre-commit code Created-by: wangrui_ Commit-by: wangrui Merged-by: cann-robot Description: <!-- 感谢您的合入申请! --> ### 当前PR是否有AI参与: [x] 否 [ ] 是 __1. AI Agent 平台: __2. AI 模型: __3. Prompt上下文 : ### PR功能描述 / 为什么需要这个合入**: 让全仓代码通过 pre-commit 全套 hook(ruff check + ruff format + codespell + trailing-whitespace / end-of-file-fixer / check-yaml 等基础 hook),共涉及 255 个文件(+9975/-7615)。 #### 修复内容分类 | 类别 | 规则 | 处理方式 | 数量 | |------|------|---------|------| | 真 bug | F821 | 字符串前向注解补 TYPE_CHECKING 导入;删死代码 del cas_mm | 13 | | | F811 | 删 testcase_op.py 被覆盖的重复 @property | 2 | | | B012 | profiling.py finally 内 return 重构为 try/except 后顺序执行 | 1 | | | hccl_cascade timeout | 主线笔误 timeout 未定义(10 处 F821),提取 _get_timeout() 为变量 | 10 | | 设计类豁免 | B027/B024 | 可选 hook / 抽象基类加 # noqa | 9 | | | E402 | backend 文件调换 docstring↔__future__ 顺序;延迟导入加 # noqa | 16 | | | F405/F403 | import * 展开为显式 import | 55 | | 异常处理 | E722 | 裸 except: → except Exception: | 37 | | | B904 | raise X → raise X from e(链式)/ from None(有意屏蔽) | 9 | | 未用代码 | F401 | re-export 导入加冗余别名 import x as x(不改 import * 行为) | 35 | | | F841 | 删确未使用的局部变量赋值 | 25 | | | B007 | 未用循环变量 → _ | 15 | | 格式化 | UP031 | % 格式化 → f-string(用 float()/str() 强转保留 printf 语义) | 88 | | | E712/E741/E731/B005 等 | != True→~、模糊名 l→ci、lambda→def、rstrip 多字符精确化 | 6 | | | trailing-ws / eof | 自动修复 | 23 | #### codespell 修复 - .gitcode/ISSUE_TEMPLATE/feature-request.yml:Backgroud → Background(真错字) - codespell 忽略列表加 dOut(数据术语 derivative output,误报) ### 该PR关联的issue *(格式为fixes #<issue号>, 或者resolves #<issue号>)*: fixes # ### 希望检视人员了解: - **非纯格式化**:除格式化外混入了 37 处 except:→except Exception: + 9 处 from e/from None 的异常处理变更(E722/B904,ruff 无自动修复,手动逐处确认语义安全),以及 10 处 hccl_cascade timeout bug 修复。 - **F841/B007 为 unsafe fix**:项目 pre-commit 配置未启用 --unsafe-fixes,这些删除/改名是手动执行并逐一确认变量确实未使用。 - **printf→f-string 保语义**:%-14.18f → {float(x):<14.18f}(加 float() 强转,因为 ml_dtypes.int4 的 printf 会强转但 f-string :f 不会),输出逐字节一致。 - **re-export 用冗余别名**:11 个 __init__.py / shim 模块的 F401 修复用 import x as x 而非 __all__,完全不改 from module import * 行为。 ## 测试 - pre-commit 9 hook 全 Passed - ruff check / ruff format 全绿 - 1321 个非设备测试通过(0 失败,20 skip 为预存在的 torch_npu/tf 冲突) - ttk 全模块 walk-import 冒烟通过(唯一失败 executor_main 为预存在的运行时依赖) ## 文档更新 <!--如果这个PR包含文档的更新,请在这里指出。例如:更新了README.md文件。--> ## 类型标签 <!-- [x] 表示选中 --> - [ ] Bug修复 - [ ] 新特性 - [ ] 性能优化 - [ ] 文档更新 - [x] 其他,请描述:代码质量清理 / lint 规范化 See merge request: cann/ops-test-kit!199 | 2 天前 | |
fix: pre-commit code Co-authored-by: wangrui<wangrui124@huawei.com> # message auto-generated for no-merge-commit merge: !199 merge br_geir into master fix: pre-commit code Created-by: wangrui_ Commit-by: wangrui Merged-by: cann-robot Description: <!-- 感谢您的合入申请! --> ### 当前PR是否有AI参与: [x] 否 [ ] 是 __1. AI Agent 平台: __2. AI 模型: __3. Prompt上下文 : ### PR功能描述 / 为什么需要这个合入**: 让全仓代码通过 pre-commit 全套 hook(ruff check + ruff format + codespell + trailing-whitespace / end-of-file-fixer / check-yaml 等基础 hook),共涉及 255 个文件(+9975/-7615)。 #### 修复内容分类 | 类别 | 规则 | 处理方式 | 数量 | |------|------|---------|------| | 真 bug | F821 | 字符串前向注解补 TYPE_CHECKING 导入;删死代码 del cas_mm | 13 | | | F811 | 删 testcase_op.py 被覆盖的重复 @property | 2 | | | B012 | profiling.py finally 内 return 重构为 try/except 后顺序执行 | 1 | | | hccl_cascade timeout | 主线笔误 timeout 未定义(10 处 F821),提取 _get_timeout() 为变量 | 10 | | 设计类豁免 | B027/B024 | 可选 hook / 抽象基类加 # noqa | 9 | | | E402 | backend 文件调换 docstring↔__future__ 顺序;延迟导入加 # noqa | 16 | | | F405/F403 | import * 展开为显式 import | 55 | | 异常处理 | E722 | 裸 except: → except Exception: | 37 | | | B904 | raise X → raise X from e(链式)/ from None(有意屏蔽) | 9 | | 未用代码 | F401 | re-export 导入加冗余别名 import x as x(不改 import * 行为) | 35 | | | F841 | 删确未使用的局部变量赋值 | 25 | | | B007 | 未用循环变量 → _ | 15 | | 格式化 | UP031 | % 格式化 → f-string(用 float()/str() 强转保留 printf 语义) | 88 | | | E712/E741/E731/B005 等 | != True→~、模糊名 l→ci、lambda→def、rstrip 多字符精确化 | 6 | | | trailing-ws / eof | 自动修复 | 23 | #### codespell 修复 - .gitcode/ISSUE_TEMPLATE/feature-request.yml:Backgroud → Background(真错字) - codespell 忽略列表加 dOut(数据术语 derivative output,误报) ### 该PR关联的issue *(格式为fixes #<issue号>, 或者resolves #<issue号>)*: fixes # ### 希望检视人员了解: - **非纯格式化**:除格式化外混入了 37 处 except:→except Exception: + 9 处 from e/from None 的异常处理变更(E722/B904,ruff 无自动修复,手动逐处确认语义安全),以及 10 处 hccl_cascade timeout bug 修复。 - **F841/B007 为 unsafe fix**:项目 pre-commit 配置未启用 --unsafe-fixes,这些删除/改名是手动执行并逐一确认变量确实未使用。 - **printf→f-string 保语义**:%-14.18f → {float(x):<14.18f}(加 float() 强转,因为 ml_dtypes.int4 的 printf 会强转但 f-string :f 不会),输出逐字节一致。 - **re-export 用冗余别名**:11 个 __init__.py / shim 模块的 F401 修复用 import x as x 而非 __all__,完全不改 from module import * 行为。 ## 测试 - pre-commit 9 hook 全 Passed - ruff check / ruff format 全绿 - 1321 个非设备测试通过(0 失败,20 skip 为预存在的 torch_npu/tf 冲突) - ttk 全模块 walk-import 冒烟通过(唯一失败 executor_main 为预存在的运行时依赖) ## 文档更新 <!--如果这个PR包含文档的更新,请在这里指出。例如:更新了README.md文件。--> ## 类型标签 <!-- [x] 表示选中 --> - [ ] Bug修复 - [ ] 新特性 - [ ] 性能优化 - [ ] 文档更新 - [x] 其他,请描述:代码质量清理 / lint 规范化 See merge request: cann/ops-test-kit!199 | 2 天前 |
| 文件 | 最后提交记录 | 最后更新时间 |
|---|---|---|
| 2 天前 | ||
| 2 天前 |