Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions Lib/uuid.py
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Modernize the :mod:`uuid` module to use f-strings.
Loading