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

Change type from Any to object for under_cached_property.__get__ #50

Merged
merged 1 commit into from
Oct 8, 2024

Conversation

bdraco
Copy link
Member

@bdraco bdraco commented Oct 7, 2024

If the implementation is type safe with anything, then it should be updated to object. I've had discussions in typeshed before, and the consensus is that typeshed should use object in such circumstances (otherwise, it triggers Any warnings in mypy if all the any warnings are enabled, anytime a user uses that function).

Originally posted by @Dreamsorcerer in #38 (comment)

@bdraco bdraco added the bot:chronographer:skip This PR does not need to include a change note label Oct 7, 2024
src/propcache/_helpers_py.py Dismissed Show dismissed Hide dismissed
src/propcache/_helpers_py.py Dismissed Show dismissed Hide dismissed
@bdraco
Copy link
Member Author

bdraco commented Oct 7, 2024

Seems ok downstream in yarl

@bdraco
Copy link
Member Author

bdraco commented Oct 7, 2024

Seems ok in aiohttp

Copy link

codecov bot commented Oct 7, 2024

Codecov Report

Attention: Patch coverage is 33.33333% with 2 lines in your changes missing coverage. Please review.

Project coverage is 88.24%. Comparing base (cc02c1f) to head (883fdb7).

Files with missing lines Patch % Lines
src/propcache/_helpers_py.py 33.33% 0 Missing and 2 partials ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##           master      #50   +/-   ##
=======================================
  Coverage   88.24%   88.24%           
=======================================
  Files          17       17           
  Lines         689      689           
  Branches       98       98           
=======================================
  Hits          608      608           
  Misses         63       63           
  Partials       18       18           
Flag Coverage Δ
CI-GHA 88.24% <33.33%> (ø)
MyPy 77.84% <33.33%> (ø)
OS-Linux 98.38% <ø> (ø)
OS-Windows 93.65% <ø> (ø)
OS-macOS 94.17% <ø> (ø)
Py-3.10.11 92.88% <ø> (ø)
Py-3.10.15 95.46% <ø> (ø)
Py-3.11.10 95.46% <ø> (ø)
Py-3.11.9 92.88% <ø> (ø)
Py-3.12.6 95.46% <ø> (ø)
Py-3.12.7 ?
Py-3.13.0-rc.3 95.46% <ø> (ø)
Py-3.8.10 93.18% <ø> (ø)
Py-3.8.18 95.77% <ø> (ø)
Py-3.9.13 92.85% <ø> (ø)
Py-3.9.20 95.45% <ø> (ø)
Py-pypy7.3.11 95.50% <ø> (ø)
Py-pypy7.3.16 95.13% <ø> (ø)
Py-pypy7.3.17 95.14% <ø> (ø)
VM-macos-latest 94.17% <ø> (ø)
VM-ubuntu-latest 98.38% <ø> (ø)
VM-windows-latest 93.65% <ø> (ø)
pytest 98.38% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@bdraco bdraco marked this pull request as ready for review October 7, 2024 21:31
@Dreamsorcerer
Copy link
Member

For calling code, this change could only remove errors, not introduce them (i.e. if using --warn-any-expr).

@bdraco
Copy link
Member Author

bdraco commented Oct 7, 2024

Before
MyPy flags
All Flags

After
MyPy flags
All Flags

@bdraco
Copy link
Member Author

bdraco commented Oct 7, 2024

Super confusing that Coverage not affected when comparing cc02c1f...883fdb7 in the CI checks and ..

Attention: Patch coverage is 33.33333% with 2 lines in your changes missing coverage. Please review.
#50 (comment)

@bdraco
Copy link
Member Author

bdraco commented Oct 7, 2024

https://mypy.readthedocs.io/en/latest/dynamic_typing.html#any-vs-object

If you’re not sure whether you need to use object or Any, use object – only switch to using Any if you get a type checker complaint.

I'd say we didn't get any complaints so that seems to be the prescribed way to go.

@bdraco
Copy link
Member Author

bdraco commented Oct 7, 2024

Too tired and jet lagged to revalidate so I'll leave this for someone else to ✅ and merge or I'll take a look again when I've had some sleep.

@bdraco
Copy link
Member Author

bdraco commented Oct 8, 2024

I think this is good to merge as-is, but I wasn't 100% on all the discussions above so I'll leave it until they are resolved above.

@webknjaz
Copy link
Member

webknjaz commented Oct 8, 2024

I think it's okay to merge. This is probably best we can do right now.

@webknjaz webknjaz enabled auto-merge (squash) October 8, 2024 11:23
@webknjaz webknjaz merged commit 6096a8a into master Oct 8, 2024
49 checks passed
@webknjaz webknjaz deleted the type_object branch October 8, 2024 12:24
@Dreamsorcerer Dreamsorcerer mentioned this pull request Oct 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bot:chronographer:skip This PR does not need to include a change note
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants