Beispiel #1
0
def create_dot_graph(
        output_folder: str,
        name_prefix: str,
        graph_representation: str,
        output_format: consts.EXTENSION = consts.EXTENSION.PNG) -> str:
    file_path = os.path.join(output_folder,
                             f'{name_prefix}{consts.EXTENSION.DOT.value}')
    # Create dot file
    create_file(graph_representation, file_path)
    dst_path = os.path.join(output_folder,
                            f'{name_prefix}{output_format.value}')
    args = ['dot', f'-T{output_format.value[1:]}', file_path, '-o', dst_path]
    # Generate graph representation
    check_call_safely(args)
    return dst_path
Beispiel #2
0
 def is_source_file_correct(self, source_file: str) -> bool:
     args = ['kotlinc', source_file, '-include-runtime', '-d', change_extension_to(source_file, EXTENSION.JAR)]
     # to be sure there is enough time to create a jar, call is checked with timeout=None;
     # there was 'Error: Invalid or corrupt jarfile' even with 5 sec timeout
     is_correct = check_call_safely(args, None)
     log.info(f'Source code is correct: {is_correct}')
     return is_correct
Beispiel #3
0
 def is_source_file_correct(self, source_file: str) -> bool:
     args = [
         'g++', '-o',
         change_extension_to(source_file, EXTENSION.OUT), source_file
     ]
     is_correct = check_call_safely(args, None)
     log.info(f'Source code is correct: {is_correct}')
     return is_correct
Beispiel #4
0
 def is_source_file_correct(self, source_file: str) -> bool:
     is_correct = check_call_safely([
         'mypy', source_file
     ]) and check_call_safely([sys.executable, source_file], shell=True)
     log.info(f'Source code is correct: {is_correct}')
     return is_correct
 def is_source_file_correct(self, source_file: str) -> bool:
     args = ['javac', source_file, '-d', SOURCE_FOLDER]
     is_correct = check_call_safely(args, None)
     log.info(f'Source code is correct: {is_correct}')
     return is_correct
Beispiel #6
0
def check_file_by_mypy_and_execution(file_name: str) -> bool:
    return check_call_safely(['mypy', file_name]) and check_call_safely(
        [sys.executable, file_name])
Beispiel #7
0
def check_python_file_by_mypy(file_name: str) -> bool:
    call_args = ['mypy', file_name]
    return check_call_safely(call_args)