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][A-100] Add type annotations for python/paddle/io/dataloader/worker.py #65645

Merged
merged 5 commits into from
Jul 4, 2024

Conversation

ooooo-create
Copy link
Contributor

PR Category

User Experience

PR Types

Improvements

Description

类型标注:
- python/paddle/io/dataloader/worker.py

Related links

@SigureMo @megemini

Copy link

paddle-bot bot commented Jul 2, 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.

SigureMo
SigureMo previously approved these changes Jul 2, 2024
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 🐾

Copy link
Member

Choose a reason for hiding this comment

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

2024-07-03 00:26:39 ++ python type_checking.py --debug
2024-07-03 00:26:39 ----------------Check results--------------------
2024-07-03 00:26:39 paddle.io.get_worker_info:1
2024-07-03 00:26:39 <string>:18:21: error: "WorkerInfo" has no attribute "num_workers"  [attr-defined]
2024-07-03 00:26:39 <string>:19:25: error: "WorkerInfo" has no attribute "id"  [attr-defined]
2024-07-03 00:26:39 Found 2 errors in 1 file (checked 1 source file)
2024-07-03 00:26:39 
2024-07-03 00:26:39 
2024-07-03 00:26:39 >>> Mistakes found in type checking!
2024-07-03 00:26:39 >>> Please recheck the type annotations. Run `tools/type_checking.py` to check the typing issues:
2024-07-03 00:26:39 > python tools/type_checking.py paddle.io.get_worker_info
2024-07-03 00:26:39 ----------------End of the Check--------------------
2024-07-03 00:26:39 ----------------End of the Check--------------------
2024-07-03 00:26:39 ++ type_checking_error=1

示例代码还是挂了,因为 WorkerInfo 完全是动态属性的

我尝试将 WorkerInfo 变为泛型,但是 Python 尚无一种泛型参数能够承载这样的需求,因此貌似并不能解决这个

现在还是添加下 # type: ignore

@paddle-bot paddle-bot bot added the contributor External developers label Jul 2, 2024
@SigureMo
Copy link
Member

SigureMo commented Jul 3, 2024

有一个加错位置了

@luotao1 luotao1 added the HappyOpenSource 快乐开源活动issue与PR label Jul 3, 2024
@SigureMo
Copy link
Member

SigureMo commented Jul 3, 2024

喔喔,最好和 #65644 一样补一下类型吧

@ooooo-create
Copy link
Contributor Author

喔喔,最好和 #65644 一样补一下类型吧

已添加~

@SigureMo SigureMo merged commit a72432c into PaddlePaddle:develop Jul 4, 2024
31 of 32 checks passed
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