From efc800725d67b284ec51c47fda5ee362bc316407 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?tonghuaroot=20=28=E7=AB=A5=E8=AF=9D=29?= Date: Sun, 18 Jan 2026 15:07:12 +0800 Subject: [PATCH 1/2] gh-143986: Modernize Lib/uuid.py: use f-strings --- Lib/uuid.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Lib/uuid.py b/Lib/uuid.py index c0150a59d7cb9a..6c16fd366ba917 100644 --- a/Lib/uuid.py +++ b/Lib/uuid.py @@ -323,7 +323,7 @@ def __int__(self): return self.int def __repr__(self): - return '%s(%r)' % (self.__class__.__name__, str(self)) + return f'{self.__class__.__name__}({str(self)!r})' def __setattr__(self, name, value): raise TypeError('UUID objects are immutable') @@ -611,7 +611,7 @@ def _arp_getnode(): return mac # This works on Linux, FreeBSD and NetBSD - mac = _find_mac_near_keyword('arp', '-an', [os.fsencode('(%s)' % ip_addr)], + mac = _find_mac_near_keyword('arp', '-an', [os.fsencode(f'({ip_addr})')], lambda i: i+2) # Return None instead of 0. if mac: @@ -718,7 +718,7 @@ def getnode(): continue if (_node is not None) and (0 <= _node < (1 << 48)): return _node - assert False, '_random_getnode() returned invalid value: {}'.format(_node) + assert False, f'_random_getnode() returned invalid value: {_node}' _last_timestamp = None From c8a083752aedc59c18b5375d07a6e4fd0a30788e Mon Sep 17 00:00:00 2001 From: "blurb-it[bot]" <43283697+blurb-it[bot]@users.noreply.github.com> Date: Sun, 18 Jan 2026 07:09:40 +0000 Subject: [PATCH 2/2] =?UTF-8?q?=F0=9F=93=9C=F0=9F=A4=96=20Added=20by=20blu?= =?UTF-8?q?rb=5Fit.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../next/Library/2026-01-18-07-09-38.gh-issue-143986.rt0Hht.rst | 1 + 1 file changed, 1 insertion(+) create mode 100644 Misc/NEWS.d/next/Library/2026-01-18-07-09-38.gh-issue-143986.rt0Hht.rst diff --git a/Misc/NEWS.d/next/Library/2026-01-18-07-09-38.gh-issue-143986.rt0Hht.rst b/Misc/NEWS.d/next/Library/2026-01-18-07-09-38.gh-issue-143986.rt0Hht.rst new file mode 100644 index 00000000000000..2f0647330e7297 --- /dev/null +++ b/Misc/NEWS.d/next/Library/2026-01-18-07-09-38.gh-issue-143986.rt0Hht.rst @@ -0,0 +1 @@ +Modernize the :mod:`uuid` module to use f-strings.