def __init__(self, member, flags=None):
if flags is not None:
assert (issubclass(type(flags), colabc.Set) or \
issubclass(type(flags), colabc.Sequence)) and \
not isinstance(flags, str), \
"flags must be a container and not a string"
assert all([isinstance(flag, str) for flag in list(flags)]), \
"all flags must be strings, given{}".format(flags)
super().__init__()
self.member = member
# list of selections
self._registry = []
# list of flags for specific kinds of selections
self._flags = set()
if flags:
self._flags.update(flags)
评论列表
文章目录