René's URL Explorer Experiment


Title: add .get() to the PackageMetadata protocol by dimbleby · Pull Request #444 · python/importlib_metadata · GitHub

Open Graph Title: add .get() to the PackageMetadata protocol by dimbleby · Pull Request #444 · python/importlib_metadata

X Title: add .get() to the PackageMetadata protocol by dimbleby · Pull Request #444 · python/importlib_metadata

Description: __getitem__ warns that it will raise KeyError rather than returning None (I see #371 etc) that's all very well but there's currently no comfortable way for users who anticipate missing values to write their code in a way that doesn't trigger that warning. We seem to be steered towards import warnings try: with warnings.catch_warnings(): warnings.filterwarnings("ignore", "Implicit None .* KeyError", DeprecationWarning) value = metadata[key] except KeyError: value = None which sure seems like a lot of ceremony. The natural way to do it would be just value = metadata.get(key). That method exists, but is not exposed by the protocol so if we try to use it then mypy shouts at us Therefore add get() to that protocol (and testcases showing that it works).

Open Graph Description: __getitem__ warns that it will raise KeyError rather than returning None (I see #371 etc) that's all very well but there's currently no comfortable way for users who anticipate missing valu...

X Description: __getitem__ warns that it will raise KeyError rather than returning None (I see #371 etc) that's all very well but there's currently no comfortable way for users who anticipate miss...

Opengraph URL: https://github.com/python/importlib_metadata/pull/444

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:c7d80077-b48f-001c-0dc0-f695ceaa868f
current-catalog-service-hashae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b
request-id85E6:966C4:57B9FB:79723B:6B00942F
html-safe-nonce55280e02f3f9a800b389612d96c48bf660a1d70d7d4ba2c173be2dce4fb4b0b5
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4NUU2Ojk2NkM0OjU3QjlGQjo3OTcyM0I6NkIwMDk0MkYiLCJ2aXNpdG9yX2lkIjoiODE4Mzg4MDgyMjE5Mzk1MTc5MSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9
visitor-hmacf74ffe5f63db3617cccef82a6a6f2ba282bf793b2bc69a13589854895d8fd247
hovercard-subject-tagpull_request:1305895345
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/importlib_metadata/pull/444/files
twitter:imagehttps://avatars.githubusercontent.com/u/875184?s=400&v=4
twitter:cardsummary_large_image
og:imagehttps://avatars.githubusercontent.com/u/875184?s=400&v=4
og:image:alt__getitem__ warns that it will raise KeyError rather than returning None (I see #371 etc) that's all very well but there's currently no comfortable way for users who anticipate missing valu...
og:site_nameGitHub
og:typeobject
hostnamegithub.com
expected-hostnamegithub.com
Nonec710a5cb5c47be60abfe6e8410436d409906979dbed614ef09f29c60f5535b08
turbo-cache-controlno-preview
diff-viewunified
go-importgithub.com/python/importlib_metadata git https://github.com/python/importlib_metadata.git
octolytics-dimension-user_id1525981
octolytics-dimension-user_loginpython
octolytics-dimension-repository_id306448340
octolytics-dimension-repository_nwopython/importlib_metadata
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id306448340
octolytics-dimension-repository_network_root_nwopython/importlib_metadata
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
releasebe616a2a6ec1c609d6e002896dff5352d5c5f28b
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://github.com/python/importlib_metadata/pull/444/files#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fpython%2Fimportlib_metadata%2Fpull%2F444%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%2Fimportlib_metadata%2Fpull%2F444%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%2Fimportlib_metadata
Reloadhttps://github.com/python/importlib_metadata/pull/444/files
Reloadhttps://github.com/python/importlib_metadata/pull/444/files
Reloadhttps://github.com/python/importlib_metadata/pull/444/files
pythonhttps://github.com/python
importlib_metadatahttps://github.com/python/importlib_metadata
Codehttps://github.com/python/importlib_metadata
Issues8 (8)https://github.com/python/importlib_metadata/issues
Pull requests6 (6)https://github.com/python/importlib_metadata/pulls
Actionshttps://github.com/python/importlib_metadata/actions
Projectshttps://github.com/python/importlib_metadata/projects
Wikihttps://github.com/python/importlib_metadata/wiki
Security and qualityhttps://github.com/python/importlib_metadata/security
Insightshttps://github.com/python/importlib_metadata/insights
Sign up for GitHub https://github.com/signup?return_to=%2Fpython%2Fimportlib_metadata%2Fissues%2Fnew%2Fchoose
terms of servicehttps://docs.github.com/terms
privacy statementhttps://docs.github.com/privacy
Sign inhttps://github.com/login?return_to=%2Fpython%2Fimportlib_metadata%2Fissues%2Fnew%2Fchoose
jaracohttps://github.com/jaraco
python:mainhttps://github.com/python/importlib_metadata/tree/main
Conversation 2 https://github.com/python/importlib_metadata/pull/444
Commits 2 https://github.com/python/importlib_metadata/pull/444/commits
Checks 0 https://github.com/python/importlib_metadata/pull/444/checks
Files changed https://github.com/python/importlib_metadata/pull/444/files
Please reload this pagehttps://github.com/python/importlib_metadata/pull/444/files
add .get() to the PackageMetadata protocol https://github.com/python/importlib_metadata/pull/444/files#top
Show all changes 2 commits https://github.com/python/importlib_metadata/pull/444/files
73c1385 add .get() to the PackageMetadata protocol dimbleby Apr 7, 2023 https://github.com/python/importlib_metadata/pull/444/commits/73c138548afd1ac37d9f80c7fecf458bf133a5aa
15fffb8 Update changelog. jaraco Apr 7, 2023 https://github.com/python/importlib_metadata/pull/444/commits/15fffb8811e21bd92101f2fa47daaf50ee48c8dd
Clear filters https://github.com/python/importlib_metadata/pull/444/files
Please reload this pagehttps://github.com/python/importlib_metadata/pull/444/files
Please reload this pagehttps://github.com/python/importlib_metadata/pull/444/files
CHANGES.rst https://github.com/python/importlib_metadata/pull/444/files#diff-ff3c479edefad986d2fe6fe7ead575a46b086e3bbcf0ccc86d85efc4a4c63c79
_meta.py https://github.com/python/importlib_metadata/pull/444/files#diff-407fc7536492e145aa94c0760676b3ec4ad294553998784910bc4cf903216b33
test_api.py https://github.com/python/importlib_metadata/pull/444/files#diff-3451cc474d5698222168f66a293339a6bd296ee2c56f56409866bbae99917a79
CHANGES.rsthttps://github.com/python/importlib_metadata/pull/444/files#diff-ff3c479edefad986d2fe6fe7ead575a46b086e3bbcf0ccc86d85efc4a4c63c79
View file https://github.com/python/importlib_metadata/blob/15fffb8811e21bd92101f2fa47daaf50ee48c8dd/CHANGES.rst
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/python/importlib_metadata/pull/444/{{ revealButtonHref }}
https://github.com/python/importlib_metadata/pull/444/files#diff-ff3c479edefad986d2fe6fe7ead575a46b086e3bbcf0ccc86d85efc4a4c63c79
importlib_metadata/_meta.pyhttps://github.com/python/importlib_metadata/pull/444/files#diff-407fc7536492e145aa94c0760676b3ec4ad294553998784910bc4cf903216b33
View file https://github.com/python/importlib_metadata/blob/15fffb8811e21bd92101f2fa47daaf50ee48c8dd/importlib_metadata/_meta.py
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/python/importlib_metadata/pull/444/{{ revealButtonHref }}
https://github.com/python/importlib_metadata/pull/444/files#diff-407fc7536492e145aa94c0760676b3ec4ad294553998784910bc4cf903216b33
https://github.com/python/importlib_metadata/pull/444/files#diff-407fc7536492e145aa94c0760676b3ec4ad294553998784910bc4cf903216b33
tests/test_api.pyhttps://github.com/python/importlib_metadata/pull/444/files#diff-3451cc474d5698222168f66a293339a6bd296ee2c56f56409866bbae99917a79
View file https://github.com/python/importlib_metadata/blob/15fffb8811e21bd92101f2fa47daaf50ee48c8dd/tests/test_api.py
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/python/importlib_metadata/pull/444/{{ revealButtonHref }}
https://github.com/python/importlib_metadata/pull/444/files#diff-3451cc474d5698222168f66a293339a6bd296ee2c56f56409866bbae99917a79
https://github.com/python/importlib_metadata/pull/444/files#diff-3451cc474d5698222168f66a293339a6bd296ee2c56f56409866bbae99917a79
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.