Skip to content

style(transport): annotate codec function signatures - #173

Open
zevision wants to merge 1 commit into
leyten:masterfrom
zevision:master
Open

zevision wants to merge 1 commit into
leyten:masterfrom
zevision:master

Conversation

@zevision

Copy link
Copy Markdown

Hi! First contribution here

I added type hints to four functions in shard/transport.py that
were missing them, so the wire format is visible at a glance without
tracing through the body:

  • _pack_parts() now declares it returns list[bytes | memoryview]
  • _unpack() declares its input is bytes | bytearray | memoryview
  • _sendall_vectored(parts=...) declares list[bytes | memoryview]
  • use_key() declares material: None

This is pure annotation work — no behavior changes, no extra imports.
Kept the changes minimal and matched the existing style.

Tests: test_transport_vectored.py + test_wire_hardening.py → 38 passed.
Happy to adjust anything if it doesn't fit the maintainers' preferences

Add return/param type hints to _pack_parts, _unpack,
_sendall_vectored, and use_key. Pure annotations, no
behavior change.

- _pack_parts() -> list[bytes | memoryview]
- _unpack(buf: bytes | bytearray | memoryview)
- _sendall_vectored(parts: list[bytes | memoryview])
- use_key(material: None)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant