Dataclass representing triplet called token consisting of length, offset and indicator. This triplet is used during LZ77 compression.
| 36 | |
| 37 | @dataclass |
| 38 | class Token: |
| 39 | """ |
| 40 | Dataclass representing triplet called token consisting of length, offset |
| 41 | and indicator. This triplet is used during LZ77 compression. |
| 42 | """ |
| 43 | |
| 44 | offset: int |
| 45 | length: int |
| 46 | indicator: str |
| 47 | |
| 48 | def __repr__(self) -> str: |
| 49 | """ |
| 50 | >>> token = Token(1, 2, "c") |
| 51 | >>> repr(token) |
| 52 | '(1, 2, c)' |
| 53 | >>> str(token) |
| 54 | '(1, 2, c)' |
| 55 | """ |
| 56 | return f"({self.offset}, {self.length}, {self.indicator})" |
| 57 | |
| 58 | |
| 59 | class LZ77Compressor: |
no outgoing calls
no test coverage detected