Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Following up from PR #7202 looking at resolving #1348, these seem like most of the remaining obvious tidying commits (pending the following comments):
statsd_increment
decorator function return type (usingReturnT
instead of usingAny
)FuncT
was unused in decorator.py, but was used in profile.py, so one commit adds more explicit return typing to the other decoratorreturn_success_on_head_request
was quite inaccurate and is hopefully better now.Two commits switched to the python3 type annotations, since I saw that in another commit following #7202, but I'm not sure if that's the consensus when changing a function, anything in a file, or if generally it's going to happen in a separate migration?
Also, using the explicit
Callable[..., SomeType]
format may work around python/mypy#1927, though is arguably more verbose; should we keep to using an #ignore or use something like this if it works?One reason for the bad typing sneaking through is that as much as we type with
HttpRequest
andHttpResponse
, they are actually synonyms forAny
(based on reveal_type, at least). I know there was some work on this, and there's an external project I've seen for django, though I'm not sure how close to use any of that is.FYI @gnprice @timabbott