Title: variables starting with an underscore are not imported with * imports even when present in __all__ · Issue #3745 · python/mypy · GitHub
Open Graph Title: variables starting with an underscore are not imported with * imports even when present in __all__ · Issue #3745 · python/mypy
X Title: variables starting with an underscore are not imported with * imports even when present in __all__ · Issue #3745 · python/mypy
Description: Reduced example of the issue: defs.py: def __pragma__(arg: str) -> None: pass __all__ = ["__pragma__"] main.py: from defs import * __pragma__('main') print('hi') The current mypy behavior differs as follows: $ python main.py hi $ mypy ma...
Open Graph Description: Reduced example of the issue: defs.py: def __pragma__(arg: str) -> None: pass __all__ = ["__pragma__"] main.py: from defs import * __pragma__('main') print('hi') The current mypy behavior differs a...
X Description: Reduced example of the issue: defs.py: def __pragma__(arg: str) -> None: pass __all__ = ["__pragma__"] main.py: from defs import * __pragma__('main') print('hi') The cu...
Opengraph URL: https://github.com/python/mypy/issues/3745
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"variables starting with an underscore are not imported with * imports even when present in __all__","articleBody":"Reduced example of the issue:\r\n\r\ndefs.py:\r\n```python\r\ndef __pragma__(arg: str) -> None:\r\n pass\r\n\r\n\r\n__all__ = [\"__pragma__\"]\r\n```\r\nmain.py:\r\n```python\r\nfrom defs import *\r\n\r\n__pragma__('main')\r\n\r\nprint('hi')\r\n```\r\nThe current mypy behavior differs as follows:\r\n```\r\n$ python main.py\r\nhi\r\n$ mypy main.py\r\nmain.py:3: error: Name '__pragma__' is not defined\r\n```\r\n\r\nThis is an most likely an obscure case, but if it could be added to `mypy` I would greatly appreciate it that would be greatly appreciated. I can also write a pull request to implement this, if it's deemed worth adding.\r\n\r\nMy use case for this is providing stubs for 'meta' functions provided by [transcrypt](http://transcrypt.com/), a Python transpiler/pre-processor. Transcrypt provides `__pragma__` and `__new__` to control / augment the transpilation. Having `import * from defs` work to import both these transcrypt-builtins and all other transpilation-builtin types would greatly increase usability of mypy and transcrypt together.","author":{"url":"https://github.com/daboross","@type":"Person","name":"daboross"},"datePublished":"2017-07-20T08:30:36Z","url":"https://github.com/python/mypy/issues/3745"}
| 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:cc68d2f7-f39c-5089-9952-1d1a3aa2708f |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | DC78:1A78DD:242B89:329A1F:6B0069B0 |
| html-safe-nonce | 0939eaea99391b61d8f531de61ddff7aae9749d2920ead758846796a89bdcaab |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJEQzc4OjFBNzhERDoyNDJCODk6MzI5QTFGOjZCMDA2OUIwIiwidmlzaXRvcl9pZCI6IjQ1NTQ2NDYzNTIxOTU4MzIwIiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 8ac1b2240f0af6494342ba8594fcc382af8f56bf45052f861c43352653a5b332 |
| hovercard-subject-tag | issue:244283516 |
| 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/3745/issue_layout |
| twitter:image | https://opengraph.githubassets.com/557725b251694d8d539743720eaba08fe6bdbfe0b9d0249b669f15344b114ce4/python/mypy/issues/3745 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/557725b251694d8d539743720eaba08fe6bdbfe0b9d0249b669f15344b114ce4/python/mypy/issues/3745 |
| og:image:alt | Reduced example of the issue: defs.py: def __pragma__(arg: str) -> None: pass __all__ = ["__pragma__"] main.py: from defs import * __pragma__('main') print('hi') The current mypy behavior differs a... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | daboross |
| hostname | github.com |
| expected-hostname | github.com |
| None | 6527e91c60c0b29d16606ff32ac5df8ecdc37a2a62205ea057a14d7762c870fa |
| 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 | 46f1cd2ae3cd8ae1a81019b5d619742e76f13bbd |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width