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

Method present

dns/update.py:266–317  ·  view source on GitHub ↗

Require that an owner name (and optionally an rdata type, or specific rdataset) exists as a prerequisite to the execution of the update. The first argument is always a name. The other arguments can be: - rdataset... - rdata...

(self, name: dns.name.Name | str, *args: Any)

Source from the content-addressed store, hash-verified

264 self._add(True, self.update, name, *args)
265
266 def present(self, name: dns.name.Name | str, *args: Any) -> None:
267 """Require that an owner name (and optionally an rdata type,
268 or specific rdataset) exists as a prerequisite to the
269 execution of the update.
270
271 The first argument is always a name.
272 The other arguments can be:
273
274 - rdataset...
275
276 - rdata...
277
278 - rdtype, string...
279 """
280
281 if isinstance(name, str):
282 name = dns.name.from_text(name, None)
283 if len(args) == 0:
284 self.find_rrset(
285 self.prerequisite,
286 name,
287 dns.rdataclass.ANY,
288 dns.rdatatype.ANY,
289 dns.rdatatype.NONE,
290 None,
291 True,
292 True,
293 )
294 elif (
295 isinstance(args[0], dns.rdataset.Rdataset)
296 or isinstance(args[0], dns.rdata.Rdata)
297 or len(args) > 1
298 ):
299 if not isinstance(args[0], dns.rdataset.Rdataset):
300 # Add a 0 TTL
301 largs = list(args)
302 largs.insert(0, 0) # type: ignore[arg-type]
303 self._add(False, self.prerequisite, name, *largs)
304 else:
305 self._add(False, self.prerequisite, name, *args)
306 else:
307 rdtype = dns.rdatatype.RdataType.make(args[0])
308 self.find_rrset(
309 self.prerequisite,
310 name,
311 dns.rdataclass.ANY,
312 rdtype,
313 dns.rdatatype.NONE,
314 None,
315 True,
316 True,
317 )
318
319 def absent(
320 self,

Callers 4

test_to_wire1Method · 0.80
test_to_wire2Method · 0.80
test_to_wire3Method · 0.80

Calls 4

_addMethod · 0.95
from_textMethod · 0.45
find_rrsetMethod · 0.45
makeMethod · 0.45

Tested by 4

test_to_wire1Method · 0.64
test_to_wire2Method · 0.64
test_to_wire3Method · 0.64