def __call__(
self,
parser, # type: argparse.ArgumentParser
namespace, # type: argparse.Namespace
values, # type: Union[ARGPARSE_TEXT, Sequence[Any], None]
option_string=None # type: Optional[ARGPARSE_TEXT]
):
# type: (...) -> None
"""Checks to make sure that the destination is empty before writing.
:raises parser.error: if destination is already set
"""
if getattr(namespace, self.dest) is not None: # type: ignore # typeshed doesn't know about Action.dest yet?
parser.error('{} argument may not be specified more than once'.format(option_string))
return
setattr(namespace, self.dest, values) # type: ignore # typeshed doesn't know about Action.dest yet?
评论列表
文章目录