ITADN

Autobahn WebSocket Protocol - Improve typing

#1838Pull Requestbblommers 创建于 2026-01-07
B
bblommerscommented
## Description Adds typehints to `autobahn/twisted/websocket.py` and `autobahn/websocket/protocol`. I realize that's only a small section of the codebase, those just contain the classes that I use the most :slightly_smiling_face: Some style choices that I made: - `X | Y` notation (instead of the `Optional[X]` that is used as well in this codebase) - Lowercase `dict[..]` and `tuple[..]`, as that is the preferred way for Python >= 3.10 (instead of `typing.Dict[..]` and `typing.Tuple[..]`) - Removed the `:style..` from the docstrings, if the type is now available as a typehint, just because it seems superfluous to specify the type twice ## Checklist - [x] I have referenced relevant issue numbers above - [x] I have performed a self-review of my code and it follows the style guidelines of this project - [ ] I have added new or used existing tests that prove my fix is effective or that my feature works - [ ] I have added necessary documentation (if appropriate) and updated the changelog - [x] I have added an AI assistance disclosure file (required!) in this PR
合并状态:未合并 关闭于 2026-01-09 3 条评论