Title: Overloading staticmethods · Issue #7781 · python/mypy · GitHub
Open Graph Title: Overloading staticmethods · Issue #7781 · python/mypy
X Title: Overloading staticmethods · Issue #7781 · python/mypy
Description: Overloaded staticmethod isn't considered correctly by the type checker. foobar.py from typing import overload class Snafu(object): @overload @staticmethod def snafu(value: None) -> None: ... @overload @staticmethod def snafu(value: bytes...
Open Graph Description: Overloaded staticmethod isn't considered correctly by the type checker. foobar.py from typing import overload class Snafu(object): @overload @staticmethod def snafu(value: None) -> None: ... @overl...
X Description: Overloaded staticmethod isn't considered correctly by the type checker. foobar.py from typing import overload class Snafu(object): @overload @staticmethod def snafu(value: None) -> None: ......
Opengraph URL: https://github.com/python/mypy/issues/7781
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Overloading staticmethods","articleBody":"Overloaded staticmethod isn't considered correctly by the type checker.\r\nfoobar.py\r\n```\r\nfrom typing import overload\r\n\r\nclass Snafu(object):\r\n @overload\r\n @staticmethod\r\n def snafu(value: None) -> None: ...\r\n\r\n @overload\r\n @staticmethod\r\n def snafu(value: bytes) -> bytes: ...\r\n\r\n @overload\r\n @staticmethod\r\n def snafu(value: str) -> bytes: ...\r\n\r\n @staticmethod\r\n def snafu(value):\r\n return bytes(value, encoding='UTF-16')\r\n\r\nprint(Snafu().snafu('123'))\r\n```\r\nWhile running `mypy foobar.py` expected output: `Success: no issues found in 1 source file`,\r\nbut got `foobar.py:21: error: No overload variant of \"snafu\" of \"Snafu\" matches argument type \"str\"\r\n`.\r\nI guessed [#5224](https://github.com/python/mypy/pull/5224) had to fix this, but i've got the behavior above.\r\n\r\nAm i doing something wrong?\r\n\r\nmypy v0.740, Python v3.7.4","author":{"url":"https://github.com/nautics889","@type":"Person","name":"nautics889"},"datePublished":"2019-10-23T14:10:47Z","url":"https://github.com/python/mypy/issues/7781"}
| 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:aa03215e-38ee-669e-358e-12e9c1ed7b69 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 8402:1833B7:20971FA:2C1B61C:6B001D0B |
| html-safe-nonce | 8c5786b52343585b7a721ee7340e26933a23fba120b02d79a96912ff4195e608 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4NDAyOjE4MzNCNzoyMDk3MUZBOjJDMUI2MUM6NkIwMDFEMEIiLCJ2aXNpdG9yX2lkIjoiNDI4MDYxMDg0MTMyNzMxMjEzOSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 773702e30b9d7aad11688e09a66a65a0fb109c47e8e80d9fc69180d642e172b5 |
| hovercard-subject-tag | issue:511350812 |
| 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/7781/issue_layout |
| twitter:image | https://opengraph.githubassets.com/4c4995bbd2411360676a98c9503e7dc26456a05fc50ac519bcbc6708a2a6b589/python/mypy/issues/7781 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/4c4995bbd2411360676a98c9503e7dc26456a05fc50ac519bcbc6708a2a6b589/python/mypy/issues/7781 |
| og:image:alt | Overloaded staticmethod isn't considered correctly by the type checker. foobar.py from typing import overload class Snafu(object): @overload @staticmethod def snafu(value: None) -> None: ... @overl... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | nautics889 |
| hostname | github.com |
| expected-hostname | github.com |
| None | 4eb4cba0d69f045374ac15de9666d22b0961e1d555cc3824f36b7734c00c78e0 |
| 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 | 44c658b24abf00491fb7ae5f56d42c9f38cbeab2 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width