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

Method _generate_next_value_

Lib/enum.py:1436–1452  ·  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

1434
1435 @staticmethod
1436 def _generate_next_value_(name, start, count, last_values):
1437 """
1438 Generate the next value when not given.
1439
1440 name: the name of the member
1441 start: the initial start value or None
1442 count: the number of existing members
1443 last_values: the last value assigned or None
1444 """
1445 if not count:
1446 return start if start is not None else 1
1447 last_value = max(last_values)
1448 try:
1449 high_bit = _high_bit(last_value)
1450 except Exception:
1451 raise TypeError('invalid flag value %r' % last_value) from None
1452 return 2 ** (high_bit+1)
1453
1454 @classmethod
1455 def _iter_member_by_value_(cls, value):

Callers

nothing calls this directly

Calls 1

_high_bitFunction · 0.85

Tested by

no test coverage detected