source: geniuswebcore/geniusweb/issuevalue/DiscreteValue.py@ 60

Last change on this file since 60 was 59, checked in by Wouter Pasman, 3 years ago

#44 manual commit of first public release, because this will cause the dist directory to move

File size: 578 bytes
RevLine 
[59]1from pyson.JsonValue import JsonValue
2
3from geniusweb.issuevalue.Value import Value
4
5
6class DiscreteValue (Value) :
7 '''
8 A value for a discrete issue. Constructor guarantees this is non-null and
9 non-empty. immutable.
10 '''
11
12 def __init__(self, value:str):
13 if value == None or value=="":
14 raise ValueError("value must be non-null and non-empty")
15 super().__init__(value)
16
17 def __hash__(self):
18 return hash(self._value)
19
20 def __repr__(self):
21 return str(self._value)
22
23 def __eq__(self, other):
24 return isinstance(other, self.__class__) and self._value == other._value
Note: See TracBrowser for help on using the repository browser.