Title: Strange Index error on string formatting · Issue #9221 · python/mypy · GitHub
Open Graph Title: Strange Index error on string formatting · Issue #9221 · python/mypy
X Title: Strange Index error on string formatting · Issue #9221 · python/mypy
Description: Are you reporting a bug, or opening a feature request? Bug. Please insert below the code you are checking with mypy, or a mock-up repro if the source is private. We would appreciate if you try to simplify your case to a minimal repro. im...
Open Graph Description: Are you reporting a bug, or opening a feature request? Bug. Please insert below the code you are checking with mypy, or a mock-up repro if the source is private. We would appreciate if you try to s...
X Description: Are you reporting a bug, or opening a feature request? Bug. Please insert below the code you are checking with mypy, or a mock-up repro if the source is private. We would appreciate if you try to s...
Opengraph URL: https://github.com/python/mypy/issues/9221
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Strange Index error on string formatting","articleBody":"* Are you reporting a bug, or opening a feature request? Bug.\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\r\n```\r\nimport github # PyGithub\r\ng = github.Github(\"access_token\")\r\ngithub_repo = \"staticdev/git-portfolio\"\r\nrepo = g.get_repo(github_repo)\r\ntry:\r\n created_pr = repo.create_pull(\r\n title=\"title\", body=\"body\", head=\"head\", base=\"base\", draft=False,\r\n )\r\nexcept github.GithubException as github_exception:\r\n extra = \"\"\r\n for error in github_exception.data[\"errors\"]:\r\n if \"message\" in error:\r\n extra += f\"{error['message']} \"\r\n else:\r\n extra += f\"Invalid field {error['field']}. \"\r\n```\r\n\r\n* What is the actual behavior/output?\r\n```\r\nsrc/git_portfolio/mypy.py:13:31: error: Invalid index type \"str\" for \"Union[str, Dict[str, str]]\"; expected type \"Union[int, slice]\" [index]\r\n extra += f\"{error['message']} \"\r\n ^\r\nsrc/git_portfolio/mypy.py:15:45: error: Invalid index type \"str\" for \"Union[str, Dict[str, str]]\"; expected type \"Union[int, slice]\" [index]\r\n extra += f\"Invalid field {error['field']}. \"\r\n ^\r\n```\r\n* What is the behavior/output you expect?\r\nI expected no error, since I did not declare any type for f-strings, and these are strings.\r\n\r\n* What are the versions of mypy and Python you are using?\r\nmypy v0.782 python 3.8.2\r\n\r\n Do you see the same issue after installing mypy from Git master?\r\nyes\r\n\r\n* What are the mypy flags you are using? (For example --strict-optional)\r\nNone.\r\n\r\n","author":{"url":"https://github.com/staticdev","@type":"Person","name":"staticdev"},"datePublished":"2020-07-27T22:00:40Z","url":"https://github.com/python/mypy/issues/9221"}
| 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:1b49c2bf-0c9f-45cb-224a-3cfb24a3872a |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | A7C4:1C3DC0:524F1C:6E5C8E:6B003030 |
| html-safe-nonce | 9b21dde5e05281c07cded88fa9fd0661ab29efd4c2a00f8e623f26dbba3db7c6 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBN0M0OjFDM0RDMDo1MjRGMUM6NkU1QzhFOjZCMDAzMDMwIiwidmlzaXRvcl9pZCI6IjY3MTIwMTIzNDg5NDY2NTczMjgiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 107b323033743638e5d046e6cc91c19f7f0084a36de0a825141adf40173c88e9 |
| hovercard-subject-tag | issue:666611502 |
| 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/9221/issue_layout |
| twitter:image | https://opengraph.githubassets.com/50107c63ed70aaa33ce30ad578e7093ad98d989851f8de6a23fb60fcc46dfc49/python/mypy/issues/9221 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/50107c63ed70aaa33ce30ad578e7093ad98d989851f8de6a23fb60fcc46dfc49/python/mypy/issues/9221 |
| og:image:alt | Are you reporting a bug, or opening a feature request? Bug. Please insert below the code you are checking with mypy, or a mock-up repro if the source is private. We would appreciate if you try to s... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | staticdev |
| hostname | github.com |
| expected-hostname | github.com |
| None | 7d0829bbde9e48b2486cb5dd6d147896eb01d32134627091f818958a935ef3f0 |
| 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 | f3f3a43ca095cdea3abbb394112e971f9fdb94fa |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width