-
Couldn't load subscription status.
- Fork 20
Mock resampler: Improve variable names #879
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
Conversation
Since the mock resampler uses a pair of channels, one to receive samples to be (fakely) resampled (input) and one to send the (fakely) resampmled samples (output), we should use clear names to identify both otherwise is really hard to follow which is which when reading the code. Signed-off-by: Leandro Lucarella <[email protected]>
|
Enabled auto-merge. |
| input_chan_recv_name = f"{request.component_id}:{request.metric_id}" | ||
| input_chan_recv = self._input_channels_receivers[input_chan_recv_name].pop() | ||
| assert input_chan_recv is not None | ||
| output_chan_sender: Sender[Sample[Quantity]] = ( | ||
| self._channel_registry.get_or_create( | ||
| Sample[Quantity], name | ||
| ).new_sender() | ||
| ) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Interesting, this is better than basic_receivers, but input_receivers and output_sender might have even nicer. input_channels_receivers make me think that they receive channels and not input values.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, at first I named it without the chan, but for some reason it still seemed ambiguous, but now I don't remember why. Maybe @daniel-zullo-frequenz as he was helping me to understand the code while I did it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IIRC we wanted to mainly get rid of basic in the variable name because it was confusing/difficult-to-understand what a basic_receiver was. I do agree having only receivers and sender in the name would have suffice to understand they are channels given the context. However I don't think it causes any misunderstanding if we keep chan/channels explicitly in the variable names. I mean I haven't seen yet any scenarios where we send/receive channels
Since the mock resampler uses a pair of channels, one to receive samples to be (fakely) resampled (input) and one to send the (fakely) resampmled samples (output), we should use clear names to identify both otherwise is really hard to follow which is which when reading the code.