Title: Enhance `stubgen` to include types for `@dataclass` private methods · Issue #9986 · python/mypy · GitHub
Open Graph Title: Enhance `stubgen` to include types for `@dataclass` private methods · Issue #9986 · python/mypy
X Title: Enhance `stubgen` to include types for `@dataclass` private methods · Issue #9986 · python/mypy
Description: Feature Enhance stubgen to include types for @dataclass private methods. Pitch Was using interface files to help communicate between teams and noticed this (perhaps a low priority bug, but feels like a feature). For example, currently fr...
Open Graph Description: Feature Enhance stubgen to include types for @dataclass private methods. Pitch Was using interface files to help communicate between teams and noticed this (perhaps a low priority bug, but feels li...
X Description: Feature Enhance stubgen to include types for @dataclass private methods. Pitch Was using interface files to help communicate between teams and noticed this (perhaps a low priority bug, but feels li...
Opengraph URL: https://github.com/python/mypy/issues/9986
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Enhance `stubgen` to include types for `@dataclass` private methods","articleBody":"**Feature**\r\n\r\nEnhance `stubgen` to include types for `@dataclass` private methods.\r\n\r\n**Pitch**\r\n\r\nWas using interface files to help communicate between teams and noticed this (perhaps a low priority bug, but feels like a feature).\r\n\r\nFor example, currently\r\n```\r\nfrom dataclasses import dataclass\r\n\r\n@dataclass(order=True)\r\nclass Dummy:\r\n foo: str\r\n bar: int\r\n```\r\ngenerates the following when passed to `stubgen`\r\n```\r\nfrom typing import Any\r\n\r\nclass Dummy:\r\n foo: str\r\n bar: int\r\n def __init__(self, foo: Any, bar: Any) -> None: ...\r\n def __lt__(self, other: Any) -> Any: ...\r\n def __gt__(self, other: Any) -> Any: ...\r\n def __le__(self, other: Any) -> Any: ...\r\n def __ge__(self, other: Any) -> Any: ...\r\n```\r\nI would hope we could generate\r\n```\r\nclass Dummy:\r\n foo: str\r\n bar: int\r\n def __init__(self, foo: str, bar: bar) -> None: ...\r\n def __lt__(self, other: Dummy) -> bool: ...\r\n def __gt__(self, other: Dummy) -> bool: ...\r\n def __le__(self, other: Dummy) -> bool: ...\r\n def __ge__(self, other: Dummy) -> bool: ...\r\n```\r\nI believe there is already logic in the dataclass plugin to implement some of these checks, but if they are they are not propagated to `stubgen`.\r\n\r\n**Metadata**\r\n```\r\nOSX\r\nPython 3.9.0\r\nmypy 0.790\r\n```","author":{"url":"https://github.com/Cireo","@type":"Person","name":"Cireo"},"datePublished":"2021-01-27T21:41:49Z","url":"https://github.com/python/mypy/issues/9986"}
| 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:6b0eea0e-df05-a1c7-12ad-acf88b0f052b |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | C56C:1FBEEF:38FC38:497891:6AFFBA28 |
| html-safe-nonce | 57adce7f29f0f938e8e45074504d13f2143a3c627c1d699abec159989b16021f |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDNTZDOjFGQkVFRjozOEZDMzg6NDk3ODkxOjZBRkZCQTI4IiwidmlzaXRvcl9pZCI6IjI4MzYxNTQ2NjYxMzQyNTYxNjgiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | a68650f5835fcf2f59cd0b9db9cd99edbd8970926979675faf5f3741af23f054 |
| hovercard-subject-tag | issue:795465272 |
| 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/9986/issue_layout |
| twitter:image | https://opengraph.githubassets.com/e233d4d563bf4b26eafd93199d1bf80a0f5b61b32564285856e1d205dcb900ac/python/mypy/issues/9986 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/e233d4d563bf4b26eafd93199d1bf80a0f5b61b32564285856e1d205dcb900ac/python/mypy/issues/9986 |
| og:image:alt | Feature Enhance stubgen to include types for @dataclass private methods. Pitch Was using interface files to help communicate between teams and noticed this (perhaps a low priority bug, but feels li... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | Cireo |
| hostname | github.com |
| expected-hostname | github.com |
| None | 7e461843db1c75e40d788c5cfd440d0e4ae1271cf19e06a798d0e7feb2d708f3 |
| 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 | d29a6a99861646939301302fab465f9f123b4773 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width