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

lint: add type hints and test for them #29

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

miketheman
Copy link

Introduce mypy and apply strict type hints.
Declare typed support via marker file and classifier.

@miketheman
Copy link
Author

Relies on #27 for a clean lint run.

@@ -213,7 +227,7 @@ def is_last_attempt(request):
if attempt is None or attempts is None:
return True

return attempt + 1 == attempts
return attempt + 1 == attempts # type: ignore[no-any-return] # TODO: what's the best way to determine these?
Copy link
Author

Choose a reason for hiding this comment

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

I'm not certain how to inspect these, since both attempt and attempts could be t.Any, due to the untyped nature of request.environ (a dict) and they are being set earlier on.

I contemplated adding assert isinstance(attempt, int); assert isinstance(attempts, int) but that felt clunky too.

Introduce `mypy` and apply strict type hints.
Declare typed support via marker file and classifier.

Signed-off-by: Mike Fiedler <miketheman@gmail.com>
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