def run(self, args: Namespace, runner: Runner) -> None: if args.question: question = runner.get_question(args.question) if not question: print('Invalid question entered. Following are available:') runner.show_all_questions() else: print(question) for tst in question.test_cases: print(tst) else: runner.show_all_questions(verbose=args.verbose)
def load_runner(self, args) -> Runner: if not args.contest_uri: raise ArgumentError( None, 'the following arguments are required: -c/--contest-uri') return Runner(uri=args.contest_uri, template=args.template, config=self.config)
def run(self, args: Namespace, runner: Runner) -> None: question = runner.get_question(args.question) if not question: logger.warning('Invalid question entered. Following are available:') runner.show_all_questions() else: logger.info(f'Selected: {question.title}') if args.add: logger.info('Enter Sample Input: (leave empty line to submit)') sample_input = multiline_input() logger.info('Enter Sample Output: (leave empty line to submit)') sample_output = multiline_input() question.add_test(sample_input, sample_output, custom_testcase=True) runner.save_questions() elif args.delete: test = question.remove_test(args.delete) if test is not None: logger.info(f'Deleted {test}') runner.save_questions() else: logger.error(f'No valid test with idx={args.delete} found ❗') else: logger.error('No option chosen ❗')
def run(self, _: Namespace, runner: Runner) -> None: runner.load_questions(force_download=True)
def run(self, args: Namespace, runner: Runner) -> None: runner.run_test_cases(args.question, args.solution_file)