You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Apr 26, 2024. It is now read-only.
`.reference` is a property whose setter function is `set_reference`.
My isn't happy when we try to assign directly:
```
scripts-dev/release.py:208: error: Trying to assign name "reference" that is not in "__slots__" of type "git.refs.head.HEAD" [misc]
scripts-dev/release.py:208: error: Incompatible types in assignment (expression has type "HEAD", variable has type "Union[Head, TagReference, RemoteReference, Reference]") [assignment]
```
but calling `set_reference` ourselves makes the typechecker happy.
Confusingly the following three types are all different:
- the `refererence` property: `Union['Head', 'TagReference', 'RemoteReference', 'Reference']`
- return type of `_get_reference`: `SymbolicReference`
- `set_reference` first argument: `Union[Commit_ish, 'SymbolicReference', str]`
where `Commit_ish = Union['Commit', 'TagObject', 'Blob', 'Tree']`
It seems that typecheckers haven't settled down on The Way to handle
properties whose getter and setter types differ: see e.g.
python/mypy#3004 .
0 commit comments