Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add client stream publisher #83

Merged
merged 2 commits into from
Nov 21, 2024
Merged

Add client stream publisher #83

merged 2 commits into from
Nov 21, 2024

Conversation

Hlamallama
Copy link
Collaborator

@Hlamallama Hlamallama commented Nov 20, 2024

Purpose

added a stream publisher to ensure that one pdu is sent at a time

Checklist

  • Added or updated unit tests
  • Added to release notes
  • Updated readme/documentation (if necessary)

Copy link
Collaborator

@rudigiesler rudigiesler left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a question about the typing change, otherwise looks good!

@@ -98,13 +99,17 @@ def __init__(
self.buffer = bytearray()
self.responses: dict[int, MemorySendChannel] = {}
self.encoder = PDUEncoder()
self.pdu_send_channel: MemorySendChannel
self.pdu_receive_channel: MemoryReceiveChannel
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this typing information necessary? I would've thought that open_memory_channel[PDU](0) would be typed, so that we don't need to specify the type here

return None

send_channel, receive_channel = open_memory_channel[PDU](0)
send_channel: MemorySendChannel
receive_channel: MemoryReceiveChannel
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same question here for changing this typing

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I initially didn't have it, ruff complained about type annotation for these.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This class (and a few others, I expect) could really benefit from using attrs to manage all the various fields. I think let's leave the type annotations as-is here and switch to attrs in a separate PR.

@Hlamallama Hlamallama merged commit 1778911 into main Nov 21, 2024
6 checks passed
@Hlamallama Hlamallama deleted the add-client-stream-publisher branch November 21, 2024 08:36
@jerith jerith mentioned this pull request Nov 25, 2024
3 tasks
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.

3 participants