Title: calling .register on typing.KeysView subclass causes false positive error `Member "register" is unknown` · Issue #9296 · python/typeshed · GitHub
Open Graph Title: calling .register on typing.KeysView subclass causes false positive error `Member "register" is unknown` · Issue #9296 · python/typeshed
X Title: calling .register on typing.KeysView subclass causes false positive error `Member "register" is unknown` · Issue #9296 · python/typeshed
Description: Type checkers that include the recent changes from #8977 #9058 (e.g. pyright v1.1.281) now incorrectly emit an error like Member "register" is unknown for the following line of code: https://github.com/jab/bidict/blob/522c9b69249d66c201f...
Open Graph Description: Type checkers that include the recent changes from #8977 #9058 (e.g. pyright v1.1.281) now incorrectly emit an error like Member "register" is unknown for the following line of code: https://github...
X Description: Type checkers that include the recent changes from #8977 #9058 (e.g. pyright v1.1.281) now incorrectly emit an error like Member "register" is unknown for the following line of code: http...
Opengraph URL: https://github.com/python/typeshed/issues/9296
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"calling .register on typing.KeysView subclass causes false positive error `Member \"register\" is unknown`","articleBody":"Type checkers that include the recent changes from ~~https://github.com/python/typeshed/pull/8977~~ https://github.com/python/typeshed/pull/9058 (e.g. pyright v1.1.281) now incorrectly emit an error like `Member \"register\" is unknown` for the following line of code:\r\n\r\nhttps://github.com/jab/bidict/blob/522c9b69249d66c201fed608f95a5da8d3064ed8/bidict/_base.py#L51\r\n\r\nType checkers that do not include those changes (e.g. pyright v1.1.278) do not emit any error for that line, as expected.\r\n\r\nCopy/pasted excerpt:\r\n```python\r\nimport typing as t\r\n\r\nfrom ._typing import KT # a typevar\r\n\r\n\r\nclass BidictKeysView(t.KeysView[KT], t.ValuesView[KT]):\r\n \"\"\"Since the keys of a bidict are the values of its inverse (and vice versa),\r\n the :class:`~collections.abc.ValuesView` result of calling *bi.values()*\r\n is also a :class:`~collections.abc.KeysView` of *bi.inverse*.\r\n \"\"\"\r\n\r\n\r\ndict_keys: t.Type[t.KeysView[t.Any]] = type({}.keys())\r\nBidictKeysView.register(dict_keys) # \u003c-- false positive error emitted here\r\n```\r\n\r\nPlease let me know if there is any other info I can provide. Thank you!","author":{"url":"https://github.com/jab","@type":"Person","name":"jab"},"datePublished":"2022-11-29T00:44:52.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":5},"url":"https://github.com/9296/typeshed/issues/9296"}
| 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:a1638391-10fd-ddff-9c58-c2f7f7b18fcc |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 8E1A:327BF5:DD48C7:12CC700:6A63BDBF |
| html-safe-nonce | 041915adcad246684e2bfa2ed252ff869a17402b5f103446cd0b5d5607e0b220 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4RTFBOjMyN0JGNTpERDQ4Qzc6MTJDQzcwMDo2QTYzQkRCRiIsInZpc2l0b3JfaWQiOiI0NDE3OTE1NTk0MjQwOTMzMzExIiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | b0a4dfc9c20e371a25afdbe0487539f455da27585a2cb6e2795225862c763cdd |
| hovercard-subject-tag | issue:1467282545 |
| 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/9296/issue_layout |
| twitter:image | https://opengraph.githubassets.com/e3f2744a7d50f8092079d83bb203fc1db342c946e9ab5644289d9715c890885a/python/typeshed/issues/9296 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/e3f2744a7d50f8092079d83bb203fc1db342c946e9ab5644289d9715c890885a/python/typeshed/issues/9296 |
| og:image:alt | Type checkers that include the recent changes from #8977 #9058 (e.g. pyright v1.1.281) now incorrectly emit an error like Member "register" is unknown for the following line of code: https://github... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | jab |
| hostname | github.com |
| expected-hostname | github.com |
| None | 4c1c4f1792dfc705b5a5073fed6c61988f59766cec1277f24f55d4b876f9881c |
| 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 | fefaad6f0be5c33f57f42bb65ed668f74c872364 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width