def _iter_member_defaults(members):
"""Iterates through Enum members and teases out the default value
the user selected with `default(<user's special value>)` from the
`default` object.
"""
for k, v in members.items():
if isinstance(v.value, default):
yield k, v.value.default
# By not yielding k, v for non-default() objects, we avoid using
# things like auto() as defaults in our .tuple()/.map() collections.
# This makes it explicit when a user is using an enum value
# as a default while ALSO allowing SparseEnumaps to adhere to the
# rules of Enums. Each value of an Enum must be unique, and those that
# aren't are basically just aliases
评论列表
文章目录