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)
| 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): |