Add int type to num_samples on InjectTemplatesRecording. - #3229
Conversation
|
Yes, we have been using |
|
Also we have switched to all native typing rather than the typing module types. So all the uses of |
|
Great thanks both I'll make some changes to this module then request review |
|
One consideration, |
|
It'll be the sixth republic before Sam let's us do static type checking. So we've worked under the |
zm711
left a comment
There was a problem hiding this comment.
numpydoc standard requires a space before the colon after an argument. So the final format is:
arg : float, default: 5.0
we put a space before the first colon since it is required for the linter, but not for the second one. This is Chris's project, but I figure we can help him out a little ;)
| The recording over which to add the templates. | ||
| If None, will default to traces containing all 0. | ||
| num_samples: list[int] | int | None | ||
| num_samples: list[int] | int | None, default: None |
There was a problem hiding this comment.
| num_samples: list[int] | int | None, default: None | |
| num_samples : list[int] | int | None, default: None |
There was a problem hiding this comment.
Should it not be optional in the case of None?
There was a problem hiding this comment.
As in the default: None part? I'm not sure on this @zm711 may know, happy to make any changes as required
There was a problem hiding this comment.
Yeah, this is an issue where we had previously agreed that None would be default: None so much of the code base has been transitioning over to that style. But more recently we had a discussion about using num_samples : list[int] | int | None, optional as an alternative style. Maybe we should add this to a maintenance meeting that way we can all discuss this in person and make sure we are all on the same page with the style. We could do a quick vote to make sure everyone agrees on which of the two styles.
There was a problem hiding this comment.
Nice this sounds good, I think I prefer default: None for consistency and it is clearer than optional if you don't know much about typing. If most of the code is default: None shall I leave this for now and we can discuss at the meeting?
There was a problem hiding this comment.
All right if you find those semantics clearer.
int type to num_samples on InjectTemplatesRecording.
Co-authored-by: Zach McKenzie <92116279+zm711@users.noreply.github.com>
Co-authored-by: Zach McKenzie <92116279+zm711@users.noreply.github.com>
Co-authored-by: Zach McKenzie <92116279+zm711@users.noreply.github.com>
Co-authored-by: Zach McKenzie <92116279+zm711@users.noreply.github.com>
Co-authored-by: Zach McKenzie <92116279+zm711@users.noreply.github.com>
Co-authored-by: Zach McKenzie <92116279+zm711@users.noreply.github.com>
Co-authored-by: Zach McKenzie <92116279+zm711@users.noreply.github.com>
Co-authored-by: Zach McKenzie <92116279+zm711@users.noreply.github.com>
Co-authored-by: Zach McKenzie <92116279+zm711@users.noreply.github.com>
Co-authored-by: Zach McKenzie <92116279+zm711@users.noreply.github.com>
Co-authored-by: Zach McKenzie <92116279+zm711@users.noreply.github.com>
Co-authored-by: Zach McKenzie <92116279+zm711@users.noreply.github.com>
Co-authored-by: Zach McKenzie <92116279+zm711@users.noreply.github.com>
Co-authored-by: Zach McKenzie <92116279+zm711@users.noreply.github.com>
Co-authored-by: Zach McKenzie <92116279+zm711@users.noreply.github.com>
for more information, see https://pre-commit.ci
…interface into fix_type_hint_generate
|
Thanks both! I've applied changes and made some further changes to docstrings, re-requested review |
| num_units : int, default: 20 | ||
| Number of units. | ||
| sampling_frequency : float | ||
| sampling_frequency : float, default: 30000.0 (in Hz) |
There was a problem hiding this comment.
For these sampling frequency default values I don't know if they should be (in Hz) vs having the (in Hz) down in the actual description. So for me I would prefer:
sampling_frequency : float, default: 30000.0
The sampling rate entered in Hz. (or samples/second)
opinions @chrishalcrow @h-mayorquin ?
There was a problem hiding this comment.
I'd personally prefer the Hz to be in the description, so that a user can copy and paste the default value and it would work.
There was a problem hiding this comment.
Agree I prefer in the description I will make the change
|
@JoeZiminski one more discussion point and then a couple of typos :) |
|
Thanks @zm711! After all that talk of codespell I should actually remember to run it locally 😆 |
Adds a missing case for the
num_samplesparameter type hint onInjectTemplatesRecording. @zm711 @h-mayorquin was the consensus to changeUnionandOptionalto|in type hints? If so should these be changed in this module?