]> git.ipfire.org Git - thirdparty/dnspython.git/commitdiff
further typing fixes for zone to file
authorBob Halley <halley@dnspython.org>
Sat, 10 Jan 2026 22:18:19 +0000 (14:18 -0800)
committerBob Halley <halley@dnspython.org>
Sat, 10 Jan 2026 22:18:19 +0000 (14:18 -0800)
dns/zone.py

index f8e3e61bbff03c198bee9f109e8c2d6763d6f8ba..a7e71ee0ea95a7b66b19dfbd7141ea5a1c4bb198 100644 (file)
@@ -676,11 +676,13 @@ class Zone(dns.transaction.TransactionManager):
                 l = "$ORIGIN " + self.origin.to_text()
                 l_b = l.encode(file_enc)
                 try:
-                    f.write(l_b)  # pyright: ignore
-                    f.write(nl_b)  # pyright: ignore
+                    bout = cast(BinaryIO, output)
+                    bout.write(l_b)
+                    bout.write(nl_b)
                 except TypeError:  # textual mode
-                    f.write(l)  # pyright: ignore
-                    f.write(nl)  # pyright: ignore
+                    tout = cast(TextIO, output)
+                    tout.write(l)
+                    tout.write(nl)
 
             if sorted:
                 names = list(self.keys())
@@ -695,13 +697,14 @@ class Zone(dns.transaction.TransactionManager):
                     want_comments=want_comments,  # pyright: ignore
                 )
                 l_b = l.encode(file_enc)
-
                 try:
-                    f.write(l_b)  # pyright: ignore
-                    f.write(nl_b)  # pyright: ignore
+                    bout = cast(BinaryIO, output)
+                    bout.write(l_b)
+                    bout.write(nl_b)
                 except TypeError:  # textual mode
-                    f.write(l)  # pyright: ignore
-                    f.write(nl)  # pyright: ignore
+                    tout = cast(TextIO, output)
+                    tout.write(l)
+                    tout.write(nl)
 
     def to_text(
         self,