@dataclass
class Interval:
isDiscrete: bool
lowerIntervalLimit: Union[int, float, str]
lowerLimitType: int
upperIntervalLimit: Union[int, float, str]
upperLimitType: int
def to_json(self) -> dict:
return asdict(self)
@staticmethod
def from_json(json: Any) -> Interval:
return Interval(
json["isDiscrete"],
json["lowerIntervalLimit"],
json["lowerLimitType"],
json["upperIntervalLimit"],
json["upperLimitType"],
)
def __eq__(self, other: Any) -> bool:
return (
isinstance(other, Interval)
and self.isDiscrete == other.isDiscrete
and self.lowerIntervalLimit == other.lowerIntervalLimit
and isinstance(self.lowerIntervalLimit, type(self.lowerIntervalLimit))
and self.lowerLimitType == other.lowerLimitType
and self.upperIntervalLimit == other.upperIntervalLimit
and isinstance(self.upperIntervalLimit, type(self.upperIntervalLimit))
and self.upperLimitType == self.upperLimitType
)