From fc2bd1e93736047f3a94e914db8644914662b012 Mon Sep 17 00:00:00 2001 From: Antoine Lambert <anlambert@softwareheritage.org> Date: Fri, 17 Feb 2023 15:46:39 +0100 Subject: [PATCH] mypy: Bump to 1.0.1 and fix new typing errors Related to swh/meta#4960 --- swh/lister/gitlab/tests/test_lister.py | 2 +- swh/lister/maven/lister.py | 2 +- swh/lister/nixguix/tests/test_lister.py | 2 +- tox.ini | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/swh/lister/gitlab/tests/test_lister.py b/swh/lister/gitlab/tests/test_lister.py index 5b809636..d1fd7971 100644 --- a/swh/lister/gitlab/tests/test_lister.py +++ b/swh/lister/gitlab/tests/test_lister.py @@ -96,7 +96,7 @@ def test_lister_gitlab_heptapod(datadir, swh_scheduler, requests_mock): def gitlab_page_response(datadir, instance: str, id_after: int) -> List[Dict]: """Return list of repositories (out of test dataset)""" datapath = Path(datadir, f"https_{instance}", f"api_response_page{id_after}.json") - return json.loads(datapath.read_text()) if datapath.exists else [] + return json.loads(datapath.read_text()) if datapath.exists() else [] def test_lister_gitlab_with_pages(swh_scheduler, requests_mock, datadir): diff --git a/swh/lister/maven/lister.py b/swh/lister/maven/lister.py index a7bb79f2..0da9b651 100644 --- a/swh/lister/maven/lister.py +++ b/swh/lister/maven/lister.py @@ -58,7 +58,7 @@ class MavenLister(Lister[MavenListerState, RepoPage]): self, scheduler: SchedulerInterface, url: str, - index_url: str = None, + index_url: str, instance: Optional[str] = None, credentials: CredentialsType = None, max_origins_per_page: Optional[int] = None, diff --git a/swh/lister/nixguix/tests/test_lister.py b/swh/lister/nixguix/tests/test_lister.py index a00a5f61..209bc5aa 100644 --- a/swh/lister/nixguix/tests/test_lister.py +++ b/swh/lister/nixguix/tests/test_lister.py @@ -44,7 +44,7 @@ SOURCES = { def page_response(datadir, instance: str = "success") -> List[Dict]: """Return list of repositories (out of test dataset)""" datapath = Path(datadir, f"sources-{instance}.json") - return json.loads(datapath.read_text()) if datapath.exists else [] + return json.loads(datapath.read_text()) if datapath.exists() else [] @pytest.mark.parametrize( diff --git a/tox.ini b/tox.ini index c9a88439..83ee868a 100644 --- a/tox.ini +++ b/tox.ini @@ -38,7 +38,7 @@ commands = extras = testing deps = - mypy==0.942 + mypy==1.0.1 commands = mypy swh -- GitLab