MCPcopy Index your code
hub / github.com/RustPython/RustPython / _iter_bits_lsb

Function _iter_bits_lsb

Lib/enum.py:114–124  ·  view source on GitHub ↗
(num)

Source from the content-addressed store, hash-verified

112 setattr(obj, '__module__', '<unknown>')
113
114def _iter_bits_lsb(num):
115 # num must be a positive integer
116 original = num
117 if isinstance(num, Enum):
118 num = num.value
119 if num < 0:
120 raise ValueError('%r is not a positive integer' % original)
121 while num:
122 b = num & (~num + 1)
123 yield b
124 num ^= b
125
126def show_flag_values(value):
127 return list(_iter_bits_lsb(value))

Callers 4

test_iter_bits_lsbMethod · 0.90
show_flag_valuesFunction · 0.85
__call__Method · 0.85

Calls 1

isinstanceFunction · 0.85

Tested by 1

test_iter_bits_lsbMethod · 0.72