From ee04c402fa3aa0ce7e1b3201ff54a0bcd030a358 Mon Sep 17 00:00:00 2001 From: Craig Leres Date: Sun, 30 Jan 2022 10:40:54 -0800 Subject: [PATCH] Reduce the number of digits after the decimal point for the Timeout DNSException from 15 to 1 (#772) * Reduce the number of digits after the decimal point for the Timeout DNSException from 15 to 1 * Address Bob Halley's concerns: change .1f to .3f and update LifetimeTimeout (cherry picked from commit 1f636810325144cd6aaeae8f673de230615ff186) --- dns/exception.py | 2 +- dns/resolver.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/dns/exception.py b/dns/exception.py index 93923734..08393821 100644 --- a/dns/exception.py +++ b/dns/exception.py @@ -125,7 +125,7 @@ class TooBig(DNSException): class Timeout(DNSException): """The DNS operation timed out.""" supp_kwargs = {'timeout'} - fmt = "The DNS operation timed out after {timeout} seconds" + fmt = "The DNS operation timed out after {timeout:.3f} seconds" class ExceptionWrapper: diff --git a/dns/resolver.py b/dns/resolver.py index 874221d1..ef2a6d5c 100644 --- a/dns/resolver.py +++ b/dns/resolver.py @@ -145,7 +145,7 @@ class LifetimeTimeout(dns.exception.Timeout): """The resolution lifetime expired.""" msg = "The resolution lifetime expired." - fmt = "%s after {timeout} seconds: {errors}" % msg[:-1] + fmt = "%s after {timeout:.3f} seconds: {errors}" % msg[:-1] supp_kwargs = {'timeout', 'errors'} def _fmt_kwargs(self, **kwargs): -- 2.47.3