Changeset View
Changeset View
Standalone View
Standalone View
swh/lister/debian/lister.py
Show All 28 Lines | decompressors = { | ||||
'xz': lzma.LZMAFile, | 'xz': lzma.LZMAFile, | ||||
} | } | ||||
logger = logging.getLogger(__name__) | logger = logging.getLogger(__name__) | ||||
class DebianLister(ListerHttpTransport, ListerBase): | class DebianLister(ListerHttpTransport, ListerBase): | ||||
"""Debian Lister which lists debian distributions. | |||||
The output of the lister should be scheduled tasks of type load-deb-package | |||||
""" | |||||
MODEL = Package | MODEL = Package | ||||
PATH_TEMPLATE = None | PATH_TEMPLATE = None | ||||
LISTER_NAME = 'debian' | LISTER_NAME = 'debian' | ||||
instance = 'debian' | instance = 'debian' | ||||
SCHEDULED_TASK_TYPES = ['load-deb-package'] | |||||
def __init__(self, distribution: str = 'Debian', | def __init__(self, distribution: str = 'Debian', | ||||
date: Optional[datetime.datetime] = None, | date: Optional[datetime.datetime] = None, | ||||
override_config: Mapping = {}): | override_config: Mapping = {}): | ||||
"""Initialize the debian lister for a given distribution at a given | """Initialize the debian lister for a given distribution at a given | ||||
date. | date. | ||||
Args: | Args: | ||||
distribution: name of the distribution (e.g. "Debian") | distribution: name of the distribution (e.g. "Debian") | ||||
date: date the snapshot is taken (defaults to now if empty) | date: date the snapshot is taken (defaults to now if empty) | ||||
override_config: Override configuration (which takes precedence | override_config: Override configuration (which takes precedence | ||||
over the parameters if provided) | over the parameters if provided) | ||||
""" | """ | ||||
vlorentz: The constructor is the the right place for documenting the "output"; it should be either in the… | |||||
Done Inline Actions
(I guess you meant not the right place)
Well, it's the lister's goal. It output tasks for loaders. But it's not clearly said anywhere. It's not a return value per say, it's written to the scheduler's db. ardumont: > The constructor is the the right place for documenting the "output"; it should be either in… | |||||
ListerHttpTransport.__init__(self, url="notused") | ListerHttpTransport.__init__(self, url="notused") | ||||
ListerBase.__init__(self, override_config=override_config) | ListerBase.__init__(self, override_config=override_config) | ||||
self.distribution = override_config.get('distribution', distribution) | self.distribution = override_config.get('distribution', distribution) | ||||
self.date = override_config.get('date', date) or datetime.datetime.now( | self.date = override_config.get('date', date) or datetime.datetime.now( | ||||
tz=datetime.timezone.utc) | tz=datetime.timezone.utc) | ||||
def transport_request(self, identifier): | def transport_request(self, identifier): | ||||
"""Subvert ListerHttpTransport.transport_request, to try several | """Subvert ListerHttpTransport.transport_request, to try several | ||||
▲ Show 20 Lines • Show All 191 Lines • Show Last 20 Lines |
The constructor is the the right place for documenting the "output"; it should be either in the class docstring's or in a method's.
It's also unclear what you call an output (is it a return value of one of the methods?)