Title: decorator as class member raises "self-argument missing" · Issue #7778 · python/mypy · GitHub
Open Graph Title: decorator as class member raises "self-argument missing" · Issue #7778 · python/mypy
X Title: decorator as class member raises "self-argument missing" · Issue #7778 · python/mypy
Description: I have a legitimate case for member functions not requiring a self parameter, which fails with error: Self argument missing for a non-static method (or an invalid type for self) (mypy version 0.730, python 3.7.4). MWE: import functools f...
Open Graph Description: I have a legitimate case for member functions not requiring a self parameter, which fails with error: Self argument missing for a non-static method (or an invalid type for self) (mypy version 0.730...
X Description: I have a legitimate case for member functions not requiring a self parameter, which fails with error: Self argument missing for a non-static method (or an invalid type for self) (mypy version 0.730...
Opengraph URL: https://github.com/python/mypy/issues/7778
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"decorator as class member raises \"self-argument missing\"","articleBody":"I have a legitimate case for member functions not requiring a `self` parameter, which fails with `error: Self argument missing for a non-static method (or an invalid type for self)` (mypy version 0.730, python 3.7.4). MWE:\r\n\r\n~~~py\r\nimport functools\r\nfrom typing import Callable\r\n\r\nclass API:\r\n def _login_required(meth: Callable) -> Callable:\r\n @functools.wraps(meth)\r\n def check_login(self, *args, **kwargs):\r\n if not self.check_login():\r\n self.login()\r\n return meth(*args, **kwargs)\r\n return check_login\r\n\r\n @_login_required\r\n def version(self):\r\n pass\r\n~~~\r\n\r\nIt is a member function of a class, to be used as decorator.\r\n\r\n\u003c!--\r\nNote: if you are reporting a wrong signature of a function or a class in\r\nthe standard library, then the typeshed tracker is better suited\r\nfor this report: https://github.com/python/typeshed/issues\r\n\r\nPlease provide more information to help us understand the issue:\r\n\r\n* Are you reporting a bug, or opening a feature request?\r\n* Please insert below the code you are checking with mypy,\r\n or a mock-up repro if the source is private. We would appreciate\r\n if you try to simplify your case to a minimal repro.\r\n* What is the actual behavior/output?\r\n* What is the behavior/output you expect?\r\n* What are the versions of mypy and Python you are using?\r\n Do you see the same issue after installing mypy from Git master?\r\n* What are the mypy flags you are using? (For example --strict-optional)\r\n* If mypy crashed with a traceback, please paste\r\n the full traceback below.\r\n\r\n(You can freely edit this text, please remove all the lines\r\nyou believe are unnecessary.)\r\n","author":{"url":"https://github.com/azrdev","@type":"Person","name":"azrdev"},"datePublished":"2019-10-22T10:26:50Z","url":"https://github.com/python/mypy/issues/7778"}
| 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:684ac572-092b-3c98-69d9-7588c589e694 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 9E94:39350B:E17CA7:1279276:6AFFF18A |
| html-safe-nonce | a1027bc22fedbfbf02daab86ee4d0c61eaf6fa7a3c7a7bfcd6231da798bc0f1b |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5RTk0OjM5MzUwQjpFMTdDQTc6MTI3OTI3Njo2QUZGRjE4QSIsInZpc2l0b3JfaWQiOiI2MjY1NzQ2NDQzNTI1NDE5NDAyIiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | affeb6cbfca828e3cfd0ef364bacf32cdb027c447bf0ce092f43c2b73c745622 |
| hovercard-subject-tag | issue:510563856 |
| 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/7778/issue_layout |
| twitter:image | https://opengraph.githubassets.com/dd21be90054e5dded9e61f2a628a57459e206098ed8b96e31c01625911f73396/python/mypy/issues/7778 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/dd21be90054e5dded9e61f2a628a57459e206098ed8b96e31c01625911f73396/python/mypy/issues/7778 |
| og:image:alt | I have a legitimate case for member functions not requiring a self parameter, which fails with error: Self argument missing for a non-static method (or an invalid type for self) (mypy version 0.730... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | azrdev |
| 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