-
Notifications
You must be signed in to change notification settings - Fork 121
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
Pytype fixes #740
Pytype fixes #740
Conversation
@@ -220,10 +219,10 @@ def iter_collect(*, | |||
|
|||
def collect(*, | |||
num_workers: int, | |||
tasks: Union[Iterator['sinter.Task'], Iterable['sinter.Task']], | |||
tasks: Union[Iterator[Task], Iterable[Task]], |
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.
Is this necessary to change? Because these methods are in the external API, I prefer to name the types how users would use them ("sinter.Task" instead of just "Task").
shots=bit_packed_detection_event_data, | ||
bit_packed_shots=True, | ||
bit_packed_predictions=True, | ||
return_weights=False, | ||
) | ||
if isinstance(result, tuple): | ||
return result[0] # pymatching returned predictions and weights |
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.
If this ever actually executed, it would be a bug. Raise an exception, or do a cast.
@@ -361,7 +361,7 @@ def test_decode_fails_correctly(decoder: str, force_streaming: Optional[bool]): | |||
with open(d / 'bad_dets.b8', 'wb') as f: | |||
f.write(b'!') | |||
|
|||
if 'vacuous' not in decoder: | |||
if 'vacuous' not in decoder and decoder_obj is not None: |
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.
I think this should assert it's not none instead of disabling the testing of the decoder that wasn't.
y_func: Callable[[TaskStats], Union[Fit, float, int]], | ||
group_func: _GroupFunc[TCurveId] = lambda _: None, | ||
filter_func: Callable[[TaskStats], Any] = lambda _: True, | ||
plot_args_func: Union[_PlotArgsFunc2[TCurveId], _PlotArgsFunc3[TCurveId]] = lambda index, group_key, group_stats: dict(), |
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.
This is an example where I sorta prefer for the exposed API to not mention the deprecated functionality, even though the method still technically supports it. I can't remove the backwards compat, but I can hide the complication of the backwards compat from new users.
7c26e1c
to
e5172a4
Compare
Closing due to stale comments and growing merge conflicts. Still open to fixing type errors in downstream tools. |
Ensure that python code bundled with stim passes
pytype --strict-none-binding
.