class TagOptions: tag_options = catalog_tags() | {CATALOG_TAG_ALL} @classmethod def tag(cls, tag_str): if tag_str not in cls.tag_options: raise argparse.ArgumentTypeError( '"{tag}" is not a valid tag. Available tags: {ops}.'.format(tag=tag_str, ops=cls.options()) ) return tag_str @classmethod def options(cls): return ', '.join([CATALOG_TAG_ALL] + sorted(catalog_tags()))
class TagOptions: tag_options = catalog_tags() | {CATALOG_TAG_ALL} @classmethod def tag(cls, tag_str): if tag_str not in cls.tag_options: raise argparse.ArgumentTypeError( f'"{tag_str}" is not a valid tag. Available tags: {cls.options()}.' ) return tag_str @classmethod def options(cls): return ', '.join( sorted(cls.tag_options, key=lambda x: '' if x == CATALOG_TAG_ALL else x))
def options(cls): return ', '.join([CATALOG_TAG_ALL] + sorted(catalog_tags()))