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

Method _generate_next_value_

Lib/enum.py:1408–1424  ·  view source on GitHub ↗

Generate the next value when not given. name: the name of the member start: the initial start value or None count: the number of existing members last_values: the last value assigned or None

(name, start, count, last_values)

Source from the content-addressed store, hash-verified

1406
1407 @staticmethod
1408 def _generate_next_value_(name, start, count, last_values):
1409 """
1410 Generate the next value when not given.
1411
1412 name: the name of the member
1413 start: the initial start value or None
1414 count: the number of existing members
1415 last_values: the last value assigned or None
1416 """
1417 if not count:
1418 return start if start is not None else 1
1419 last_value = max(last_values)
1420 try:
1421 high_bit = _high_bit(last_value)
1422 except Exception:
1423 raise TypeError('invalid flag value %r' % last_value) from None
1424 return 2 ** (high_bit+1)
1425
1426 @classmethod
1427 def _iter_member_by_value_(cls, value):

Callers

nothing calls this directly

Calls 2

maxFunction · 0.85
_high_bitFunction · 0.85

Tested by

no test coverage detected