From: Bob Halley Date: Sat, 10 Jan 2026 22:18:19 +0000 (-0800) Subject: further typing fixes for zone to file X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=147a7cd1063f76bdfc17600a412c8869f9080090;p=thirdparty%2Fdnspython.git further typing fixes for zone to file --- diff --git a/dns/zone.py b/dns/zone.py index f8e3e61b..a7e71ee0 100644 --- a/dns/zone.py +++ b/dns/zone.py @@ -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,