Skip to content
This repository was archived by the owner on Aug 15, 2019. It is now read-only.

Conversation

@PeterJCLaw
Copy link
Contributor

@PeterJCLaw PeterJCLaw commented Feb 17, 2018

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:

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:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there something we can constrain it down to besides Any?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

huh, that should, I think, be str? Not sure why I made that Any.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants