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

Move to pyright and fix type errors #135

Merged
merged 2 commits into from
Aug 19, 2024
Merged

Move to pyright and fix type errors #135

merged 2 commits into from
Aug 19, 2024

Conversation

callumforrester
Copy link
Contributor

Fixes #103

Copy link

codecov bot commented Aug 13, 2024

Codecov Report

Attention: Patch coverage is 71.42857% with 4 lines in your changes missing coverage. Please review.

Project coverage is 96.05%. Comparing base (c15b8c3) to head (89c18c0).
Report is 1 commits behind head on main.

Files Patch % Lines
src/scanspec/plot.py 75.00% 2 Missing ⚠️
src/scanspec/cli.py 0.00% 1 Missing ⚠️
src/scanspec/sphinxext.py 50.00% 1 Missing ⚠️
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.
📢 Have feedback on the report? Share it here.

@callumforrester callumforrester force-pushed the 103_pyright branch 3 times, most recently from 112d5e7 to 44f3b10 Compare August 14, 2024 12:48
@callumforrester callumforrester marked this pull request as ready for review August 14, 2024 12:53
@@ -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)
Copy link
Contributor

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?

Copy link
Contributor Author

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...

Copy link
Contributor Author

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"]
Copy link
Contributor

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

@callumforrester callumforrester merged commit 0f7329f into main Aug 19, 2024
18 checks passed
@callumforrester callumforrester deleted the 103_pyright branch August 19, 2024 08:28
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.

Move to pyright
3 participants