Title: mypy@0.920 regression: Argument 1 to "get" of "Mapping" has incompatible type · Issue #6597 · python/typeshed · GitHub
Open Graph Title: mypy@0.920 regression: Argument 1 to "get" of "Mapping" has incompatible type · Issue #6597 · python/typeshed
X Title: mypy@0.920 regression: Argument 1 to "get" of "Mapping" has incompatible type · Issue #6597 · python/typeshed
Description: I got a new regression from the latest release on a real project: https://github.com/wemake-services/wemake-python-styleguide/blob/master/wemake_python_styleguide/logic/arguments/function_args.py#L125-L126 Error: wemake_python_styleguide...
Open Graph Description: I got a new regression from the latest release on a real project: https://github.com/wemake-services/wemake-python-styleguide/blob/master/wemake_python_styleguide/logic/arguments/function_args.py#L...
X Description: I got a new regression from the latest release on a real project: https://github.com/wemake-services/wemake-python-styleguide/blob/master/wemake_python_styleguide/logic/arguments/function_args.py#L...
Opengraph URL: https://github.com/python/typeshed/issues/6597
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"mypy@0.920 regression: Argument 1 to \"get\" of \"Mapping\" has incompatible type","articleBody":"I got a new regression from the latest release on a real project: https://github.com/wemake-services/wemake-python-styleguide/blob/master/wemake_python_styleguide/logic/arguments/function_args.py#L125-L126\r\n\r\nError:\r\n\r\n```\r\nwemake_python_styleguide/logic/arguments/function_args.py:126: error: Argument 1 to \"get\" of \"Mapping\" has incompatible type \"Optional[Any]\"; expected \"str\"\r\n```\r\n\r\nSimplier repro:\r\n\r\n```python\r\nfrom typing import Mapping, Any, Optional\r\n\r\nx: Optional[Any]\r\nm: Mapping[str, int]\r\n\r\nm.get(x)\r\n# error: Argument 1 to \"get\" of \"Mapping\" has incompatible type \"Optional[Any]\"; expected \"str\"\r\n```\r\n\r\nSo, what do you think: is this a valid error? Because it will work at runtime with no problem. And since it has `Any` part in it, sometimes it can even be `str`. So, in my app it was working as expected in all cases: if `x` is `str` and exists in `m` - then fine. If not - then just return `None`.\r\n\r\nI am openning it here, because it looks like a typeshed issue, rather than a mypy issue.","author":{"url":"https://github.com/sobolevn","@type":"Person","name":"sobolevn"},"datePublished":"2021-12-16T09:41:35.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":8},"url":"https://github.com/6597/typeshed/issues/6597"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:7414a653-6328-811f-e5f5-c7b0b29c1aba |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 88C0:2DAE85:B9B1D5:F8CE76:6A6194D7 |
| html-safe-nonce | 8e8801feca7cb071c6992e9369938a52dfb9abae713766b0c1218ffb713522b7 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4OEMwOjJEQUU4NTpCOUIxRDU6RjhDRTc2OjZBNjE5NEQ3IiwidmlzaXRvcl9pZCI6Ijc1MzI3MzM5OTg4MDY3MDEyNzEiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 759f6fa02a154e4fa51cf5bb9af712b51b263fe710cffe961f42e4042c6c7caf |
| hovercard-subject-tag | issue:1081973402 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/python/typeshed/6597/issue_layout |
| twitter:image | https://opengraph.githubassets.com/986265c07b578be898eb58412d4f292600bf6319788d25c7b048bf311affbb0e/python/typeshed/issues/6597 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/986265c07b578be898eb58412d4f292600bf6319788d25c7b048bf311affbb0e/python/typeshed/issues/6597 |
| og:image:alt | I got a new regression from the latest release on a real project: https://github.com/wemake-services/wemake-python-styleguide/blob/master/wemake_python_styleguide/logic/arguments/function_args.py#L... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | sobolevn |
| hostname | github.com |
| expected-hostname | github.com |
| None | c28c2f6607f2aacbd934868d997038895c9780d08babfe918550d73773326f4c |
| turbo-cache-control | no-preview |
| go-import | github.com/python/typeshed git https://github.com/python/typeshed.git |
| octolytics-dimension-user_id | 1525981 |
| octolytics-dimension-user_login | python |
| octolytics-dimension-repository_id | 31696383 |
| octolytics-dimension-repository_nwo | python/typeshed |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 31696383 |
| octolytics-dimension-repository_network_root_nwo | python/typeshed |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | cd05235d52ffb3318513d883a56c87a121015c8b |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width