Replace an rdataset. It is not an error if there is no rdataset matching *replacement*. Ownership of the *replacement* object is transferred to the node; in other words, this method does not store a copy of *replacement* at the node, it stores *replacement* itself.
(self, replacement: dns.rdataset.Rdataset)
| 263 | self.rdatasets.remove(rds) |
| 264 | |
| 265 | def replace_rdataset(self, replacement: dns.rdataset.Rdataset) -> None: |
| 266 | """Replace an rdataset. |
| 267 | |
| 268 | It is not an error if there is no rdataset matching *replacement*. |
| 269 | |
| 270 | Ownership of the *replacement* object is transferred to the node; |
| 271 | in other words, this method does not store a copy of *replacement* |
| 272 | at the node, it stores *replacement* itself. |
| 273 | |
| 274 | *replacement*, a ``dns.rdataset.Rdataset``. |
| 275 | |
| 276 | Raises ``ValueError`` if *replacement* is not a |
| 277 | ``dns.rdataset.Rdataset``. |
| 278 | """ |
| 279 | |
| 280 | if not isinstance(replacement, dns.rdataset.Rdataset): |
| 281 | raise ValueError("replacement is not an rdataset") |
| 282 | if isinstance(replacement, dns.rrset.RRset): |
| 283 | # RRsets are not good replacements as the match() method |
| 284 | # is not compatible. |
| 285 | replacement = replacement.to_rdataset() |
| 286 | self.delete_rdataset( |
| 287 | replacement.rdclass, replacement.rdtype, replacement.covers |
| 288 | ) |
| 289 | self._append_rdataset(replacement) |
| 290 | |
| 291 | def classify(self) -> NodeKind: |
| 292 | """Classify a node. |