From ebf75abff4e7c0d775847108fe583ccaeb1edd94 Mon Sep 17 00:00:00 2001 From: Valeriu Predoi Date: Fri, 11 Nov 2022 13:02:40 +0000 Subject: [PATCH 1/9] set implicit optional to true in mypy config --- setup.cfg | 1 + 1 file changed, 1 insertion(+) diff --git a/setup.cfg b/setup.cfg index 5550bd7fbc..d8ef8aec7b 100644 --- a/setup.cfg +++ b/setup.cfg @@ -33,6 +33,7 @@ multi_line_output = 3 include_trailing_comma = true [mypy] +implicit_optional = True ignore_missing_imports = True files = esmvalcore, tests From 88ba754085fdf664945ae2dafa4ebfccb8fd6843 Mon Sep 17 00:00:00 2001 From: Valeriu Predoi Date: Fri, 11 Nov 2022 13:08:01 +0000 Subject: [PATCH 2/9] run a GA sesh on curr branch --- .github/workflows/run-tests.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml index a9322fe9e8..fc79714c44 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/run-tests.yml @@ -21,6 +21,7 @@ on: push: branches: - main + - set_implicit_optional_mypy # run the test only if the PR is to main # turn it on if required #pull_request: From 6891402a747b0ea2e7fd1f512fddc87fd60f74cd Mon Sep 17 00:00:00 2001 From: Valeriu Predoi Date: Fri, 11 Nov 2022 13:34:32 +0000 Subject: [PATCH 3/9] add new mypy opt --- setup.cfg | 2 ++ 1 file changed, 2 insertions(+) diff --git a/setup.cfg b/setup.cfg index d8ef8aec7b..7ca9cb03d5 100644 --- a/setup.cfg +++ b/setup.cfg @@ -33,6 +33,8 @@ multi_line_output = 3 include_trailing_comma = true [mypy] +# see mypy.readthedocs.io/en/stable/command_line.html +check_untyped_defs = True implicit_optional = True ignore_missing_imports = True files = esmvalcore, tests From a2f39428f68d786e0a5f8ec5ba1f31159ad5c14f Mon Sep 17 00:00:00 2001 From: Valeriu Predoi Date: Fri, 11 Nov 2022 13:51:29 +0000 Subject: [PATCH 4/9] remove opt since that makes hell break loose --- setup.cfg | 1 - 1 file changed, 1 deletion(-) diff --git a/setup.cfg b/setup.cfg index 7ca9cb03d5..88fee9d4fc 100644 --- a/setup.cfg +++ b/setup.cfg @@ -34,7 +34,6 @@ include_trailing_comma = true [mypy] # see mypy.readthedocs.io/en/stable/command_line.html -check_untyped_defs = True implicit_optional = True ignore_missing_imports = True files = esmvalcore, tests From 1fcba7ce5e3cd42ebb3f63ff2b695778596a202c Mon Sep 17 00:00:00 2001 From: Valeriu Predoi Date: Fri, 11 Nov 2022 14:09:45 +0000 Subject: [PATCH 5/9] remove Type from task.py --- esmvalcore/_task.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/esmvalcore/_task.py b/esmvalcore/_task.py index cf2ddda20b..f1edd15f24 100644 --- a/esmvalcore/_task.py +++ b/esmvalcore/_task.py @@ -736,7 +736,7 @@ def _run_sequential(self) -> None: def _run_parallel(self, max_parallel_tasks=None): """Run tasks in parallel.""" scheduled = self.flatten() - running: Dict[Type[BaseTask], Type[ApplyResult]] = {} + running: Dict[BaseTask, ApplyResult] = {} n_tasks = n_scheduled = len(scheduled) n_running = 0 From 77297eb679a713fb783de42eae801019cf8236f5 Mon Sep 17 00:00:00 2001 From: Valeriu Predoi Date: Fri, 11 Nov 2022 14:14:06 +0000 Subject: [PATCH 6/9] aghh flake now --- esmvalcore/_task.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/esmvalcore/_task.py b/esmvalcore/_task.py index f1edd15f24..480d476fa1 100644 --- a/esmvalcore/_task.py +++ b/esmvalcore/_task.py @@ -16,7 +16,7 @@ from multiprocessing.pool import ApplyResult from pathlib import Path, PosixPath from shutil import which -from typing import Dict, Type +from typing import Dict import psutil import yaml From b66fe7def7e97910b8b74ee439669a93a7c6c696 Mon Sep 17 00:00:00 2001 From: Valeriu Predoi Date: Fri, 11 Nov 2022 14:28:22 +0000 Subject: [PATCH 7/9] ok this is getting on me nerves - removed all traces of typing in task.py --- esmvalcore/_task.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/esmvalcore/_task.py b/esmvalcore/_task.py index 480d476fa1..23db5705d2 100644 --- a/esmvalcore/_task.py +++ b/esmvalcore/_task.py @@ -16,7 +16,6 @@ from multiprocessing.pool import ApplyResult from pathlib import Path, PosixPath from shutil import which -from typing import Dict import psutil import yaml @@ -736,7 +735,7 @@ def _run_sequential(self) -> None: def _run_parallel(self, max_parallel_tasks=None): """Run tasks in parallel.""" scheduled = self.flatten() - running: Dict[BaseTask, ApplyResult] = {} + running = {} n_tasks = n_scheduled = len(scheduled) n_running = 0 From 6abc2befe31b2a98d7d407fd34d16a9441d6bff0 Mon Sep 17 00:00:00 2001 From: Valeriu Predoi Date: Fri, 11 Nov 2022 14:35:26 +0000 Subject: [PATCH 8/9] eliminate unused import --- esmvalcore/_task.py | 1 - 1 file changed, 1 deletion(-) diff --git a/esmvalcore/_task.py b/esmvalcore/_task.py index 23db5705d2..94b6b2f824 100644 --- a/esmvalcore/_task.py +++ b/esmvalcore/_task.py @@ -13,7 +13,6 @@ import time from copy import deepcopy from multiprocessing import Pool -from multiprocessing.pool import ApplyResult from pathlib import Path, PosixPath from shutil import which From 5442a768e4bb2d8586dcfb4bc209ebac686e0e39 Mon Sep 17 00:00:00 2001 From: Valeriu Predoi Date: Fri, 11 Nov 2022 15:03:17 +0000 Subject: [PATCH 9/9] unrun ga --- .github/workflows/run-tests.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml index fc79714c44..a9322fe9e8 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/run-tests.yml @@ -21,7 +21,6 @@ on: push: branches: - main - - set_implicit_optional_mypy # run the test only if the PR is to main # turn it on if required #pull_request: