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][task 11] enable Ruff F403 rule in python/paddle/base/layers/__init__.py #57379

Merged
merged 4 commits into from
Sep 19, 2023

Conversation

ooooo-create
Copy link
Contributor

@ooooo-create ooooo-create commented Sep 15, 2023

PR types

Others

PR changes

Others

Description

enable Ruff F403 rule in python/paddle/base
fix python/paddle/base/layers/init.py
fix python/paddle/nn/functional/pooling.py
@gouzil

@paddle-bot
Copy link

paddle-bot bot commented Sep 15, 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.

@paddle-bot paddle-bot bot added the contributor External developers label Sep 15, 2023
@luotao1 luotao1 added the HappyOpenSource 快乐开源活动issue与PR label Sep 15, 2023
from . import math_op_patch
from .math_op_patch import *
Copy link
Member

@SigureMo SigureMo Sep 17, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这个 PR 可以在 F401 合入后开展,可以考虑一个一个来过 CI,我们首先看一下是否有代码会用这里的重导出,我们可以搜索 base.layers import,可以发现有几处,但是并不需要 .io 下和 .math_op_patch 下的 symbol,因此这两处重导出都可以直接删掉(应该,但不排除有其他用法)

甚至下面的 from ..layer_helper import LayerHelper 我们也可以规范一下,移除这里的重导出(这里重导出一个上层模块的 symbol 本就是不推荐的),搜索到的 from ...base.layers import LayerHelper 可以改为 from ...base.layer_helper import LayerHelper

可以先尝试改这一个文件,然后看看是否能够通过 CI,之后再改其他文件,慢慢来,F403 本就不是很容易改的,甚至可以考虑拆成多个 PR 慢慢做

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

paddle.base.layers.__init__.py修改已提交

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这个 PR 是准备只做这一个文件嘛?是的话可以改一下标题

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

是的是的,我改一下标题

@ooooo-create ooooo-create changed the title [CodeStyle][task 11] enable Ruff F403 rule in python/paddle/base [CodeStyle][task 11] enable Ruff F403 rule in python/paddle/base/layers/__init__.py Sep 19, 2023
Copy link
Member

@SigureMo SigureMo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

我记得还有个 from .libpaddle import * 来着,下个 PR 记得加 noqa,确保 ruff 扫后无存量

LGTMeow 🐾 本 PR 先行合入,这是 F403 的 part1

Comment on lines +111 to 112
"F522",
"F403",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这里是因为解决冲突写错了?不过 F522 出现概率很小,这两天应该不会出现增量,这个 PR 就这样吧,下个 PR 把 F522 和 F403 一并删掉

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

是,当时拉取完没改回去🤣,下个pr改回来~

@luotao1 luotao1 merged commit 8685af3 into PaddlePaddle:develop Sep 19, 2023
@ooooo-create ooooo-create deleted the ooooo/F403 branch September 23, 2023 05:24
Frida-a pushed a commit to Frida-a/Paddle that referenced this pull request Oct 14, 2023
…ers/__init__.py` (PaddlePaddle#57379)

* enable F403

* empty

* try to fix paddle.base.layers.__init__.py
danleifeng pushed a commit to danleifeng/Paddle that referenced this pull request Nov 14, 2023
…ers/__init__.py` (PaddlePaddle#57379)

* enable F403

* empty

* try to fix paddle.base.layers.__init__.py
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
contributor External developers HappyOpenSource 快乐开源活动issue与PR
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants