| Total Complexity | 6 |
| Total Lines | 34 |
| Duplicated Lines | 0 % |
| Changes | 5 | ||
| Bugs | 0 | Features | 0 |
| 1 | """Implements the Crc64Result class. |
||
| 8 | class Crc64Result(object): |
||
| 9 | """Implements a class that represents the result of a 64-bit Cyclic Redundancy Check checksum. |
||
| 10 | """ |
||
| 11 | |||
| 12 | def __init__(self, crc64): |
||
| 13 | self._crc64 = crc64 |
||
| 14 | |||
| 15 | |||
| 16 | @property |
||
| 17 | def high_bytes(self): |
||
| 18 | """Returns the topmost 4 bytes of the checksum formatted as a lowercase hex string. |
||
| 19 | """ |
||
| 20 | |||
| 21 | return format(self._crc64 >> 32, "08x") |
||
| 22 | |||
| 23 | |||
| 24 | @property |
||
| 25 | def low_bytes(self): |
||
| 26 | """Returns the bottommost 4 bytes of the checksum formatted as a lowercase hex string. |
||
| 27 | """ |
||
| 28 | |||
| 29 | return format(self._crc64 & 0xffffffff, "08x") |
||
| 30 | |||
| 31 | |||
| 32 | def __eq__(self, other): |
||
| 33 | return self._crc64 == other._crc64 # pylint: disable=locally-disabled, protected-access |
||
| 34 | |||
| 35 | |||
| 36 | def __ne__(self, other): |
||
| 37 | return not self.__eq__(other) |
||
| 38 | |||
| 39 | |||
| 40 | def __str__(self): |
||
| 41 | return format(self._crc64, "016x") |
||
| 42 |