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

Update type annotations for audited widgets. #1952

Merged
merged 4 commits into from
May 26, 2023

Conversation

freakboy3742
Copy link
Member

At some point during the audit, we decided to introduce type annotations as part of documentation.

This PR retrospectively applies type annotations (including adding from __future__ import annotations so we can benefit from the most recent set of typing conventions).

PR Checklist:

  • All new features have been tested
  • All new features have been documented
  • I have read the CONTRIBUTING.md file
  • I will abide by the code of conduct

@freakboy3742 freakboy3742 requested a review from mhsmith May 26, 2023 06:01
Copy link
Member

@mhsmith mhsmith left a comment

Choose a reason for hiding this comment

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

I wasn't sure about arguments that accept int or float being annotated as float, but it turns out this has a special case in PEP 484:

Rather than requiring that users write import numbers and then use numbers.Float etc., this PEP proposes a straightforward shortcut that is almost as effective: when an argument is annotated as having type float, an argument of type int is acceptable

And this is implemented by mypy.

@mhsmith mhsmith merged commit c450f00 into beeware:main May 26, 2023
@freakboy3742 freakboy3742 deleted the update-annotations branch May 28, 2023 22:46
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.

2 participants