gaogaotiantian / objprint

A library that can print Python objects in human readable format
Apache License 2.0
510 stars 43 forks source link

Add typing hints #107

Open user-11150 opened 1 month ago

user-11150 commented 1 month ago

Add typing hints (mypy strict mode)

gaogaotiantian commented 1 month ago

Sorry I did not have the time to check this. I was moving. Currently there's no plan to use the strict mode. However, some of the additions to the missing signatures are okay. Also in this PR do not change Type to type because that is deprecated in 3.9 and 3.8 is still alive (for a little bit). If Type is to be replaced, we should replace all the Dict and List etc.

So could you remove the strict check and leave only the additions to the signature types?

user-11150 commented 1 month ago

如果把DictList替换成builtins的dict和list,低于3.9的你打算怎么支持

gaogaotiantian commented 1 month ago

Also in this PR do not change Type to type

我的意思是不要这么干。

user-11150 commented 1 month ago

哦,抱歉误解了

user-11150 commented 1 month ago

我是不是还需要重新fork一下你的仓库

user-11150 commented 1 month ago

拉一个新的PR

gaogaotiantian commented 1 month ago

不用。你不应该在你的master上直接做修改……我建议你去看一下git的工作流程,可能对你有帮助。对于这个PR,你可以直接在你的branch上push新的commit。

user-11150 commented 1 month ago

我改了一下,你看看可以吗

user-11150 commented 1 month ago

不用。你不应该在你的master上直接做修改……我建议你去看一下git的工作流程,可能对你有帮助。对于这个PR,你可以直接在你的branch上push新的commit。

【十分钟学会正确的github工作流,和开源作者们使用同一套流程-哔哩哔哩】 https://b23.tv/1V1kgFN

你说的是这个视频吗?

gaogaotiantian commented 3 weeks ago

是,你需要熟悉一下github的操作。

对于这个PR,在这个PR里,只做一件事,就是把没有标注的类型补全。所以不要加--strict,不要去给Type做generic,包括其他的类型的generic都先不要做。你加的很可能是正确的,但是这不一定会让代码更好读。