Type compatibility with `h11._headers.Header`
还没有人认领这个 Issue。
评估
- 难度
- 1/5
- 预计耗时
- 1-3 小时
- 新手友好度
- 48/100
- Issue 类型
- 缺陷
- 描述清晰度
- 描述清楚
- 活跃度
- 停滞
- 技术栈
- python
- 领域
- networking
调研方向
Start in src/wsproto/typing.py and inspect how the Headers alias is defined. Compare it with h11._headers.Headers from version 0.13.0, then verify that the reported mypy error is resolved and that existing checks still pass. Done means wsproto.Header is type-compatible with h11 headers.
由索引模型根据 Issue 内容生成。
描述
At the moment, the wsproto.typing.Header type is not compatible with h11._headers.Header which is defined as the following, starting with version 0.13.0:
class Headers(Sequence[Tuple[bytes, bytes]]):
[...]
The following patch might provide this compatibility:
diff --git a/src/wsproto/typing.py b/src/wsproto/typing.py
index a44b27e..1786501 100644
--- a/src/wsproto/typing.py
+++ b/src/wsproto/typing.py
@@ -1,3 +1,3 @@
-from typing import List, Tuple
+from typing import Sequence, Tuple
-Headers = List[Tuple[bytes, bytes]]
+Headers = Sequence[Tuple[bytes, bytes]]
This would fix mypy errors such as:
error: Argument "headers" to "initiate_upgrade_connection" of "WSConnection" has incompatible type "Headers"; expected "List[Tuple[bytes, bytes]]" [arg-type]
Would that make sense? I can make a PR if necessary.
- 主要语言
- Python
- 星标
- 303
- 派生
- 57
- PR 合并指标
- 30 天内没有已合并 PR
贡献指南
这个仓库没有索引到贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
python-hyper/wsproto 的其他 Issue
-
Compression 未关闭
难度 5/5 一周以上 新手友好度 25/100
python-hyper/wsproto#199 · 5 条评论 ·
-
难度 3/5 1-2 天 新手友好度 38/100
python-hyper/wsproto#182 ·
查看 python-hyper/wsproto 的全部 Issue
相似的 Issue
-
link-check link-check:sphinx-theme
难度 2/5 1-3 小时 新手友好度 72/100
-
难度 2/5 1-3 小时 新手友好度 65/100
qgis/QGIS-Documentation#11275 ·
-
bug priority:normal ready-for-dev
难度 2/5 1-3 小时 新手友好度 88/100
OpenHands/extensions#626 · 1 条评论 ·
-
难度 1/5 1 小时以内 新手友好度 90/100
CSCfi/sd-search-api#39 ·
-
难度 1/5 1 小时以内 新手友好度 90/100