mypy: add typing annotations for novel lister abstractions

This commit is contained in:
Stefano Zacchiroli 2019-10-18 17:32:03 +02:00
parent 7dfd811e16
commit 6159faa2f5
3 changed files with 7 additions and 6 deletions

View file

@ -5,8 +5,9 @@
import logging
from swh.core import utils
from typing import Any, List
from swh.core import utils
from .lister_base import ListerBase
@ -20,7 +21,7 @@ class SimpleLister(ListerBase):
information and stores those in db
"""
def list_packages(self, *args):
def list_packages(self, response: Any) -> List[Any]:
"""Listing packages method.
"""

View file

@ -77,7 +77,7 @@ class CRANLister(SimpleLister):
"""
return None
def list_packages(self, *args) -> List[Mapping[str, str]]:
def list_packages(self, response) -> List[Mapping[str, str]]:
"""Runs R script which uses inbuilt API to return a json response
containing data about the R packages.

View file

@ -3,13 +3,13 @@
# License: GNU General Public License version 3, or any later version
# See top-level LICENSE file for more information
from typing import Any, Mapping, Optional
from typing import Any, List, Mapping, Optional
def debian_init(db_engine, lister=None,
override_conf: Optional[Mapping[str, Any]] = None,
distributions: Optional[str] = ['stretch', 'buster'],
area_names: Optional[str] = ['main', 'contrib', 'non-free']):
distributions: List[str] = ['stretch', 'buster'],
area_names: List[str] = ['main', 'contrib', 'non-free']):
"""Initialize the debian data model.
Args: