René's URL Explorer Experiment


Title: Ensures overloads are ordered from narrow to broad by Michael0x2a · Pull Request #2138 · python/typeshed · GitHub

Open Graph Title: Ensures overloads are ordered from narrow to broad by Michael0x2a · Pull Request #2138 · python/typeshed

X Title: Ensures overloads are ordered from narrow to broad by Michael0x2a · Pull Request #2138 · python/typeshed

Description: This commit reorders any overloads where the first overload was "shadowing" the second, preventing it from ever being matched by type checkers that work by selecting the first matching overload alternative. For example, the first overload alternative below is strictly broader then the second, preventing it from ever being selected: class Parent: pass class Child(Parent): pass @overload def foo(x: *int) -> Parent: ... @overload def foo(x: int, y: int) -> Child: ... The correct thing to do is to either delete the second overload or rearrange them to look like this: @overload def foo(x: int, y: int) -> Child: ... @overload def foo(x: *int) -> Parent: ... Rationale: I'm currently working on a proposal that would amend PEP 484 to (a) mandate type checkers check overloads in order and (b) prohibit overloads where an earlier alternative completely shadows a later one. This would prohibit overloads that look like the example below, where the first alternative completely shadows the second. I figured it would be a good idea to make these changes ahead of time: if my proposal is accepted, it'd make the transition smoother. If not, this is hopefully a relatively harmless change. Note: I think some of these overloads could be simplified (e.g. reversed(...)), but I mostly stuck with rearranging them in case I was wrong. The only overload I actually changed was hmac.compare_digest -- I believe the Python 2 version actually accepts unicode.

Open Graph Description: This commit reorders any overloads where the first overload was "shadowing" the second, preventing it from ever being matched by type checkers that work by selecting the first matching ov...

X Description: This commit reorders any overloads where the first overload was "shadowing" the second, preventing it from ever being matched by type checkers that work by selecting the first mat...

Opengraph URL: https://github.com/python/typeshed/pull/2138

X: @github

direct link

Domain: github.com

react-profiling0
react-import-mapreact,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322
route-pattern/:user_id/:repository/pull/:id/files(.:format)
route-controllerpull_requests
route-actionfiles
fetch-noncev2:c4f06b26-652d-c57d-cc42-30fd2ddc044b
current-catalog-service-hashae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b
request-idD082:30CC09:1CDB16B:26C09E1:6B0003D1
html-safe-nonce13a02d9461e5de996dfcf2b543b394100779eb2d93c7048b8e82f143969a9cb7
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJEMDgyOjMwQ0MwOToxQ0RCMTZCOjI2QzA5RTE6NkIwMDAzRDEiLCJ2aXNpdG9yX2lkIjoiMzUxODU5ODg5MDQyNzI1MzcxMyIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9
visitor-hmac97b5aed21c93403f1f054e156952a945638be8f1d0a9d86c06315e876de9943e
hovercard-subject-tagpull_request:188479059
github-keyboard-shortcutsrepository,pull-request-list,pull-request-conversation,pull-request-files-changed,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///pull_requests/show/files
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/python/typeshed/pull/2138/files
twitter:imagehttps://avatars.githubusercontent.com/u/1424628?s=400&v=4
twitter:cardsummary_large_image
og:imagehttps://avatars.githubusercontent.com/u/1424628?s=400&v=4
og:image:altThis commit reorders any overloads where the first overload was "shadowing" the second, preventing it from ever being matched by type checkers that work by selecting the first matching ov...
og:site_nameGitHub
og:typeobject
hostnamegithub.com
expected-hostnamegithub.com
None0a0d8686a27478df474dd7415776a7a080cde8838b3cd92ea7601187572e5729
turbo-cache-controlno-preview
diff-viewunified
go-importgithub.com/python/typeshed git https://github.com/python/typeshed.git
octolytics-dimension-user_id1525981
octolytics-dimension-user_loginpython
octolytics-dimension-repository_id31696383
octolytics-dimension-repository_nwopython/typeshed
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id31696383
octolytics-dimension-repository_network_root_nwopython/typeshed
turbo-body-classeslogged-out env-production page-responsive full-width
disable-turbotrue
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
release16a11879678aaf97e2a42c33ee70830aa084fa37
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://github.com/python/typeshed/pull/2138/files#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fpython%2Ftypeshed%2Fpull%2F2138%2Ffiles
GitHubRepository hosting, code review, and collaborationhttps://github.com/platform
CopilotAI coding agent for tasks, projects, and automated workhttps://github.com/features/copilot
ActionsCI/CD and automationhttps://github.com/features/actions
Code QualityQuality analysis, fixes, and enforcementhttps://github.com/features/code-quality
CodespacesCloud development environmentshttps://github.com/features/codespaces
Code SecurityVulnerability detection and remediationhttps://github.com/security/advanced-security/code-security
Secret ProtectionSecret scanning and leak preventionhttps://github.com/security/advanced-security/secret-protection
All Featureshttps://github.com/features
Documentationhttps://docs.github.com/en
Traininghttps://learn.github.com/skills
Certificationshttps://learn.github.com/credentials
Build with Copilothttps://github.com/features/ai
Customize Copilothttps://docs.github.com/en/copilot/how-tos/copilot-on-github/customize-copilot/customize-copilot-overview
Integrationshttps://github.com/marketplace
Trending reposhttps://github.com/trending
GitHub Sponsorshttps://github.com/open-source/sponsors
Developer articleshttps://github.com/resources/articles
ChangelogYour source for the latest features, improvements, and fixes across GitHub products, all in one place.https://github.blog/changelog/
Enterpriseshttps://github.com/enterprise
Teamhttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
See all industrieshttps://github.com/solutions/industry
Why GitHubhttps://github.com/why-github
Customer Storieshttps://github.com/customer-stories
Business insightshttps://github.com/solutions/executive-insights
Trust Centerhttps://github.com/trust-center
GitHub Advanced SecurityEnterprise-grade code securityhttps://github.com/security/advanced-security
Copilot for businessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/enterprise/premium-support
Documentationhttps://docs.github.com/en
Resource centerhttps://github.com/resources
Bloghttps://github.blog/
Events & webinarshttps://github.com/resources/events
Community Forumhttps://github.com/orgs/community/discussions
Customer Storieshttps://github.com/customer-stories
Integrationshttps://github.com/marketplace
Customer supporthttps://help.github.com/
Traininghttps://learn.github.com/skills
GitHub Statushttps://www.githubstatus.com/
Abouthttps://github.com/about
Partnershttps://github.com/partners
Changeloghttps://github.blog/changelog/
GitHub UniverseThe event for developers, by developers — talks, workshops, and what’s next for GitHub.https://githubuniverse.com/
Pricinghttps://github.com/pricing
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fpython%2Ftypeshed%2Fpull%2F2138%2Ffiles
Sign uphttps://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fpull_requests%2Fshow%2Ffiles&source=header-repo&source_repo=python%2Ftypeshed
Reloadhttps://github.com/python/typeshed/pull/2138/files
Reloadhttps://github.com/python/typeshed/pull/2138/files
Reloadhttps://github.com/python/typeshed/pull/2138/files
pythonhttps://github.com/python
typeshedhttps://github.com/python/typeshed
Codehttps://github.com/python/typeshed
Issues196 (196)https://github.com/python/typeshed/issues
Pull requests251 (251)https://github.com/python/typeshed/pulls
Actionshttps://github.com/python/typeshed/actions
Security and qualityhttps://github.com/python/typeshed/security
Insightshttps://github.com/python/typeshed/insights
Sign up for GitHub https://github.com/signup?return_to=%2Fpython%2Ftypeshed%2Fissues%2Fnew%2Fchoose
terms of servicehttps://docs.github.com/terms
privacy statementhttps://docs.github.com/privacy
Sign inhttps://github.com/login?return_to=%2Fpython%2Ftypeshed%2Fissues%2Fnew%2Fchoose
JelleZijlstrahttps://github.com/JelleZijlstra
python:masterhttps://github.com/python/typeshed/tree/master
Michael0x2a:rearrange-overloadshttps://github.com/Michael0x2a/typeshed/tree/rearrange-overloads
Conversation 6 https://github.com/python/typeshed/pull/2138
Commits 4 https://github.com/python/typeshed/pull/2138/commits
Checks 0 https://github.com/python/typeshed/pull/2138/checks
Files changed https://github.com/python/typeshed/pull/2138/files
Please reload this pagehttps://github.com/python/typeshed/pull/2138/files
Ensures overloads are ordered from narrow to broad https://github.com/python/typeshed/pull/2138/files#top
Show all changes 4 commits https://github.com/python/typeshed/pull/2138/files
4f5ddcb Ensures commits are ordered from narrow to broad Michael0x2a May 16, 2018 https://github.com/python/typeshed/pull/2138/commits/4f5ddcb7b9e817746473fd0442bb8d23d987abc9
fff21f2 Remove default argument from stat_float_times Michael0x2a May 16, 2018 https://github.com/python/typeshed/pull/2138/commits/fff21f29ee271b52aab17ce10dc13ad501b03b05
1f44ff6 Revert change to attr Michael0x2a May 16, 2018 https://github.com/python/typeshed/pull/2138/commits/1f44ff6f64d0a94e7e847481dfe4b98bd958891c
1028a57 Unrevert changes to attrs; make Python 2 builtins consistent Michael0x2a May 17, 2018 https://github.com/python/typeshed/pull/2138/commits/1028a5740622135b9fc5def614fbc9d580734b57
Clear filters https://github.com/python/typeshed/pull/2138/files
Please reload this pagehttps://github.com/python/typeshed/pull/2138/files
Please reload this pagehttps://github.com/python/typeshed/pull/2138/files
__builtin__.pyi https://github.com/python/typeshed/pull/2138/files#diff-1d779f57c4a031bf6683d708babcda1f1e1bc38fc30e63e87c3451827a870a30
builtins.pyi https://github.com/python/typeshed/pull/2138/files#diff-196cf72b2c2e2ff35261c6c3d749e4ab7f2c152ab57850ea396d95b3575c3234
__init__.pyi https://github.com/python/typeshed/pull/2138/files#diff-30d33e0fc4776d985f00c56e21d80c37ba0a6f4a2505e26a7d08f0e96c8c0c6d
path.pyi https://github.com/python/typeshed/pull/2138/files#diff-debcfb6f9f6c4ea9b3e4e832ae7859758eeff67d4c4561fc65813fd78ebd4794
hmac.pyi https://github.com/python/typeshed/pull/2138/files#diff-1809bb01ff4d84f6dbb49fa77677a2baa1310bbc69c74d5ab355694cd50e46ab
sysconfig.pyi https://github.com/python/typeshed/pull/2138/files#diff-65c352c1bfd388901f24725b588347847ca023c54d9c02cd34225d6ed3467a65
builtins.pyi https://github.com/python/typeshed/pull/2138/files#diff-239dc3791974e4efcfcdfde98af36512ab98aa1e43230a91b636a3c49a9121ba
typing.pyi https://github.com/python/typeshed/pull/2138/files#diff-009a41a8f985ef690b94fb876cfcd4d00fff765eb3f41468a1d816c555bc338b
parse.pyi https://github.com/python/typeshed/pull/2138/files#diff-3fefc83720c9fbde86c02be5ad5773e216aeab1586365efefe300ae260dc8e62
__init__.pyi https://github.com/python/typeshed/pull/2138/files#diff-3458355da79a3a0a8e0c965c12c669e5d907f11d88bcbfacae7afd34d09243c3
stdlib/2/__builtin__.pyihttps://github.com/python/typeshed/pull/2138/files#diff-1d779f57c4a031bf6683d708babcda1f1e1bc38fc30e63e87c3451827a870a30
View file https://github.com/Michael0x2a/typeshed/blob/1028a5740622135b9fc5def614fbc9d580734b57/stdlib/2/__builtin__.pyi
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/python/typeshed/pull/2138/{{ revealButtonHref }}
https://github.com/python/typeshed/pull/2138/files#diff-1d779f57c4a031bf6683d708babcda1f1e1bc38fc30e63e87c3451827a870a30
https://github.com/python/typeshed/pull/2138/files#diff-1d779f57c4a031bf6683d708babcda1f1e1bc38fc30e63e87c3451827a870a30
stdlib/2/builtins.pyihttps://github.com/python/typeshed/pull/2138/files#diff-196cf72b2c2e2ff35261c6c3d749e4ab7f2c152ab57850ea396d95b3575c3234
View file https://github.com/Michael0x2a/typeshed/blob/1028a5740622135b9fc5def614fbc9d580734b57/stdlib/2/builtins.pyi
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/python/typeshed/pull/2138/{{ revealButtonHref }}
https://github.com/python/typeshed/pull/2138/files#diff-196cf72b2c2e2ff35261c6c3d749e4ab7f2c152ab57850ea396d95b3575c3234
https://github.com/python/typeshed/pull/2138/files#diff-196cf72b2c2e2ff35261c6c3d749e4ab7f2c152ab57850ea396d95b3575c3234
stdlib/2/os/__init__.pyihttps://github.com/python/typeshed/pull/2138/files#diff-30d33e0fc4776d985f00c56e21d80c37ba0a6f4a2505e26a7d08f0e96c8c0c6d
View file https://github.com/Michael0x2a/typeshed/blob/1028a5740622135b9fc5def614fbc9d580734b57/stdlib/2/os/__init__.pyi
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/python/typeshed/pull/2138/{{ revealButtonHref }}
https://github.com/python/typeshed/pull/2138/files#diff-30d33e0fc4776d985f00c56e21d80c37ba0a6f4a2505e26a7d08f0e96c8c0c6d
https://github.com/python/typeshed/pull/2138/files#diff-30d33e0fc4776d985f00c56e21d80c37ba0a6f4a2505e26a7d08f0e96c8c0c6d
stdlib/2/os/path.pyihttps://github.com/python/typeshed/pull/2138/files#diff-debcfb6f9f6c4ea9b3e4e832ae7859758eeff67d4c4561fc65813fd78ebd4794
View file https://github.com/Michael0x2a/typeshed/blob/1028a5740622135b9fc5def614fbc9d580734b57/stdlib/2/os/path.pyi
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/python/typeshed/pull/2138/{{ revealButtonHref }}
https://github.com/python/typeshed/pull/2138/files#diff-debcfb6f9f6c4ea9b3e4e832ae7859758eeff67d4c4561fc65813fd78ebd4794
https://github.com/python/typeshed/pull/2138/files#diff-debcfb6f9f6c4ea9b3e4e832ae7859758eeff67d4c4561fc65813fd78ebd4794
stdlib/2and3/hmac.pyihttps://github.com/python/typeshed/pull/2138/files#diff-1809bb01ff4d84f6dbb49fa77677a2baa1310bbc69c74d5ab355694cd50e46ab
View file https://github.com/Michael0x2a/typeshed/blob/1028a5740622135b9fc5def614fbc9d580734b57/stdlib/2and3/hmac.pyi
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/python/typeshed/pull/2138/{{ revealButtonHref }}
https://github.com/python/typeshed/pull/2138/files#diff-1809bb01ff4d84f6dbb49fa77677a2baa1310bbc69c74d5ab355694cd50e46ab
https://github.com/python/typeshed/pull/2138/files#diff-1809bb01ff4d84f6dbb49fa77677a2baa1310bbc69c74d5ab355694cd50e46ab
stdlib/2and3/sysconfig.pyihttps://github.com/python/typeshed/pull/2138/files#diff-65c352c1bfd388901f24725b588347847ca023c54d9c02cd34225d6ed3467a65
View file https://github.com/Michael0x2a/typeshed/blob/1028a5740622135b9fc5def614fbc9d580734b57/stdlib/2and3/sysconfig.pyi
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/python/typeshed/pull/2138/{{ revealButtonHref }}
https://github.com/python/typeshed/pull/2138/files#diff-65c352c1bfd388901f24725b588347847ca023c54d9c02cd34225d6ed3467a65
https://github.com/python/typeshed/pull/2138/files#diff-65c352c1bfd388901f24725b588347847ca023c54d9c02cd34225d6ed3467a65
stdlib/3/builtins.pyihttps://github.com/python/typeshed/pull/2138/files#diff-239dc3791974e4efcfcdfde98af36512ab98aa1e43230a91b636a3c49a9121ba
View file https://github.com/Michael0x2a/typeshed/blob/1028a5740622135b9fc5def614fbc9d580734b57/stdlib/3/builtins.pyi
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/python/typeshed/pull/2138/{{ revealButtonHref }}
https://github.com/python/typeshed/pull/2138/files#diff-239dc3791974e4efcfcdfde98af36512ab98aa1e43230a91b636a3c49a9121ba
https://github.com/python/typeshed/pull/2138/files#diff-239dc3791974e4efcfcdfde98af36512ab98aa1e43230a91b636a3c49a9121ba
https://github.com/python/typeshed/pull/2138/files#diff-239dc3791974e4efcfcdfde98af36512ab98aa1e43230a91b636a3c49a9121ba
https://github.com/python/typeshed/pull/2138/files#diff-239dc3791974e4efcfcdfde98af36512ab98aa1e43230a91b636a3c49a9121ba
stdlib/3/typing.pyihttps://github.com/python/typeshed/pull/2138/files#diff-009a41a8f985ef690b94fb876cfcd4d00fff765eb3f41468a1d816c555bc338b
View file https://github.com/Michael0x2a/typeshed/blob/1028a5740622135b9fc5def614fbc9d580734b57/stdlib/3/typing.pyi
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/python/typeshed/pull/2138/{{ revealButtonHref }}
https://github.com/python/typeshed/pull/2138/files#diff-009a41a8f985ef690b94fb876cfcd4d00fff765eb3f41468a1d816c555bc338b
https://github.com/python/typeshed/pull/2138/files#diff-009a41a8f985ef690b94fb876cfcd4d00fff765eb3f41468a1d816c555bc338b
stdlib/3/urllib/parse.pyihttps://github.com/python/typeshed/pull/2138/files#diff-3fefc83720c9fbde86c02be5ad5773e216aeab1586365efefe300ae260dc8e62
View file https://github.com/Michael0x2a/typeshed/blob/1028a5740622135b9fc5def614fbc9d580734b57/stdlib/3/urllib/parse.pyi
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/python/typeshed/pull/2138/{{ revealButtonHref }}
https://github.com/python/typeshed/pull/2138/files#diff-3fefc83720c9fbde86c02be5ad5773e216aeab1586365efefe300ae260dc8e62
third_party/2and3/attr/__init__.pyihttps://github.com/python/typeshed/pull/2138/files#diff-3458355da79a3a0a8e0c965c12c669e5d907f11d88bcbfacae7afd34d09243c3
View file https://github.com/Michael0x2a/typeshed/blob/1028a5740622135b9fc5def614fbc9d580734b57/third_party/2and3/attr/__init__.pyi
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/python/typeshed/pull/2138/{{ revealButtonHref }}
https://github.com/python/typeshed/pull/2138/files#diff-3458355da79a3a0a8e0c965c12c669e5d907f11d88bcbfacae7afd34d09243c3
https://github.com/python/typeshed/pull/2138/files#diff-3458355da79a3a0a8e0c965c12c669e5d907f11d88bcbfacae7afd34d09243c3
https://github.com/python/typeshed/pull/2138/files#diff-3458355da79a3a0a8e0c965c12c669e5d907f11d88bcbfacae7afd34d09243c3
https://github.com/python/typeshed/pull/2138/files#diff-3458355da79a3a0a8e0c965c12c669e5d907f11d88bcbfacae7afd34d09243c3
https://github.com/python/typeshed/pull/2138/files#diff-3458355da79a3a0a8e0c965c12c669e5d907f11d88bcbfacae7afd34d09243c3
https://github.com/python/typeshed/pull/2138/files#diff-3458355da79a3a0a8e0c965c12c669e5d907f11d88bcbfacae7afd34d09243c3
https://github.com/python/typeshed/pull/2138/files#diff-3458355da79a3a0a8e0c965c12c669e5d907f11d88bcbfacae7afd34d09243c3
https://github.com/python/typeshed/pull/2138/files#diff-3458355da79a3a0a8e0c965c12c669e5d907f11d88bcbfacae7afd34d09243c3
https://github.com/python/typeshed/pull/2138/files#diff-3458355da79a3a0a8e0c965c12c669e5d907f11d88bcbfacae7afd34d09243c3
https://github.com/python/typeshed/pull/2138/files#diff-3458355da79a3a0a8e0c965c12c669e5d907f11d88bcbfacae7afd34d09243c3
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.