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

Function from_text

dns/zone.py:1252–1323  ·  view source on GitHub ↗

Build a zone object from a zone file format string. *text*, a ``str``, the zone file format input. *origin*, a ``dns.name.Name``, a ``str``, or ``None``. The origin of the zone; if not specified, the first ``$ORIGIN`` statement in the zone file will determine the origin of the zon

(
    text: str,
    origin: dns.name.Name | str | None = None,
    rdclass: dns.rdataclass.RdataClass = dns.rdataclass.IN,
    relativize: bool = True,
    zone_factory: Any = Zone,
    filename: str | None = None,
    allow_include: bool = False,
    check_origin: bool = True,
    idna_codec: dns.name.IDNACodec | None = None,
    allow_directives: bool | Iterable[str] = True,
)

Source from the content-addressed store, hash-verified

1250
1251
1252def from_text(
1253 text: str,
1254 origin: dns.name.Name | str | None = None,
1255 rdclass: dns.rdataclass.RdataClass = dns.rdataclass.IN,
1256 relativize: bool = True,
1257 zone_factory: Any = Zone,
1258 filename: str | None = None,
1259 allow_include: bool = False,
1260 check_origin: bool = True,
1261 idna_codec: dns.name.IDNACodec | None = None,
1262 allow_directives: bool | Iterable[str] = True,
1263) -> Zone:
1264 """Build a zone object from a zone file format string.
1265
1266 *text*, a ``str``, the zone file format input.
1267
1268 *origin*, a ``dns.name.Name``, a ``str``, or ``None``. The origin
1269 of the zone; if not specified, the first ``$ORIGIN`` statement in the
1270 zone file will determine the origin of the zone.
1271
1272 *rdclass*, a ``dns.rdataclass.RdataClass``, the zone's rdata class; the default is
1273 class IN.
1274
1275 *relativize*, a ``bool``, determine's whether domain names are
1276 relativized to the zone's origin. The default is ``True``.
1277
1278 *zone_factory*, the zone factory to use or ``None``. If ``None``, then
1279 ``dns.zone.Zone`` will be used. The value may be any class or callable
1280 that returns a subclass of ``dns.zone.Zone``.
1281
1282 *filename*, a ``str`` or ``None``, the filename to emit when
1283 describing where an error occurred; the default is ``'<string>'``.
1284
1285 *allow_include*, a ``bool``. If ``True``, the default, then ``$INCLUDE``
1286 directives are permitted. If ``False``, then encoutering a ``$INCLUDE``
1287 will raise a ``SyntaxError`` exception.
1288
1289 *check_origin*, a ``bool``. If ``True``, the default, then sanity
1290 checks of the origin node will be made by calling the zone&#x27;s
1291 ``check_origin()`` method.
1292
1293 *idna_codec*, a ``dns.name.IDNACodec``, specifies the IDNA
1294 encoder/decoder. If ``None``, the default IDNA 2003 encoder/decoder
1295 is used.
1296
1297 *allow_directives*, a ``bool`` or an iterable of `str`. If ``True``, the default,
1298 then directives are permitted, and the *allow_include* parameter controls whether
1299 ``$INCLUDE`` is permitted. If ``False`` or an empty iterable, then no directive
1300 processing is done and any directive-like text will be treated as a regular owner
1301 name. If a non-empty iterable, then only the listed directives (including the
1302 ``$``) are allowed.
1303
1304 Raises ``dns.zone.NoSOA`` if there is no SOA RRset.
1305
1306 Raises ``dns.zone.NoNS`` if there is no NS RRset.
1307
1308 Raises ``KeyError`` if there is no origin node.
1309

Callers

nothing calls this directly

Calls 1

_from_textFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…