Title: [Bug]: No overload variant of "__getitem__" of "Spines" matches argument type "slice" [call-overload] · Issue #26808 · matplotlib/matplotlib · GitHub
Open Graph Title: [Bug]: No overload variant of "__getitem__" of "Spines" matches argument type "slice" [call-overload] · Issue #26808 · matplotlib/matplotlib
X Title: [Bug]: No overload variant of "__getitem__" of "Spines" matches argument type "slice" [call-overload] · Issue #26808 · matplotlib/matplotlib
Description: Bug summary Following the docs on Spines, specifically this pattern: spines[:].set_visible(False) leads to a mypy error: error: No overload variant of "__getitem__" of "Spines" matches argument type "slice" [call-overload] note: Possible...
Open Graph Description: Bug summary Following the docs on Spines, specifically this pattern: spines[:].set_visible(False) leads to a mypy error: error: No overload variant of "__getitem__" of "Spines" matches argument typ...
X Description: Bug summary Following the docs on Spines, specifically this pattern: spines[:].set_visible(False) leads to a mypy error: error: No overload variant of "__getitem__" of "Spines" ...
Opengraph URL: https://github.com/matplotlib/matplotlib/issues/26808
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"[Bug]: No overload variant of \"__getitem__\" of \"Spines\" matches argument type \"slice\" [call-overload]","articleBody":"### Bug summary\r\n\r\nFollowing the [docs on Spines](https://matplotlib.org/stable/api/spines_api.html#matplotlib.spines.Spines), specifically this pattern:\r\n\r\n```python\r\nspines[:].set_visible(False)\r\n```\r\nleads to a `mypy` error:\r\n\r\n```\r\nerror: No overload variant of \"__getitem__\" of \"Spines\" matches argument type \"slice\" [call-overload]\r\nnote: Possible overload variants:\r\nnote: def __getitem__(self, str, /) -\u003e Spine\r\nnote: def __getitem__(self, list[str], /) -\u003e SpinesProxy\r\n```\r\n\r\n### Code for reproduction\r\n\r\n```python\r\nimport matplotlib.pyplot as plt\r\n\r\nax = plt.gca()\r\nax.spines[:].set_visible(False)\r\n```\r\n\r\n\r\n### Actual outcome\r\n\r\n```\r\nerror: No overload variant of \"__getitem__\" of \"Spines\" matches argument type \"slice\" [call-overload]\r\nnote: Possible overload variants:\r\nnote: def __getitem__(self, str, /) -\u003e Spine\r\nnote: def __getitem__(self, list[str], /) -\u003e SpinesProxy\r\n```\r\n\r\n### Expected outcome\r\n\r\n`mypy` passes the above code as correctly typed.\r\n\r\nFix would likely be to define an overload for a `slice` type here: https://github.com/matplotlib/matplotlib/blob/258dd85653febd091ba6f153f8808bb366716ae9/lib/matplotlib/spines.pyi#L69\r\n\r\n### Additional information\r\n\r\n_No response_\r\n\r\n### Operating system\r\n\r\n_No response_\r\n\r\n### Matplotlib Version\r\n\r\n3.8.0\r\n\r\n### Matplotlib Backend\r\n\r\n_No response_\r\n\r\n### Python version\r\n\r\n_No response_\r\n\r\n### Jupyter version\r\n\r\n_No response_\r\n\r\n### Installation\r\n\r\nNone","author":{"url":"https://github.com/jklaise","@type":"Person","name":"jklaise"},"datePublished":"2023-09-18T14:32:22.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":0},"url":"https://github.com/26808/matplotlib/issues/26808"}
| 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:4e1c53c4-0a17-92a7-9464-63260570402b |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | B7C2:288515:105CE47:15EDE80:6A5335D6 |
| html-safe-nonce | af94699ccc459fa27262fabb42a1c50a9e37c149940ac4db608db8f3dfb43f3e |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCN0MyOjI4ODUxNToxMDVDRTQ3OjE1RURFODA6NkE1MzM1RDYiLCJ2aXNpdG9yX2lkIjoiODU2NTM2OTM0MzY1MDc3MjQzOCIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 3f267b9c35842235a5b0f3293cbdc37a28b03c3241a6029b3b51e6a6d8a07cf5 |
| hovercard-subject-tag | issue:1901079370 |
| 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/matplotlib/matplotlib/26808/issue_layout |
| twitter:image | https://opengraph.githubassets.com/6f8a8614954cdd35c67d770a528d2ec849a42a0810814ce6f28b93be9babb7e7/matplotlib/matplotlib/issues/26808 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/6f8a8614954cdd35c67d770a528d2ec849a42a0810814ce6f28b93be9babb7e7/matplotlib/matplotlib/issues/26808 |
| og:image:alt | Bug summary Following the docs on Spines, specifically this pattern: spines[:].set_visible(False) leads to a mypy error: error: No overload variant of "__getitem__" of "Spines" matches argument typ... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | jklaise |
| hostname | github.com |
| expected-hostname | github.com |
| None | b9a586c06a05a7a86fc7e3f4dbd03e42f6869085879aa184aa6369456dbd50fb |
| turbo-cache-control | no-preview |
| go-import | github.com/matplotlib/matplotlib git https://github.com/matplotlib/matplotlib.git |
| octolytics-dimension-user_id | 215947 |
| octolytics-dimension-user_login | matplotlib |
| octolytics-dimension-repository_id | 1385122 |
| octolytics-dimension-repository_nwo | matplotlib/matplotlib |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 1385122 |
| octolytics-dimension-repository_network_root_nwo | matplotlib/matplotlib |
| 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 | 07a982c1d40157c619b364352b704c3ce66bb332 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width