-
Notifications
You must be signed in to change notification settings - Fork 3
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
Move to pyright and fix type errors #135
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #135 +/- ##
==========================================
- Coverage 96.25% 96.05% -0.20%
==========================================
Files 9 9
Lines 935 939 +4
==========================================
+ Hits 900 902 +2
- Misses 35 37 +2 ☔ View full report in Codecov by Sentry. |
112d5e7
to
44f3b10
Compare
src/scanspec/core.py
Outdated
@@ -616,7 +616,7 @@ def consume(self, num: int | None = None) -> Frames[Axis]: | |||
|
|||
def __len__(self) -> int: | |||
"""Number of frames left in a scan, reduces when `consume` is called.""" | |||
return self.end_index - self.index | |||
return int(self.end_index - self.index) |
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.
Nit: if we define self.end_index: int = np.prod...
then we shouldn't have to do this?
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.
That still requires a cast when I try 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.
In the end I went with self.end_index = int(np.prod(self.lengths))
, since that fixes another error that emerged with a pyright upgrade
pyproject.toml
Outdated
"click>=8.1", | ||
"pydantic>=2.0", | ||
] | ||
dependencies = ["numpy>=2", "click>=8.1", "pydantic>=2.0"] |
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.
numpy needs to be unpinned
44f3b10
to
2527d04
Compare
Fixes #103