-
Notifications
You must be signed in to change notification settings - Fork 5.6k
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
Conversation
你的PR提交成功,感谢你对开源项目的贡献! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
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
吧
有一个加错位置了 |
喔喔,最好和 #65644 一样补一下类型吧 |
已添加~ |
PR Category
User Experience
PR Types
Improvements
Description
类型标注:
-
python/paddle/io/dataloader/worker.py
Related links
@SigureMo @megemini