CodeQL 文档

模块使用“import”和“import from”导入

ID: py/import-and-import-from
Kind: problem
Security severity: 
Severity: recommendation
Precision: very-high
Tags:
   - maintainability
Query suites:
   - python-security-and-quality.qls

点击查看 CodeQL 仓库中的查询

使用 import xxxfrom xxx import yyy 两次导入模块会造成混淆。

建议

删除 from xxx import yyy 语句。如果需要,添加 yyy = xxx.yyy

示例

import os
from os import walk

参考资料

  • ©GitHub, Inc.
  • 条款
  • 隐私