Changeset View
Changeset View
Standalone View
Standalone View
swh/lister/core/lister_base.py
# Copyright (C) 2015-2018 the Software Heritage developers | # Copyright (C) 2015-2018 the Software Heritage developers | ||||
# License: GNU General Public License version 3, or any later version | # License: GNU General Public License version 3, or any later version | ||||
# See top-level LICENSE file for more information | # See top-level LICENSE file for more information | ||||
import abc | import abc | ||||
import datetime | import datetime | ||||
import gzip | import gzip | ||||
import json | import json | ||||
import logging | import logging | ||||
import os | import os | ||||
import re | import re | ||||
import time | import time | ||||
from sqlalchemy import create_engine, func | from sqlalchemy import create_engine, func | ||||
from sqlalchemy.orm import sessionmaker | from sqlalchemy.orm import sessionmaker | ||||
from typing import Any, Type, Union | |||||
from swh.core import config | from swh.core import config | ||||
from swh.scheduler import get_scheduler, utils | from swh.scheduler import get_scheduler, utils | ||||
from .abstractattribute import AbstractAttribute | from .abstractattribute import AbstractAttribute | ||||
logger = logging.getLogger(__name__) | logger = logging.getLogger(__name__) | ||||
Show All 35 Lines | """Lister core base class. | ||||
def transport_response_simplified | def transport_response_simplified | ||||
def transport_quota_check | def transport_quota_check | ||||
Optional Overrides: | Optional Overrides: | ||||
def filter_before_inject | def filter_before_inject | ||||
def is_within_bounds | def is_within_bounds | ||||
""" | """ | ||||
MODEL = AbstractAttribute('Subclass type (not instance)' | MODEL = AbstractAttribute( | ||||
' of swh.lister.core.models.ModelBase' | 'Subclass type (not instance) of swh.lister.core.models.ModelBase ' | ||||
' customized for a specific service.') | 'customized for a specific service.' | ||||
LISTER_NAME = AbstractAttribute("Lister's name") | ) # type: Union[AbstractAttribute, Type[Any]] | ||||
LISTER_NAME = AbstractAttribute( | |||||
"Lister's name") # type: Union[AbstractAttribute, str] | |||||
def transport_request(self, identifier): | def transport_request(self, identifier): | ||||
"""Given a target endpoint identifier to query, try once to request it. | """Given a target endpoint identifier to query, try once to request it. | ||||
Implementation of this method determines the network request protocol. | Implementation of this method determines the network request protocol. | ||||
Args: | Args: | ||||
identifier (string): unique identifier for an endpoint query. | identifier (string): unique identifier for an endpoint query. | ||||
▲ Show 20 Lines • Show All 439 Lines • Show Last 20 Lines |