Last change
on this file since 78 was 73, checked in by Bart Vastenhouw, 3 years ago |
Fix for IssueValue hashcode.
|
File size:
1.0 KB
|
Line | |
---|
1 | from _decimal import Decimal
|
---|
2 | from abc import ABC
|
---|
3 |
|
---|
4 | from pyson.JsonDeserialize import JsonDeserialize
|
---|
5 | from pyson.JsonSubTypes import JsonSubTypes
|
---|
6 | from pyson.JsonValue import JsonValue
|
---|
7 |
|
---|
8 |
|
---|
9 |
|
---|
10 | @JsonDeserialize("geniusweb.issuevalue.ValueDeserializer.ValueDeserializer")
|
---|
11 | @JsonSubTypes(["geniusweb.issuevalue.NumberValue.NumberValue",\
|
---|
12 | "geniusweb.issuevalue.DiscreteValue.DiscreteValue"])
|
---|
13 | class Value(ABC):
|
---|
14 | '''
|
---|
15 | A possible value for an Issue. Must be immutable and thread safe. Supported
|
---|
16 | values are {@link NumberValue} and {@link DiscreteValue}. All values are just
|
---|
17 | strings, a custom deserializer is used to determine which type it is.
|
---|
18 |
|
---|
19 | Value must be de-serializable all by itself, because it can occur plain in a
|
---|
20 | Bid eg Bid["fte":0.8]
|
---|
21 | '''
|
---|
22 | def __init__(self, value):
|
---|
23 | self._value = value;
|
---|
24 |
|
---|
25 | @JsonValue()
|
---|
26 | def getValue(self) -> str:
|
---|
27 | return self._value;
|
---|
28 |
|
---|
29 | def __repr__(self):
|
---|
30 | return str(self._value)
|
---|
31 |
|
---|
32 | def __eq__(self, other):
|
---|
33 | return isinstance(other, self.__class__) and self._value == other._value
|
---|
34 |
|
---|
35 | def __hash__(self):
|
---|
36 | return hash(self._value) |
---|
Note:
See
TracBrowser
for help on using the repository browser.