From 87f9e19fa8a8ff9814f1ca035614546fabf54291 Mon Sep 17 00:00:00 2001 From: David Robertson Date: Fri, 1 Apr 2022 15:53:47 +0100 Subject: [PATCH] Workaround a false positive about indexing into refs ``` scripts-dev/release.py:495: error: Unsupported right operand type for in ("Callable[[], IterableList[Reference]]") [operator] scripts-dev/release.py:496: error: Value of type "Callable[[], IterableList[Reference]]" is not indexable [index] ``` `refs` is an alias the the property `references`. Mypy gets confused by the alias, see https://github.com/python/mypy/issues/6700 --- scripts-dev/release.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts-dev/release.py b/scripts-dev/release.py index 50a5b2628824..1e29fe73b582 100755 --- a/scripts-dev/release.py +++ b/scripts-dev/release.py @@ -491,8 +491,8 @@ def parse_version_from_module() -> Tuple[ def find_ref(repo: git.Repo, ref_name: str) -> Optional[git.HEAD]: """Find the branch/ref, looking first locally then in the remote.""" - if ref_name in repo.refs: - return repo.refs[ref_name] + if ref_name in repo.references: + return repo.references[ref_name] elif ref_name in repo.remote().refs: return repo.remote().refs[ref_name] else: