예제 #1
0
파일: show.py 프로젝트: avikumar15/cpcli
    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)
예제 #2
0
파일: __init__.py 프로젝트: adityaa30/cpcli
    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)
예제 #3
0
    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 ❗')
예제 #4
0
파일: download.py 프로젝트: adityaa30/cpcli
 def run(self, _: Namespace, runner: Runner) -> None:
     runner.load_questions(force_download=True)
예제 #5
0
파일: run.py 프로젝트: adityaa30/cpcli
 def run(self, args: Namespace, runner: Runner) -> None:
     runner.run_test_cases(args.question, args.solution_file)