fix(util): preserve LRU cache decorator types#2643
Open
paulkagiri wants to merge 1 commit into
Open
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #2643 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 64 64
Lines 7976 7981 +5
Branches 1102 1102
=========================================
+ Hits 7976 7981 +5 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary of Changes
Use
ParamSpecto type Falcon's internal LRU cache decorator factory so wrapped callables keep their original signatures and exposecache_clear()to static type checkers.This removes the now-unnecessary
type: ignorecomments around cached resolver/status helpers and adds the narrow assertions needed where the ASGI testing client converts a collected response status after the app has responded.Related Issues
Closes #2629
Pull Request Checklist
tox.docs/.docs/.versionadded,versionchanged, ordeprecateddirectives.docs/_newsfragments/, with the file name format{issue_number}.{fragment_type}.rst. (Runtox -e towncrier, and inspectdocs/_build/html/changes/in the browser to ensure it renders correctly.)Validation performed:
python -m mypy --strict falconpython -m ruff format --check falcon/util/misc.py falcon/media/handlers.py falcon/http_error.py falcon/http_status.py falcon/response.py falcon/testing/client.pypython -m ruff check falcon/util/misc.py falcon/media/handlers.py falcon/http_error.py falcon/http_status.py falcon/response.py falcon/testing/client.pypython -m pytest tests/test_media_handlers.py tests/test_httpstatus.py tests/test_utils.py::TestFalconUtils::test_code_to_http_status tests/test_utils.py::TestFalconUtils::test_http_status_to_code tests/asgi/test_hello_asgi.py -qpython tools/towncrier_draft.py --dry-rungit diff --check