Title: [Type Hinting] Pylance can't infer type of `CallbackContext.DEFAULT_TYPE` · Issue #3008 · python-telegram-bot/python-telegram-bot · GitHub
Open Graph Title: [Type Hinting] Pylance can't infer type of `CallbackContext.DEFAULT_TYPE` · Issue #3008 · python-telegram-bot/python-telegram-bot
X Title: [Type Hinting] Pylance can't infer type of `CallbackContext.DEFAULT_TYPE` · Issue #3008 · python-telegram-bot/python-telegram-bot
Description: Steps to Reproduce Start typing context.bot. in vscode with pylance No type hints/autocomplete is available since pylance cannot infer the type of CallbackContext.DEFAULT_TYPE The same applies for rest: UD, CD, BD (user/chat/bot_data) Ex...
Open Graph Description: Steps to Reproduce Start typing context.bot. in vscode with pylance No type hints/autocomplete is available since pylance cannot infer the type of CallbackContext.DEFAULT_TYPE The same applies for ...
X Description: Steps to Reproduce Start typing context.bot. in vscode with pylance No type hints/autocomplete is available since pylance cannot infer the type of CallbackContext.DEFAULT_TYPE The same applies for ...
Opengraph URL: https://github.com/python-telegram-bot/python-telegram-bot/issues/3008
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"[Type Hinting] Pylance can't infer type of `CallbackContext.DEFAULT_TYPE`","articleBody":"### Steps to Reproduce\r\n\r\n1. Start typing `context.bot.` in vscode with pylance\r\n2. No type hints/autocomplete is available since pylance cannot infer the type of `CallbackContext.DEFAULT_TYPE`\r\n\r\nThe same applies for rest: `UD`, `CD`, `BD` (user/chat/bot_data)\r\n\r\n### Expected behaviour\r\n\r\nPylance could maybe infer the type and give autocomplete suggestions? But I wouldn't expect it to.\r\n\r\n### Actual behaviour\r\n\r\nIt doesn't infer the type correctly.\r\n\r\nPossible solution: Remove `CallbackContext.DEFAULT_TYPE` and add a `CallbackContextType` (or similar naming) where that would be simply `CallbackContext[ExtBot, Dict, Dict, Dict]`. We could keep this in the same file too.\r\n\r\n### Operating System\r\n\r\nLinux, Ubuntu 22.04\r\n\r\n### Version of Python, python-telegram-bot & dependencies\r\n\r\n```shell\r\npython-telegram-bot 20.0a0\r\nBot API 6.0\r\nPython 3.10.4 (main, Apr 2 2022, 09:04:19) [GCC 11.2.0]\r\n```\r\n\r\n\r\n### Relevant log output\r\n\r\n```python\r\n-\r\n```\r\n\r\n\r\n### Additional Context\r\n\r\nOriginally reported here: https://t.me/pythontelegrambottalk/218000","author":{"url":"https://github.com/harshil21","@type":"Person","name":"harshil21"},"datePublished":"2022-05-07T19:36:47Z","url":"https://github.com/python-telegram-bot/python-telegram-bot/issues/3008"}
| 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:d0b397a7-0ab7-8465-4431-2bf339e265c6 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 9950:B1B84:3C45615:4C885B6:6B024339 |
| html-safe-nonce | 09033ebd8f49e0f479b7de54eff74b56e25df1bac0d68dd4a91546ad4ee5fcbb |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5OTUwOkIxQjg0OjNDNDU2MTU6NEM4ODVCNjo2QjAyNDMzOSIsInZpc2l0b3JfaWQiOiIzNjg1Mzc4MjA4NjA3Mzg4NDczIiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 6182972daa11cb6957900d46093bae3494d5a4ae3b4dfa6d1ad227acff90ce40 |
| hovercard-subject-tag | issue:1228706661 |
| 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-telegram-bot/python-telegram-bot/3008/issue_layout |
| twitter:image | https://opengraph.githubassets.com/96788ca37f11c62fae081edf09d2b75c0690c3638c9e48096ccf06adb83e5357/python-telegram-bot/python-telegram-bot/issues/3008 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/96788ca37f11c62fae081edf09d2b75c0690c3638c9e48096ccf06adb83e5357/python-telegram-bot/python-telegram-bot/issues/3008 |
| og:image:alt | Steps to Reproduce Start typing context.bot. in vscode with pylance No type hints/autocomplete is available since pylance cannot infer the type of CallbackContext.DEFAULT_TYPE The same applies for ... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | harshil21 |
| hostname | github.com |
| expected-hostname | github.com |
| None | 87e774ee7c6b3bee0490394e4d3e57ec9dbc956f74b87ea685dc8996c1676456 |
| turbo-cache-control | no-preview |
| go-import | github.com/python-telegram-bot/python-telegram-bot git https://github.com/python-telegram-bot/python-telegram-bot.git |
| octolytics-dimension-user_id | 16178365 |
| octolytics-dimension-user_login | python-telegram-bot |
| octolytics-dimension-repository_id | 38696925 |
| octolytics-dimension-repository_nwo | python-telegram-bot/python-telegram-bot |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 38696925 |
| octolytics-dimension-repository_network_root_nwo | python-telegram-bot/python-telegram-bot |
| 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 | 423dbb54c5e7bfecc838eb387c1435eb3d0e760d |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width