The Wayback Machine - https://web.archive.org/web/20210831162600/https://github.com/TheAlgorithms/Python/pull/4320/files
Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix mypy scripts #4320

Merged
merged 1 commit into from Apr 7, 2021
Merged
Changes from all commits
Commits
File filter
Filter file types
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
@@ -2,4 +2,4 @@
ignore_missing_imports = True

; FIXME: #4052 fix mypy errors in the exclude directories and remove them below
exclude = (data_structures|dynamic_programming|graphs|maths|matrix|other|project_euler|scripts|searches|strings*)/$
exclude = (data_structures|dynamic_programming|graphs|maths|matrix|other|project_euler|searches|strings*)/$
@@ -4,7 +4,7 @@
try:
from .build_directory_md import good_file_paths
except ImportError:
from build_directory_md import good_file_paths
from build_directory_md import good_file_paths # type: ignore

filepaths = list(good_file_paths())
assert filepaths, "good_file_paths() failed!"
@@ -22,7 +22,7 @@ def convert_path_to_module(file_path: pathlib.Path) -> ModuleType:
"""Converts a file path to a Python module"""
spec = importlib.util.spec_from_file_location(file_path.name, str(file_path))
module = importlib.util.module_from_spec(spec)
spec.loader.exec_module(module)
spec.loader.exec_module(module) # type: ignore
return module


@@ -89,5 +89,5 @@ def test_project_euler(solution_path: pathlib.Path) -> None:
problem_number: str = solution_path.parent.name[8:].zfill(3)
expected: str = PROBLEM_ANSWERS[problem_number]
solution_module = convert_path_to_module(solution_path)
answer = str(solution_module.solution())
answer = str(solution_module.solution()) # type: ignore
assert answer == expected, f"Expected {expected} but got {answer}"
ProTip! Use n and p to navigate between commits in a pull request.