Title: 'from .foo import *' introduces 'foo' as symbol that mypy doesn't recognise · Issue #4140 · python/mypy · GitHub
Open Graph Title: 'from .foo import *' introduces 'foo' as symbol that mypy doesn't recognise · Issue #4140 · python/mypy
X Title: 'from .foo import *' introduces 'foo' as symbol that mypy doesn't recognise · Issue #4140 · python/mypy
Description: The typeshed definition for yaml/__init__.pyi contains the following (src): from yaml.error import * This has two side effects: it adds every symbol foo in yaml/error.py as yaml.foo. However, it also defines yaml.error. I believe this is...
Open Graph Description: The typeshed definition for yaml/__init__.pyi contains the following (src): from yaml.error import * This has two side effects: it adds every symbol foo in yaml/error.py as yaml.foo. However, it al...
X Description: The typeshed definition for yaml/__init__.pyi contains the following (src): from yaml.error import * This has two side effects: it adds every symbol foo in yaml/error.py as yaml.foo. However, it al...
Opengraph URL: https://github.com/python/mypy/issues/4140
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"'from .foo import *' introduces 'foo' as symbol that mypy doesn't recognise","articleBody":"The typeshed definition for `yaml/__init__.pyi` contains the following ([src](https://github.com/python/typeshed/blob/master/third_party/2and3/yaml/__init__.pyi#L2)):\r\n\r\n```python\r\nfrom yaml.error import *\r\n```\r\n\r\nThis has two side effects: it adds every symbol `foo` in `yaml/error.py` as `yaml.foo`. However, it also defines `yaml.error`.\r\n\r\nI believe this is why the mypy complains about the following correct code:\r\n\r\n```python\r\nimport yaml\r\n\r\ndef foo():\r\n # type: () -> None\r\n yaml.error\r\n```\r\n\r\n```\r\n$ mypy --py2 foo.py\r\nfoo.py:5: error: Module has no attribute \"error\"\r\n```\r\n\r\nOddly, I can't reproduce this on Python 3. The following code does not produce a type error:\r\n\r\n```python\r\nimport yaml\r\n\r\ndef foo() -> None:\r\n yaml.error\r\n```","author":{"url":"https://github.com/Wilfred","@type":"Person","name":"Wilfred"},"datePublished":"2017-10-20T15:59:20Z","url":"https://github.com/python/mypy/issues/4140"}
| 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:b7602903-9fe0-f0c9-f207-efd727de7dab |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | D52C:3B60C0:5059CB:6BB15A:6B002F05 |
| html-safe-nonce | 316a67357940aaf889a9998cc247433d33e03c29b3c8822b4ad18786da82c9ca |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJENTJDOjNCNjBDMDo1MDU5Q0I6NkJCMTVBOjZCMDAyRjA1IiwidmlzaXRvcl9pZCI6IjQwMTcxNTE4MDA3MjQ0MzQ2OTMiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 9473b6e4092c55e73f88828dad75f8692da47a9eced476da4da65726ecc02265 |
| hovercard-subject-tag | issue:267223368 |
| 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/4140/issue_layout |
| twitter:image | https://opengraph.githubassets.com/22c1b270624d17dc519f02e34e5c686bdec7f0aeed0dbd93cb54216a70a4bf54/python/mypy/issues/4140 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/22c1b270624d17dc519f02e34e5c686bdec7f0aeed0dbd93cb54216a70a4bf54/python/mypy/issues/4140 |
| og:image:alt | The typeshed definition for yaml/__init__.pyi contains the following (src): from yaml.error import * This has two side effects: it adds every symbol foo in yaml/error.py as yaml.foo. However, it al... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | Wilfred |
| hostname | github.com |
| expected-hostname | github.com |
| None | 7d0829bbde9e48b2486cb5dd6d147896eb01d32134627091f818958a935ef3f0 |
| 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 | f3f3a43ca095cdea3abbb394112e971f9fdb94fa |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width