Skip to content

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

Merged
SigureMo merged 7 commits into
PaddlePaddle:developfrom
Whsjrczr:typing2
Aug 10, 2024
Merged

SigureMo merged 7 commits into
PaddlePaddle:developfrom
Whsjrczr:typing2

Conversation

@Whsjrczr

@Whsjrczr Whsjrczr commented Aug 7, 2024

Copy link
Copy Markdown
Contributor

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

@paddle-bot

paddle-bot Bot commented Aug 7, 2024

Copy link
Copy Markdown

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

Whsjrczr commented Aug 8, 2024

Copy link
Copy Markdown
Contributor Author

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

Comment thread python/paddle/reader/decorator.py Outdated
Comment on lines +36 to +38
if TYPE_CHECKING:
from collections.abc import Sequence

Copy link
Copy Markdown
Collaborator

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
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

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

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

已更新

@gouzil

gouzil commented Aug 8, 2024

Copy link
Copy Markdown
Collaborator

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

现在的位置就是对的

Comment thread python/paddle/reader/decorator.py Outdated
import random
import sys
import warnings
from collections.abc import Generator

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

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

Copy link
Copy Markdown
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

Whsjrczr commented Aug 9, 2024

Copy link
Copy Markdown
Contributor Author

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位置不对嘛

@SigureMo SigureMo left a comment

Copy link
Copy Markdown
Collaborator

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
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