MCPcopy Create free account
hub / github.com/secdev/scapy / _huffman_encode_char

Method _huffman_encode_char

scapy/contrib/http2.py:1001–1014  ·  view source on GitHub ↗

huffman_encode_char assumes that the static_huffman_tree was previously initialized :param str|EOS c: a symbol to encode :return: (int, int): the bitstring of the symbol and its bitlength :raises: AssertionError

(cls, c)

Source from the content-addressed store, hash-verified

999
1000 @classmethod
1001 def _huffman_encode_char(cls, c):
1002 # type: (Union[str, EOS]) -> Tuple[int, int]
1003 """ huffman_encode_char assumes that the static_huffman_tree was
1004 previously initialized
1005
1006 :param str|EOS c: a symbol to encode
1007 :return: (int, int): the bitstring of the symbol and its bitlength
1008 :raises: AssertionError
1009 """
1010 if isinstance(c, EOS):
1011 return cls.static_huffman_code[-1]
1012 else:
1013 assert isinstance(c, int) or len(c) == 1
1014 return cls.static_huffman_code[orb(c)]
1015
1016 @classmethod
1017 def huffman_encode(cls, s):

Callers 1

huffman_encodeMethod · 0.80

Calls 1

orbFunction · 0.90

Tested by

no test coverage detected