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

Fix type hint support for functools cached_property wrapped funcs #501

Merged
merged 2 commits into from
Sep 9, 2021

Conversation

jalaziz
Copy link
Contributor

@jalaziz jalaziz commented Sep 6, 2021

functools added a cached_property wrapper in Python 3.8. Support type
hinting for properties wrapped in both Django's cached_property and
functool's cached_property.

This came up while fixing system check warnings. I couldn't figure out why
the "property" was being reported as "magic" until I checked the type
hinting detection source code.

functools added a `cached_property` wrapper in Python 3.8. Support type
hinting for properties wrapped in both Django's `cached_property` and
functool's `cached_property`.
@codecov
Copy link

codecov bot commented Sep 6, 2021

Codecov Report

Merging #501 (5743e4a) into master (1407059) will increase coverage by 0.00%.
The diff coverage is 100.00%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master     #501   +/-   ##
=======================================
  Coverage   98.58%   98.58%           
=======================================
  Files          57       57           
  Lines        5710     5729   +19     
=======================================
+ Hits         5629     5648   +19     
  Misses         81       81           
Impacted Files Coverage Δ
drf_spectacular/plumbing.py 97.81% <100.00%> (+0.01%) ⬆️
tests/test_fields.py 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 1407059...5743e4a. Read the comment docs.

tfranzel added a commit that referenced this pull request Sep 9, 2021
@tfranzel tfranzel merged commit 5743e4a into tfranzel:master Sep 9, 2021
@tfranzel
Copy link
Owner

tfranzel commented Sep 9, 2021

very nice @jalaziz! thanks for the PR. i added a testcase to actually test the output of the endpoint to make sure the expectations on the outcome are also matched.

@jalaziz jalaziz deleted the functools-cached_property branch June 27, 2022 03:45
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.

None yet

2 participants