From a68cc16656427345f729f82321107cd59694962f Mon Sep 17 00:00:00 2001 From: Christian Clauss Date: Tue, 26 Oct 2021 16:10:32 +0200 Subject: [PATCH 01/23] DRAFT: Run a mypy reality check Let's see what is required to finish #4052 --- .github/workflows/build.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index f710e1e0ed54..5e0c84e698ad 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -26,3 +26,8 @@ jobs: run: pytest --doctest-modules --ignore=project_euler/ --ignore=scripts/validate_solutions.py --cov-report=term-missing:skip-covered --cov=. . - if: ${{ success() }} run: scripts/build_directory_md.py 2>&1 | tee DIRECTORY.md + - name: Mypy reality check + run: | + mv mypy.ini was_mypy.ini + mypy --install-types --non-interactive . || true + mv was_mypy.ini mypy.ini From 275615b8ccb435b8b81795b2ae148648adb9a662 Mon Sep 17 00:00:00 2001 From: Christian Clauss Date: Tue, 26 Oct 2021 16:20:37 +0200 Subject: [PATCH 02/23] mypy --ignore-missing-imports --install-types --non-interactive --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 5e0c84e698ad..74e6d6bdbd3a 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -29,5 +29,5 @@ jobs: - name: Mypy reality check run: | mv mypy.ini was_mypy.ini - mypy --install-types --non-interactive . || true + mypy --ignore-missing-imports --install-types --non-interactive . || true mv was_mypy.ini mypy.ini From 43df758437c92865ace98575d5eb921efc25c175 Mon Sep 17 00:00:00 2001 From: Christian Clauss Date: Fri, 29 Oct 2021 09:40:42 +0200 Subject: [PATCH 03/23] Check our progress... --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 74e6d6bdbd3a..73ff1d5bc673 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -26,7 +26,7 @@ jobs: run: pytest --doctest-modules --ignore=project_euler/ --ignore=scripts/validate_solutions.py --cov-report=term-missing:skip-covered --cov=. . - if: ${{ success() }} run: scripts/build_directory_md.py 2>&1 | tee DIRECTORY.md - - name: Mypy reality check + - name: A mypy reality check run: | mv mypy.ini was_mypy.ini mypy --ignore-missing-imports --install-types --non-interactive . || true From 8ced76cd5ac3127bf876d238c5a9941142fa198c Mon Sep 17 00:00:00 2001 From: Christian Clauss Date: Fri, 29 Oct 2021 10:31:14 +0200 Subject: [PATCH 04/23] Update build.yml --- .github/workflows/build.yml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 73ff1d5bc673..81ab17c9cf07 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -29,5 +29,10 @@ jobs: - name: A mypy reality check run: | mv mypy.ini was_mypy.ini - mypy --ignore-missing-imports --install-types --non-interactive . || true + mypy --ignore-missing-imports --install-types --non-interactive ./graphs || true # Errors: 10 + mypy --ignore-missing-imports --install-types --non-interactive ./maths || true # Errors: 14 + mypy --ignore-missing-imports --install-types --non-interactive ./matrix || true # Errors: 15 + mypy --ignore-missing-imports --install-types --non-interactive ./searches || true # Errors: 45 + mypy --ignore-missing-imports --install-types --non-interactive ./other || true # Errors: 51 + mypy --ignore-missing-imports --install-types --non-interactive ./data_structures || true # Errors: 117 mv was_mypy.ini mypy.ini From 5273f52726441639f875b78aa6528cb89c8bf229 Mon Sep 17 00:00:00 2001 From: Christian Clauss Date: Wed, 3 Nov 2021 14:25:48 +0100 Subject: [PATCH 05/23] Update build.yml --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 81ab17c9cf07..7320a6e56472 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -29,7 +29,7 @@ jobs: - name: A mypy reality check run: | mv mypy.ini was_mypy.ini - mypy --ignore-missing-imports --install-types --non-interactive ./graphs || true # Errors: 10 + mypy --ignore-missing-imports --install-types --non-interactive ./graphs || true # Errors: 10 mypy --ignore-missing-imports --install-types --non-interactive ./maths || true # Errors: 14 mypy --ignore-missing-imports --install-types --non-interactive ./matrix || true # Errors: 15 mypy --ignore-missing-imports --install-types --non-interactive ./searches || true # Errors: 45 From c8b64a8d98c97f889664611c9efe2a3bcb852251 Mon Sep 17 00:00:00 2001 From: Christian Clauss Date: Wed, 3 Nov 2021 14:37:42 +0100 Subject: [PATCH 06/23] Update build.yml --- .github/workflows/build.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 7320a6e56472..84009a8ea02c 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -29,10 +29,10 @@ jobs: - name: A mypy reality check run: | mv mypy.ini was_mypy.ini - mypy --ignore-missing-imports --install-types --non-interactive ./graphs || true # Errors: 10 - mypy --ignore-missing-imports --install-types --non-interactive ./maths || true # Errors: 14 - mypy --ignore-missing-imports --install-types --non-interactive ./matrix || true # Errors: 15 - mypy --ignore-missing-imports --install-types --non-interactive ./searches || true # Errors: 45 - mypy --ignore-missing-imports --install-types --non-interactive ./other || true # Errors: 51 - mypy --ignore-missing-imports --install-types --non-interactive ./data_structures || true # Errors: 117 + mypy --ignore-missing-imports --install-types --non-interactive ./graphs || true # Errors: 10 -> 9 + mypy --ignore-missing-imports --install-types --non-interactive ./maths || true # Errors: 14 -> 14 + mypy --ignore-missing-imports --install-types --non-interactive ./matrix || true # Errors: 15 -> 15 + mypy --ignore-missing-imports --install-types --non-interactive ./searches || true # Errors: 45 -> 21 + mypy --ignore-missing-imports --install-types --non-interactive ./other || true # Errors: 51 -> 43 + mypy --ignore-missing-imports --install-types --non-interactive ./data_structures || true # Errors: 117 -> 67 mv was_mypy.ini mypy.ini From 8ea9fab7ec6bdf75eec1bec3e7198edcdf67f2cf Mon Sep 17 00:00:00 2001 From: Christian Clauss Date: Thu, 4 Nov 2021 17:53:04 +0100 Subject: [PATCH 07/23] Update build.yml --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 84009a8ea02c..a76f238bb409 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -29,7 +29,7 @@ jobs: - name: A mypy reality check run: | mv mypy.ini was_mypy.ini - mypy --ignore-missing-imports --install-types --non-interactive ./graphs || true # Errors: 10 -> 9 + mypy --ignore-missing-imports --install-types --non-interactive ./graphs || true # Errors: 10 -> 9 mypy --ignore-missing-imports --install-types --non-interactive ./maths || true # Errors: 14 -> 14 mypy --ignore-missing-imports --install-types --non-interactive ./matrix || true # Errors: 15 -> 15 mypy --ignore-missing-imports --install-types --non-interactive ./searches || true # Errors: 45 -> 21 From 967e1bd4cf1d823e512a900cf1c0c0a1b1cd36db Mon Sep 17 00:00:00 2001 From: Christian Clauss Date: Fri, 5 Nov 2021 08:02:08 +0100 Subject: [PATCH 08/23] mypy --exclude 20 files --- .github/workflows/build.yml | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index a76f238bb409..90835d911c24 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -21,7 +21,28 @@ jobs: run: | python -m pip install --upgrade pip setuptools six wheel python -m pip install mypy pytest-cov -r requirements.txt - - run: mypy --install-types --non-interactive . + - run: mypy --install-types --non-interactive + --exclude=data_structures/stacks/next_greater_element.py + --exclude=graphs/boruvka.py + --exclude=graphs/breadth_first_search.py + --exclude=graphs/breadth_first_search_2.py + --exclude=graphs/check_cycle.py + --exclude=graphs/finding_bridges.py + --exclude=graphs/greedy_min_vertex_cover.py + --exclude=graphs/random_graph_generator.py + --exclude=maths/average_mode.py + --exclude=maths/gamma_recursive.py + --exclude=maths/proth_number.py + --exclude=maths/series/geometric_series.py + --exclude=maths/series/p_series.py + --exclude=matrix/matrix_operation.py + --exclude=other/fischer_yates_shuffle.py + --exclude=other/least_recently_used.py + --exclude=other/lfu_cache.py + --exclude=other/lru_cache.py + --exclude=searches/simulated_annealing.py + --exclude=searches/ternary_search.py + . - name: Run tests run: pytest --doctest-modules --ignore=project_euler/ --ignore=scripts/validate_solutions.py --cov-report=term-missing:skip-covered --cov=. . - if: ${{ success() }} From 471e6381948c3f96f036b377f37722edd0d7d38f Mon Sep 17 00:00:00 2001 From: Christian Clauss Date: Fri, 5 Nov 2021 08:13:06 +0100 Subject: [PATCH 09/23] --exclude with no `=` --- .github/workflows/build.yml | 40 ++++++++++++++++++------------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 90835d911c24..241ed6047f69 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -22,26 +22,26 @@ jobs: python -m pip install --upgrade pip setuptools six wheel python -m pip install mypy pytest-cov -r requirements.txt - run: mypy --install-types --non-interactive - --exclude=data_structures/stacks/next_greater_element.py - --exclude=graphs/boruvka.py - --exclude=graphs/breadth_first_search.py - --exclude=graphs/breadth_first_search_2.py - --exclude=graphs/check_cycle.py - --exclude=graphs/finding_bridges.py - --exclude=graphs/greedy_min_vertex_cover.py - --exclude=graphs/random_graph_generator.py - --exclude=maths/average_mode.py - --exclude=maths/gamma_recursive.py - --exclude=maths/proth_number.py - --exclude=maths/series/geometric_series.py - --exclude=maths/series/p_series.py - --exclude=matrix/matrix_operation.py - --exclude=other/fischer_yates_shuffle.py - --exclude=other/least_recently_used.py - --exclude=other/lfu_cache.py - --exclude=other/lru_cache.py - --exclude=searches/simulated_annealing.py - --exclude=searches/ternary_search.py + --exclude data_structures/stacks/next_greater_element.py + --exclude graphs/boruvka.py + --exclude graphs/breadth_first_search.py + --exclude graphs/breadth_first_search_2.py + --exclude graphs/check_cycle.py + --exclude graphs/finding_bridges.py + --exclude graphs/greedy_min_vertex_cover.py + --exclude graphs/random_graph_generator.py + --exclude maths/average_mode.py + --exclude maths/gamma_recursive.py + --exclude maths/proth_number.py + --exclude maths/series/geometric_series.py + --exclude maths/series/p_series.py + --exclude matrix/matrix_operation.py + --exclude other/fischer_yates_shuffle.py + --exclude other/least_recently_used.py + --exclude other/lfu_cache.py + --exclude other/lru_cache.py + --exclude searches/simulated_annealing.py + --exclude searches/ternary_search.py . - name: Run tests run: pytest --doctest-modules --ignore=project_euler/ --ignore=scripts/validate_solutions.py --cov-report=term-missing:skip-covered --cov=. . From 14633a158671f08e2fd2cd254e54f37061e85d8a Mon Sep 17 00:00:00 2001 From: Christian Clauss Date: Fri, 5 Nov 2021 08:30:35 +0100 Subject: [PATCH 10/23] Update build.yml --- .github/workflows/build.yml | 40 ++++++++++++++++++------------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 241ed6047f69..d7e7b01c570f 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -22,26 +22,26 @@ jobs: python -m pip install --upgrade pip setuptools six wheel python -m pip install mypy pytest-cov -r requirements.txt - run: mypy --install-types --non-interactive - --exclude data_structures/stacks/next_greater_element.py - --exclude graphs/boruvka.py - --exclude graphs/breadth_first_search.py - --exclude graphs/breadth_first_search_2.py - --exclude graphs/check_cycle.py - --exclude graphs/finding_bridges.py - --exclude graphs/greedy_min_vertex_cover.py - --exclude graphs/random_graph_generator.py - --exclude maths/average_mode.py - --exclude maths/gamma_recursive.py - --exclude maths/proth_number.py - --exclude maths/series/geometric_series.py - --exclude maths/series/p_series.py - --exclude matrix/matrix_operation.py - --exclude other/fischer_yates_shuffle.py - --exclude other/least_recently_used.py - --exclude other/lfu_cache.py - --exclude other/lru_cache.py - --exclude searches/simulated_annealing.py - --exclude searches/ternary_search.py + --exclude ./data_structures/stacks/next_greater_element.py + --exclude ./graphs/boruvka.py + --exclude ./graphs/breadth_first_search.py + --exclude ./graphs/breadth_first_search_2.py + --exclude ./graphs/check_cycle.py + --exclude ./graphs/finding_bridges.py + --exclude ./graphs/greedy_min_vertex_cover.py + --exclude ./graphs/random_graph_generator.py + --exclude ./maths/average_mode.py + --exclude ./maths/gamma_recursive.py + --exclude ./maths/proth_number.py + --exclude ./maths/series/geometric_series.py + --exclude ./maths/series/p_series.py + --exclude ./matrix/matrix_operation.py + --exclude ./other/fischer_yates_shuffle.py + --exclude ./other/least_recently_used.py + --exclude ./other/lfu_cache.py + --exclude ./other/lru_cache.py + --exclude ./searches/simulated_annealing.py + --exclude ./searches/ternary_search.py . - name: Run tests run: pytest --doctest-modules --ignore=project_euler/ --ignore=scripts/validate_solutions.py --cov-report=term-missing:skip-covered --cov=. . From f073fe7cc42949afc352c00ce96a954ec8bec77a Mon Sep 17 00:00:00 2001 From: Christian Clauss Date: Fri, 5 Nov 2021 08:56:20 +0100 Subject: [PATCH 11/23] 558 character regex!!! --- .github/workflows/build.yml | 26 +++----------------------- 1 file changed, 3 insertions(+), 23 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index d7e7b01c570f..2bd556c067b1 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -21,28 +21,8 @@ jobs: run: | python -m pip install --upgrade pip setuptools six wheel python -m pip install mypy pytest-cov -r requirements.txt - - run: mypy --install-types --non-interactive - --exclude ./data_structures/stacks/next_greater_element.py - --exclude ./graphs/boruvka.py - --exclude ./graphs/breadth_first_search.py - --exclude ./graphs/breadth_first_search_2.py - --exclude ./graphs/check_cycle.py - --exclude ./graphs/finding_bridges.py - --exclude ./graphs/greedy_min_vertex_cover.py - --exclude ./graphs/random_graph_generator.py - --exclude ./maths/average_mode.py - --exclude ./maths/gamma_recursive.py - --exclude ./maths/proth_number.py - --exclude ./maths/series/geometric_series.py - --exclude ./maths/series/p_series.py - --exclude ./matrix/matrix_operation.py - --exclude ./other/fischer_yates_shuffle.py - --exclude ./other/least_recently_used.py - --exclude ./other/lfu_cache.py - --exclude ./other/lru_cache.py - --exclude ./searches/simulated_annealing.py - --exclude ./searches/ternary_search.py - . + - run: mypy --exclude (data_structures/stacks/next_greater_element.py|graphs/boruvka.py|graphs/breadth_first_search.py|graphs/breadth_first_search_2.py|graphs/check_cycle.py|graphs/finding_bridges.py|graphs/greedy_min_vertex_cover.py|graphs/random_graph_generator.py|maths/average_mode.py|maths/gamma_recursive.py|maths/proth_number.py|maths/series/geometric_series.py|maths/series/p_series.py|matrix/matrix_operation.py|other/fischer_yates_shuffle.py|other/least_recently_used.py|other/lfu_cache.py|other/lru_cache.py|searches/simulated_annealing.py|searches/ternary_search.py)/$ + --install-types --non-interactive . - name: Run tests run: pytest --doctest-modules --ignore=project_euler/ --ignore=scripts/validate_solutions.py --cov-report=term-missing:skip-covered --cov=. . - if: ${{ success() }} @@ -50,7 +30,7 @@ jobs: - name: A mypy reality check run: | mv mypy.ini was_mypy.ini - mypy --ignore-missing-imports --install-types --non-interactive ./graphs || true # Errors: 10 -> 9 + mypy --ignore-missing-imports --install-types --non-interactive ./graphs || true # Errors: 10 -> 9 mypy --ignore-missing-imports --install-types --non-interactive ./maths || true # Errors: 14 -> 14 mypy --ignore-missing-imports --install-types --non-interactive ./matrix || true # Errors: 15 -> 15 mypy --ignore-missing-imports --install-types --non-interactive ./searches || true # Errors: 45 -> 21 From b0a55498ef68747c37d096703b48066137a12c1c Mon Sep 17 00:00:00 2001 From: Christian Clauss Date: Fri, 5 Nov 2021 09:02:38 +0100 Subject: [PATCH 12/23] With quotes --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 2bd556c067b1..92e776764b64 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -21,7 +21,7 @@ jobs: run: | python -m pip install --upgrade pip setuptools six wheel python -m pip install mypy pytest-cov -r requirements.txt - - run: mypy --exclude (data_structures/stacks/next_greater_element.py|graphs/boruvka.py|graphs/breadth_first_search.py|graphs/breadth_first_search_2.py|graphs/check_cycle.py|graphs/finding_bridges.py|graphs/greedy_min_vertex_cover.py|graphs/random_graph_generator.py|maths/average_mode.py|maths/gamma_recursive.py|maths/proth_number.py|maths/series/geometric_series.py|maths/series/p_series.py|matrix/matrix_operation.py|other/fischer_yates_shuffle.py|other/least_recently_used.py|other/lfu_cache.py|other/lru_cache.py|searches/simulated_annealing.py|searches/ternary_search.py)/$ + - run: mypy --exclude "(data_structures/stacks/next_greater_element.py|graphs/boruvka.py|graphs/breadth_first_search.py|graphs/breadth_first_search_2.py|graphs/check_cycle.py|graphs/finding_bridges.py|graphs/greedy_min_vertex_cover.py|graphs/random_graph_generator.py|maths/average_mode.py|maths/gamma_recursive.py|maths/proth_number.py|maths/series/geometric_series.py|maths/series/p_series.py|matrix/matrix_operation.py|other/fischer_yates_shuffle.py|other/least_recently_used.py|other/lfu_cache.py|other/lru_cache.py|searches/simulated_annealing.py|searches/ternary_search.py)/$" --install-types --non-interactive . - name: Run tests run: pytest --doctest-modules --ignore=project_euler/ --ignore=scripts/validate_solutions.py --cov-report=term-missing:skip-covered --cov=. . From 2d6594152533a6ac87b0abfddece740551278365 Mon Sep 17 00:00:00 2001 From: Christian Clauss Date: Fri, 5 Nov 2021 09:10:13 +0100 Subject: [PATCH 13/23] mypy.ini: mega exclude --- mypy.ini | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/mypy.ini b/mypy.ini index ba552f878e30..d819324ca576 100644 --- a/mypy.ini +++ b/mypy.ini @@ -1,5 +1,7 @@ [mypy] ignore_missing_imports = True +install-types = True +non-interactive = True ; FIXME: #4052 fix mypy errors in the exclude directories and remove them below -exclude = (data_structures|graphs|maths|matrix|other|searches)/$ +exclude = (data_structures/stacks/next_greater_element.py|graphs/boruvka.py|graphs/breadth_first_search.py|graphs/breadth_first_search_2.py|graphs/check_cycle.py|graphs/finding_bridges.py|graphs/greedy_min_vertex_cover.py|graphs/random_graph_generator.py|maths/average_mode.py|maths/gamma_recursive.py|maths/proth_number.py|maths/series/geometric_series.py|maths/series/p_series.py|matrix/matrix_operation.py|other/fischer_yates_shuffle.py|other/least_recently_used.py|other/lfu_cache.py|other/lru_cache.py|searches/simulated_annealing.py|searches/ternary_search.py)/$ From ffad6f59b7c64e12b8786ed7e4134079d7d93654 Mon Sep 17 00:00:00 2001 From: Christian Clauss Date: Fri, 5 Nov 2021 09:14:25 +0100 Subject: [PATCH 14/23] Update mypy.ini --- mypy.ini | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/mypy.ini b/mypy.ini index d819324ca576..78bb98243674 100644 --- a/mypy.ini +++ b/mypy.ini @@ -1,7 +1,7 @@ [mypy] ignore_missing_imports = True -install-types = True -non-interactive = True +install_types = True +non_interactive = True ; FIXME: #4052 fix mypy errors in the exclude directories and remove them below -exclude = (data_structures/stacks/next_greater_element.py|graphs/boruvka.py|graphs/breadth_first_search.py|graphs/breadth_first_search_2.py|graphs/check_cycle.py|graphs/finding_bridges.py|graphs/greedy_min_vertex_cover.py|graphs/random_graph_generator.py|maths/average_mode.py|maths/gamma_recursive.py|maths/proth_number.py|maths/series/geometric_series.py|maths/series/p_series.py|matrix/matrix_operation.py|other/fischer_yates_shuffle.py|other/least_recently_used.py|other/lfu_cache.py|other/lru_cache.py|searches/simulated_annealing.py|searches/ternary_search.py)/$ +exclude = "(data_structures/stacks/next_greater_element.py|graphs/boruvka.py|graphs/breadth_first_search.py|graphs/breadth_first_search_2.py|graphs/check_cycle.py|graphs/finding_bridges.py|graphs/greedy_min_vertex_cover.py|graphs/random_graph_generator.py|maths/average_mode.py|maths/gamma_recursive.py|maths/proth_number.py|maths/series/geometric_series.py|maths/series/p_series.py|matrix/matrix_operation.py|other/fischer_yates_shuffle.py|other/least_recently_used.py|other/lfu_cache.py|other/lru_cache.py|searches/simulated_annealing.py|searches/ternary_search.py)/$" From 105c1f41d034dc52f4999083cf355af08cb7a302 Mon Sep 17 00:00:00 2001 From: Christian Clauss Date: Fri, 5 Nov 2021 09:15:39 +0100 Subject: [PATCH 15/23] Update build.yml --- .github/workflows/build.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 92e776764b64..c395391032a9 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -21,8 +21,7 @@ jobs: run: | python -m pip install --upgrade pip setuptools six wheel python -m pip install mypy pytest-cov -r requirements.txt - - run: mypy --exclude "(data_structures/stacks/next_greater_element.py|graphs/boruvka.py|graphs/breadth_first_search.py|graphs/breadth_first_search_2.py|graphs/check_cycle.py|graphs/finding_bridges.py|graphs/greedy_min_vertex_cover.py|graphs/random_graph_generator.py|maths/average_mode.py|maths/gamma_recursive.py|maths/proth_number.py|maths/series/geometric_series.py|maths/series/p_series.py|matrix/matrix_operation.py|other/fischer_yates_shuffle.py|other/least_recently_used.py|other/lfu_cache.py|other/lru_cache.py|searches/simulated_annealing.py|searches/ternary_search.py)/$" - --install-types --non-interactive . + - run: mypy . # See `mypy.ini` for configuration settings. - name: Run tests run: pytest --doctest-modules --ignore=project_euler/ --ignore=scripts/validate_solutions.py --cov-report=term-missing:skip-covered --cov=. . - if: ${{ success() }} From f972c84dd25983f435b635b1d99e299824a77ef6 Mon Sep 17 00:00:00 2001 From: Christian Clauss Date: Fri, 5 Nov 2021 09:48:08 +0100 Subject: [PATCH 16/23] Update mypy.ini --- mypy.ini | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mypy.ini b/mypy.ini index 78bb98243674..b6c51c2a5680 100644 --- a/mypy.ini +++ b/mypy.ini @@ -4,4 +4,4 @@ install_types = True non_interactive = True ; FIXME: #4052 fix mypy errors in the exclude directories and remove them below -exclude = "(data_structures/stacks/next_greater_element.py|graphs/boruvka.py|graphs/breadth_first_search.py|graphs/breadth_first_search_2.py|graphs/check_cycle.py|graphs/finding_bridges.py|graphs/greedy_min_vertex_cover.py|graphs/random_graph_generator.py|maths/average_mode.py|maths/gamma_recursive.py|maths/proth_number.py|maths/series/geometric_series.py|maths/series/p_series.py|matrix/matrix_operation.py|other/fischer_yates_shuffle.py|other/least_recently_used.py|other/lfu_cache.py|other/lru_cache.py|searches/simulated_annealing.py|searches/ternary_search.py)/$" +exclude = "(data_structures/stacks/next_greater_element.py|graphs/boruvka.py|graphs/breadth_first_search.py|graphs/breadth_first_search_2.py|graphs/check_cycle.py|graphs/finding_bridges.py|graphs/greedy_min_vertex_cover.py|graphs/random_graph_generator.py|maths/average_mode.py|maths/gamma_recursive.py|maths/proth_number.py|maths/series/geometric_series.py|maths/series/p_series.py|matrix/matrix_operation.py|other/fischer_yates_shuffle.py|other/least_recently_used.py|other/lfu_cache.py|other/lru_cache.py|searches/simulated_annealing.py|searches/ternary_search.py)/$" From 9c621d3d66a195cc71f29eaa1a28b338baa93b1d Mon Sep 17 00:00:00 2001 From: Christian Clauss Date: Fri, 5 Nov 2021 11:44:23 +0100 Subject: [PATCH 17/23] Update build.yml --- .github/workflows/build.yml | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index c395391032a9..e5f8d6b39a7b 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -26,13 +26,3 @@ jobs: run: pytest --doctest-modules --ignore=project_euler/ --ignore=scripts/validate_solutions.py --cov-report=term-missing:skip-covered --cov=. . - if: ${{ success() }} run: scripts/build_directory_md.py 2>&1 | tee DIRECTORY.md - - name: A mypy reality check - run: | - mv mypy.ini was_mypy.ini - mypy --ignore-missing-imports --install-types --non-interactive ./graphs || true # Errors: 10 -> 9 - mypy --ignore-missing-imports --install-types --non-interactive ./maths || true # Errors: 14 -> 14 - mypy --ignore-missing-imports --install-types --non-interactive ./matrix || true # Errors: 15 -> 15 - mypy --ignore-missing-imports --install-types --non-interactive ./searches || true # Errors: 45 -> 21 - mypy --ignore-missing-imports --install-types --non-interactive ./other || true # Errors: 51 -> 43 - mypy --ignore-missing-imports --install-types --non-interactive ./data_structures || true # Errors: 117 -> 67 - mv was_mypy.ini mypy.ini From 0091d5cea1e94b7377a65612b6b21544918ddee1 Mon Sep 17 00:00:00 2001 From: Christian Clauss Date: Fri, 5 Nov 2021 11:45:18 +0100 Subject: [PATCH 18/23] Update mypy.ini --- mypy.ini | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mypy.ini b/mypy.ini index b6c51c2a5680..2ad6017c4f94 100644 --- a/mypy.ini +++ b/mypy.ini @@ -4,4 +4,4 @@ install_types = True non_interactive = True ; FIXME: #4052 fix mypy errors in the exclude directories and remove them below -exclude = "(data_structures/stacks/next_greater_element.py|graphs/boruvka.py|graphs/breadth_first_search.py|graphs/breadth_first_search_2.py|graphs/check_cycle.py|graphs/finding_bridges.py|graphs/greedy_min_vertex_cover.py|graphs/random_graph_generator.py|maths/average_mode.py|maths/gamma_recursive.py|maths/proth_number.py|maths/series/geometric_series.py|maths/series/p_series.py|matrix/matrix_operation.py|other/fischer_yates_shuffle.py|other/least_recently_used.py|other/lfu_cache.py|other/lru_cache.py|searches/simulated_annealing.py|searches/ternary_search.py)/$" +exclude = (data_structures/stacks/next_greater_element.py|graphs/boruvka.py|graphs/breadth_first_search.py|graphs/breadth_first_search_2.py|graphs/check_cycle.py|graphs/finding_bridges.py|graphs/greedy_min_vertex_cover.py|graphs/random_graph_generator.py|maths/average_mode.py|maths/gamma_recursive.py|maths/proth_number.py|maths/series/geometric_series.py|maths/series/p_series.py|matrix/matrix_operation.py|other/fischer_yates_shuffle.py|other/least_recently_used.py|other/lfu_cache.py|other/lru_cache.py|searches/simulated_annealing.py|searches/ternary_search.py)/$ From 9404b67313713974ea5fcfa906a459454e0b5a7f Mon Sep 17 00:00:00 2001 From: Christian Clauss Date: Fri, 5 Nov 2021 12:28:15 +0100 Subject: [PATCH 19/23] .py --> .p* --- mypy.ini | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mypy.ini b/mypy.ini index 2ad6017c4f94..1af183399c1b 100644 --- a/mypy.ini +++ b/mypy.ini @@ -4,4 +4,4 @@ install_types = True non_interactive = True ; FIXME: #4052 fix mypy errors in the exclude directories and remove them below -exclude = (data_structures/stacks/next_greater_element.py|graphs/boruvka.py|graphs/breadth_first_search.py|graphs/breadth_first_search_2.py|graphs/check_cycle.py|graphs/finding_bridges.py|graphs/greedy_min_vertex_cover.py|graphs/random_graph_generator.py|maths/average_mode.py|maths/gamma_recursive.py|maths/proth_number.py|maths/series/geometric_series.py|maths/series/p_series.py|matrix/matrix_operation.py|other/fischer_yates_shuffle.py|other/least_recently_used.py|other/lfu_cache.py|other/lru_cache.py|searches/simulated_annealing.py|searches/ternary_search.py)/$ +exclude = (data_structures/stacks/next_greater_element.p*|graphs/boruvka.p*|graphs/breadth_first_search.p*|graphs/breadth_first_search_2.p*|graphs/check_cycle.p*|graphs/finding_bridges.p*|graphs/greedy_min_vertex_cover.p*|graphs/random_graph_generator.p*|maths/average_mode.p*|maths/gamma_recursive.p*|maths/proth_number.p*|maths/series/geometric_series.p*|maths/series/p_series.p*|matrix/matrix_operation.p*|other/fischer_yates_shuffle.p*|other/least_recently_used.p*|other/lfu_cache.p*|other/lru_cache.p*|searches/simulated_annealing.p*|searches/ternary_search.p*)/$ From 3bfb2b6791711a4021aee78d8827ecc1ad563ca9 Mon Sep 17 00:00:00 2001 From: Christian Clauss Date: Fri, 5 Nov 2021 12:36:42 +0100 Subject: [PATCH 20/23] Escape the dots!: `.` --> `\.` --- mypy.ini | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mypy.ini b/mypy.ini index 1af183399c1b..45ee4d4d2820 100644 --- a/mypy.ini +++ b/mypy.ini @@ -4,4 +4,4 @@ install_types = True non_interactive = True ; FIXME: #4052 fix mypy errors in the exclude directories and remove them below -exclude = (data_structures/stacks/next_greater_element.p*|graphs/boruvka.p*|graphs/breadth_first_search.p*|graphs/breadth_first_search_2.p*|graphs/check_cycle.p*|graphs/finding_bridges.p*|graphs/greedy_min_vertex_cover.p*|graphs/random_graph_generator.p*|maths/average_mode.p*|maths/gamma_recursive.p*|maths/proth_number.p*|maths/series/geometric_series.p*|maths/series/p_series.p*|matrix/matrix_operation.p*|other/fischer_yates_shuffle.p*|other/least_recently_used.p*|other/lfu_cache.p*|other/lru_cache.p*|searches/simulated_annealing.p*|searches/ternary_search.p*)/$ +exclude = (data_structures/stacks/next_greater_element\.py|graphs/boruvka\.py|graphs/breadth_first_search\.py|graphs/breadth_first_search_2\.py|graphs/check_cycle\.py|graphs/finding_bridges\.py|graphs/greedy_min_vertex_cover\.py|graphs/random_graph_generator\.py|maths/average_mode\.py|maths/gamma_recursive\.py|maths/proth_number\.py|maths/series/geometric_series\.py|maths/series/p_series\.py|matrix/matrix_operation\.py|other/fischer_yates_shuffle\.py|other/least_recently_used\.py|other/lfu_cache\.py|other/lru_cache\.py|searches/simulated_annealing\.py|searches/ternary_search\.py)/$ From dcefccb3431e7575afb60b295920dbbc4c4419c4 Mon Sep 17 00:00:00 2001 From: Christian Clauss Date: Fri, 5 Nov 2021 12:47:31 +0100 Subject: [PATCH 21/23] Remove the comment --- mypy.ini | 2 -- 1 file changed, 2 deletions(-) diff --git a/mypy.ini b/mypy.ini index 45ee4d4d2820..c11e4e55a7d3 100644 --- a/mypy.ini +++ b/mypy.ini @@ -2,6 +2,4 @@ ignore_missing_imports = True install_types = True non_interactive = True - -; FIXME: #4052 fix mypy errors in the exclude directories and remove them below exclude = (data_structures/stacks/next_greater_element\.py|graphs/boruvka\.py|graphs/breadth_first_search\.py|graphs/breadth_first_search_2\.py|graphs/check_cycle\.py|graphs/finding_bridges\.py|graphs/greedy_min_vertex_cover\.py|graphs/random_graph_generator\.py|maths/average_mode\.py|maths/gamma_recursive\.py|maths/proth_number\.py|maths/series/geometric_series\.py|maths/series/p_series\.py|matrix/matrix_operation\.py|other/fischer_yates_shuffle\.py|other/least_recently_used\.py|other/lfu_cache\.py|other/lru_cache\.py|searches/simulated_annealing\.py|searches/ternary_search\.py)/$ From 535988eea83af8324f6501dd40e04922ae6eb784 Mon Sep 17 00:00:00 2001 From: Christian Clauss Date: Fri, 5 Nov 2021 12:55:56 +0100 Subject: [PATCH 22/23] Leading slash --- mypy.ini | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mypy.ini b/mypy.ini index c11e4e55a7d3..8d38f7cf7ec6 100644 --- a/mypy.ini +++ b/mypy.ini @@ -2,4 +2,4 @@ ignore_missing_imports = True install_types = True non_interactive = True -exclude = (data_structures/stacks/next_greater_element\.py|graphs/boruvka\.py|graphs/breadth_first_search\.py|graphs/breadth_first_search_2\.py|graphs/check_cycle\.py|graphs/finding_bridges\.py|graphs/greedy_min_vertex_cover\.py|graphs/random_graph_generator\.py|maths/average_mode\.py|maths/gamma_recursive\.py|maths/proth_number\.py|maths/series/geometric_series\.py|maths/series/p_series\.py|matrix/matrix_operation\.py|other/fischer_yates_shuffle\.py|other/least_recently_used\.py|other/lfu_cache\.py|other/lru_cache\.py|searches/simulated_annealing\.py|searches/ternary_search\.py)/$ +exclude = /(data_structures/stacks/next_greater_element\.py|graphs/boruvka\.py|graphs/breadth_first_search\.py|graphs/breadth_first_search_2\.py|graphs/check_cycle\.py|graphs/finding_bridges\.py|graphs/greedy_min_vertex_cover\.py|graphs/random_graph_generator\.py|maths/average_mode\.py|maths/gamma_recursive\.py|maths/proth_number\.py|maths/series/geometric_series\.py|maths/series/p_series\.py|matrix/matrix_operation\.py|other/fischer_yates_shuffle\.py|other/least_recently_used\.py|other/lfu_cache\.py|other/lru_cache\.py|searches/simulated_annealing\.py|searches/ternary_search\.py)$ From 36d2c4bdd6ab2685948d30bdcc9589faf25eb44d Mon Sep 17 00:00:00 2001 From: Christian Clauss Date: Fri, 5 Nov 2021 14:56:36 +0100 Subject: [PATCH 23/23] Update mypy.ini Co-authored-by: Dylan Buchi --- mypy.ini | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/mypy.ini b/mypy.ini index 8d38f7cf7ec6..1a2282c44846 100644 --- a/mypy.ini +++ b/mypy.ini @@ -2,4 +2,5 @@ ignore_missing_imports = True install_types = True non_interactive = True -exclude = /(data_structures/stacks/next_greater_element\.py|graphs/boruvka\.py|graphs/breadth_first_search\.py|graphs/breadth_first_search_2\.py|graphs/check_cycle\.py|graphs/finding_bridges\.py|graphs/greedy_min_vertex_cover\.py|graphs/random_graph_generator\.py|maths/average_mode\.py|maths/gamma_recursive\.py|maths/proth_number\.py|maths/series/geometric_series\.py|maths/series/p_series\.py|matrix/matrix_operation\.py|other/fischer_yates_shuffle\.py|other/least_recently_used\.py|other/lfu_cache\.py|other/lru_cache\.py|searches/simulated_annealing\.py|searches/ternary_search\.py)$ +exclude = (data_structures/stacks/next_greater_element.py|graphs/boruvka.py|graphs/breadth_first_search.py|graphs/breadth_first_search_2.py|graphs/check_cycle.py|graphs/finding_bridges.py|graphs/greedy_min_vertex_cover.py|graphs/random_graph_generator.py|maths/average_mode.py|maths/gamma_recursive.py|maths/proth_number.py|maths/series/geometric_series.py|maths/series/p_series.py|matrix_operation.py|other/fischer_yates_shuffle.py|other/least_recently_used.py|other/lfu_cache.py|other/lru_cache.py|searches/simulated_annealing.py|searches/ternary_search.py) +