Skip to content
This repository has been archived by the owner on Jan 25, 2024. It is now read-only.

Typing issues with Board.backend #409

Open
trickeydan opened this issue Sep 8, 2019 · 1 comment
Open

Typing issues with Board.backend #409

trickeydan opened this issue Sep 8, 2019 · 1 comment
Labels
typing A incorrect or loose type that needs correcting.

Comments

@trickeydan
Copy link
Contributor

I think the issue is partially due to backend being of type Type[Backend] rather than
Backend. If the below code is used MyPy is happy but it will almost certainly run time error when we don't provide the necessary values to the subtype's constructor.

board_type: Type['Board'] = backend().board

Converting Backend.board from a @property to a @classmethod is the only thing, other than the cast, that I can think of but that would require large changes to the codebase and Backend.board() doesn't feel particularly nice, though a rename could fix that.

Do you think it's worth changing, or should we just leave as the cast?

Originally posted by @sedders123 in #406

@trickeydan
Copy link
Contributor Author

Possibly relevant: #342

@trickeydan trickeydan added the typing A incorrect or loose type that needs correcting. label Sep 8, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
typing A incorrect or loose type that needs correcting.
Projects
None yet
Development

No branches or pull requests

1 participant