This repository was archived by the owner on Aug 15, 2019. It is now read-only.
Open
Conversation
This will show any untyped functions.
Ignore a deprecated class
This doesn't approach the Gpio or Servo constructors for now, but all the simpler functions are annotated.
This doesn't approach the all_known_boards attribute for now as it's not at all clear how to type that suitably.
robot/robot.py
Outdated
|
|
||
| @staticmethod | ||
| def _single_index(name, list_of_boards: BoardList[TBoard]) -> TBoard: | ||
| def _single_index(name: Any, list_of_boards: BoardList[TBoard]) -> TBoard: |
Member
There was a problem hiding this comment.
Is there something we can constrain it down to besides Any?
Contributor
Author
There was a problem hiding this comment.
huh, that should, I think, be str? Not sure why I made that Any.
Contributor
Author
There was a problem hiding this comment.
Ah, I know why I made that Any -- because that's the technically correct type. The only thing we do with the name is format it intio a string, so we don't care what type it is.
Member
There was a problem hiding this comment.
I think we should still constrain it to a better type that reflects what it should be, even if the implementation doesn't actually care what type it is
While 'Any' is technically correct, all our usages of it are going to be strings. Realistically any other type here is almost certainly an error.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This adds a bunch more types, though as a result we get more errors. I think some of the errors are fixable, though I'm not sure we can actually get to a point of having a clean type-check with some of the current structures. If things need changing, I'll probably do that in separate branches.
Depends on:
robot.robot.Robot(not necessarily that PR specifically, but we need to do something and we know we want to tidy them up at some point)Simplify board lists #79: Simplify board lists (which greatly simplifies typingBoardList)Collect the board lists only when needed #80: Collect board lists only when needed (I think that change will simplify the typing of that collection)