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

Class RRset

dns/rrset.py:30–184  ·  view source on GitHub ↗

A DNS RRset (named rdataset). RRset inherits from Rdataset, and RRsets can be treated as Rdatasets in most cases. There are, however, a few notable exceptions. RRsets have different to_wire() and to_text() method arguments, reflecting the fact that RRsets always have an owner

Source from the content-addressed store, hash-verified

28
29
30class RRset(dns.rdataset.Rdataset):
31 """A DNS RRset (named rdataset).
32
33 RRset inherits from Rdataset, and RRsets can be treated as
34 Rdatasets in most cases. There are, however, a few notable
35 exceptions. RRsets have different to_wire() and to_text() method
36 arguments, reflecting the fact that RRsets always have an owner
37 name.
38 """
39
40 __slots__ = ["name", "deleting"]
41
42 def __init__(
43 self,
44 name: dns.name.Name,
45 rdclass: dns.rdataclass.RdataClass,
46 rdtype: dns.rdatatype.RdataType,
47 covers: dns.rdatatype.RdataType = dns.rdatatype.NONE,
48 deleting: dns.rdataclass.RdataClass | None = None,
49 ):
50 """Create a new RRset."""
51
52 super().__init__(rdclass, rdtype, covers)
53 self.name = name
54 self.deleting = deleting
55
56 def _clone(self):
57 obj = cast(RRset, super()._clone())
58 obj.name = self.name
59 obj.deleting = self.deleting
60 return obj
61
62 def __repr__(self):
63 if self.covers == 0:
64 ctext = ""
65 else:
66 ctext = "(" + dns.rdatatype.to_text(self.covers) + ")"
67 if self.deleting is not None:
68 dtext = " delete=" + dns.rdataclass.to_text(self.deleting)
69 else:
70 dtext = ""
71 return (
72 "<DNS "
73 + str(self.name)
74 + " "
75 + dns.rdataclass.to_text(self.rdclass)
76 + " "
77 + dns.rdatatype.to_text(self.rdtype)
78 + ctext
79 + dtext
80 + " RRset: "
81 + self._rdata_repr()
82 + ">"
83 )
84
85 def __str__(self):
86 return self.to_text()
87

Callers 2

from_text_listFunction · 0.85
from_rdata_listFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…