From: Bob Halley Date: Wed, 19 Aug 2020 23:14:24 +0000 (-0700) Subject: rename masterfile to zonefile X-Git-Tag: v2.1.0rc1~63 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=bccfd05f2b89adcb379fcebb7d0c4140aca4a6fb;p=thirdparty%2Fdnspython.git rename masterfile to zonefile --- diff --git a/dns/__init__.py b/dns/__init__.py index eafdcc4d..3a51a539 100644 --- a/dns/__init__.py +++ b/dns/__init__.py @@ -31,7 +31,6 @@ __all__ = [ 'inet', 'ipv4', 'ipv6', - 'masterfile', 'message', 'name', 'namedict', @@ -60,6 +59,7 @@ __all__ = [ 'versioned', 'wire', 'zone', + 'zonefile', ] from dns.version import version as __version__ # noqa diff --git a/dns/rdataset.py b/dns/rdataset.py index 10cb252f..2a42e424 100644 --- a/dns/rdataset.py +++ b/dns/rdataset.py @@ -178,7 +178,7 @@ class Rdataset(dns.set.Set): def to_text(self, name=None, origin=None, relativize=True, override_rdclass=None, want_comments=False, **kw): - """Convert the rdataset into DNS master file format. + """Convert the rdataset into DNS zone file format. See ``dns.name.Name.choose_relativity`` for more information on how *origin* and *relativize* determine the way names diff --git a/dns/rrset.py b/dns/rrset.py index 5a09352e..adfcad9d 100644 --- a/dns/rrset.py +++ b/dns/rrset.py @@ -92,7 +92,7 @@ class RRset(dns.rdataset.Rdataset): def to_text(self, origin=None, relativize=True, **kw): - """Convert the RRset into DNS master file format. + """Convert the RRset into DNS zone file format. See ``dns.name.Name.choose_relativity`` for more information on how *origin* and *relativize* determine the way names diff --git a/dns/tokenizer.py b/dns/tokenizer.py index 131d428b..7ddc7a96 100644 --- a/dns/tokenizer.py +++ b/dns/tokenizer.py @@ -15,7 +15,7 @@ # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT # OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -"""Tokenize DNS master file format""" +"""Tokenize DNS zone file format""" import io import sys @@ -41,7 +41,7 @@ class UngetBufferFull(dns.exception.DNSException): class Token: - """A DNS master file format token. + """A DNS zone file format token. ttype: The token type value: The token value @@ -191,7 +191,7 @@ class Token: class Tokenizer: - """A DNS master file format tokenizer. + """A DNS zone file format tokenizer. A token object is basically a (type, value) tuple. The valid types are EOF, EOL, WHITESPACE, IDENTIFIER, QUOTED_STRING, diff --git a/dns/transaction.py b/dns/transaction.py index eae2920c..db32e9dc 100644 --- a/dns/transaction.py +++ b/dns/transaction.py @@ -472,7 +472,7 @@ class Transaction: This method is called when reading a possibly relativized source, and an origin setting operation occurs (e.g. $ORIGIN - in a masterfile). + in a zone file). """ raise NotImplementedError # pragma: no cover diff --git a/dns/versioned.py b/dns/versioned.py index 99c30e49..ff3d7020 100644 --- a/dns/versioned.py +++ b/dns/versioned.py @@ -181,7 +181,7 @@ class Zone(dns.zone.Zone): *origin* is the origin of the zone. It may be a ``dns.name.Name``, a ``str``, or ``None``. If ``None``, then the zone's origin will - be set by the first ``$ORIGIN`` line in a masterfile. + be set by the first ``$ORIGIN`` line in a zone file. *rdclass*, an ``int``, the zone's rdata class; the default is class IN. diff --git a/dns/zone.py b/dns/zone.py index 11c4c336..39ab1a60 100644 --- a/dns/zone.py +++ b/dns/zone.py @@ -22,7 +22,6 @@ import io import os import dns.exception -import dns.masterfile import dns.name import dns.node import dns.rdataclass @@ -34,6 +33,7 @@ import dns.tokenizer import dns.transaction import dns.ttl import dns.grange +import dns.zonefile class BadZone(dns.exception.DNSException): @@ -77,7 +77,7 @@ class Zone(dns.transaction.TransactionManager): *origin* is the origin of the zone. It may be a ``dns.name.Name``, a ``str``, or ``None``. If ``None``, then the zone's origin will - be set by the first ``$ORIGIN`` line in a masterfile. + be set by the first ``$ORIGIN`` line in a zone file. *rdclass*, an ``int``, the zone's rdata class; the default is class IN. @@ -761,13 +761,13 @@ class Transaction(dns.transaction.Transaction): def from_text(text, origin=None, rdclass=dns.rdataclass.IN, relativize=True, zone_factory=Zone, filename=None, allow_include=False, check_origin=True, idna_codec=None): - """Build a zone object from a master file format string. + """Build a zone object from a zone file format string. - *text*, a ``str``, the master file format input. + *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 - masterfile will determine the origin of the zone. + zone file will determine the origin of the zone. *rdclass*, an ``int``, the zone's rdata class; the default is class IN. @@ -811,11 +811,11 @@ def from_text(text, origin=None, rdclass=dns.rdataclass.IN, zone = zone_factory(origin, rdclass, relativize=relativize) with zone.writer(True) as txn: tok = dns.tokenizer.Tokenizer(text, filename, idna_codec=idna_codec) - reader = dns.masterfile.Reader(tok, rdclass, txn, - allow_include=allow_include) + reader = dns.zonefile.Reader(tok, rdclass, txn, + allow_include=allow_include) try: reader.read() - except dns.masterfile.UnknownOrigin: + except dns.zonefile.UnknownOrigin: # for backwards compatibility raise dns.zone.UnknownOrigin # Now that we're done reading, do some basic checking of the zone. @@ -827,14 +827,14 @@ def from_text(text, origin=None, rdclass=dns.rdataclass.IN, def from_file(f, origin=None, rdclass=dns.rdataclass.IN, relativize=True, zone_factory=Zone, filename=None, allow_include=True, check_origin=True): - """Read a master file and build a zone object. + """Read a zone file and build a zone object. *f*, a file or ``str``. If *f* is a string, it is treated as the name of a file to open. *origin*, a ``dns.name.Name``, a ``str``, or ``None``. The origin of the zone; if not specified, the first ``$ORIGIN`` statement in the - masterfile will determine the origin of the zone. + zone file will determine the origin of the zone. *rdclass*, an ``int``, the zone's rdata class; the default is class IN. diff --git a/dns/masterfile.py b/dns/zonefile.py similarity index 98% rename from dns/masterfile.py rename to dns/zonefile.py index 66bb6a3a..df2d01ca 100644 --- a/dns/masterfile.py +++ b/dns/zonefile.py @@ -40,7 +40,7 @@ class UnknownOrigin(dns.exception.DNSException): class Reader: - """Read a DNS master file into a transaction.""" + """Read a DNS zone file into a transaction.""" def __init__(self, tok, rdclass, txn, allow_include=False): self.tok = tok @@ -64,7 +64,7 @@ class Reader: break def _rr_line(self): - """Process one line from a DNS master file.""" + """Process one line from a DNS zone file.""" # Name if self.current_origin is None: raise UnknownOrigin @@ -197,7 +197,7 @@ class Reader: def _generate_line(self): # range lhs [ttl] [class] type rhs [ comment ] """Process one line containing the GENERATE statement from a DNS - master file.""" + zone file.""" if self.current_origin is None: raise UnknownOrigin @@ -312,7 +312,7 @@ class Reader: self.txn.add(name, ttl, rd) def read(self): - """Read a DNS master file and build a zone object. + """Read a DNS zone file and build a zone object. @raises dns.zone.NoSOA: No SOA RR was found at the zone origin @raises dns.zone.NoNS: No NS RRset was found at the zone origin @@ -386,7 +386,7 @@ class Reader: self._generate_line() else: raise dns.exception.SyntaxError( - "Unknown master file directive '" + c + "'") + "Unknown zone file directive '" + c + "'") continue self.tok.unget(token) self._rr_line()