]> git.ipfire.org Git - thirdparty/dnspython.git/commitdiff
improve typing and remove unneeded assignments
authorBob Halley <halley@dnspython.org>
Fri, 5 Dec 2025 23:48:37 +0000 (15:48 -0800)
committerBob Halley <halley@dnspython.org>
Fri, 5 Dec 2025 23:48:37 +0000 (15:48 -0800)
dns/zonefile.py

index 78fd13e2424db642d3f5ad6be0536d2686be1c28..4654446cf0ba1cf7a682beed5f6b2720657d5b17 100644 (file)
@@ -152,7 +152,7 @@ class Reader:
 
     def _rr_line(self):
         """Process one line from a DNS zone file."""
-        token = None
+        token: dns.tokenizer.Token
         # Name
         if self.force_name is not None:
             name = self.force_name
@@ -190,7 +190,6 @@ class Reader:
                 ttl = dns.ttl.from_text(token.value)
                 self.last_ttl = ttl
                 self.last_ttl_known = True
-                token = None
             except dns.ttl.BadTTL:
                 self.tok.unget(token)
 
@@ -212,12 +211,10 @@ class Reader:
         if ttl is None:
             # support for <class> <ttl> <type> syntax
             token = self._get_identifier()
-            ttl = None
             try:
                 ttl = dns.ttl.from_text(token.value)
                 self.last_ttl = ttl
                 self.last_ttl_known = True
-                token = None
             except dns.ttl.BadTTL:
                 if self.default_ttl_known:
                     ttl = self.default_ttl