source: geniuswebcore/geniusweb/inform/OptIn.py@ 100

Last change on this file since 100 was 100, checked in by ruud, 19 months ago

python installs also wheel to avoid error messages

File size: 1.1 KB
Line 
1from typing import List
2
3from geniusweb.actions.PartyId import PartyId
4from geniusweb.actions.Votes import Votes
5from geniusweb.inform.Inform import Inform
6
7
8class OptIn (Inform):
9 '''
10 Informs party that it's time to Opt-in.
11
12 '''
13 def __init__(self, votes:List[Votes] ) :
14 '''
15 @param votes a list of votes. There may be only one votes per party.
16 '''
17 self._votes = votes;
18
19 parties:List[PartyId] = []
20 for vots in votes:
21 partyid = vots.getActor()
22 if partyid in parties:
23 raise ValueError("OptIn contains multiple Votes for party " + str(partyid))
24 parties.append(partyid)
25
26 def getVotes(self)->List[Votes] :
27 '''
28 @return list of Votes that can be opted in to
29 '''
30 return list(self._votes);
31
32 def __eq__(self, other):
33 return isinstance(other, self.__class__) and self._votes==other._votes
34
35 def __hash__(self):
36 return hash(tuple(self._votes))
37
38 def __repr__(self) -> str :
39 return "OptIn[" + str(self._votes) + "]"
40
Note: See TracBrowser for help on using the repository browser.