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

[Typing][PEP585 Upgrade][BUAA][111-120] Use standard collections for type hints for 10 files in python/paddle/ #67168

Merged
merged 7 commits into from
Aug 10, 2024

Conversation

Whsjrczr
Copy link
Contributor

@Whsjrczr Whsjrczr commented Aug 7, 2024

PR Category

User Experience

PR Types

Others

Description

python/paddle/quantization/config.py
python/paddle/reader/decorator.py
python/paddle/sparse/nn/functional/conv.py
python/paddle/sparse/nn/layer/conv.py
python/paddle/sparse/unary.py
python/paddle/tensor/array.py
python/paddle/tensor/creation.py
python/paddle/tensor/einsum.py
python/paddle/tensor/linalg.py
python/paddle/tensor/manipulation.py

Copy link

paddle-bot bot commented Aug 7, 2024

你的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.

@luotao1 luotao1 added the HappyOpenSource Pro 进阶版快乐开源活动,更具挑战性的任务 label Aug 8, 2024
@Whsjrczr
Copy link
Contributor Author

Whsjrczr commented Aug 8, 2024

请问Generator的import时的位置该放在哪里

Comment on lines 36 to 38
if TYPE_CHECKING:
from collections.abc import Sequence

Copy link
Member

Choose a reason for hiding this comment

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

这为啥又来一次TYPE_CHECKING

from typing import TYPE_CHECKING, Literal, Sequence
from typing import TYPE_CHECKING, Literal

if TYPE_CHECKING:
Copy link
Member

Choose a reason for hiding this comment

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

同上,后面的就不一一评论了

Copy link
Contributor Author

Choose a reason for hiding this comment

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

已更新

@gouzil
Copy link
Member

gouzil commented Aug 8, 2024

请问Generator的import时的位置该放在哪里

现在的位置就是对的

@@ -20,15 +20,14 @@
import random
import sys
import warnings
from collections.abc import Generator
Copy link
Member

Choose a reason for hiding this comment

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

这个在 type alias 里用了,不能改,运行时会挂

Copy link
Contributor Author

Choose a reason for hiding this comment

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

收到!

@SigureMo SigureMo changed the title [Typing][PEP585 Upgrade][BUAA][111-120] Use standard collections for type hints for 10 files in python/paddle/ [Typing][PEP585 Upgrade][BUAA][111-120] Use standard collections for type hints for 10 files in python/paddle/ Aug 9, 2024
@Whsjrczr
Copy link
Contributor Author

Whsjrczr commented Aug 9, 2024

PR-CI-SOT 还是过不了,报错:
2024-08-09 13:27:00 File "/workspace/Paddle/build/python/paddle/reader/decorator.py", line 72, in
2024-08-09 13:27:00 _Reader: TypeAlias = Callable[[], Generator[_T, None, None]]
2024-08-09 13:27:00 TypeError: 'ABCMeta' object is not subscriptable
请问是Callable位置不对嘛

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.

LGTMeow 🐾

@SigureMo SigureMo merged commit c4bc2c9 into PaddlePaddle:develop Aug 10, 2024
31 checks passed
Jeff114514 pushed a commit to Jeff114514/Paddle that referenced this pull request Aug 14, 2024
…type hints for 10 files in `python/paddle/` (PaddlePaddle#67168)


---------

Co-authored-by: gouzi <530971494@qq.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
contributor External developers HappyOpenSource Pro 进阶版快乐开源活动,更具挑战性的任务
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants