Title: Decorator on method in derived class · Issue #1441 · python/mypy · GitHub
Open Graph Title: Decorator on method in derived class · Issue #1441 · python/mypy
X Title: Decorator on method in derived class · Issue #1441 · python/mypy
Description: A decorator that changes the signature of a function is rejected if the old signature isn't consistent with the superclass. E.g.: def convert_to_bool(f): # type: (Callable[..., int]) -> Callable[..., bool] def wrapper(*n, **kw): i = f(*n...
Open Graph Description: A decorator that changes the signature of a function is rejected if the old signature isn't consistent with the superclass. E.g.: def convert_to_bool(f): # type: (Callable[..., int]) -> Callable[.....
X Description: A decorator that changes the signature of a function is rejected if the old signature isn't consistent with the superclass. E.g.: def convert_to_bool(f): # type: (Callable[..., int]) -> Call...
Opengraph URL: https://github.com/python/mypy/issues/1441
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Decorator on method in derived class","articleBody":"A decorator that changes the signature of a function is rejected if the old signature isn't consistent with the superclass. E.g.:\n\n```\ndef convert_to_bool(f):\n # type: (Callable[..., int]) -> Callable[..., bool]\n def wrapper(*n, **kw):\n i = f(*n, **kw)\n return i \u003c 10\n return wrapper\n\nclass Base(object):\n def f(self):\n # type: () -> bool\n return True\n\nclass Derived(Base):\n @convert_to_bool\n def f(self):\n # type: () -> int\n return 20\n```\n\nThe interesting point here is that the base class doesn't use the decorator while the child does. Our particular issue is in code that uses contextlib.contextmanager, but I think we can work around it by adding the decorator to the base class.\n","author":{"url":"https://github.com/drewhaven","@type":"Person","name":"drewhaven"},"datePublished":"2016-04-25T22:32:01Z","url":"https://github.com/python/mypy/issues/1441"}
| 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:d91ccd38-0635-3494-888f-3c91bb9002e6 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | C616:C5FC2:10C4D32:15E377B:6B000589 |
| html-safe-nonce | 3816b83c28f8b644a899921fa466d9f55ddc1060f350ef4e7ca6b474d495e271 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDNjE2OkM1RkMyOjEwQzREMzI6MTVFMzc3Qjo2QjAwMDU4OSIsInZpc2l0b3JfaWQiOiI3NTIwMzY0NzU5MjkyNTc3MTYxIiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | a8f9398986bc5a8a98cb8fdf3f8c637131204fcb8659776c32e3fd63668111ed |
| hovercard-subject-tag | issue:150997962 |
| 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/1441/issue_layout |
| twitter:image | https://opengraph.githubassets.com/4f38c39bc5ef74a35a9cb52686d60777e3912db8e089c9fd9100dedcb34031ab/python/mypy/issues/1441 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/4f38c39bc5ef74a35a9cb52686d60777e3912db8e089c9fd9100dedcb34031ab/python/mypy/issues/1441 |
| og:image:alt | A decorator that changes the signature of a function is rejected if the old signature isn't consistent with the superclass. E.g.: def convert_to_bool(f): # type: (Callable[..., int]) -> Callable[..... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | drewhaven |
| hostname | github.com |
| expected-hostname | github.com |
| None | 0a0d8686a27478df474dd7415776a7a080cde8838b3cd92ea7601187572e5729 |
| 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 | 16a11879678aaf97e2a42c33ee70830aa084fa37 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width