[Typing][A-100] Add type annotations for python/paddle/io/dataloader/worker.py#65645
Merged
SigureMo merged 5 commits intoPaddlePaddle:developfrom Jul 4, 2024
Merged
[Typing][A-100] Add type annotations for python/paddle/io/dataloader/worker.py#65645SigureMo merged 5 commits intoPaddlePaddle:developfrom
python/paddle/io/dataloader/worker.py#65645SigureMo merged 5 commits intoPaddlePaddle:developfrom
Conversation
|
你的PR提交成功,感谢你对开源项目的贡献! |
SigureMo
reviewed
Jul 2, 2024
Member
There was a problem hiding this comment.
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 吧
Member
|
有一个加错位置了 |
Member
|
喔喔,最好和 #65644 一样补一下类型吧 |
Contributor
Author
已添加~ |
SigureMo
approved these changes
Jul 3, 2024
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PR Category
User Experience
PR Types
Improvements
Description
类型标注:
-
python/paddle/io/dataloader/worker.pyRelated links
@SigureMo @megemini