2015-12-19 15:55:14 +00:00
|
|
|
|
2024-07-09 23:09:11 +00:00
|
|
|
import dataclasses
|
|
|
|
|
|
|
|
class JunkComparisonException(BaseException):
|
2015-12-19 15:55:14 +00:00
|
|
|
|
2018-02-06 19:20:09 +00:00
|
|
|
def __str__ (self):
|
|
|
|
return "Attempting to perform calculations involving junk values."
|
2015-12-19 15:55:14 +00:00
|
|
|
|
2024-07-09 23:09:11 +00:00
|
|
|
@dataclasses.dataclass
|
2015-12-19 15:55:14 +00:00
|
|
|
class Junk:
|
2024-07-09 23:09:11 +00:00
|
|
|
represents: str | None = None
|
2015-12-19 15:55:14 +00:00
|
|
|
|
2018-02-06 19:56:33 +00:00
|
|
|
def __str__ (self):
|
2024-07-09 23:09:11 +00:00
|
|
|
return '[{}]'.format(self.represents or 'junk')
|
2015-12-19 15:55:14 +00:00
|
|
|
|
2018-02-06 19:56:33 +00:00
|
|
|
def __repr__ (self):
|
|
|
|
return self.__str__()
|
2015-12-19 15:55:14 +00:00
|
|
|
|
2024-07-09 23:09:11 +00:00
|
|
|
def __format__ (self, format):
|
|
|
|
return self.__str__()
|
|
|
|
|
2018-02-06 19:56:33 +00:00
|
|
|
def __add__ (self, other):
|
|
|
|
return self
|
2015-12-19 15:55:14 +00:00
|
|
|
|
2018-02-06 19:56:33 +00:00
|
|
|
def __radd__ (self, other):
|
|
|
|
return self
|
2015-12-19 15:55:14 +00:00
|
|
|
|
2018-02-06 19:56:33 +00:00
|
|
|
def __sub__ (self, other):
|
|
|
|
return self
|
2015-12-19 15:55:14 +00:00
|
|
|
|
2018-02-06 19:56:33 +00:00
|
|
|
def __rsub__ (self, other):
|
|
|
|
return self
|
2018-02-06 19:20:09 +00:00
|
|
|
|