コード例 #1
0
def _download_project(project):
    sources_by_type = get_sources(_get_archive_path())
    project_type = get_project_type_by_name(project, case_insensitive=True)
    if project_type is None or project_type not in sources_by_type:
        _error_and_exit(f'No valid sources found for project: "{project}"')
    sources = sources_by_type[project_type]
    for source in sources:
        _download_image_from_source(source)
コード例 #2
0
def _download_language(language):
    sources_by_type = get_sources(
        path=os.path.join(_get_archive_path(), language[0], language))
    if all([len(sources) <= 0 for _, sources in sources_by_type.items()]):
        _error_and_exit(f'No valid sources found for language: "{language}"')
    for project_type, sources in sources_by_type.items():
        for source in sources:
            _download_image_from_source(source)
コード例 #3
0
def _run_project(project):
    sources_by_type = get_sources(_get_archive_path())
    project_type = get_project_type_by_name(project, case_insensitive=True)
    if project_type is None or project_type not in sources_by_type:
        _error_and_exit(f'No valid sources found for project: "{project}"')
    sources = sources_by_type[project_type]
    params = _prompt_params(project_type)
    for source in sources:
        _build_and_run(source, params)
コード例 #4
0
def _run_language(language):
    sources_by_type = get_sources(
        path=os.path.join(_get_archive_path(), language[0], language))
    if all([len(sources) <= 0 for _, sources in sources_by_type.items()]):
        _error_and_exit(f'No valid sources found for language: "{language}"')
    for project_type, sources in sources_by_type.items():
        for source in sources:
            params = _prompt_params(project_type)
            _build_and_run(source, params)
コード例 #5
0
def _run_language(language):
    all_tests = _collect_tests()
    sources_by_type = get_sources(
        path=os.path.join('archive', language[0], language))
    if all([len(sources) <= 0 for _, sources in sources_by_type.items()]):
        _error_and_exit(f'No valid sources found for language: "{language}"')
    tests = []
    for project_type, sources in sources_by_type.items():
        for src in sources:
            tests += _get_tests(src, project_type, all_tests)
    _run_pytest_and_exit(*tests)
コード例 #6
0
def _download_source(source):
    sources_by_type = get_sources(_get_archive_path())
    for project_type, sources in sources_by_type.items():
        for src in sources:
            if f'{src.name}{src.extension}'.lower() == source.lower():
                _download_image_from_source(src)
                break
        else:  # If didn't break inner loop continue
            continue
        break  # Else break this loop as well
    else:
        _error_and_exit(f'Source "{source}" could not be found')
コード例 #7
0
def _run_source(source):
    sources_by_type = get_sources(_get_archive_path())
    for project_type, sources in sources_by_type.items():
        for src in sources:
            if f'{src.name}{src.extension}'.lower() == source.lower():
                params = _prompt_params(project_type)
                _build_and_run(src, params)
                break
        else:  # If didn't break inner loop continue
            continue
        break  # Else break this loop as well
    else:
        _error_and_exit(f'Source "{source}" could not be found')
コード例 #8
0
def _run_source(source):
    all_tests = _collect_tests()
    sources_by_type = get_sources('archive')
    for project_type, sources in sources_by_type.items():
        for src in sources:
            filename = f'{src.name}{src.extension}'
            if filename.lower() == source.lower():
                tests = _get_tests(src, project_type, all_tests)
                _run_pytest_and_exit(*tests)
                break
        else:  # If didn't break inner loop continue
            continue
        break  # Else break this loop as well
    else:
        _error_and_exit(f'Source "{source}" could not be found')
コード例 #9
0
def _run_all():
    sources_by_type = get_sources(_get_archive_path())
    for project_type, sources in sources_by_type.items():
        params = _prompt_params(project_type)
        for source in sources:
            _build_and_run(source, params)
コード例 #10
0
def _get_project_permutations():
    path_to_directory_containing_this_file = os.path.dirname(os.path.abspath(__file__))
    sources = source.get_sources(os.path.join(path_to_directory_containing_this_file, '..', 'archive'))
    return {project_type: _project_permutation(sources, project_type)for project_type in ProjectType}
コード例 #11
0
def _download_all():
    sources_by_type = get_sources(_get_archive_path())
    for _, sources in sources_by_type.items():
        for source in sources:
            _download_image_from_source(source)