MCPcopy Index your code
hub / github.com/python/cpython / getnode

Function getnode

Lib/uuid.py:702–721  ·  view source on GitHub ↗

Get the hardware address as a 48-bit positive integer. The first time this runs, it may launch a separate program, which could be quite slow. If all attempts to obtain the hardware address fail, we choose a random 48-bit number with its eighth bit set to 1 as recommended in RFC 412

()

Source from the content-addressed store, hash-verified

700_node = None
701
702def getnode():
703 """Get the hardware address as a 48-bit positive integer.
704
705 The first time this runs, it may launch a separate program, which could
706 be quite slow. If all attempts to obtain the hardware address fail, we
707 choose a random 48-bit number with its eighth bit set to 1 as recommended
708 in RFC 4122.
709 """
710 global _node
711 if _node is not None:
712 return _node
713
714 for getter in _GETTERS + [_random_getnode]:
715 try:
716 _node = getter()
717 except:
718 continue
719 if (_node is not None) and (0 <= _node < (1 << 48)):
720 return _node
721 assert False, '_random_getnode() returned invalid value: {}'.format(_node)
722
723
724_last_timestamp = None

Callers 2

uuid1Function · 0.85
uuid6Function · 0.85

Calls 1

formatMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…