import github # PyGithub
g = github.Github("access_token")
github_repo = "staticdev/git-portfolio"
repo = g.get_repo(github_repo)
try:
created_pr = repo.create_pull(
title="title", body="body", head="head", base="base", draft=False,
)
except github.GithubException as github_exception:
extra = ""
for error in github_exception.data["errors"]:
if "message" in error:
extra += f"{error['message']} "
else:
extra += f"Invalid field {error['field']}. "
src/git_portfolio/mypy.py:13:31: error: Invalid index type "str" for "Union[str, Dict[str, str]]"; expected type "Union[int, slice]" [index]
extra += f"{error['message']} "
^
src/git_portfolio/mypy.py:15:45: error: Invalid index type "str" for "Union[str, Dict[str, str]]"; expected type "Union[int, slice]" [index]
extra += f"Invalid field {error['field']}. "
^
or a mock-up repro if the source is private. We would appreciate
if you try to simplify your case to a minimal repro.
What is the behavior/output you expect?
I expected no error, since I did not declare any type for f-strings, and these are strings.
What are the versions of mypy and Python you are using?
mypy v0.782 python 3.8.2
Do you see the same issue after installing mypy from Git master?
yes
What are the mypy flags you are using? (For example --strict-optional)
None.