From d62e77c1b49565a520600de7895169832285f9ee Mon Sep 17 00:00:00 2001 From: Vincent SELLIER Date: Mon, 25 Jan 2021 18:00:21 +0100 Subject: [PATCH] cgit lister: Add missing types on the init method Related to T2984 --- swh/lister/cgit/lister.py | 5 ++++- swh/lister/tests/test_cli.py | 1 + 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/swh/lister/cgit/lister.py b/swh/lister/cgit/lister.py index 8a92463..d0c35b5 100644 --- a/swh/lister/cgit/lister.py +++ b/swh/lister/cgit/lister.py @@ -35,7 +35,9 @@ class CGitLister(StatelessLister[Repositories]): LISTER_NAME = "cgit" - def __init__(self, scheduler: SchedulerInterface, url=None, instance=None): + def __init__( + self, scheduler: SchedulerInterface, url: str, instance: Optional[str] = None + ): """Lister class for CGit repositories. Args: @@ -47,6 +49,7 @@ class CGitLister(StatelessLister[Repositories]): """ if not instance: instance = urlparse(url).hostname + assert instance is not None # Make mypy happy super().__init__( scheduler=scheduler, credentials=None, url=url, instance=instance, diff --git a/swh/lister/tests/test_cli.py b/swh/lister/tests/test_cli.py index 1bccee9..0d674e6 100644 --- a/swh/lister/tests/test_cli.py +++ b/swh/lister/tests/test_cli.py @@ -10,6 +10,7 @@ from swh.lister.cli import SUPPORTED_LISTERS, get_lister from .test_utils import init_db lister_args = { + "cgit": {"url": "https://git.eclipse.org/c/",}, "phabricator": { "instance": "softwareheritage", "url": "https://forge.softwareheritage.org/api/diffusion.repository.search",