def __call__(self, parser, namespace, values, option_string=None):
# extract the path to our data, and the label for the legend
datapath = os.path.abspath(os.path.expanduser(values[0]))
label = values[1]
# check the path exists
if not os.path.exists(datapath): raise argparse.ArgumentError(self, "The supplied path to the plot data does not exist: '{0}'".format(datapath))
# remove the default
if "_didremovedefault" not in namespace:
setattr(namespace, self.dest, [])
setattr(namespace, "_didremovedefault", True)
# append out new experiment path
dest = getattr(namespace, self.dest)
dest.append((datapath, label))
评论列表
文章目录