Title: "Expected TypedDict key to be string literal" false positive? · Issue #4122 · python/mypy · GitHub
Open Graph Title: "Expected TypedDict key to be string literal" false positive? · Issue #4122 · python/mypy
X Title: "Expected TypedDict key to be string literal" false positive? · Issue #4122 · python/mypy
Description: Shouldn't something like this work? from mypy_extensions import TypedDict Details = TypedDict('Details', {'first_name': str, 'last_name': str}) DetailsSubset = TypedDict('DetailsSubset', {'first_name': str, 'last_name': str}, total=False...
Open Graph Description: Shouldn't something like this work? from mypy_extensions import TypedDict Details = TypedDict('Details', {'first_name': str, 'last_name': str}) DetailsSubset = TypedDict('DetailsSubset', {'first_na...
X Description: Shouldn't something like this work? from mypy_extensions import TypedDict Details = TypedDict('Details', {'first_name': str, 'last_name': str}) DetailsSubset = TypedDict...
Opengraph URL: https://github.com/python/mypy/issues/4122
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"\"Expected TypedDict key to be string literal\" false positive?","articleBody":"Shouldn't something like this work?\r\n\r\n```python\r\nfrom mypy_extensions import TypedDict\r\n\r\nDetails = TypedDict('Details', {'first_name': str, 'last_name': str})\r\nDetailsSubset = TypedDict('DetailsSubset', {'first_name': str, 'last_name': str}, total=False)\r\ndefaults = {'first_name': 'John', 'last_name': 'Luther'} # type: Details\r\n\r\n\r\ndef generate(data: DetailsSubset) -> Details:\r\n return {**defaults, **data}\r\n```\r\n\r\nI'm getting:\r\n```\r\n% mypy code.py \r\ncode.py: error: Expected TypedDict key to be string literal\r\n```\r\n\r\nOh, and the error message is missing the line number, that could be handy to have.\r\n\r\nI'm using mypy 0.530 and Python 3.6.2.","author":{"url":"https://github.com/jstasiak","@type":"Person","name":"jstasiak"},"datePublished":"2017-10-16T10:57:19Z","url":"https://github.com/python/mypy/issues/4122"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| 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:fdeb03a2-1705-8c0b-af6a-c7eabfef4d16 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 94A0:1EE22E:2DCAB:3E86A:6B00507F |
| html-safe-nonce | 5a49911f3ebc4c4de5d39a45ee6d46222fcc76ca111ac719e02e7f30ff5c6132 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5NEEwOjFFRTIyRToyRENBQjozRTg2QTo2QjAwNTA3RiIsInZpc2l0b3JfaWQiOiIzMjY4NzgzMzU4OTAwOTgxODg4IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | b4b15121ccfad2f4eb42d2cbda11c20a7bd6c7d61a634a19f4f524a15b9dd3cb |
| hovercard-subject-tag | issue:265728334 |
| 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/mypy/4122/issue_layout |
| twitter:image | https://opengraph.githubassets.com/ca820b18bf3e9a2bd10b3cd224152c94746ed66c62c33209c4ba73dd0aeb12a5/python/mypy/issues/4122 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/ca820b18bf3e9a2bd10b3cd224152c94746ed66c62c33209c4ba73dd0aeb12a5/python/mypy/issues/4122 |
| og:image:alt | Shouldn't something like this work? from mypy_extensions import TypedDict Details = TypedDict('Details', {'first_name': str, 'last_name': str}) DetailsSubset = TypedDict('DetailsSubset', {'first_na... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | jstasiak |
| hostname | github.com |
| expected-hostname | github.com |
| None | f420f4996e6b1ff1ccd6d7683f8134f4b5f0f8a50124c210dbfe7490e5644abb |
| turbo-cache-control | no-preview |
| go-import | github.com/python/mypy git https://github.com/python/mypy.git |
| octolytics-dimension-user_id | 1525981 |
| octolytics-dimension-user_login | python |
| octolytics-dimension-repository_id | 7053637 |
| octolytics-dimension-repository_nwo | python/mypy |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 7053637 |
| octolytics-dimension-repository_network_root_nwo | python/mypy |
| 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 | 26e00df917aba0f128135dc073ea0c5e33a70d40 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width