MCPcopy Create free account
hub / github.com/TheAlgorithms/Python / Token

Class Token

data_compression/lz77.py:38–56  ·  view source on GitHub ↗

Dataclass representing triplet called token consisting of length, offset and indicator. This triplet is used during LZ77 compression.

Source from the content-addressed store, hash-verified

36
37@dataclass
38class 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
59class LZ77Compressor:

Callers 1

_find_encoding_tokenMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected