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

Method __init__

dns/wire.py:14–27  ·  view source on GitHub ↗

Initialize a Parser *wire*, a ``bytes`` contains the data to be parsed, and possibly other data. Typically it is the whole message or a slice of it. *current*, an `int`, the offset within *wire* where parsing should begin.

(self, wire: bytes, current: int = 0)

Source from the content-addressed store, hash-verified

12 """Helper class for parsing DNS wire format."""
13
14 def __init__(self, wire: bytes, current: int = 0):
15 """Initialize a Parser
16
17 *wire*, a ``bytes`` contains the data to be parsed, and possibly other data.
18 Typically it is the whole message or a slice of it.
19
20 *current*, an `int`, the offset within *wire* where parsing should begin.
21 """
22 self.wire = wire
23 self.current = 0
24 self.end = len(self.wire)
25 if current:
26 self.seek(current)
27 self.furthest = current
28
29 def remaining(self) -> int:
30 return self.end - self.current

Callers

nothing calls this directly

Calls 1

seekMethod · 0.95

Tested by

no test coverage detected