def make_argparser(): from preparation.resources.Resource import trunks_registered parser = argparse.ArgumentParser(description='View how some explanation(s) evolute ') fmt_args = parser.add_mutually_exclusive_group() fmt_args.add_argument('--format', default=FORMATS['twoline'], help='''Self argument for str.format call while printing evolution. If omitted, same as --twoline. ''') for name, fmt in FORMATS.items(): fmt_args.add_argument('--' + name, dest='format', action='store_const', const=fmt, help='Format as ' + repr(fmt)) parser.add_argument('trunk', choices=trunks_registered(), help='resource to use') parser.add_argument('title', nargs='+', help='''title (titles) to show. They will be used to find raw explanations yielded by the resource's parser, so should be exactly in the same format the parser gives it.''') return parser
def main(args=None): if not isinstance(args, argparse.Namespace): parser = make_argparser() args = parser.parse_args(args) assert not ('all' in args.trunks and len(args.trunks) != 1) if 'all' in args.trunks: args.trunks = trunks_registered() for name in args.trunks: resource_by_trunk(name)().build()
def make_argparser(): from preparation.resources.Resource import trunks_registered parser = argparse.ArgumentParser(description='View how some resource changes') trunks = trunks_registered() parser.add_argument('trunk', metavar='TRUNK', choices=trunks, help='One of registered trunks ({})'.format(', '.join(trunks))) return parser
def make_argparser(): parser = argparse.ArgumentParser(description='Rebuild some asset') names = tuple(trunks_registered()) parser.add_argument('trunks', metavar='TRUNK', nargs='+', choices=names + ('all',), help='One of registered trunks ({}) or just \'all\'.'.format(', '.join(names))) return parser
def make_argparser(): from preparation.resources.Resource import trunks_registered parser = argparse.ArgumentParser( description='View how some resource changes') trunks = trunks_registered() parser.add_argument('trunk', metavar='TRUNK', choices=trunks, help='One of registered trunks ({})'.format( ', '.join(trunks))) return parser
import functools import random import sys import nose import hb_res from preparation.resources.Resource import trunks_registered, applied_modifiers, resource_by_trunk __author__ = 'moskupols' _multiprocess_shared_ = True _all_trunks = set(trunks_registered()) _trunk_filter = _all_trunks def trunk_parametrized(trunks=_all_trunks): def decorate(tester): @functools.wraps(tester) def generate_tests(*args): interesting = list(_trunk_filter & set(trunks)) random.shuffle(interesting) for t in interesting: yield (tester, t) + args return generate_tests return decorate _use_generated = False
import functools import random import sys import nose import hb_res from preparation.resources.Resource import trunks_registered, applied_modifiers, resource_by_trunk __author__ = 'moskupols' _multiprocess_shared_ = True _all_trunks = set(trunks_registered()) _trunk_filter = _all_trunks def trunk_parametrized(trunks=_all_trunks): def decorate(tester): @functools.wraps(tester) def generate_tests(*args): interesting = list(_trunk_filter & set(trunks)) random.shuffle(interesting) for t in interesting: yield (tester, t) + args return generate_tests return decorate _use_generated = False @functools.lru_cache()