from libs.osaf.osaf_core import OSAF_Core
from libs.spider_logger.logger import SpiderLog
from libs.unirepo.unirepo import UniRepo


class SPK_Repo(UniRepo):
    def __init__(self, logger: SpiderLog, osa: OSAF_Core, conf, sources, spk):
        self.spk = spk
        super().__init__(logger, osa, conf, sources)

    def search(self, pkg_query, strict_names=True):

        uq = self.unpack_query(pkg_query)
        fl = {}
        fl.update(self.spk.filters)
        fl.update(uq)
        return super().search(self.pack_query(fl),strict_names)
