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

Update streamer.py #103

Merged
merged 2 commits into from
Nov 16, 2023
Merged

Update streamer.py #103

merged 2 commits into from
Nov 16, 2023

Conversation

Quenos
Copy link
Contributor

@Quenos Quenos commented Nov 16, 2023

Fixing issue #100

Description

Related issue(s)

Fixes ...

Pre-merge checklist

  • Passing tests
  • New tests added (if applicable)

Fixing issue #100
@Quenos
Copy link
Contributor Author

Quenos commented Nov 16, 2023

Why is this failing?
Because channel is an event type.

@Graeme22
Copy link
Contributor

It looks like here

channel = next((k for k, v in self._channels.items() if v == message['channel']), None)

self._subscription_state[channel]...

It's complaining that if the iterator is exhausted, the _subscription_state dict will be accessed with None as a key which will fail. You can omit the second argument, None, from the next function; that way, it'll raise an exception if the iterator reaches the end instead of passing None to the dict.

Alternatively, you could make channel a dict mapping int to the event type instead of the other way around.

@Quenos
Copy link
Contributor Author

Quenos commented Nov 16, 2023

Apparently it broke something else now

@Graeme22
Copy link
Contributor

Nope it's working well!

@Graeme22 Graeme22 merged commit a8a8982 into tastyware:master Nov 16, 2023
0 of 4 checks passed
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.

2 participants