-
Notifications
You must be signed in to change notification settings - Fork 177
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
chore: move types from shared-data to performance-metrics #15355
Conversation
I am stuck. mypy is evaluating robot_context_tracker.py and failing with
For the first error, I can't figure out why For the second, I get that async_wrapper is returning a coroutine where the return type of the coroutine is |
It looks like
I think the Suppose I'll need to think some more about how to solve both of these. For now, feel free to slap |
No worries at all, not like I was on the right path either. Do you think it is better to type ignore or cast to the right type? |
No preference from me. Sometimes one or the other can be more specific, but I don't know about this case. |
@SyntaxColoring, I need to have SupportsTracking and RobotContextState exist when the performance metrics package is not available (when installing the opentrons package from PyPI). Trying to figure out the best solution. Stubbing a mypy Protocol and an enum seems weird. The Protocol contains no logic in the first place, and what would I stub for the enum? See https://github.com/Opentrons/opentrons/actions/runs/9417949287/job/25944364043#step:9:1 |
It looks like you need class StubbedTracker(SupportsTracking):
... Which does require I would solve that by just declaring it as class StubbedTracker:
... without explicitly subclassing if TYPE_CHECKING:
# Enforce StubbedTracker implements SupportsTracking
# without creating a runtime dependency on it.
from performance_metrics import SupportsTracking
_: Type["SupportsTracking"] = StubbedTracker The
|
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.
Looks great, thank you!
@@ -142,6 +142,7 @@ def wrapper( | |||
|
|||
return result | |||
|
|||
# Whereas this is evaluated correctly as _UnderlyingFunctionReturn |
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.
Looks like a comment left over from debugging?
Overview
Changelog
Risk assessment
Low