Upgrade `typing.type_check_only` to be applicable to variables(and maybe import statements)
还没有人认领这个 Issue。
- 主要语言
- Python
- 星标
- 1.8k
- 派生
- 302
- 平均合并
- 23 小时
- 30 天内合并 PR
- 8
描述
from typing import _KT, _promote
Success: no issues found in 1 source file
Sure it has an underscore, but seems super sus that there is no mechanism to specify that a variable in a stub is just a type time helper and has no bearing on reality whatsoever.
You can specify explicitly that an import is accessible by importing it with an alias, although this in itself looks extremely hacky/workaroundy.
Also if it were possible to mark something in a stub as 'type time' only, then you could remove all the underscores and make a bunch of types look a lot nicer.
Very much related to https://github.com/python/mypy/issues/11503, where a module import in a stub can be completely fictitious, and there is currently no way to specify it one way or the other.
贡献指南
这个仓库没有索引到贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
调研方向
首先检查针对变量和导入语句所要求的 typing.type_check_only 行为,然后阅读关于存根中虚构模块导入的相关 issue #11503。只有在所需的、仅在类型检查时生效的语义以及导入行为都得到明确说明并达成一致后,才算完成。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- python
- 领域
- tooling
- Issue 类型
- 功能
- 难度
- 5/5
- 预计耗时
- 一周以上
- 活跃度
- 停滞
- 描述清晰度
- 需要澄清
- 新手友好度
- 30/100