VoteIT / STVPoll

0 stars 3 forks source link

"TypeError: unsupported operand type(s) for |: 'types.GenericAlias' and 'TypeVar'" #1

Open luukasahola opened 1 year ago

luukasahola commented 1 year ago

While running the test script on the repository page, Python gives out the following error output:

Traceback (most recent call last):
  File "/home/luukas/stv/stv-test.py", line 1, in <module>
    from stvpoll.scottish_stv import ScottishSTV
  File "/home/luukas/.local/lib/python3.9/site-packages/stvpoll/scottish_stv.py", line 3, in <module>
    from stvpoll.abcs import STVPollBase
  File "/home/luukas/.local/lib/python3.9/site-packages/stvpoll/abcs.py", line 15, in <module>
    from .tiebreak_strategies import (
  File "/home/luukas/.local/lib/python3.9/site-packages/stvpoll/tiebreak_strategies.py", line 8, in <module>
    class TiebreakStrategy(Protocol):
  File "/home/luukas/.local/lib/python3.9/site-packages/stvpoll/tiebreak_strategies.py", line 14, in TiebreakStrategy
    ) -> Candidates | Candidate:  # pragma: no coverage
TypeError: unsupported operand type(s) for |: 'types.GenericAlias' and 'TypeVar'

The following output was produced with the following workflow:

> pip3 install STVpoll
> # Inserted the Scottish STV example to stv-test.py
> doas chmod +x stv-test.py
> python3 stv-test.py
luukasahola commented 1 year ago

2

Got it fixed with a bit of documentation. Please approve my pull request.