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

Add return types to all __str__ methods #3221

Closed
wants to merge 1 commit into from

Conversation

adamtheturtle
Copy link
Contributor

If this library is to ship type hints, it is important that those type hints are valid.
A type checker (e.g. mypy or pyright) can check that those type hints are valid, but to do so, the codebase must be type hinted throughout. This PR is one small step towards that goal.

This change replaces all instances of def __str__(self): with def __str__(self) -> str:.
I chose to do a small PR, as to add passing type checking to the whole codebase involves hundreds or maybe thousands of changes, some of which may need real consideration.

If this library is to ship type hints, it is important that those
type hints are valid.
A type checker (e.g. `mypy` or `pyright`) can check that those type
hints are valid, but to do so, the codebase must be type hinted throughout.
This PR is one small step towards that goal.

This change replaces all instances of `def __str__(self):` with
`def __str__(self) -> str:`.
I chose to do a small PR, as to add passing type checking to the
whole codebase involves hundreds or maybe thousands of changes,
some of which may need real consideration.
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.

1 participant