Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[CodeStyle][NPY001] replace numpy deprecated type alias #51524

Merged
merged 4 commits into from
Mar 16, 2023

Conversation

SigureMo
Copy link
Member

@SigureMo SigureMo commented Mar 12, 2023

PR types

Bug fixes

PR changes

Others

Describe

#49949,这些别名自 NumPy 1.20 弃用,1.24 已经移除,#49949 结项时已经全面清理,但是难以杜绝增量的产生,本 PR 引入 Ruff NPY001 rule 以避免增量。

  • 是否可以引入本 rule:✅ 如上所述,为避免增量可引入
  • 是否可引入自动修复:❌ Ruff 提供的自动方案可保证不修改代码语义,但会降低可读性,不是最为推荐的方案,因此建议仅引入该 rule 用于拦截,修复则由开发者来手动修复

修复所使用的命令如下:

# 安装 ruff 0.0.254
pip install ruff==0.0.254
# 本 rule 自动修复方案不合适,因此仅仅跑一下(不加 `--fix`),之后手动修复
ruff --select NPY001 .
# 手动修复中...

Note

Related links

@paddle-bot
Copy link

paddle-bot bot commented Mar 12, 2023

你的PR提交成功,感谢你对开源项目的贡献!
请关注后续CI自动化测试结果,详情请参考Paddle-CI手册
Your PR has been submitted. Thanks for your contribution!
Please wait for the result of CI firstly. See Paddle CI Manual for details.

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.

2 participants