MCPcopy Create free account
hub / github.com/rthalley/dnspython / prefixed_length

Function prefixed_length

dns/renderer.py:41–55  ·  view source on GitHub ↗
(output, length_length)

Source from the content-addressed store, hash-verified

39
40@contextlib.contextmanager
41def prefixed_length(output, length_length):
42 output.write(b"\00" * length_length)
43 start = output.tell()
44 yield
45 end = output.tell()
46 length = end - start
47 if length > 0:
48 try:
49 output.seek(start - length_length)
50 try:
51 output.write(length.to_bytes(length_length, "big"))
52 except OverflowError:
53 raise dns.exception.FormError
54 finally:
55 output.seek(end)
56
57
58class Renderer:

Callers 1

_write_tsigMethod · 0.85

Calls 2

writeMethod · 0.45
seekMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…